BlockList vs. "zero length" group names
This commit is contained in:
parent
b447e68597
commit
df67e883f3
|
@ -118,7 +118,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
for (TSGroupModel *blockedGroup in blockedGroups) {
|
||||
UIImage *image = blockedGroup.groupImage ?: OWSGroupAvatarBuilder.defaultGroupImage;
|
||||
NSString *groupName = blockedGroup.groupName ?: TSGroupThread.defaultGroupName;
|
||||
NSString *groupName
|
||||
= blockedGroup.groupName.length > 0 ? blockedGroup.groupName : TSGroupThread.defaultGroupName;
|
||||
|
||||
[blockedGroupsSection addItem:[OWSTableItem
|
||||
itemWithCustomCellBlock:^{
|
||||
|
|
|
@ -248,8 +248,8 @@
|
|||
/* Action sheet body when confirming you want to unblock a group */
|
||||
"BLOCK_LIST_UNBLOCK_GROUP_BODY" = "Existing members will be able to add you to the group again.";
|
||||
|
||||
/* Action sheet title when confirming you want to unblock a group. Embeds the {{conversation title}}. */
|
||||
"BLOCK_LIST_UNBLOCK_GROUP_TITLE_FORMAT" = "Unblock This Group?";
|
||||
/* Action sheet title when confirming you want to unblock a group. */
|
||||
"BLOCK_LIST_UNBLOCK_GROUP_TITLE" = "Unblock This Group?";
|
||||
|
||||
/* A format for the 'unblock conversation' action sheet title. Embeds the {{conversation title}}. */
|
||||
"BLOCK_LIST_UNBLOCK_TITLE_FORMAT" = "Unblock %@?";
|
||||
|
|
|
@ -154,10 +154,11 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
|
|||
OWSAssert(fromViewController);
|
||||
OWSAssert(blockingManager);
|
||||
|
||||
NSString *groupName = groupThread.name.length > 0 ? groupThread.name : TSGroupThread.defaultGroupName;
|
||||
NSString *title = [NSString
|
||||
stringWithFormat:NSLocalizedString(@"BLOCK_LIST_BLOCK_GROUP_TITLE_FORMAT",
|
||||
@"A format for the 'block group' action sheet title. Embeds the {{group name}}."),
|
||||
[self formatDisplayNameForAlertTitle:groupThread.name]];
|
||||
[self formatDisplayNameForAlertTitle:groupName]];
|
||||
|
||||
UIAlertController *actionSheetController =
|
||||
[UIAlertController alertControllerWithTitle:title
|
||||
|
@ -246,6 +247,9 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
|
|||
DDLogError(@"Failed to leave blocked group with error: %@", error);
|
||||
}
|
||||
|
||||
NSString *groupName
|
||||
= groupThread.name.length > 0 ? groupThread.name : TSGroupThread.defaultGroupName;
|
||||
|
||||
[self
|
||||
showOkAlertWithTitle:NSLocalizedString(@"BLOCK_LIST_VIEW_BLOCKED_GROUP_ALERT_TITLE",
|
||||
@"The title of the 'group blocked' alert.")
|
||||
|
@ -256,7 +260,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
|
|||
@"The message format of the 'conversation blocked' "
|
||||
@"alert. "
|
||||
@"Embeds the {{conversation title}}."),
|
||||
[self formatDisplayNameForAlertMessage:groupThread.name]]
|
||||
[self formatDisplayNameForAlertMessage:groupName]]
|
||||
fromViewController:fromViewController
|
||||
completionBlock:completionBlock];
|
||||
}];
|
||||
|
@ -279,8 +283,9 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
|
|||
completionBlock:completionBlock];
|
||||
} else if ([thread isKindOfClass:[TSGroupThread class]]) {
|
||||
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
||||
NSString *groupName = groupThread.name.length > 0 ? groupThread.name : TSGroupThread.defaultGroupName;
|
||||
[self showUnblockGroupActionSheet:groupThread.groupModel
|
||||
displayName:groupThread.name
|
||||
displayName:groupName
|
||||
fromViewController:fromViewController
|
||||
blockingManager:blockingManager
|
||||
completionBlock:completionBlock];
|
||||
|
@ -398,11 +403,9 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
|
|||
OWSAssert(fromViewController);
|
||||
OWSAssert(blockingManager);
|
||||
|
||||
NSString *title = [NSString
|
||||
stringWithFormat:
|
||||
NSLocalizedString(@"BLOCK_LIST_UNBLOCK_GROUP_TITLE_FORMAT",
|
||||
@"Action sheet title when confirming you want to unblock a group. Embeds the {{conversation title}}."),
|
||||
[self formatDisplayNameForAlertTitle:displayName]];
|
||||
NSString *title =
|
||||
[NSString stringWithFormat:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_GROUP_TITLE",
|
||||
@"Action sheet title when confirming you want to unblock a group.")];
|
||||
|
||||
NSString *message = NSLocalizedString(
|
||||
@"BLOCK_LIST_UNBLOCK_GROUP_BODY", @"Action sheet body when confirming you want to unblock a group");
|
||||
|
|
|
@ -221,8 +221,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(presentingViewController);
|
||||
OWSAssert(messageSender);
|
||||
|
||||
NSString *groupName = thread.name.length > 0 ? thread.name : TSGroupThread.defaultGroupName;
|
||||
NSString *title = [NSString
|
||||
stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", @"Modal text when removing a group"), thread.name];
|
||||
stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", @"Modal text when removing a group"), groupName];
|
||||
UIAlertController *removingFromGroup =
|
||||
[UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
|
||||
[presentingViewController presentViewController:removingFromGroup animated:YES completion:nil];
|
||||
|
|
|
@ -175,6 +175,10 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific
|
|||
|
||||
- (NSString *)name
|
||||
{
|
||||
// TODO sometimes groupName is set to the empty string. I'm hesitent to change
|
||||
// the semantics here until we have time to thouroughly test the fallout.
|
||||
// Instead, see the `groupNameOrDefault` which is appropriate for use when displaying
|
||||
// text corresponding to a group.
|
||||
return self.groupModel.groupName ?: self.class.defaultGroupName;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue