Delete a voice broadcast with all related events if MSC3912 is supported.

This commit is contained in:
Nicolas Mauri 2023-01-19 12:13:44 +01:00
parent fdf1839b12
commit 37bd17798c

View file

@ -4302,6 +4302,23 @@ static CGSize kThreadListBarButtonItemImageSize;
[self startActivityIndicator]; [self startActivityIndicator];
// If it's a voice broadcast, delete the selected event and all related events (only if this feature is supported).
BOOL supportsRedactionWithRelations = self.mainSession.store.supportedMatrixVersions.supportsRedactionWithRelations || self.mainSession.store.supportedMatrixVersions.supportsRedactionWithRelationsUnstable;
if (supportsRedactionWithRelations && selectedEvent.eventType == MXEventTypeCustom && [selectedEvent.type isEqualToString:VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType]) {
MXWeakify(self);
[self.roomDataSource.room redactEvent:selectedEvent.eventId withRelations:@[MXEventRelationTypeReference] reason:nil success:^{
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
MXLogDebug(@"[RoomVC] Redact event (%@) failed", selectedEvent.eventId);
//Alert user
[self showError:error];
}];
} else {
MXWeakify(self); MXWeakify(self);
[self.roomDataSource.room redactEvent:selectedEvent.eventId reason:nil success:^{ [self.roomDataSource.room redactEvent:selectedEvent.eventId reason:nil success:^{
MXStrongifyAndReturnIfNil(self); MXStrongifyAndReturnIfNil(self);
@ -4314,6 +4331,7 @@ static CGSize kThreadListBarButtonItemImageSize;
//Alert user //Alert user
[self showError:error]; [self showError:error];
}]; }];
}
}]]; }]];
} }