mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 19:18:37 +00:00
Leave attachment insert early if there are no attachments.
This commit is contained in:
committed by
Cody Henthorne
parent
5cd2568776
commit
29c70acf4e
@@ -847,6 +847,10 @@ public class AttachmentTable extends DatabaseTable {
|
||||
@NonNull Map<Attachment, AttachmentId> insertAttachmentsForMessage(long mmsId, @NonNull List<Attachment> attachments, @NonNull List<Attachment> quoteAttachment)
|
||||
throws MmsException
|
||||
{
|
||||
if (attachments.isEmpty() && quoteAttachment.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Log.d(TAG, "insertParts(" + attachments.size() + ")");
|
||||
|
||||
Map<Attachment, AttachmentId> insertedAttachments = new HashMap<>();
|
||||
|
||||
@@ -2975,7 +2975,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
val messageId = db.insert(TABLE_NAME, null, contentValues)
|
||||
if (messageId < 0) {
|
||||
Log.w(TAG, "Tried to insert media message but failed. Assuming duplicate.")
|
||||
return@withinTransaction kotlin.Pair(-1L, null)
|
||||
return@withinTransaction -1L to null
|
||||
}
|
||||
|
||||
threads.markAsActiveEarly(threadId)
|
||||
@@ -3009,11 +3009,11 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
}
|
||||
}
|
||||
|
||||
kotlin.Pair(messageId, insertedAttachments)
|
||||
messageId to insertedAttachments
|
||||
}
|
||||
|
||||
if (messageId < 0) {
|
||||
return kotlin.Pair(messageId, insertedAttachments)
|
||||
return messageId to insertedAttachments
|
||||
}
|
||||
|
||||
insertListener?.onComplete()
|
||||
@@ -3025,7 +3025,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
threads.update(threadId, unarchive)
|
||||
}
|
||||
|
||||
return kotlin.Pair(messageId, insertedAttachments)
|
||||
return messageId to insertedAttachments
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user