Fix album message ID handling
This commit is contained in:
parent
add2c467e4
commit
f2572e4c91
|
@ -801,14 +801,10 @@ class MediaGallery: NSObject, MediaGalleryDataSource, MediaTileViewControllerDel
|
|||
|
||||
func buildGalleryItem(attachment: TSAttachment, transaction: YapDatabaseReadTransaction) -> MediaGalleryItem? {
|
||||
guard let attachmentStream = attachment as? TSAttachmentStream else {
|
||||
// Avoid crash in debug mode
|
||||
// owsFailDebug("gallery doesn't yet support showing undownloaded attachments")
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let message = attachmentStream.fetchAlbumMessage(with: transaction) else {
|
||||
// Avoid crash in debug mode
|
||||
// owsFailDebug("message was unexpectedly nil")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ extension Storage {
|
|||
let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) else { return nil }
|
||||
let message = TSIncomingMessage.from(message, quotedMessage: quotedMessage, linkPreview: linkPreview, associatedWith: thread)
|
||||
message.save(with: transaction)
|
||||
message.attachments(with: transaction).forEach { attachment in
|
||||
attachment.albumMessageId = message.uniqueId!
|
||||
attachment.save(with: transaction)
|
||||
}
|
||||
DispatchQueue.main.async { message.touch() } // FIXME: Hack for a thread updating issue
|
||||
return message.uniqueId!
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class MessageSender : NSObject {
|
|||
public static let shared = MessageSender() // FIXME: Remove once requestSenderKey is static
|
||||
|
||||
// MARK: Preparation
|
||||
private static func prep(_ attachments: [SignalAttachment], for message: VisibleMessage, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
public static func prep(_ attachments: [SignalAttachment], for message: VisibleMessage, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
guard let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) else {
|
||||
#if DEBUG
|
||||
preconditionFailure()
|
||||
|
|
Loading…
Reference in New Issue