Respond to CR.

pull/1/head
Matthew Chen 8 years ago
parent 6006d22870
commit 10ca369da8

@ -282,22 +282,11 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
// TODO deprecate this and implement something like previewTextWithTransaction: for all TSInteractions // TODO deprecate this and implement something like previewTextWithTransaction: for all TSInteractions
- (NSString *)description - (NSString *)description
{ {
if (self.body.length > 0) { __block NSString *result;
// Use the message text/caption, if any. [self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
return self.body; result = [self previewTextWithTransaction:transaction];
} else if ([self hasAttachments]) { }];
NSString *attachmentId = self.attachmentIds[0]; return result;
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 @"";
}
} }
- (void)removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction - (void)removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction

Loading…
Cancel
Save