Skip to content
Snippets Groups Projects
Commit 65372e54 authored by Cody Henthorne's avatar Cody Henthorne
Browse files

Auto-decline invites to a group by a blocked user.

parent 2454b2e0
No related branches found
No related tags found
No related merge requests found
......@@ -568,6 +568,7 @@ public class GroupsV2StateProcessor {
}
Optional<DecryptedMember> selfAsMemberOptional = DecryptedGroupUtil.findMemberByUuid(newLocalState.getMembersList(), selfAci.uuid());
Optional<DecryptedPendingMember> selfAsPendingOptional = DecryptedGroupUtil.findPendingByUuid(newLocalState.getPendingMembersList(), selfAci.uuid());
if (selfAsMemberOptional.isPresent()) {
DecryptedMember selfAsMember = selfAsMemberOptional.get();
......@@ -601,6 +602,18 @@ public class GroupsV2StateProcessor {
} else {
Log.w(TAG, "Could not find founding member during gv2 create. Not enabling profile sharing.");
}
} else if (selfAsPendingOptional.isPresent()) {
Optional<Recipient> addedBy = selfAsPendingOptional.flatMap(adder -> Optional.ofNullable(UuidUtil.fromByteStringOrNull(adder.getAddedByUuid()))
.map(a -> Recipient.externalPush(ServiceId.fromByteStringOrNull(adder.getAddedByUuid()), null, false)));
if (addedBy.isPresent() && addedBy.get().isBlocked()) {
Log.i(TAG, String.format( "Added to group %s by a blocked user %s. Leaving group.", groupId, addedBy.get().getId()));
ApplicationDependencies.getJobManager().add(new LeaveGroupV2Job(groupId));
//noinspection UnnecessaryReturnStatement
return;
} else {
Log.i(TAG, String.format("Added to %s, but not enabling profile sharing as we are a pending member.", groupId));
}
} else {
Log.i(TAG, String.format("Added to %s, but not enabling profile sharing as not a fullMember.", groupId));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment