Allow any group member to set member labels.

This commit is contained in:
jeffrey-signal
2026-03-03 16:12:38 -05:00
committed by Greyson Parrelli
parent a6c8b940c9
commit 16e63a061d
9 changed files with 10 additions and 20 deletions

View File

@@ -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
}

View File

@@ -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
}
/**