Skip to content

Commit

Permalink
Prevent expiry timers from being sent to distribution lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal committed Oct 24, 2022
1 parent 94f072c commit 428ab65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Expand Up @@ -313,7 +313,7 @@ public static boolean shouldHaveProfileKey(@NonNull Recipient recipient) {
@WorkerThread
public static boolean setAndSendUniversalExpireTimerIfNecessary(@NonNull Context context, @NonNull Recipient recipient, long threadId) {
int defaultTimer = SignalStore.settings().getUniversalExpireTimer();
if (defaultTimer == 0 || recipient.isGroup() || recipient.getExpiresInSeconds() != 0 || !recipient.isRegistered()) {
if (defaultTimer == 0 || recipient.isGroup() || recipient.isDistributionList() || recipient.getExpiresInSeconds() != 0 || !recipient.isRegistered()) {
return false;
}

Expand Down
Expand Up @@ -153,9 +153,8 @@ public static void sendStories(@NonNull final Context context,
database.beginTransaction();

for (OutgoingSecureMediaMessage message : messages) {
long allocatedThreadId = threadDatabase.getOrCreateValidThreadId(message.getRecipient(), -1L, message.getDistributionType());
Recipient recipient = message.getRecipient();
long messageId = database.insertMessageOutbox(applyUniversalExpireTimerIfNecessary(context, recipient, message.stripAttachments(), allocatedThreadId), allocatedThreadId, false, insertListener);
long allocatedThreadId = threadDatabase.getOrCreateValidThreadId(message.getRecipient(), -1L, message.getDistributionType());
long messageId = database.insertMessageOutbox(message.stripAttachments(), allocatedThreadId, false, insertListener);

messageIds.add(messageId);
threads.add(allocatedThreadId);
Expand Down

0 comments on commit 428ab65

Please sign in to comment.