mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 18:57:43 +00:00
Ignore closed group messages from users who are not members.
This commit is contained in:
parent
45220bfa70
commit
7d9eafe8fb
@ -137,8 +137,7 @@ public class GroupMessageProcessor {
|
||||
GroupDatabase database = DatabaseFactory.getGroupDatabase(context);
|
||||
String id = GroupUtil.getEncodedId(group);
|
||||
|
||||
String masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
String ourHexEncodedPublicKey = masterHexEncodedPublicKey != null ? masterHexEncodedPublicKey : TextSecurePreferences.getLocalNumber(context);
|
||||
String ourHexEncodedPublicKey = getMasterHexEncodedPublicKey(context, TextSecurePreferences.getLocalNumber(context));
|
||||
|
||||
if (group.getGroupType() == SignalServiceGroup.GroupType.SIGNAL) {
|
||||
// Only update group if admin sent the message
|
||||
|
@ -1895,7 +1895,28 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
boolean isGroupActive = groupId.isPresent() && groupDatabase.isActive(groupId.get());
|
||||
boolean isLeaveMessage = message.getGroupInfo().isPresent() && message.getGroupInfo().get().getType() == SignalServiceGroup.Type.QUIT;
|
||||
|
||||
return (isContentMessage && !isGroupActive) || (sender.isBlocked() && !isLeaveMessage);
|
||||
boolean isClosedGroup = conversation.getAddress().isSignalGroup();
|
||||
boolean isGroupMember = true;
|
||||
|
||||
// Only allow messages from members of a group
|
||||
if (isClosedGroup) {
|
||||
String senderHexEncodedPublicKey = content.getSender();
|
||||
|
||||
try {
|
||||
String masterHexEncodedPublicKey = PromiseUtil.timeout(LokiDeviceLinkUtilities.INSTANCE.getMasterHexEncodedPublicKey(content.getSender()), 5000).get();
|
||||
if (masterHexEncodedPublicKey != null) {
|
||||
senderHexEncodedPublicKey = masterHexEncodedPublicKey;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Recipient senderMaster = Recipient.from(context, Address.fromSerialized(senderHexEncodedPublicKey), false);
|
||||
|
||||
isGroupMember = groupId.isPresent() && groupDatabase.getGroupMembers(groupId.get(), true).contains(senderMaster);
|
||||
}
|
||||
|
||||
return (isContentMessage && !isGroupActive) || (sender.isBlocked() && !isLeaveMessage) || (isContentMessage && !isGroupMember);
|
||||
} else {
|
||||
return sender.isBlocked();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user