diff --git a/native/components/community-actions-button.react.js b/native/components/community-actions-button.react.js --- a/native/components/community-actions-button.react.js +++ b/native/components/community-actions-button.react.js @@ -7,7 +7,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js'; -import { threadHasPermission } from 'lib/shared/thread-utils.js'; +import { useThreadHasPermission } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; @@ -82,6 +82,15 @@ const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme); const styles = useStyles(unboundStyles); + const canManageLinks = useThreadHasPermission( + community, + threadPermissions.MANAGE_INVITE_LINKS, + ); + const canChangeRoles = useThreadHasPermission( + community, + threadPermissions.CHANGE_ROLE, + ); + const { showActionSheetWithOptions } = useActionSheet(); const actions = React.useMemo(() => { if (!community) { @@ -89,10 +98,6 @@ } const result = []; - const canManageLinks = threadHasPermission( - community, - threadPermissions.MANAGE_INVITE_LINKS, - ); if (canManageLinks) { result.push({ label: 'Manage invite links', @@ -107,10 +112,6 @@ }); } - const canChangeRoles = threadHasPermission( - community, - threadPermissions.CHANGE_ROLE, - ); if (canChangeRoles) { result.push({ label: 'Manage roles', @@ -136,7 +137,9 @@ return null; }, [ community, + canManageLinks, inviteLink, + canChangeRoles, fid, navigateToManagePublicLinkView, navigateToInviteLinksView,