kopia lustrzana https://github.com/ryukoposting/Signal-Android
Prevent updates to blocked groups.
rodzic
35d0f1fc8c
commit
642d37edb2
|
@ -130,8 +130,8 @@ sealed class ConversationSettingsViewModel(
|
|||
state.copy(
|
||||
recipient = recipient,
|
||||
buttonStripState = ButtonStripPreference.State(
|
||||
isVideoAvailable = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED && !recipient.isSelf,
|
||||
isAudioAvailable = !recipient.isGroup && !recipient.isSelf,
|
||||
isVideoAvailable = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED && !recipient.isSelf && !recipient.isBlocked,
|
||||
isAudioAvailable = !recipient.isGroup && !recipient.isSelf && !recipient.isBlocked,
|
||||
isAudioSecure = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED,
|
||||
isMuted = recipient.isMuted,
|
||||
isMuteAvailable = !recipient.isSelf,
|
||||
|
@ -240,11 +240,12 @@ sealed class ConversationSettingsViewModel(
|
|||
private val liveGroup = LiveGroup(groupId)
|
||||
|
||||
init {
|
||||
store.update(liveGroup.groupRecipient) { recipient, state ->
|
||||
val recipientAndIsActive = LiveDataUtil.combineLatest(liveGroup.groupRecipient, liveGroup.isActive) { r, a -> r to a }
|
||||
store.update(recipientAndIsActive) { (recipient, isActive), state ->
|
||||
state.copy(
|
||||
recipient = recipient,
|
||||
buttonStripState = ButtonStripPreference.State(
|
||||
isVideoAvailable = recipient.isPushV2Group,
|
||||
isVideoAvailable = recipient.isPushV2Group && !recipient.isBlocked && isActive,
|
||||
isAudioAvailable = false,
|
||||
isAudioSecure = recipient.isPushV2Group,
|
||||
isMuted = recipient.isMuted,
|
||||
|
|
|
@ -624,7 +624,7 @@ public class ConversationParentFragment extends Fragment
|
|||
setBlockedUserState(recipientSnapshot, isSecureText, isDefaultSms);
|
||||
calculateCharactersRemaining();
|
||||
|
||||
if (recipientSnapshot.getGroupId().isPresent() && recipientSnapshot.getGroupId().get().isV2()) {
|
||||
if (recipientSnapshot.getGroupId().isPresent() && recipientSnapshot.getGroupId().get().isV2() && !recipientSnapshot.isBlocked()) {
|
||||
GroupId.V2 groupId = recipientSnapshot.getGroupId().get().requireV2();
|
||||
|
||||
ApplicationDependencies.getJobManager()
|
||||
|
|
|
@ -621,6 +621,10 @@ final class GroupManagerV2 {
|
|||
final DecryptedGroup decryptedGroupState;
|
||||
final DecryptedGroup previousGroupState;
|
||||
|
||||
if (Recipient.externalGroupExact(context, groupId).isBlocked()) {
|
||||
throw new GroupChangeFailedException("Group is blocked.");
|
||||
}
|
||||
|
||||
try {
|
||||
previousGroupState = v2GroupProperties.getDecryptedGroup();
|
||||
decryptedChange = groupOperations.decryptChange(changeActions, selfAci.uuid());
|
||||
|
|
|
@ -123,6 +123,11 @@ public class GroupV1MigrationJob extends BaseJob {
|
|||
|
||||
@Override
|
||||
protected void onRun() throws IOException, GroupChangeBusyException, RetryLaterException {
|
||||
if (Recipient.resolved(recipientId).isBlocked()) {
|
||||
Log.i(TAG, "Group blocked. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
GroupsV1MigrationUtil.migrate(context, recipientId, false);
|
||||
} catch (GroupsV1MigrationUtil.InvalidMigrationStateException e) {
|
||||
|
|
|
@ -130,9 +130,15 @@ public final class PushGroupSilentUpdateSendJob extends BaseJob {
|
|||
throw new NotPushRegisteredException();
|
||||
}
|
||||
|
||||
GroupId.V2 groupId = GroupId.v2(GroupUtil.requireMasterKey(groupContextV2.getMasterKey().toByteArray()));
|
||||
List<Recipient> destinations = Stream.of(recipients).map(Recipient::resolved).toList();
|
||||
List<Recipient> completions = deliver(destinations, groupId);
|
||||
GroupId.V2 groupId = GroupId.v2(GroupUtil.requireMasterKey(groupContextV2.getMasterKey().toByteArray()));
|
||||
|
||||
if (Recipient.externalGroupExact(context, groupId).isBlocked()) {
|
||||
Log.i(TAG, "Not updating group state for blocked group " + groupId);
|
||||
return;
|
||||
}
|
||||
|
||||
List<Recipient> destinations = Stream.of(recipients).map(Recipient::resolved).toList();
|
||||
List<Recipient> completions = deliver(destinations, groupId);
|
||||
|
||||
for (Recipient completion : completions) {
|
||||
recipients.remove(completion.getId());
|
||||
|
|
|
@ -84,6 +84,11 @@ final class RequestGroupV2InfoWorkerJob extends BaseJob {
|
|||
return;
|
||||
}
|
||||
|
||||
if (Recipient.externalGroupExact(context, groupId).isBlocked()) {
|
||||
Log.i(TAG, "Not fetching group info for blocked group " + groupId);
|
||||
return;
|
||||
}
|
||||
|
||||
GroupManager.updateGroupFromServer(context, group.get().requireV2GroupProperties().getGroupMasterKey(), toRevision, System.currentTimeMillis(), null);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue