Fix issue with sending story viewed receipts.

fork-5.53.8
Greyson Parrelli 2022-10-24 18:47:10 -04:00
rodzic 064f7abd92
commit b46e129c23
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -137,14 +137,14 @@ public class SendViewedReceiptJob extends BaseJob {
boolean canSendNonStoryReceipts = TextSecurePreferences.isReadReceiptsEnabled(context);
boolean canSendStoryReceipts = SignalStore.storyValues().getViewedReceiptsEnabled();
List<MessageId> messageIds = new LinkedList<>();
List<MessageId> foundMessageIds = new LinkedList<>();
List<Long> messageSentTimestamps = new LinkedList<>();
List<StoryType> storyTypes = SignalDatabase.mms().getStoryTypes(messageIds);
List<StoryType> storyTypes = SignalDatabase.mms().getStoryTypes(this.messageIds);
for (int i = 0; i < storyTypes.size(); i++) {
StoryType storyType = storyTypes.get(i);
if ((storyType == StoryType.NONE && canSendNonStoryReceipts) || (storyType.isStory() && canSendStoryReceipts)) {
messageIds.add(this.messageIds.get(i));
foundMessageIds.add(this.messageIds.get(i));
messageSentTimestamps.add(this.messageSentTimestamps.get(i));
}
}
@ -158,7 +158,7 @@ public class SendViewedReceiptJob extends BaseJob {
return;
}
if (messageIds.isEmpty()) {
if (foundMessageIds.isEmpty()) {
Log.w(TAG, "No messages in this batch are allowed to be sent!");
return;
}
@ -206,8 +206,8 @@ public class SendViewedReceiptJob extends BaseJob {
receiptMessage,
recipient.needsPniSignature());
if (Util.hasItems(messageIds)) {
SignalDatabase.messageLog().insertIfPossible(recipientId, timestamp, result, ContentHint.IMPLICIT, messageIds, false);
if (Util.hasItems(foundMessageIds)) {
SignalDatabase.messageLog().insertIfPossible(recipientId, timestamp, result, ContentHint.IMPLICIT, foundMessageIds, false);
}
}