Trim whitespace from group names.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 8e694d2631
commit 782e3d42bd

@ -467,12 +467,12 @@ NS_ASSUME_NONNULL_BEGIN
- (TSGroupModel *)makeGroup - (TSGroupModel *)makeGroup
{ {
NSString *title = self.groupNameTextField.text; NSString *groupName =
[self.groupNameTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSMutableArray<NSString *> *recipientIds = [self.memberRecipientIds.allObjects mutableCopy]; NSMutableArray<NSString *> *recipientIds = [self.memberRecipientIds.allObjects mutableCopy];
[recipientIds addObject:[self.contactsViewHelper localNumber]]; [recipientIds addObject:[self.contactsViewHelper localNumber]];
NSData *groupId = [SecurityUtils generateRandomBytes:16]; NSData *groupId = [SecurityUtils generateRandomBytes:16];
return [[TSGroupModel alloc] initWithTitle:groupName memberIds:recipientIds image:self.groupAvatar groupId:groupId];
return [[TSGroupModel alloc] initWithTitle:title memberIds:recipientIds image:self.groupAvatar groupId:groupId];
} }
#pragma mark - Group Avatar #pragma mark - Group Avatar

@ -373,7 +373,9 @@ NS_ASSUME_NONNULL_BEGIN
{ {
OWSAssert(self.conversationSettingsViewDelegate); OWSAssert(self.conversationSettingsViewDelegate);
TSGroupModel *groupModel = [[TSGroupModel alloc] initWithTitle:self.groupNameTextField.text NSString *groupName =
[self.groupNameTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
TSGroupModel *groupModel = [[TSGroupModel alloc] initWithTitle:groupName
memberIds:[self.memberRecipientIds.allObjects mutableCopy] memberIds:[self.memberRecipientIds.allObjects mutableCopy]
image:self.groupAvatar image:self.groupAvatar
groupId:self.thread.groupModel.groupId]; groupId:self.thread.groupModel.groupId];

Loading…
Cancel
Save