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(
|
state.copy(
|
||||||
recipient = recipient,
|
recipient = recipient,
|
||||||
buttonStripState = ButtonStripPreference.State(
|
buttonStripState = ButtonStripPreference.State(
|
||||||
isVideoAvailable = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED && !recipient.isSelf,
|
isVideoAvailable = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED && !recipient.isSelf && !recipient.isBlocked,
|
||||||
isAudioAvailable = !recipient.isGroup && !recipient.isSelf,
|
isAudioAvailable = !recipient.isGroup && !recipient.isSelf && !recipient.isBlocked,
|
||||||
isAudioSecure = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED,
|
isAudioSecure = recipient.registered == RecipientDatabase.RegisteredState.REGISTERED,
|
||||||
isMuted = recipient.isMuted,
|
isMuted = recipient.isMuted,
|
||||||
isMuteAvailable = !recipient.isSelf,
|
isMuteAvailable = !recipient.isSelf,
|
||||||
|
@ -240,11 +240,12 @@ sealed class ConversationSettingsViewModel(
|
||||||
private val liveGroup = LiveGroup(groupId)
|
private val liveGroup = LiveGroup(groupId)
|
||||||
|
|
||||||
init {
|
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(
|
state.copy(
|
||||||
recipient = recipient,
|
recipient = recipient,
|
||||||
buttonStripState = ButtonStripPreference.State(
|
buttonStripState = ButtonStripPreference.State(
|
||||||
isVideoAvailable = recipient.isPushV2Group,
|
isVideoAvailable = recipient.isPushV2Group && !recipient.isBlocked && isActive,
|
||||||
isAudioAvailable = false,
|
isAudioAvailable = false,
|
||||||
isAudioSecure = recipient.isPushV2Group,
|
isAudioSecure = recipient.isPushV2Group,
|
||||||
isMuted = recipient.isMuted,
|
isMuted = recipient.isMuted,
|
||||||
|
|
|
@ -624,7 +624,7 @@ public class ConversationParentFragment extends Fragment
|
||||||
setBlockedUserState(recipientSnapshot, isSecureText, isDefaultSms);
|
setBlockedUserState(recipientSnapshot, isSecureText, isDefaultSms);
|
||||||
calculateCharactersRemaining();
|
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();
|
GroupId.V2 groupId = recipientSnapshot.getGroupId().get().requireV2();
|
||||||
|
|
||||||
ApplicationDependencies.getJobManager()
|
ApplicationDependencies.getJobManager()
|
||||||
|
|
|
@ -621,6 +621,10 @@ final class GroupManagerV2 {
|
||||||
final DecryptedGroup decryptedGroupState;
|
final DecryptedGroup decryptedGroupState;
|
||||||
final DecryptedGroup previousGroupState;
|
final DecryptedGroup previousGroupState;
|
||||||
|
|
||||||
|
if (Recipient.externalGroupExact(context, groupId).isBlocked()) {
|
||||||
|
throw new GroupChangeFailedException("Group is blocked.");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
previousGroupState = v2GroupProperties.getDecryptedGroup();
|
previousGroupState = v2GroupProperties.getDecryptedGroup();
|
||||||
decryptedChange = groupOperations.decryptChange(changeActions, selfAci.uuid());
|
decryptedChange = groupOperations.decryptChange(changeActions, selfAci.uuid());
|
||||||
|
|
|
@ -123,6 +123,11 @@ public class GroupV1MigrationJob extends BaseJob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRun() throws IOException, GroupChangeBusyException, RetryLaterException {
|
protected void onRun() throws IOException, GroupChangeBusyException, RetryLaterException {
|
||||||
|
if (Recipient.resolved(recipientId).isBlocked()) {
|
||||||
|
Log.i(TAG, "Group blocked. Skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GroupsV1MigrationUtil.migrate(context, recipientId, false);
|
GroupsV1MigrationUtil.migrate(context, recipientId, false);
|
||||||
} catch (GroupsV1MigrationUtil.InvalidMigrationStateException e) {
|
} catch (GroupsV1MigrationUtil.InvalidMigrationStateException e) {
|
||||||
|
|
|
@ -131,6 +131,12 @@ public final class PushGroupSilentUpdateSendJob extends BaseJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupId.V2 groupId = GroupId.v2(GroupUtil.requireMasterKey(groupContextV2.getMasterKey().toByteArray()));
|
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> destinations = Stream.of(recipients).map(Recipient::resolved).toList();
|
||||||
List<Recipient> completions = deliver(destinations, groupId);
|
List<Recipient> completions = deliver(destinations, groupId);
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,11 @@ final class RequestGroupV2InfoWorkerJob extends BaseJob {
|
||||||
return;
|
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);
|
GroupManager.updateGroupFromServer(context, group.get().requireV2GroupProperties().getGroupMasterKey(), toRevision, System.currentTimeMillis(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue