Ensure we do not send captions for non-story messages.
This commit is contained in:
parent
a7a4972013
commit
9b83c5e283
2 changed files with 10 additions and 6 deletions
|
@ -36,6 +36,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.signal.core.util.CursorUtil;
|
||||||
|
import org.signal.core.util.SqlUtil;
|
||||||
import org.signal.core.util.StreamUtil;
|
import org.signal.core.util.StreamUtil;
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||||
|
@ -54,12 +56,10 @@ import org.thoughtcrime.securesms.mms.PartAuthority;
|
||||||
import org.thoughtcrime.securesms.mms.SentMediaQuality;
|
import org.thoughtcrime.securesms.mms.SentMediaQuality;
|
||||||
import org.thoughtcrime.securesms.stickers.StickerLocator;
|
import org.thoughtcrime.securesms.stickers.StickerLocator;
|
||||||
import org.thoughtcrime.securesms.util.Base64;
|
import org.thoughtcrime.securesms.util.Base64;
|
||||||
import org.signal.core.util.CursorUtil;
|
|
||||||
import org.thoughtcrime.securesms.util.FileUtils;
|
import org.thoughtcrime.securesms.util.FileUtils;
|
||||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||||
import org.thoughtcrime.securesms.util.SetUtil;
|
import org.thoughtcrime.securesms.util.SetUtil;
|
||||||
import org.signal.core.util.SqlUtil;
|
|
||||||
import org.thoughtcrime.securesms.util.StorageUtil;
|
import org.thoughtcrime.securesms.util.StorageUtil;
|
||||||
import org.thoughtcrime.securesms.video.EncryptedMediaDataSource;
|
import org.thoughtcrime.securesms.video.EncryptedMediaDataSource;
|
||||||
import org.whispersystems.signalservice.internal.util.JsonUtil;
|
import org.whispersystems.signalservice.internal.util.JsonUtil;
|
||||||
|
@ -744,7 +744,7 @@ public class AttachmentDatabase extends Database {
|
||||||
return databaseAttachment;
|
return databaseAttachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMessageId(@NonNull Collection<AttachmentId> attachmentIds, long mmsId) {
|
public void updateMessageId(@NonNull Collection<AttachmentId> attachmentIds, long mmsId, boolean isStory) {
|
||||||
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
|
||||||
|
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
|
@ -752,6 +752,10 @@ public class AttachmentDatabase extends Database {
|
||||||
ContentValues values = new ContentValues(1);
|
ContentValues values = new ContentValues(1);
|
||||||
values.put(MMS_ID, mmsId);
|
values.put(MMS_ID, mmsId);
|
||||||
|
|
||||||
|
if (!isStory) {
|
||||||
|
values.putNull(CAPTION);
|
||||||
|
}
|
||||||
|
|
||||||
for (AttachmentId attachmentId : attachmentIds) {
|
for (AttachmentId attachmentId : attachmentIds) {
|
||||||
db.update(TABLE_NAME, values, PART_ID_WHERE, attachmentId.toStrings());
|
db.update(TABLE_NAME, values, PART_ID_WHERE, attachmentId.toStrings());
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class MessageSender {
|
||||||
List<AttachmentId> attachmentIds = Stream.of(preUploadResults).map(PreUploadResult::getAttachmentId).toList();
|
List<AttachmentId> attachmentIds = Stream.of(preUploadResults).map(PreUploadResult::getAttachmentId).toList();
|
||||||
List<String> jobIds = Stream.of(preUploadResults).map(PreUploadResult::getJobIds).flatMap(Stream::of).toList();
|
List<String> jobIds = Stream.of(preUploadResults).map(PreUploadResult::getJobIds).flatMap(Stream::of).toList();
|
||||||
|
|
||||||
attachmentDatabase.updateMessageId(attachmentIds, messageId);
|
attachmentDatabase.updateMessageId(attachmentIds, messageId, message.getStoryType().isStory());
|
||||||
|
|
||||||
sendMediaMessage(context, recipient, false, messageId, jobIds);
|
sendMediaMessage(context, recipient, false, messageId, jobIds);
|
||||||
onMessageSent();
|
onMessageSent();
|
||||||
|
@ -227,7 +227,7 @@ public class MessageSender {
|
||||||
false,
|
false,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
attachmentDatabase.updateMessageId(preUploadAttachmentIds, primaryMessageId);
|
attachmentDatabase.updateMessageId(preUploadAttachmentIds, primaryMessageId, primaryMessage.getStoryType().isStory());
|
||||||
messageIds.add(primaryMessageId);
|
messageIds.add(primaryMessageId);
|
||||||
|
|
||||||
if (messages.size() > 0) {
|
if (messages.size() > 0) {
|
||||||
|
@ -255,7 +255,7 @@ public class MessageSender {
|
||||||
attachmentIds.add(attachmentId);
|
attachmentIds.add(attachmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
attachmentDatabase.updateMessageId(attachmentIds, messageId);
|
attachmentDatabase.updateMessageId(attachmentIds, messageId, secondaryMessage.getStoryType().isStory());
|
||||||
messageIds.add(messageId);
|
messageIds.add(messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue