A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): limit menus, members and actions while previewing
Hampus8913bca0a3c7
diff --git a/fluxer_app/src/features/channel/components/ChannelMembers.tsx b/fluxer_app/src/features/channel/components/ChannelMembers.tsxindex 723f76dd2..b538d8a6f 100644--- a/fluxer_app/src/features/channel/components/ChannelMembers.tsx+++ b/fluxer_app/src/features/channel/components/ChannelMembers.tsx@@ -152,6 +152,7 @@ const GroupDMMemberListGroup = observer(({group, channelId, ownerId, onHeadingRename={group.displayName}count={group.count}className={styles.groupHeader}+ data-flx="channel.channel-members.group-dm-member-list-group.group-header"/><div className={styles.membersList} data-flx="channel.channel-members.group-dm-member-list-group.members-list">{group.users.map((user) => {@@ -442,6 +443,7 @@ const LazyMemberList = observer(function LazyMemberList({guild, channel}: LazyMecount={group.count}className={clsx(styles.virtualRow, styles.virtualGroupRow)}style={rowStyle}+ data-flx="channel.channel-members.lazy-member-list.virtual-row"/>,);@@ -578,7 +580,11 @@ export const ChannelMembers = observer(function ChannelMembers({guild = null, chconst frameSides = guild ? {left: false} : undefined;return (<OutlineFrame hideTopBorder sides={frameSides} data-flx="channel.channel-members.outline-frame--2">- <LazyMemberList guild={guild} channel={channel} data-flx="channel.channel-members.lazy-member-list" />+ {guild.visiting ? (+ <MemberListUnavailableFallback variant="visiting" data-flx="channel.channel-members.visiting-fallback" />+ ) : (+ <LazyMemberList guild={guild} channel={channel} data-flx="channel.channel-members.lazy-member-list" />+ )}</OutlineFrame>);});diff --git a/fluxer_app/src/features/channel/components/ChannelWelcomeSection.tsx b/fluxer_app/src/features/channel/components/ChannelWelcomeSection.tsxindex 3efc51557..afb3c9054 100644--- a/fluxer_app/src/features/channel/components/ChannelWelcomeSection.tsx+++ b/fluxer_app/src/features/channel/components/ChannelWelcomeSection.tsx@@ -6,9 +6,11 @@ import {GroupDMWelcomeSection} from '@app/features/channel/components/direct_mesimport {PersonalNotesWelcomeSection} from '@app/features/channel/components/direct_message/PersonalNotesWelcomeSection';import type {Channel} from '@app/features/channel/models/Channel';import * as ChannelUtils from '@app/features/channel/utils/ChannelUtils';+import Guilds from '@app/features/guild/state/Guilds';import {ThreadWelcomeSection} from '@app/features/threads/components/ThreadWelcomeSection';import Users from '@app/features/user/state/Users';import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';+import {MS_PER_DAY} from '@fluxer/date_utils/src/DateConstants';import {Trans} from '@lingui/react/macro';import {clsx} from 'clsx';import {observer} from 'mobx-react-lite';@@ -45,6 +47,13 @@ export const ChannelWelcomeSection = observer(({channel}: ChannelWelcomeSectionPreturn <ThreadWelcomeSection thread={channel} data-flx="channel.channel-welcome-section.thread-welcome-section" />;}const channelDisplayName = `#${channel.name ?? ''}`;+ const visitor = Users.currentUser;+ const visitHistoryLimited =+ channel.guildId != null &&+ Guilds.getGuild(channel.guildId)?.visiting === true &&+ visitor != null &&+ visitor.accountTier !== 'verified' &&+ channel.createdAt.getTime() < Date.now() - visitor.guildVisitHistoryDays * MS_PER_DAY;return (<div className={styles.container} data-flx="channel.channel-welcome-section.container"><div@@ -57,7 +66,13 @@ export const ChannelWelcomeSection = observer(({channel}: ChannelWelcomeSectionP<Trans>Welcome to {channelDisplayName}</Trans></h1><p className={styles.description} data-flx="channel.channel-welcome-section.description">- <Trans>This is the start of {channelDisplayName}.</Trans>+ {visitHistoryLimited ? (+ <Trans comment="Shown at the top of a channel you are previewing before joining the community, where older messages are hidden until you join.">+ Older messages are visible after you join.+ </Trans>+ ) : (+ <Trans>This is the start of {channelDisplayName}.</Trans>+ )}</p></div>);diff --git a/fluxer_app/src/features/channel/components/MessageActionBar.tsx b/fluxer_app/src/features/channel/components/MessageActionBar.tsxindex 768d30a0d..222ec9553 100644--- a/fluxer_app/src/features/channel/components/MessageActionBar.tsx+++ b/fluxer_app/src/features/channel/components/MessageActionBar.tsx@@ -253,13 +253,14 @@ interface MessageActionBarCoreProps {canCrosspostMessage: boolean;shouldRenderSuppressEmbeds: boolean;canCreateThread?: boolean;+ isPreviewing?: boolean;};developerMode: boolean;isActive: boolean;onPopoutToggle?: (isOpen: boolean) => void;}-export const MessageActionBarCore: React.FC<MessageActionBarCoreProps> = observer(+const MessageActionBarCore: React.FC<MessageActionBarCoreProps> = observer(({message, handleDelete, permissions, developerMode, isActive, onPopoutToggle}) => {const {i18n} = useLingui();const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);@@ -529,17 +530,19 @@ export const MessageActionBarCore: React.FC<MessageActionBarCoreProps> = observedata-flx="channel.message-action-bar.message-action-bar-core.message-action-bar-button.copy-message-link"/>)}- <MessageActionBarButton- icon={- <MarkAsUnreadIcon- size={20}- data-flx="channel.message-action-bar.message-action-bar-core.mark-as-unread-icon"- />- }- label={i18n._(MARK_AS_UNREAD_DESCRIPTOR)}- onClick={handlers.handleMarkAsUnread}- data-flx="channel.message-action-bar.message-action-bar-core.message-action-bar-button.mark-as-unread"- />+ {!permissions.isPreviewing && (+ <MessageActionBarButton+ icon={+ <MarkAsUnreadIcon+ size={20}+ data-flx="channel.message-action-bar.message-action-bar-core.mark-as-unread-icon"+ />+ }+ label={i18n._(MARK_AS_UNREAD_DESCRIPTOR)}+ onClick={handlers.handleMarkAsUnread}+ data-flx="channel.message-action-bar.message-action-bar-core.message-action-bar-button.mark-as-unread"+ />+ )}{message.isUserMessage() && canPinMessage && (<MessageActionBarButtonicon={diff --git a/fluxer_app/src/features/channel/components/MessageActionMenu.tsx b/fluxer_app/src/features/channel/components/MessageActionMenu.tsxindex 5b7808452..e1d4fb4d1 100644--- a/fluxer_app/src/features/channel/components/MessageActionMenu.tsx+++ b/fluxer_app/src/features/channel/components/MessageActionMenu.tsx@@ -253,7 +253,7 @@ export const useMessageActionMenuData = (shortcut: <KeybindHint action="message_react" data-flx="channel.message-action-menu.groups.keybind-hint" />,});}- if (reactions.length > 0 && onOpenReactionsSheet) {+ if (reactions.length > 0 && onOpenReactionsSheet && !permissions?.isPreviewing) {reactionActions.push({id: messageActionMenuItemIds.viewReactions,icon: <ViewReactionsIcon size={20} data-flx="channel.message-action-menu.groups.view-reactions-icon" />,@@ -272,15 +272,17 @@ export const useMessageActionMenuData = (danger: true,});}- interactionActions.push({- id: messageActionMenuItemIds.markUnread,- icon: <MarkAsUnreadIcon size={20} data-flx="channel.message-action-menu.groups.mark-as-unread-icon" />,- label: i18n._(MARK_AS_UNREAD_DESCRIPTOR),- onClick: handlers.handleMarkAsUnread,- shortcut: (- <KeybindHint action="message_mark_unread" data-flx="channel.message-action-menu.groups.keybind-hint--2" />- ),- });+ if (!permissions?.isPreviewing) {+ interactionActions.push({+ id: messageActionMenuItemIds.markUnread,+ icon: <MarkAsUnreadIcon size={20} data-flx="channel.message-action-menu.groups.mark-as-unread-icon" />,+ label: i18n._(MARK_AS_UNREAD_DESCRIPTOR),+ onClick: handlers.handleMarkAsUnread,+ shortcut: (+ <KeybindHint action="message_mark_unread" data-flx="channel.message-action-menu.groups.keybind-hint--2" />+ ),+ });+ }if (message.isUserMessage() && supportsInteractiveActions && permissions?.canSendMessages) {interactionActions.push({id: messageActionMenuItemIds.reply,diff --git a/fluxer_app/src/features/channel/components/MessageActionUtils.tsx b/fluxer_app/src/features/channel/components/MessageActionUtils.tsxindex 1fc92b1de..b14126eef 100644--- a/fluxer_app/src/features/channel/components/MessageActionUtils.tsx+++ b/fluxer_app/src/features/channel/components/MessageActionUtils.tsx@@ -177,6 +177,7 @@ export interface MessagePermissions {canSuppressEmbeds: boolean;shouldRenderSuppressEmbeds: boolean;canCreateThread: boolean;+ isPreviewing: boolean;}function canCreateThreadFromMessage(message: Message, channel: Channel): boolean {@@ -239,7 +240,10 @@ function getMessagePermissionsForChannel(message: Message, channel: Channel): Me!sendMessageDisabled &&(isDM ? true : Permission.can(Permissions.PIN_MESSAGES, {channelId: message.channelId}));const canForwardMessage =- !interactionsBlocked && !sendMessageDisabled && canForwardMessageFromChannel(message, channel, isDM);+ !interactionsBlocked &&+ !sendMessageDisabled &&+ guild?.visiting !== true &&+ canForwardMessageFromChannel(message, channel, isDM);const canCrosspostMessage =!interactionsBlocked &&!sendMessageDisabled &&@@ -274,6 +278,7 @@ function getMessagePermissionsForChannel(message: Message, channel: Channel): MecanSuppressEmbeds,shouldRenderSuppressEmbeds,canCreateThread: canCreateThreadFromMessage(message, channel),+ isPreviewing: guild?.visiting === true,};}diff --git a/fluxer_app/src/features/channel/components/shared/MemberListUnavailableFallback.tsx b/fluxer_app/src/features/channel/components/shared/MemberListUnavailableFallback.tsxindex 05cdc4b4a..20ad72940 100644--- a/fluxer_app/src/features/channel/components/shared/MemberListUnavailableFallback.tsx+++ b/fluxer_app/src/features/channel/components/shared/MemberListUnavailableFallback.tsx@@ -23,7 +23,12 @@ const MEMBER_LISTS_ARE_TEMPORARILY_UNAVAILABLE_IN_THIS_COMMUNITY_DESCRIPTOR = mscomment: 'Label in the channel and chat member list unavailable fallback.',});-type MemberListUnavailableVariant = 'unavailable' | 'permission_denied';+const MEMBERS_VISIBLE_AFTER_JOIN_DESCRIPTOR = msg({+ message: 'Members are visible after you join.',+ comment: 'Member list placeholder while someone looks around a community without joining.',+});++type MemberListUnavailableVariant = 'unavailable' | 'permission_denied' | 'visiting';interface MemberListUnavailableFallbackProps {className?: string;@@ -36,14 +41,15 @@ export function MemberListUnavailableFallback({}: MemberListUnavailableFallbackProps) {const {i18n} = useLingui();const containerClassName = className ? `${styles.container} ${className}` : styles.container;- const title =- variant === 'permission_denied'- ? i18n._(YOU_CAN_T_VIEW_MEMBERS_DESCRIPTOR)- : i18n._(MEMBER_LIST_UNAVAILABLE_DESCRIPTOR);- const description =- variant === 'permission_denied'- ? i18n._(YOU_DON_T_HAVE_PERMISSION_TO_VIEW_THE_DESCRIPTOR)- : i18n._(MEMBER_LISTS_ARE_TEMPORARILY_UNAVAILABLE_IN_THIS_COMMUNITY_DESCRIPTOR);+ let title = i18n._(MEMBER_LIST_UNAVAILABLE_DESCRIPTOR);+ let description: string | null = i18n._(MEMBER_LISTS_ARE_TEMPORARILY_UNAVAILABLE_IN_THIS_COMMUNITY_DESCRIPTOR);+ if (variant === 'permission_denied') {+ title = i18n._(YOU_CAN_T_VIEW_MEMBERS_DESCRIPTOR);+ description = i18n._(YOU_DON_T_HAVE_PERMISSION_TO_VIEW_THE_DESCRIPTOR);+ } else if (variant === 'visiting') {+ title = i18n._(MEMBERS_VISIBLE_AFTER_JOIN_DESCRIPTOR);+ description = null;+ }return (<div className={containerClassName} data-flx="channel.member-list-unavailable-fallback.div"><div className={styles.content} data-flx="channel.member-list-unavailable-fallback.content">@@ -51,9 +57,11 @@ export function MemberListUnavailableFallback({<h3 className={styles.title} data-flx="channel.member-list-unavailable-fallback.title">{title}</h3>- <p className={styles.description} data-flx="channel.member-list-unavailable-fallback.description">- {description}- </p>+ {description === null ? null : (+ <p className={styles.description} data-flx="channel.member-list-unavailable-fallback.description">+ {description}+ </p>+ )}</div></div>);diff --git a/fluxer_app/src/features/guild/components/popouts/GuildHeaderPopout.tsx b/fluxer_app/src/features/guild/components/popouts/GuildHeaderPopout.tsxindex 7dc3f1c20..d1aa3237c 100644--- a/fluxer_app/src/features/guild/components/popouts/GuildHeaderPopout.tsx+++ b/fluxer_app/src/features/guild/components/popouts/GuildHeaderPopout.tsx@@ -2,13 +2,19 @@import {GuildSettingsModal, UserSettingsModal} from '@app/features/app/components/dialogs/LoadableSettingsModals';import {useRovingFocusList} from '@app/features/app/hooks/useRovingFocusList';+import RuntimeConfig from '@app/features/app/state/RuntimeConfig';import Authentication from '@app/features/auth/state/Authentication';import {CategoryCreateModal} from '@app/features/channel/components/modals/CategoryCreateModal';import {ChannelCreateModal} from '@app/features/channel/components/modals/ChannelCreateModal';import {DELETE_MY_MESSAGES_DESCRIPTOR} from '@app/features/channel/utils/ChannelMessageDescriptors';+import {joinVisitedGuild, leaveVisit} from '@app/features/guild/commands/GuildVisitCommands';import {GuildNotificationSettingsModal} from '@app/features/guild/components/modals/GuildNotificationSettingsModal';import {GuildPrivacySettingsModal} from '@app/features/guild/components/modals/GuildPrivacySettingsModal';import styles from '@app/features/guild/components/popouts/GuildHeaderPopout.module.css';+import {+ JOIN_COMMUNITY_DESCRIPTOR,+ STOP_PREVIEWING_DESCRIPTOR,+} from '@app/features/guild/components/visits/GuildPreviewNagbar';import {useDeleteMyMessagesInGuild} from '@app/features/guild/hooks/useDeleteMyMessagesInGuild';import {useLeaveGuild} from '@app/features/guild/hooks/useLeaveGuild';import type {Guild} from '@app/features/guild/models/Guild';@@ -34,11 +40,13 @@ import * as UserGuildSettingsCommands from '@app/features/user/commands/UserGuilimport {GUILD_SETTINGS_LABEL_DESCRIPTOR} from '@app/features/user/components/settings_utils/GuildSettingsConstants';import UserGuildSettings from '@app/features/user/state/UserGuildSettings';import Users from '@app/features/user/state/Users';+import {canOpenProfileEditor} from '@app/features/user/utils/ProfileEditAccess';import {Permissions} from '@fluxer/constants/src/ChannelConstants';import {msg} from '@lingui/core/macro';import {useLingui} from '@lingui/react/macro';import {BellIcon,+ DoorOpenIcon,FolderPlusIcon,GearIcon,type Icon,@@ -176,7 +184,7 @@ export const GuildHeaderPopout = observer(({guild}: {guild: Guild}) => {canManageEmojis ||canCreateExpressions ||canBanMembers;- const canEditCommunityProfile = Users.getCurrentUser()?.isClaimed() ?? true;+ const canEditCommunityProfile = canOpenProfileEditor(Users.getCurrentUser());const settings = UserGuildSettings.getSettingsForScope(guild.id);const hideMutedChannels = settings?.hide_muted_channels ?? false;const handleToggleHideMutedChannels = useCallback(@@ -193,6 +201,33 @@ export const GuildHeaderPopout = observer(({guild}: {guild: Guild}) => {});const leaveGuild = useLeaveGuild();const deleteMyMessagesInGuild = useDeleteMyMessagesInGuild();+ if (guild.visiting) {+ return (+ <div+ className={styles.container}+ ref={listRef}+ role="menu"+ aria-orientation="vertical"+ tabIndex={-1}+ data-autofocus+ data-flx="guild.guild-header-popout.visiting-container"+ >+ <GuildHeaderPopoutItem+ icon={DoorOpenIcon}+ title={i18n._(JOIN_COMMUNITY_DESCRIPTOR)}+ onClick={() => void joinVisitedGuild(guild.id)}+ data-flx="guild.guild-header-popout.guild-header-popout-item.join-visit"+ />+ <GuildHeaderPopoutItem+ danger={true}+ icon={SignOutIcon}+ onClick={() => void leaveVisit(guild.id)}+ title={i18n._(STOP_PREVIEWING_DESCRIPTOR)}+ data-flx="guild.guild-header-popout.guild-header-popout-item.leave-visit"+ />+ </div>+ );+ }return (<divclassName={styles.container}@@ -277,21 +312,23 @@ export const GuildHeaderPopout = observer(({guild}: {guild: Guild}) => {}data-flx="guild.guild-header-popout.guild-header-popout-item.push--5"/>- <GuildHeaderPopoutItem- icon={ShieldIcon}- title={i18n._(PRIVACY_SETTINGS_DESCRIPTOR)}- onClick={() =>- ModalCommands.push(- modal(() => (- <GuildPrivacySettingsModal- guildId={guild.id}- data-flx="guild.guild-header-popout.guild-privacy-settings-modal"- />- )),- )- }- data-flx="guild.guild-header-popout.guild-header-popout-item.push--6"- />+ {!RuntimeConfig.directMessagesDisabled && (+ <GuildHeaderPopoutItem+ icon={ShieldIcon}+ title={i18n._(PRIVACY_SETTINGS_DESCRIPTOR)}+ onClick={() =>+ ModalCommands.push(+ modal(() => (+ <GuildPrivacySettingsModal+ guildId={guild.id}+ data-flx="guild.guild-header-popout.guild-privacy-settings-modal"+ />+ )),+ )+ }+ data-flx="guild.guild-header-popout.guild-header-popout-item.push--6"+ />+ )}{canEditCommunityProfile && (<GuildHeaderPopoutItemicon={UserCircleIcon}diff --git a/fluxer_app/src/features/member/state/MemberSidebar.ts b/fluxer_app/src/features/member/state/MemberSidebar.tsindex e6cf0967f..e94d231cb 100644--- a/fluxer_app/src/features/member/state/MemberSidebar.ts+++ b/fluxer_app/src/features/member/state/MemberSidebar.ts@@ -997,6 +997,9 @@ class MemberSidebar {ranges: Array<[number, number]>,forceResend = false,): boolean {+ if (Guilds.getGuild(guildId)?.visiting === true) {+ return false;+ }const normalizedRanges = normalizeMemberListRanges(ranges);const storageKey = this.resolveStorageKey(guildId, channelId);const socket = GatewaySessions.foregroundConnection.socket;diff --git a/fluxer_app/src/features/permissions/utils/PermissionUtils.ts b/fluxer_app/src/features/permissions/utils/PermissionUtils.tsindex 5da64d1dc..a4ea95f7f 100644--- a/fluxer_app/src/features/permissions/utils/PermissionUtils.ts+++ b/fluxer_app/src/features/permissions/utils/PermissionUtils.ts@@ -19,6 +19,7 @@ import {Permissions,} from '@fluxer/constants/src/ChannelConstants';import {GuildMFALevel} from '@fluxer/constants/src/GuildConstants';+import {GUILD_VISITOR_PERMISSIONS_MASK} from '@fluxer/constants/src/GuildVisitConstants';import {THREAD_ONLY_CHANNEL_TYPES} from '@fluxer/constants/src/ThreadConstants';import {ThreadPermissionFlags} from '@fluxer/constants/src/ThreadPermissionUtils';import type {RoleId, UserId} from '@fluxer/schema/src/branded/WireIds';@@ -125,10 +126,21 @@ export function computePermissions(if (guild == null) {return NONE;}+ roles = roles != null && guildRoles ? {...guildRoles, ...roles} : (guildRoles ?? roles ?? {});+ if (userId === Authentication.currentUserId && Guilds.getGuild(guild.id)?.visiting === true) {+ const everyone = roles?.[guild.id as keyof typeof roles];+ let visitorPermissions =+ (everyone != null ? everyone.permissions : DEFAULT_PERMISSIONS) & ~Permissions.ADMINISTRATOR;+ const overwriteEveryone = overwrites?.[guild.id];+ if (overwriteEveryone != null) {+ visitorPermissions &= ~overwriteEveryone.deny;+ visitorPermissions |= overwriteEveryone.allow;+ }+ return visitorPermissions & GUILD_VISITOR_PERMISSIONS_MASK;+ }if (guild.owner_id === userId) {return calculateElevatedPermissions(ALL_PERMISSIONS, guild, userId, checkElevated);}- roles = roles != null && guildRoles ? {...guildRoles, ...roles} : (guildRoles ?? roles ?? {});const member = GuildMembers.getMember(guild.id, userId);const roleEveryone = roles?.[guild.id as keyof typeof roles];let permissions = roleEveryone != null ? roleEveryone.permissions : DEFAULT_PERMISSIONS;@@ -477,7 +489,7 @@ export function generatePermissionSpec(i18n: I18n, {threads = false}: {threads?:];}-export type PermissionKey = keyof typeof Permissions | keyof typeof ThreadPermissionFlags;+type PermissionKey = keyof typeof Permissions | keyof typeof ThreadPermissionFlags;export interface BotPermissionOption {id: PermissionKey;diff --git a/fluxer_app/src/features/presence/state/MemberPresenceSubscription.ts b/fluxer_app/src/features/presence/state/MemberPresenceSubscription.tsindex 57518bab5..d1f378b14 100644--- a/fluxer_app/src/features/presence/state/MemberPresenceSubscription.ts+++ b/fluxer_app/src/features/presence/state/MemberPresenceSubscription.ts@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport GatewaySessions from '@app/features/gateway/transport/GatewaySessionPool';+import Guilds from '@app/features/guild/state/Guilds';import {AccountScopedWork} from '@app/features/platform/state/AccountScopedWork';import {makeAutoObservable, runInAction} from 'mobx';@@ -196,7 +197,7 @@ class MemberPresenceSubscription {private syncToGatewayImmediate(guildId: string): void {const socket = GatewaySessions.foregroundConnection.socket;- if (!socket) {+ if (!socket || Guilds.getGuild(guildId)?.visiting === true) {return;}const guildSubs = this.subscriptions.get(guildId);diff --git a/fluxer_app/src/features/ui/action_menu/ChannelContextMenu.tsx b/fluxer_app/src/features/ui/action_menu/ChannelContextMenu.tsxindex 65ea89a14..b18621f1a 100644--- a/fluxer_app/src/features/ui/action_menu/ChannelContextMenu.tsx+++ b/fluxer_app/src/features/ui/action_menu/ChannelContextMenu.tsx@@ -34,7 +34,8 @@ export const ChannelContextMenu: React.FC<ChannelContextMenuProps> = observer(({() => [i18n._(MUTE_CHANNEL_DESCRIPTOR), i18n._(UNMUTE_CHANNEL_DESCRIPTOR)],[i18n.locale],);- const showMuteMenuItem = GUILD_TEXT_BASED_CHANNEL_TYPES.has(channel.type) || channel.isThreadOnly();+ const showMuteMenuItem =+ guild?.visiting !== true && (GUILD_TEXT_BASED_CHANNEL_TYPES.has(channel.type) || channel.isThreadOnly());const notificationSettingsLabel = i18n._(NOTIFICATION_SETTINGS_DESCRIPTOR);const splitGroups = useMemo<{beforeBehavior: Array<MenuGroupType>;diff --git a/fluxer_app/src/features/ui/action_menu/GuildContextMenu.tsx b/fluxer_app/src/features/ui/action_menu/GuildContextMenu.tsxindex beffb22b8..96b0ae392 100644--- a/fluxer_app/src/features/ui/action_menu/GuildContextMenu.tsx+++ b/fluxer_app/src/features/ui/action_menu/GuildContextMenu.tsx@@ -36,13 +36,15 @@ export const GuildContextMenu: React.FC<GuildContextMenuProps> = observer(({guilexcludeLabels={excludeLabels}data-flx="ui.action-menu.guild-context-menu.data-menu-renderer"/>- <MenuGroup data-flx="ui.action-menu.guild-context-menu.menu-group">- <MuteCommunityMenuItem- guild={guild}- onClose={onClose}- data-flx="ui.action-menu.guild-context-menu.mute-community-menu-item"- />- </MenuGroup>+ {guild.visiting ? null : (+ <MenuGroup data-flx="ui.action-menu.guild-context-menu.menu-group">+ <MuteCommunityMenuItem+ guild={guild}+ onClose={onClose}+ data-flx="ui.action-menu.guild-context-menu.mute-community-menu-item"+ />+ </MenuGroup>+ )}</>);});diff --git a/fluxer_app/src/features/ui/action_menu/items/ChannelMenuData.tsx b/fluxer_app/src/features/ui/action_menu/items/ChannelMenuData.tsxindex c748b70af..9493007a0 100644--- a/fluxer_app/src/features/ui/action_menu/items/ChannelMenuData.tsx+++ b/fluxer_app/src/features/ui/action_menu/items/ChannelMenuData.tsx@@ -458,7 +458,8 @@ export function useChannelMenuData(onClick: handlers.handleMarkAsRead,});}- if (Accessibility.showFavorites && !channel.isThread() && !channel.isThreadOnly()) {+ const previewing = guild?.visiting === true;+ if (Accessibility.showFavorites && !previewing && !channel.isThread() && !channel.isThreadOnly()) {metaItems.push({icon: (<FavoriteIcon@@ -519,7 +520,7 @@ export function useChannelMenuData(});menuGroups.push({items: inviteItems});const notificationItems: Array<MenuItemType> = [];- if (!state.isLinkChannel) {+ if (!state.isLinkChannel && !previewing) {notificationItems.push({icon: state.isMuted ? (<MuteIcon size={20} data-flx="ui.action-menu.items.channel-menu-data.groups.mute-icon" />@@ -533,17 +534,19 @@ export function useChannelMenuData(onClick: handlers.handleOpenMuteSheet,});}- notificationItems.push({- icon: (- <NotificationSettingsIcon- size={20}- data-flx="ui.action-menu.items.channel-menu-data.groups.notification-settings-icon--2"- />- ),- label: i18n._(NOTIFICATION_SETTINGS_DESCRIPTOR),- onClick: handlers.handleNotificationSettings,- });- menuGroups.push({items: notificationItems});+ if (!previewing) {+ notificationItems.push({+ icon: (+ <NotificationSettingsIcon+ size={20}+ data-flx="ui.action-menu.items.channel-menu-data.groups.notification-settings-icon--2"+ />+ ),+ label: i18n._(NOTIFICATION_SETTINGS_DESCRIPTOR),+ onClick: handlers.handleNotificationSettings,+ });+ }+ if (notificationItems.length > 0) menuGroups.push({items: notificationItems});if (channel.isThreadOnly()) {menuGroups.push({items: [diff --git a/fluxer_app/src/features/ui/action_menu/items/GuildMenuData.tsx b/fluxer_app/src/features/ui/action_menu/items/GuildMenuData.tsxindex 0fb38c725..fff9ffe09 100644--- a/fluxer_app/src/features/ui/action_menu/items/GuildMenuData.tsx+++ b/fluxer_app/src/features/ui/action_menu/items/GuildMenuData.tsx@@ -11,8 +11,13 @@ import {DELETE_MY_MESSAGES_DESCRIPTOR} from '@app/features/channel/utils/Channelimport {COMMUNITY_RECORD_DESCRIPTOR, RecordDebugModal} from '@app/features/devtools/components/debug/RecordDebugModal';import {hasForumUnread} from '@app/features/forum/state/ForumReadState';+import {joinVisitedGuild, leaveVisit} from '@app/features/guild/commands/GuildVisitCommands';import {GuildNotificationSettingsModal} from '@app/features/guild/components/modals/GuildNotificationSettingsModal';import {GuildPrivacySettingsModal} from '@app/features/guild/components/modals/GuildPrivacySettingsModal';+import {+ JOIN_COMMUNITY_DESCRIPTOR,+ STOP_PREVIEWING_DESCRIPTOR,+} from '@app/features/guild/components/visits/GuildPreviewNagbar';import {useDeleteMyMessagesInGuild} from '@app/features/guild/hooks/useDeleteMyMessagesInGuild';import {useLeaveGuild} from '@app/features/guild/hooks/useLeaveGuild';import type {Guild} from '@app/features/guild/models/Guild';@@ -70,6 +75,7 @@ import {import UserGuildSettings from '@app/features/user/state/UserGuildSettings';import UserSettings from '@app/features/user/state/UserSettings';import Users from '@app/features/user/state/Users';+import {canOpenProfileEditor} from '@app/features/user/utils/ProfileEditAccess';import {getMutedText} from '@app/lib/overlay/OverlayContextMenu';import {Permissions} from '@fluxer/constants/src/ChannelConstants';import {ContentWarningLevel} from '@fluxer/constants/src/GuildConstants';@@ -132,7 +138,8 @@ export function useGuildMenuData(guild: Guild, options: UseGuildMenuDataOptions)canBanMembers;const isOwner = guild.isOwner(Authentication.currentUserId);const developerMode = UserSettings.developerMode;- const canEditCommunityProfile = Users.getCurrentUser()?.isClaimed() ?? true;+ const canEditCommunityProfile = canOpenProfileEditor(Users.getCurrentUser());+ const directMessagesDisabled = RuntimeConfig.directMessagesDisabled;const settings = UserGuildSettings.getSettingsForScope(guild.id);const hideMutedChannels = settings?.hide_muted_channels ?? false;const isMuted = settings?.muted ?? false;@@ -305,6 +312,30 @@ export function useGuildMenuData(guild: Guild, options: UseGuildMenuDataOptions)});}, [discoveryEnabled, guild.features, guild.id, i18n.locale]);const groups = useMemo(() => {+ if (guild.visiting) {+ return [+ {+ items: [+ {+ label: i18n._(JOIN_COMMUNITY_DESCRIPTOR),+ onClick: () => {+ onClose();+ void joinVisitedGuild(guild.id);+ },+ },+ {+ icon: <LeaveIcon size={20} data-flx="ui.action-menu.items.guild-menu-data.groups.leave-visit-icon" />,+ label: i18n._(STOP_PREVIEWING_DESCRIPTOR),+ onClick: () => {+ onClose();+ void leaveVisit(guild.id);+ },+ danger: true,+ },+ ],+ },+ ];+ }const menuGroups: Array<MenuGroupType> = [];const quickActions: Array<MenuItemType | MenuSubmenuItemType> = [];if (hasGuildUnread) {@@ -384,14 +415,16 @@ export function useGuildMenuData(guild: Guild, options: UseGuildMenuDataOptions)label: i18n._(NOTIFICATION_SETTINGS_DESCRIPTOR),onClick: handlers.handleNotificationSettings,},- {+ ];+ if (!directMessagesDisabled) {+ settingsItems.push({icon: (<PrivacySettingsIcon size={20} data-flx="ui.action-menu.items.guild-menu-data.groups.privacy-settings-icon" />),label: i18n._(PRIVACY_SETTINGS_DESCRIPTOR),onClick: handlers.handlePrivacySettings,- },- ];+ });+ }if (canEditCommunityProfile) {settingsItems.push({icon: <EditProfileIcon size={20} data-flx="ui.action-menu.items.guild-menu-data.groups.edit-profile-icon" />,@@ -468,8 +501,10 @@ export function useGuildMenuData(guild: Guild, options: UseGuildMenuDataOptions)canAccessGuildSettings,canManageChannels,canEditCommunityProfile,+ directMessagesDisabled,availableSettingsTabs,guild.id,+ guild.visiting,isMuted,hideMutedChannels,hasCurrentGuildMatureContentGate,