Add a failsafe to prevent non-admin sends in announcement groups.

fork-5.53.8
Greyson Parrelli 2021-08-25 14:20:49 -04:00
rodzic 8c3a0c1f9f
commit ba4d1c9844
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -173,6 +173,12 @@ 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()));