Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(threads): let administrators grant thread permissions (#3256)

Hampus1997850d55ce
diff --git a/fluxer_app/src/features/channel/components/modals/channel_tabs/ChannelPermissionsTab.tsx b/fluxer_app/src/features/channel/components/modals/channel_tabs/ChannelPermissionsTab.tsx
index 1d6517dad..916db8020 100644
--- a/fluxer_app/src/features/channel/components/modals/channel_tabs/ChannelPermissionsTab.tsx
+++ b/fluxer_app/src/features/channel/components/modals/channel_tabs/ChannelPermissionsTab.tsx
@@ -35,7 +35,7 @@ import Users from '@app/features/user/state/Users';
import * as NicknameUtils from '@app/features/user/utils/NicknameUtils';
import {flip, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole} from '@floating-ui/react';
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
-import {THREAD_PERMISSIONS} from '@fluxer/constants/src/ThreadPermissionUtils';
+import {THREAD_PERMISSIONS, withImplicitThreadBits} from '@fluxer/constants/src/ThreadPermissionUtils';
import {msg} from '@lingui/core/macro';
import {Trans, useLingui} from '@lingui/react/macro';
import {matchSorter} from 'match-sorter';
@@ -117,7 +117,7 @@ const ChannelPermissionsTab: React.FC<{channelId: string}> = observer(({channelI
}, [isAddOverrideOpen, channelId]);
const currentUserPermissions = useMemo(() => {
if (!guild || !currentUser || !channel) return 0n;
- return PermissionUtils.computePermissions(currentUser.id, channel.toJSON());
+ return withImplicitThreadBits(PermissionUtils.computePermissions(currentUser.id, channel.toJSON()));
}, [guild, currentUser, channel]);
const currentUserMember = useMemo(() => {
if (!guild || !currentUser) return null;
diff --git a/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildRolesTab.tsx b/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildRolesTab.tsx
index 45e9a0869..a836eee2f 100644
--- a/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildRolesTab.tsx
+++ b/fluxer_app/src/features/guild/components/modals/guild_tabs/GuildRolesTab.tsx
@@ -38,7 +38,7 @@ import MobileLayout from '@app/features/ui/state/MobileLayout';
import SettingsSidebar from '@app/features/ui/state/SettingsSidebar';
import Users from '@app/features/user/state/Users';
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
-import {THREAD_PERMISSIONS} from '@fluxer/constants/src/ThreadPermissionUtils';
+import {THREAD_PERMISSIONS, withImplicitThreadBits} from '@fluxer/constants/src/ThreadPermissionUtils';
import {msg} from '@lingui/core/macro';
import {Trans, useLingui} from '@lingui/react/macro';
import {matchSorter} from 'match-sorter';
@@ -168,7 +168,7 @@ const GuildRolesTab: React.FC<{guildId: string}> = observer(({guildId}) => {
}, [guild, currentUserMember]);
const currentUserPermissions = useMemo(() => {
if (!guild || !currentUser) return 0n;
- return PermissionUtils.computePermissions(currentUser.id, guild.toJSON());
+ return withImplicitThreadBits(PermissionUtils.computePermissions(currentUser.id, guild.toJSON()));
}, [guild, currentUser]);
const wouldRemoveOwnPermission = useCallback(
(permission: bigint, roleId: string): boolean => {