Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32212272
D12568.1765140682.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D12568.1765140682.diff
View Options
diff --git a/lib/shared/community-utils.js b/lib/shared/community-utils.js
--- a/lib/shared/community-utils.js
+++ b/lib/shared/community-utils.js
@@ -2,6 +2,7 @@
import * as React from 'react';
+import { useThreadHasPermission } from './thread-utils.js';
import {
createOrUpdateFarcasterChannelTagActionTypes,
useCreateOrUpdateFarcasterChannelTag,
@@ -10,6 +11,10 @@
} from '../actions/community-actions.js';
import { createLoadingStatusSelector } from '../selectors/loading-selectors.js';
import type { SetState } from '../types/hook-types.js';
+import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
+import { threadPermissions } from '../types/thread-permission-types.js';
+import { threadTypes } from '../types/thread-types-enum.js';
+import { useCurrentUserFID } from '../utils/farcaster-utils.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useSelector } from '../utils/redux-utils.js';
@@ -140,10 +145,26 @@
};
}
+function useCanManageFarcasterChannelTag(community: ThreadInfo): boolean {
+ const fid = useCurrentUserFID();
+
+ const canManageFarcasterChannelTag = useThreadHasPermission(
+ community,
+ threadPermissions.MANAGE_FARCASTER_CHANNEL_TAGS,
+ );
+
+ return (
+ canManageFarcasterChannelTag &&
+ !!fid &&
+ community.type !== threadTypes.GENESIS
+ );
+}
+
export {
tagFarcasterChannelCopy,
tagFarcasterChannelErrorMessages,
farcasterChannelTagBlobHash,
useCreateFarcasterChannelTag,
useRemoveFarcasterChannelTag,
+ useCanManageFarcasterChannelTag,
};
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,11 +7,10 @@
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js';
+import { useCanManageFarcasterChannelTag } from 'lib/shared/community-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';
-import { useCurrentUserFID } from 'lib/utils/farcaster-utils.js';
import SWMansionIcon from './swmansion-icon.react.js';
import {
@@ -36,8 +35,6 @@
const { navigate } = useNavigation();
- const fid = useCurrentUserFID();
-
const navigateToInviteLinksView = React.useCallback(() => {
if (!inviteLink || !community) {
return;
@@ -92,10 +89,8 @@
community,
threadPermissions.CHANGE_ROLE,
);
- const canManageFarcasterChannelTag = useThreadHasPermission(
- community,
- threadPermissions.MANAGE_FARCASTER_CHANNEL_TAGS,
- );
+ const canManageFarcasterChannelTag =
+ useCanManageFarcasterChannelTag(community);
const { showActionSheetWithOptions } = useActionSheet();
const actions = React.useMemo(() => {
@@ -125,12 +120,7 @@
});
}
- const canTagFarcasterChannel =
- canManageFarcasterChannelTag &&
- fid &&
- community.type !== threadTypes.GENESIS;
-
- if (canTagFarcasterChannel) {
+ if (canManageFarcasterChannelTag) {
result.push({
label: 'Tag Farcaster channel',
action: navigateToTagFarcasterChannel,
@@ -147,7 +137,6 @@
inviteLink,
canChangeRoles,
canManageFarcasterChannelTag,
- fid,
navigateToManagePublicLinkView,
navigateToInviteLinksView,
navigateToCommunityRolesScreen,
diff --git a/web/components/community-actions-menu.react.js b/web/components/community-actions-menu.react.js
--- a/web/components/community-actions-menu.react.js
+++ b/web/components/community-actions-menu.react.js
@@ -6,6 +6,7 @@
import SWMansionIcon from 'lib/components/swmansion-icon.react.js';
import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
+import { useCanManageFarcasterChannelTag } from 'lib/shared/community-utils.js';
import { useThreadHasPermission } from 'lib/shared/thread-utils.js';
import type { InviteLink } from 'lib/types/link-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
@@ -18,6 +19,7 @@
import ViewInviteLinkModal from '../invite-links/view-invite-link-modal.react.js';
import { useSelector } from '../redux/redux-utils.js';
import CommunityRolesModal from '../roles/community-roles-modal.react.js';
+import TagFarcasterChannelModal from '../tag-farcaster-channel/tag-farcaster-channel-modal.react.js';
import { AddLink } from '../vectors.react.js';
type Props = {
@@ -42,6 +44,8 @@
community,
threadPermissions.CHANGE_ROLE,
);
+ const canManageFarcasterChannelTag =
+ useCanManageFarcasterChannelTag(community);
const openViewInviteLinkModal = React.useCallback(() => {
if (!inviteLink) {
@@ -58,6 +62,10 @@
() => pushModal(<CommunityRolesModal community={community} />),
[community, pushModal],
);
+ const openFarcasterChannelTagModal = React.useCallback(
+ () => pushModal(<TagFarcasterChannelModal communityID={communityID} />),
+ [communityID, pushModal],
+ );
const items = React.useMemo(() => {
const itemSpecs: MenuItemProps[] = [];
@@ -86,14 +94,24 @@
});
}
+ if (canManageFarcasterChannelTag) {
+ itemSpecs.push({
+ text: 'Tag Farcaster channel',
+ icon: 'tag',
+ onClick: openFarcasterChannelTagModal,
+ });
+ }
+
return itemSpecs;
}, [
canManageLinks,
inviteLink,
+ canChangeRoles,
+ canManageFarcasterChannelTag,
openManageInviteLinksModal,
openViewInviteLinkModal,
- canChangeRoles,
openCommunityRolesModal,
+ openFarcasterChannelTagModal,
]);
const menuItems = React.useMemo(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 8:51 PM (15 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5843676
Default Alt Text
D12568.1765140682.diff (5 KB)
Attached To
Mode
D12568: [web] add Tag Farcaster channel option to CommunityActionsMenu
Attached
Detach File
Event Timeline
Log In to Comment