Respond to CR.

This commit is contained in:
Matthew Chen 2018-02-22 16:12:39 -05:00
parent 6006d22870
commit 10ca369da8
1 changed files with 5 additions and 16 deletions

View File

@ -282,22 +282,11 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
// TODO deprecate this and implement something like previewTextWithTransaction: for all TSInteractions
- (NSString *)description
{
if (self.body.length > 0) {
// Use the message text/caption, if any.
return self.body;
} else if ([self hasAttachments]) {
NSString *attachmentId = self.attachmentIds[0];
TSAttachment *attachment = [TSAttachment fetchObjectWithUniqueID:attachmentId];
if (attachment) {
return attachment.description;
} else {
return NSLocalizedString(@"UNKNOWN_ATTACHMENT_LABEL", @"In Inbox view, last message label for thread with corrupted attachment.");
}
} else {
OWSFail(@"%@ message has neither body nor attachment.", self.logTag);
// TODO: We should do better here.
return @"";
}
__block NSString *result;
[self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
result = [self previewTextWithTransaction:transaction];
}];
return result;
}
- (void)removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction