Fix issue where group leave failed to send in announcement group.

This commit is contained in:
Greyson Parrelli 2021-08-27 13:24:47 -04:00 committed by Alex Hart
parent 08008629b3
commit 7c134a6c9d

View file

@ -173,12 +173,6 @@ public final class PushGroupSendJob extends PushSendJob {
throw new MmsException("No GV1 messages can be sent anymore!");
}
Optional<GroupDatabase.GroupRecord> groupRecord = DatabaseFactory.getGroupDatabase(context).getGroup(groupRecipient.requireGroupId());
if (groupRecord.isPresent() && groupRecord.get().isAnnouncementGroup() && !groupRecord.get().isAdmin(Recipient.self())) {
throw new MmsException("Non-admins cannot send messages in announcement groups!");
}
try {
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments()));
@ -327,6 +321,12 @@ public final class PushGroupSendJob extends PushSendJob {
throw new UndeliverableMessageException("Messages can no longer be sent to V1 groups!");
}
} else {
Optional<GroupDatabase.GroupRecord> groupRecord = DatabaseFactory.getGroupDatabase(context).getGroup(groupRecipient.requireGroupId());
if (groupRecord.isPresent() && groupRecord.get().isAnnouncementGroup() && !groupRecord.get().isAdmin(Recipient.self())) {
throw new UndeliverableMessageException("Non-admins cannot send messages in announcement groups!");
}
SignalServiceDataMessage.Builder builder = SignalServiceDataMessage.newBuilder()
.withTimestamp(message.getSentTimeMillis());