Allow all group members to have labels, no permission required

This commit is contained in:
Scott Nonnenberg
2026-02-28 05:34:14 +10:00
committed by Yash
parent e3560adbcf
commit 051a8a0eef
4 changed files with 1 additions and 167 deletions

View File

@@ -26,7 +26,6 @@ import {
import { ConversationColors } from '../../../types/Colors.std.js';
import { WidthBreakpoint } from '../../_util.std.js';
import { AxoAlertDialog } from '../../../axo/AxoAlertDialog.dom.js';
import { SignalService as Proto } from '../../../protobuf/index.std.js';
import { Avatar, AvatarSize } from '../../Avatar.dom.js';
import { UserText } from '../../UserText.dom.js';
import { GroupMemberLabel } from '../ContactName.dom.js';
@@ -105,8 +104,6 @@ export function GroupMemberLabelEditor({
}: PropsType): React.JSX.Element {
const [isShowingGeneralError, setIsShowingGeneralError] =
React.useState(false);
const [isShowingPermissionsError, setIsShowingPermissionsError] =
React.useState(false);
const messageContainer = useRef<HTMLDivElement | null>(null);
@@ -134,17 +131,6 @@ export function GroupMemberLabelEditor({
? { labelEmoji, labelString: labelStringForSave }
: undefined;
useEffect(() => {
if (
!group.areWeAdmin &&
group.accessControlAttributes ===
Proto.AccessControl.AccessRequired.ADMINISTRATOR &&
!isShowingPermissionsError
) {
setIsShowingPermissionsError(true);
}
}, [group, isShowingPermissionsError, setIsShowingPermissionsError]);
const tryClose = React.useRef<() => void | undefined>();
const [confirmDiscardModal, confirmDiscardIf] = useConfirmDiscard({
i18n,
@@ -438,38 +424,6 @@ export function GroupMemberLabelEditor({
</AxoAlertDialog.Footer>
</AxoAlertDialog.Content>
</AxoAlertDialog.Root>
<AxoAlertDialog.Root
open={isShowingPermissionsError}
onOpenChange={value => {
if (!value) {
setIsShowingPermissionsError(false);
popPanelForConversation();
}
}}
>
<AxoAlertDialog.Content escape="cancel-is-noop">
<AxoAlertDialog.Body>
<AxoAlertDialog.Title>
{i18n('icu:ConversationDetails--member-label--error-title')}
</AxoAlertDialog.Title>
<AxoAlertDialog.Description>
{i18n('icu:ConversationDetails--member-label--error-permissions')}
</AxoAlertDialog.Description>
</AxoAlertDialog.Body>
<AxoAlertDialog.Footer>
<AxoAlertDialog.Action
variant="primary"
arrow={false}
onClick={() => {
popPanelForConversation();
setIsShowingPermissionsError(false);
}}
>
{i18n('icu:ok')}
</AxoAlertDialog.Action>
</AxoAlertDialog.Footer>
</AxoAlertDialog.Content>
</AxoAlertDialog.Root>
</div>
);
}

View File

@@ -8,7 +8,6 @@ import { SignalService as Proto } from '../../../protobuf/index.std.js';
import { PanelRow } from './PanelRow.dom.js';
import { PanelSection } from './PanelSection.dom.js';
import { Select } from '../../Select.dom.js';
import { AxoAlertDialog } from '../../../axo/AxoAlertDialog.dom.js';
export type PropsDataType = {
conversation?: ConversationType;
@@ -32,8 +31,6 @@ export function GroupV2Permissions({
}: PropsType): React.JSX.Element {
const AccessControlEnum = Proto.AccessControl.AccessRequired;
const [isWarningAboutClearingLabels, setIsWarningAboutClearingLabels] =
React.useState(false);
const addMembersSelectId = useId();
const groupInfoSelectId = useId();
const announcementSelectId = useId();
@@ -41,17 +38,8 @@ export function GroupV2Permissions({
if (conversation === undefined) {
throw new Error('GroupV2Permissions rendered without a conversation');
}
const nonAdminsHaveLabels = conversation.memberships?.some(
membership => !membership.isAdmin && membership.labelString
);
const updateAccessControlAttributes = (value: string) => {
const newValue = Number(value);
if (newValue === AccessControlEnum.ADMINISTRATOR && nonAdminsHaveLabels) {
setIsWarningAboutClearingLabels(true);
return;
}
setAccessControlAttributesSetting(conversation.id, Number(value));
};
const updateAccessControlMembers = (value: string) => {
@@ -126,51 +114,6 @@ export function GroupV2Permissions({
}
/>
)}
<AxoAlertDialog.Root
open={isWarningAboutClearingLabels}
onOpenChange={value => {
if (!value) {
setIsWarningAboutClearingLabels(false);
}
}}
>
<AxoAlertDialog.Content escape="cancel-is-noop">
<AxoAlertDialog.Body>
<AxoAlertDialog.Title>
{i18n('icu:ConversationDetails--label-clear-warning--title')}
</AxoAlertDialog.Title>
<AxoAlertDialog.Description>
{i18n(
'icu:ConversationDetails--label-clear-warning--description'
)}
</AxoAlertDialog.Description>
</AxoAlertDialog.Body>
<AxoAlertDialog.Footer>
<AxoAlertDialog.Action
variant="secondary"
arrow={false}
onClick={() => {
setIsWarningAboutClearingLabels(false);
}}
>
{i18n('icu:cancel')}
</AxoAlertDialog.Action>
<AxoAlertDialog.Action
variant="primary"
arrow={false}
onClick={() => {
setAccessControlAttributesSetting(
conversation.id,
AccessControlEnum.ADMINISTRATOR
);
setIsWarningAboutClearingLabels(false);
}}
>
{i18n('icu:ConversationDetails--label-clear-warning--continue')}
</AxoAlertDialog.Action>
</AxoAlertDialog.Footer>
</AxoAlertDialog.Content>
</AxoAlertDialog.Root>
</PanelSection>
);
}