Prevent bogus message emission on group deletion

Only send a message if the local number is part of the group

* Fix error on empty group #1449
* Fix an unlogged issue about notification sent to group members even is the local user already quit the group
pull/1/head
Thomas Guillet 9 years ago committed by Michael Kirk
parent 087f753979
commit f1b4bd772c

@ -332,6 +332,9 @@
- (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath { - (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath {
TSThread *thread = [self threadForIndexPath:indexPath]; TSThread *thread = [self threadForIndexPath:indexPath];
if ([thread isKindOfClass:[TSGroupThread class]]) { if ([thread isKindOfClass:[TSGroupThread class]]) {
TSGroupThread *gThread = (TSGroupThread *)thread;
if ([gThread.groupModel.groupMemberIds containsObject:[TSAccountManager localNumber]]) {
UIAlertController *removingFromGroup = [UIAlertController UIAlertController *removingFromGroup = [UIAlertController
alertControllerWithTitle:[NSString alertControllerWithTitle:[NSString
stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]] stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]]
@ -361,6 +364,9 @@
} else { } else {
[self deleteThread:thread]; [self deleteThread:thread];
} }
} else {
[self deleteThread:thread];
}
} }
- (void)deleteThread:(TSThread *)thread { - (void)deleteThread:(TSThread *)thread {

Loading…
Cancel
Save