mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-04 07:25:25 +01:00
Allow any group member to set member labels.
This commit is contained in:
committed by
Greyson Parrelli
parent
a6c8b940c9
commit
16e63a061d
@@ -107,7 +107,6 @@ class MemberLabelFragment : ComposeFragment(), ReactWithAnyEmojiBottomSheetDialo
|
||||
}
|
||||
|
||||
val networkErrorMessage = stringResource(R.string.GroupMemberLabel__error_cant_save_no_network)
|
||||
val noPermissionErrorMessage = stringResource(R.string.GroupMemberLabel__error_no_edit_permission)
|
||||
|
||||
LaunchedEffect(uiState.saveState) {
|
||||
when (uiState.saveState) {
|
||||
@@ -121,10 +120,7 @@ class MemberLabelFragment : ComposeFragment(), ReactWithAnyEmojiBottomSheetDialo
|
||||
viewModel.onSaveStateConsumed()
|
||||
}
|
||||
|
||||
is SaveState.InsufficientRights -> {
|
||||
snackbarHostState.showSnackbar(noPermissionErrorMessage)
|
||||
viewModel.onSaveStateConsumed()
|
||||
}
|
||||
is SaveState.InsufficientRights -> throw IllegalStateException("User does not have permission to set member label.")
|
||||
|
||||
is SaveState.InProgress, null -> Unit
|
||||
}
|
||||
|
||||
@@ -94,12 +94,12 @@ class MemberLabelRepository private constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the [Recipient] has permission to set their member label in the given group.
|
||||
* Checks whether [recipient] has permission to set their member label in the given group.
|
||||
*/
|
||||
suspend fun canSetLabel(groupId: GroupId.V2, recipient: Recipient): Boolean = withContext(Dispatchers.IO) {
|
||||
if (!RemoteConfig.sendMemberLabels) return@withContext false
|
||||
val groupRecord = groupsTable.getGroup(groupId).orNull() ?: return@withContext false
|
||||
groupRecord.attributesAccessControl.allows(groupRecord.memberLevel(recipient))
|
||||
groupRecord.memberLevel(recipient).isInGroup
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user