A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): hide settings for features the instance turns off
Hampus185feed60c37
diff --git a/fluxer_app/src/features/user/components/modals/UserProfileActionsSheet.tsx b/fluxer_app/src/features/user/components/modals/UserProfileActionsSheet.tsxindex 3bfc73e5c..a55e53f85 100644--- a/fluxer_app/src/features/user/components/modals/UserProfileActionsSheet.tsx+++ b/fluxer_app/src/features/user/components/modals/UserProfileActionsSheet.tsx@@ -334,7 +334,7 @@ export const UserProfileActionsSheet: React.FC<UserProfileActionsSheetProps> = o}}if (!isCurrentUser) {- if (relationshipType === RelationshipTypes.FRIEND && !RuntimeConfig.directMessagesDisabled) {+ if (relationshipType === RelationshipTypes.FRIEND && !RuntimeConfig.friendsDisabled) {menuGroups.push({items: [{diff --git a/fluxer_app/src/features/user/components/modals/tabs/LinkedAccountsTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/LinkedAccountsTab.tsxindex 9f16b0018..2c2f9e31b 100644--- a/fluxer_app/src/features/user/components/modals/tabs/LinkedAccountsTab.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/LinkedAccountsTab.tsx@@ -411,10 +411,14 @@ const LinkedAccountsTab: React.FC = observer(() => {Icon={UserListIcon}title={<Trans>No connections yet</Trans>}description={- <Trans>- Link your {BLUESKY_PROVIDER_NAME} account or verify domain ownership to display them on your- profile.- </Trans>+ RuntimeConfig.blueskyConnectionsEnabled ? (+ <Trans>+ Link your {BLUESKY_PROVIDER_NAME} account or verify domain ownership to display them on your+ profile.+ </Trans>+ ) : (+ <Trans>Verify domain ownership to display it on your profile.</Trans>+ )}data-flx="user.linked-accounts-tab.status-slate"/>diff --git a/fluxer_app/src/features/user/components/modals/tabs/accessibility_tab/VisualTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/accessibility_tab/VisualTab.tsxindex 70f4d52f0..a146cc613 100644--- a/fluxer_app/src/features/user/components/modals/tabs/accessibility_tab/VisualTab.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/accessibility_tab/VisualTab.tsx@@ -10,6 +10,7 @@ import type {RadioOption} from '@app/features/ui/radio_group/RadioGroup';import {RadioGroup} from '@app/features/ui/radio_group/RadioGroup';import {formatRoundedPercentage} from '@app/features/ui/utils/PercentageFormatting';import styles from '@app/features/user/components/modals/tabs/accessibility_tab/VisualTab.module.css';+import {shouldShowDirectMessageSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import {DIM_STRIKETHROUGH_TEXT_DESCRIPTOR} from '@app/features/user/components/settings_utils/section_registry/SharedDescriptors';import {ALWAYS_UNDERLINE_LINKS_DESCRIPTOR,@@ -131,18 +132,20 @@ export const VisualTabContent: React.FC = observer(() => {onChange={(value) => AccessibilityCommands.update({dimStrikethroughText: value})}data-flx="user.accessibility-tab.visual-tab.visual-tab-content.switch.update--2"/>- <SettingsTabSection- title={<Trans>DM message previews</Trans>}- data-flx="user.accessibility-tab.visual-tab.visual-tab-content.settings-tab-section--2"- >- <RadioGroup- options={dmMessagePreviewOptions(i18n)}- value={Accessibility.dmMessagePreviewMode}- onChange={(value) => AccessibilityCommands.update({dmMessagePreviewMode: value})}- aria-label={i18n._(DM_MESSAGE_PREVIEW_MODE_DESCRIPTOR)}- data-flx="user.accessibility-tab.visual-tab.visual-tab-content.radio-group.update"- />- </SettingsTabSection>+ {shouldShowDirectMessageSettings() && (+ <SettingsTabSection+ title={<Trans>DM message previews</Trans>}+ data-flx="user.accessibility-tab.visual-tab.visual-tab-content.settings-tab-section--2"+ >+ <RadioGroup+ options={dmMessagePreviewOptions(i18n)}+ value={Accessibility.dmMessagePreviewMode}+ onChange={(value) => AccessibilityCommands.update({dmMessagePreviewMode: value})}+ aria-label={i18n._(DM_MESSAGE_PREVIEW_MODE_DESCRIPTOR)}+ data-flx="user.accessibility-tab.visual-tab.visual-tab-content.radio-group.update"+ />+ </SettingsTabSection>+ )}</>);});diff --git a/fluxer_app/src/features/user/components/modals/tabs/applications_tab/application_detail/BotProfileSection.tsx b/fluxer_app/src/features/user/components/modals/tabs/applications_tab/application_detail/BotProfileSection.tsxindex ca73de173..28c361033 100644--- a/fluxer_app/src/features/user/components/modals/tabs/applications_tab/application_detail/BotProfileSection.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/applications_tab/application_detail/BotProfileSection.tsx@@ -12,6 +12,7 @@ import {SectionCard} from '@app/features/user/components/modals/tabs/applicationimport type {ApplicationDetailForm} from '@app/features/user/components/modals/tabs/applications_tab/application_detail/ApplicationDetailTypes';import {AvatarUploader} from '@app/features/user/components/modals/tabs/my_profile_tab/AvatarUploader';import {BannerUploader} from '@app/features/user/components/modals/tabs/my_profile_tab/BannerUploader';+import {shouldShowFriendSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import {BOT_AVATAR_DESCRIPTOR,BOT_PROFILE_DESCRIPTOR,@@ -246,35 +247,39 @@ export const BotProfileSection: React.FC<BotProfileSectionProps> = ({objectFit="contain"data-flx="user.applications-tab.application-detail.bot-profile-section.image-preview-field"/>- <Controller- name="friendlyBot"- control={form.control}- render={({field}) => (- <Switch- label={i18n._(FRIENDLY_BOT_DESCRIPTOR)}- description={i18n._(ALLOW_USERS_TO_SEND_THIS_BOT_FRIEND_REQUESTS_DESCRIPTOR)}- value={Boolean(field.value)}- onChange={field.onChange}- data-flx="user.applications-tab.application-detail.bot-profile-section.switch.change"+ {shouldShowFriendSettings() && (+ <>+ <Controller+ name="friendlyBot"+ control={form.control}+ render={({field}) => (+ <Switch+ label={i18n._(FRIENDLY_BOT_DESCRIPTOR)}+ description={i18n._(ALLOW_USERS_TO_SEND_THIS_BOT_FRIEND_REQUESTS_DESCRIPTOR)}+ value={Boolean(field.value)}+ onChange={field.onChange}+ data-flx="user.applications-tab.application-detail.bot-profile-section.switch.change"+ />+ )}+ data-flx="user.applications-tab.application-detail.bot-profile-section.controller--3"/>- )}- data-flx="user.applications-tab.application-detail.bot-profile-section.controller--3"- />- <Controller- name="botManualFriendRequestApproval"- control={form.control}- render={({field}) => (- <Switch- label={i18n._(REQUIRE_MANUAL_FRIEND_APPROVAL_DESCRIPTOR)}- description={i18n._(WHEN_ENABLED_YOU_MUST_ACCEPT_FRIEND_REQUESTS_TO_DESCRIPTOR)}- value={Boolean(field.value)}- onChange={field.onChange}- disabled={!friendlyFlagEnabled}- data-flx="user.applications-tab.application-detail.bot-profile-section.switch.change--2"+ <Controller+ name="botManualFriendRequestApproval"+ control={form.control}+ render={({field}) => (+ <Switch+ label={i18n._(REQUIRE_MANUAL_FRIEND_APPROVAL_DESCRIPTOR)}+ description={i18n._(WHEN_ENABLED_YOU_MUST_ACCEPT_FRIEND_REQUESTS_TO_DESCRIPTOR)}+ value={Boolean(field.value)}+ onChange={field.onChange}+ disabled={!friendlyFlagEnabled}+ data-flx="user.applications-tab.application-detail.bot-profile-section.switch.change--2"+ />+ )}+ data-flx="user.applications-tab.application-detail.bot-profile-section.controller--4"/>- )}- data-flx="user.applications-tab.application-detail.bot-profile-section.controller--4"- />+ </>+ )}</div></SectionCard>);diff --git a/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/ConnectionsTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/ConnectionsTab.tsxindex 03fe89e3d..2b502a569 100644--- a/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/ConnectionsTab.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/ConnectionsTab.tsx@@ -15,6 +15,10 @@ import {WarningAlert} from '@app/features/ui/warning_alert/WarningAlert';import * as UserSettingsCommands from '@app/features/user/commands/UserSettingsCommands';import {PrivacySetupModal} from '@app/features/user/components/modals/PrivacySetupModal';import styles from '@app/features/user/components/modals/tabs/privacy_safety_tab/ConnectionsTab.module.css';+import {+ shouldShowDirectMessageSettings,+ shouldShowFriendSettings,+} from '@app/features/user/components/settings_utils/SettingsVisibility';import UserSettings from '@app/features/user/state/UserSettings';import {FriendSourceFlags} from '@fluxer/constants/src/UserConstants';import {msg} from '@lingui/core/macro';@@ -84,11 +88,11 @@ interface DirectMessagesConfirmModalProps {allowMessages: boolean;onApplyToAll: () => Promise<void>;onSkip: () => Promise<void>;- isBotSetting?: boolean;+ senderType: 'members' | 'bots';}const DirectMessagesConfirmModal = observer(- ({allowMessages, onApplyToAll, onSkip, isBotSetting = false}: DirectMessagesConfirmModalProps) => {+ ({allowMessages, onApplyToAll, onSkip, senderType}: DirectMessagesConfirmModalProps) => {const {i18n} = useLingui();const [submitting, setSubmitting] = useState(false);const initialFocusRef = useRef<HTMLButtonElement | null>(null);@@ -110,13 +114,30 @@ const DirectMessagesConfirmModal = observer(setSubmitting(false);}}, [onSkip]);- const title = allowMessages- ? isBotSetting- ? i18n._(ALLOW_BOTS_TO_SEND_YOU_DIRECT_MESSAGES_DESCRIPTOR)- : i18n._(ALLOW_DIRECT_MESSAGES_FROM_COMMUNITY_MEMBERS_DESCRIPTOR)- : isBotSetting- ? i18n._(BLOCK_BOTS_FROM_SENDING_YOU_DIRECT_MESSAGES_DESCRIPTOR)- : i18n._(BLOCK_DIRECT_MESSAGES_FROM_COMMUNITY_MEMBERS_DESCRIPTOR);+ let title: string;+ if (allowMessages) {+ title =+ senderType === 'bots'+ ? i18n._(ALLOW_BOTS_TO_SEND_YOU_DIRECT_MESSAGES_DESCRIPTOR)+ : i18n._(ALLOW_DIRECT_MESSAGES_FROM_COMMUNITY_MEMBERS_DESCRIPTOR);+ } else {+ title =+ senderType === 'bots'+ ? i18n._(BLOCK_BOTS_FROM_SENDING_YOU_DIRECT_MESSAGES_DESCRIPTOR)+ : i18n._(BLOCK_DIRECT_MESSAGES_FROM_COMMUNITY_MEMBERS_DESCRIPTOR);+ }+ let description: string;+ if (allowMessages) {+ description =+ senderType === 'bots'+ ? i18n._(DO_YOU_ALSO_WANT_TO_ALLOW_BOTS_FROM_DESCRIPTOR)+ : i18n._(DO_YOU_ALSO_WANT_TO_ALLOW_DIRECT_MESSAGES_DESCRIPTOR);+ } else {+ description =+ senderType === 'bots'+ ? i18n._(DO_YOU_ALSO_WANT_TO_BLOCK_BOTS_FROM_DESCRIPTOR)+ : i18n._(DO_YOU_ALSO_WANT_TO_BLOCK_DIRECT_MESSAGES_DESCRIPTOR);+ }return (<Modal.Rootsize="small"@@ -131,13 +152,7 @@ const DirectMessagesConfirmModal = observer(<Modal.Content data-flx="user.privacy-safety-tab.connections-tab.direct-messages-confirm-modal.modal-content"><Modal.ContentLayout data-flx="user.privacy-safety-tab.connections-tab.direct-messages-confirm-modal.modal-content-layout"><Modal.Description data-flx="user.privacy-safety-tab.connections-tab.direct-messages-confirm-modal.modal-description">- {allowMessages- ? isBotSetting- ? i18n._(DO_YOU_ALSO_WANT_TO_ALLOW_BOTS_FROM_DESCRIPTOR)- : i18n._(DO_YOU_ALSO_WANT_TO_ALLOW_DIRECT_MESSAGES_DESCRIPTOR)- : isBotSetting- ? i18n._(DO_YOU_ALSO_WANT_TO_BLOCK_BOTS_FROM_DESCRIPTOR)- : i18n._(DO_YOU_ALSO_WANT_TO_BLOCK_DIRECT_MESSAGES_DESCRIPTOR)}+ {description}</Modal.Description><Modal.DescriptionclassName={styles.confirmDescription}@@ -210,6 +225,9 @@ export const ConnectionsTabContent: React.FC = observer(() => {const friendSourceFlags = UserSettings.friendSourceFlags;const defaultGuildsRestricted = UserSettings.defaultGuildsRestricted;const botDefaultGuildsRestricted = UserSettings.botDefaultGuildsRestricted;+ const showFriendRequests = shouldShowFriendSettings();+ const showDirectMessages = shouldShowDirectMessageSettings();+ const titleSubsections = showFriendRequests && showDirectMessages;const everyoneEnabled = (friendSourceFlags & FriendSourceFlags.NO_RELATION) === FriendSourceFlags.NO_RELATION;const hasFriendFlag = (flag: number) => (friendSourceFlags & flag) === flag;const handleFriendRequestToggle = async (flag: number, value: boolean) => {@@ -229,6 +247,7 @@ export const ConnectionsTabContent: React.FC = observer(() => {modal(() => (<DirectMessagesConfirmModalallowMessages={value}+ senderType="members"onApplyToAll={async () => {const guildIds = value ? [] : guilds.map((guild) => guild.id);await UserSettingsCommands.update({defaultGuildsRestricted: !value, restrictedGuilds: guildIds});@@ -252,7 +271,7 @@ export const ConnectionsTabContent: React.FC = observer(() => {modal(() => (<DirectMessagesConfirmModalallowMessages={value}- isBotSetting+ senderType="bots"onApplyToAll={async () => {const guildIds = value ? [] : guilds.map((guild) => guild.id);await UserSettingsCommands.update({@@ -275,66 +294,72 @@ export const ConnectionsTabContent: React.FC = observer(() => {};return (<>- <SettingsTabSection- title={<Trans>Friend requests</Trans>}- description={<Trans>Choose who can send you a friend request.</Trans>}- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.settings-tab-section"- >- <Switch- label={<Trans>Everyone</Trans>}- description={<Trans>Anyone who finds you can send a request. Turn this off to pick groups below.</Trans>}- value={hasFriendFlag(FriendSourceFlags.NO_RELATION)}- onChange={(value) => handleFriendRequestToggle(FriendSourceFlags.NO_RELATION, value)}- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.friend-request-toggle"- />- <Switch- label={i18n._(FRIENDS_OF_FRIENDS_DESCRIPTOR)}- description={<Trans>People who share at least one friend with you.</Trans>}- value={everyoneEnabled || hasFriendFlag(FriendSourceFlags.MUTUAL_FRIENDS)}- onChange={(value) => handleFriendRequestToggle(FriendSourceFlags.MUTUAL_FRIENDS, value)}- disabled={everyoneEnabled}- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.friend-request-toggle--2"- />- <Switch- label={i18n._(COMMUNITY_MEMBERS_DESCRIPTOR)}- description={<Trans>People who share a community with you.</Trans>}- value={everyoneEnabled || hasFriendFlag(FriendSourceFlags.MUTUAL_GUILDS)}- onChange={(value) => handleFriendRequestToggle(FriendSourceFlags.MUTUAL_GUILDS, value)}- disabled={everyoneEnabled}- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.friend-request-toggle--3"- />- </SettingsTabSection>- <PrivacyReviewAlert data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.privacy-review-alert" />- <SettingsTabSection- title={<Trans>Direct messages</Trans>}- description={- <Trans>- Friends can always message you. These settings cover people and bots you only share a community with.- </Trans>- }- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.settings-tab-section--2"- >- <Switch- label={<Trans>Allow direct messages from community members</Trans>}- description={- <Trans>Applies to communities you join from now on. You can also change it for each community.</Trans>- }- value={!defaultGuildsRestricted}- onChange={handleDirectMessagesToggle}- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.direct-messages-toggle"- />- <Switch- label={<Trans>Allow direct messages from community bots</Trans>}- description={- <Trans>- Applies to bots in communities you join from now on. You can also change it for each community.- </Trans>- }- value={!botDefaultGuildsRestricted}- onChange={handleBotDirectMessagesToggle}- data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.bot-direct-messages-toggle"- />- </SettingsTabSection>+ {showFriendRequests && (+ <SettingsTabSection+ title={titleSubsections ? <Trans>Friend requests</Trans> : undefined}+ description={<Trans>Choose who can send you a friend request.</Trans>}+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.settings-tab-section"+ >+ <Switch+ label={<Trans>Everyone</Trans>}+ description={<Trans>Anyone who finds you can send a request. Turn this off to pick groups below.</Trans>}+ value={hasFriendFlag(FriendSourceFlags.NO_RELATION)}+ onChange={(value) => handleFriendRequestToggle(FriendSourceFlags.NO_RELATION, value)}+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.friend-request-toggle"+ />+ <Switch+ label={i18n._(FRIENDS_OF_FRIENDS_DESCRIPTOR)}+ description={<Trans>People who share at least one friend with you.</Trans>}+ value={everyoneEnabled || hasFriendFlag(FriendSourceFlags.MUTUAL_FRIENDS)}+ onChange={(value) => handleFriendRequestToggle(FriendSourceFlags.MUTUAL_FRIENDS, value)}+ disabled={everyoneEnabled}+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.friend-request-toggle--2"+ />+ <Switch+ label={i18n._(COMMUNITY_MEMBERS_DESCRIPTOR)}+ description={<Trans>People who share a community with you.</Trans>}+ value={everyoneEnabled || hasFriendFlag(FriendSourceFlags.MUTUAL_GUILDS)}+ onChange={(value) => handleFriendRequestToggle(FriendSourceFlags.MUTUAL_GUILDS, value)}+ disabled={everyoneEnabled}+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.friend-request-toggle--3"+ />+ </SettingsTabSection>+ )}+ {showDirectMessages && (+ <>+ <PrivacyReviewAlert data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.privacy-review-alert" />+ <SettingsTabSection+ title={titleSubsections ? <Trans>Direct messages</Trans> : undefined}+ description={+ <Trans>+ Friends can always message you. These settings cover people and bots you only share a community with.+ </Trans>+ }+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.settings-tab-section--2"+ >+ <Switch+ label={<Trans>Allow direct messages from community members</Trans>}+ description={+ <Trans>Applies to communities you join from now on. You can also change it for each community.</Trans>+ }+ value={!defaultGuildsRestricted}+ onChange={handleDirectMessagesToggle}+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.direct-messages-toggle"+ />+ <Switch+ label={<Trans>Allow direct messages from community bots</Trans>}+ description={+ <Trans>+ Applies to bots in communities you join from now on. You can also change it for each community.+ </Trans>+ }+ value={!botDefaultGuildsRestricted}+ onChange={handleBotDirectMessagesToggle}+ data-flx="user.privacy-safety-tab.connections-tab.connections-tab-content.switch.bot-direct-messages-toggle"+ />+ </SettingsTabSection>+ </>+ )}</>);});diff --git a/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/PrivacySafetyTabInline.tsx b/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/PrivacySafetyTabInline.tsxindex 8f4bf72b6..a9690a508 100644--- a/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/PrivacySafetyTabInline.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/PrivacySafetyTabInline.tsx@@ -10,6 +10,12 @@ import {DataExportTabContent as DataExportTab} from '@app/features/user/componenimport {ProfilePrivacyTabContent as ProfilePrivacyTab} from '@app/features/user/components/modals/tabs/privacy_safety_tab/ProfilePrivacyTab';import {SensitiveContentTabContent as SensitiveContentTab} from '@app/features/user/components/modals/tabs/privacy_safety_tab/SensitiveContentTab';import styles from '@app/features/user/components/modals/tabs/TabInline.module.css';+import {+ shouldShowDirectMessageSettings,+ shouldShowFriendSettings,+ shouldShowFriendsAndDirectMessageSettings,+} from '@app/features/user/components/settings_utils/SettingsVisibility';+import {getFriendsAndDirectMessagesSectionLabel} from '@app/features/user/components/settings_utils/section_registry/PrivacySafetySections';import {useUserSettingsMutationController} from '@app/features/user/hooks/useUserSettingsMutationController';import {ACTIVITY_SHARING_DESCRIPTOR,@@ -21,11 +27,6 @@ import {useLingui} from '@lingui/react/macro';import {observer} from 'mobx-react-lite';import type React from 'react';-const FRIENDS_AND_DIRECT_MESSAGES_DESCRIPTOR = msg({- message: 'Friends & direct messages',- comment: 'Privacy dashboard section label for who can send friend requests and direct messages.',-});-const COMMUNICATION_DESCRIPTOR = msg({message: 'Communication',comment: 'Short label in the privacy dashboard. Keep it concise.',@@ -57,33 +58,39 @@ export const PrivacyDashboardContent: React.FC = observer(() => {><ProfilePrivacyTab data-flx="user.privacy-safety-tab.privacy-dashboard-content.profile-privacy-tab" /></SettingsSection>- <SettingsSection- id="connections"- tabType="privacy_safety"- title={i18n._(FRIENDS_AND_DIRECT_MESSAGES_DESCRIPTOR)}- data-flx="user.privacy-safety-tab.privacy-dashboard-content.connections"- >- <ConnectionsTab data-flx="user.privacy-safety-tab.privacy-dashboard-content.connections-tab" />- </SettingsSection>- <SettingsSection- id="communication"- tabType="privacy_safety"- title={i18n._(COMMUNICATION_DESCRIPTOR)}- data-flx="user.privacy-safety-tab.privacy-dashboard-content.communication"- >- <CommunicationTab- mutationController={mutationController}- data-flx="user.privacy-safety-tab.privacy-dashboard-content.communication-tab"- />- </SettingsSection>- <SettingsSection- id="active-now"- tabType="privacy_safety"- title={i18n._(ACTIVITY_SHARING_DESCRIPTOR)}- data-flx="user.privacy-safety-tab.privacy-dashboard-content.active-now"- >- <ActiveNowTab data-flx="user.privacy-safety-tab.privacy-dashboard-content.active-now-tab" />- </SettingsSection>+ {shouldShowFriendsAndDirectMessageSettings() && (+ <SettingsSection+ id="connections"+ tabType="privacy_safety"+ title={i18n._(getFriendsAndDirectMessagesSectionLabel())}+ data-flx="user.privacy-safety-tab.privacy-dashboard-content.connections"+ >+ <ConnectionsTab data-flx="user.privacy-safety-tab.privacy-dashboard-content.connections-tab" />+ </SettingsSection>+ )}+ {shouldShowDirectMessageSettings() && (+ <SettingsSection+ id="communication"+ tabType="privacy_safety"+ title={i18n._(COMMUNICATION_DESCRIPTOR)}+ data-flx="user.privacy-safety-tab.privacy-dashboard-content.communication"+ >+ <CommunicationTab+ mutationController={mutationController}+ data-flx="user.privacy-safety-tab.privacy-dashboard-content.communication-tab"+ />+ </SettingsSection>+ )}+ {shouldShowFriendSettings() && (+ <SettingsSection+ id="active-now"+ tabType="privacy_safety"+ title={i18n._(ACTIVITY_SHARING_DESCRIPTOR)}+ data-flx="user.privacy-safety-tab.privacy-dashboard-content.active-now"+ >+ <ActiveNowTab data-flx="user.privacy-safety-tab.privacy-dashboard-content.active-now-tab" />+ </SettingsSection>+ )}<SettingsSectionid="sensitive-content"tabType="privacy_safety"diff --git a/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/SensitiveContentTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/SensitiveContentTab.tsxindex 1a2660670..107f1bf91 100644--- a/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/SensitiveContentTab.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/privacy_safety_tab/SensitiveContentTab.tsx@@ -6,6 +6,7 @@ import FocusRing from '@app/features/ui/focus_ring/FocusRing';import {getNextTabIndex, getTabNavigationDirection} from '@app/features/ui/tabs/TabKeyboardNavigation';import * as UserSettingsCommands from '@app/features/user/commands/UserSettingsCommands';import styles from '@app/features/user/components/modals/tabs/privacy_safety_tab/SensitiveContentTab.module.css';+import {shouldShowDirectMessageSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import UserSettings from '@app/features/user/state/UserSettings';import Users from '@app/features/user/state/Users';import {SensitiveMediaFilterLevel} from '@fluxer/constants/src/UserConstants';@@ -272,24 +273,28 @@ export const SensitiveContentTabContent: React.FC = observer(() => {className={styles.rows}data-flx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.rows">- <SensitiveContentChoiceRow- label={i18n._(DIRECT_MESSAGES_FROM_FRIENDS_DESCRIPTOR)}- description={i18n._(FRIENDS_DESCRIPTION_DESCRIPTOR)}- value={friendDmFilter}- options={isMatureContentAllowed ? filterOptions : teenDmOptions}- onChange={setFriendDmFilter}- dataFlx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.select.set-friend-dm-filter"- data-flx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.sensitive-content-choice-row.set-friend-dm-filter"- />- <SensitiveContentChoiceRow- label={i18n._(DIRECT_MESSAGES_FROM_OTHERS_DESCRIPTOR)}- description={i18n._(OTHERS_DESCRIPTION_DESCRIPTOR)}- value={nonFriendDmFilter}- options={isMatureContentAllowed ? filterOptions : teenDmOptions}- onChange={setNonFriendDmFilter}- dataFlx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.select.set-non-friend-dm-filter"- data-flx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.sensitive-content-choice-row.set-non-friend-dm-filter"- />+ {shouldShowDirectMessageSettings() && (+ <>+ <SensitiveContentChoiceRow+ label={i18n._(DIRECT_MESSAGES_FROM_FRIENDS_DESCRIPTOR)}+ description={i18n._(FRIENDS_DESCRIPTION_DESCRIPTOR)}+ value={friendDmFilter}+ options={isMatureContentAllowed ? filterOptions : teenDmOptions}+ onChange={setFriendDmFilter}+ dataFlx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.select.set-friend-dm-filter"+ data-flx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.sensitive-content-choice-row.set-friend-dm-filter"+ />+ <SensitiveContentChoiceRow+ label={i18n._(DIRECT_MESSAGES_FROM_OTHERS_DESCRIPTOR)}+ description={i18n._(OTHERS_DESCRIPTION_DESCRIPTOR)}+ value={nonFriendDmFilter}+ options={isMatureContentAllowed ? filterOptions : teenDmOptions}+ onChange={setNonFriendDmFilter}+ dataFlx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.select.set-non-friend-dm-filter"+ data-flx="user.privacy-safety-tab.sensitive-content-tab.sensitive-content-tab-content.sensitive-content-choice-row.set-non-friend-dm-filter"+ />+ </>+ )}<SensitiveContentChoiceRowlabel={i18n._(MESSAGES_IN_COMMUNITY_CHANNELS_DESCRIPTOR)}description={i18n._(COMMUNITY_DESCRIPTION_DESCRIPTOR)}diff --git a/fluxer_app/src/features/user/components/settings_utils/search_index/SearchIndexHelpers.ts b/fluxer_app/src/features/user/components/settings_utils/SettingsVisibility.tssimilarity index 61%rename from fluxer_app/src/features/user/components/settings_utils/search_index/SearchIndexHelpers.tsrename to fluxer_app/src/features/user/components/settings_utils/SettingsVisibility.tsindex ef8460dea..60a3d13d7 100644--- a/fluxer_app/src/features/user/components/settings_utils/search_index/SearchIndexHelpers.ts+++ b/fluxer_app/src/features/user/components/settings_utils/SettingsVisibility.ts@@ -14,3 +14,15 @@ export function shouldShowEmailAccountSettings(): boolean {export function shouldShowRecoveryKitSettings(): boolean {return RuntimeConfig.usesUsernameSignIn && shouldShowClaimedAccountSettings();}++export function shouldShowFriendSettings(): boolean {+ return !RuntimeConfig.friendsDisabled;+}++export function shouldShowDirectMessageSettings(): boolean {+ return !RuntimeConfig.directMessagesDisabled;+}++export function shouldShowFriendsAndDirectMessageSettings(): boolean {+ return shouldShowFriendSettings() || shouldShowDirectMessageSettings();+}diff --git a/fluxer_app/src/features/user/components/settings_utils/search_index/AccessibilityIndex.ts b/fluxer_app/src/features/user/components/settings_utils/search_index/AccessibilityIndex.tsindex c0f1b64bd..93907e065 100644--- a/fluxer_app/src/features/user/components/settings_utils/search_index/AccessibilityIndex.ts+++ b/fluxer_app/src/features/user/components/settings_utils/search_index/AccessibilityIndex.ts@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport {getElectronAPI, isDesktop} from '@app/features/ui/utils/NativeUtils';+import {shouldShowDirectMessageSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import type {SearchableSettingDescriptor} from '@app/features/user/components/settings_utils/search_index/SearchIndexTypes';import {ANIMATIONS_DESCRIPTOR,@@ -322,6 +323,7 @@ export const accessibilityIndex: Array<SearchableSettingDescriptor> = [id: 'accessibility-dm-message-previews',tabType: 'accessibility',sectionId: 'visual',+ isVisible: shouldShowDirectMessageSettings,label: DM_MESSAGE_PREVIEWS_DESCRIPTOR,keywords: [DIRECT_MESSAGE_PREVIEW_DESCRIPTOR,diff --git a/fluxer_app/src/features/user/components/settings_utils/search_index/AccountSecurityIndex.ts b/fluxer_app/src/features/user/components/settings_utils/search_index/AccountSecurityIndex.tsindex bddf0be8d..97297bb2d 100644--- a/fluxer_app/src/features/user/components/settings_utils/search_index/AccountSecurityIndex.ts+++ b/fluxer_app/src/features/user/components/settings_utils/search_index/AccountSecurityIndex.ts@@ -11,7 +11,7 @@ import {shouldShowClaimedAccountSettings,shouldShowEmailAccountSettings,shouldShowRecoveryKitSettings,-} from '@app/features/user/components/settings_utils/search_index/SearchIndexHelpers';+} from '@app/features/user/components/settings_utils/SettingsVisibility';import type {SearchableSettingDescriptor} from '@app/features/user/components/settings_utils/search_index/SearchIndexTypes';import {ADDRESS_DESCRIPTOR,diff --git a/fluxer_app/src/features/user/components/settings_utils/search_index/LinkedAccountsIndex.ts b/fluxer_app/src/features/user/components/settings_utils/search_index/LinkedAccountsIndex.tsindex e486aaee0..097f08405 100644--- a/fluxer_app/src/features/user/components/settings_utils/search_index/LinkedAccountsIndex.ts+++ b/fluxer_app/src/features/user/components/settings_utils/search_index/LinkedAccountsIndex.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport {VERIFY_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';-import {shouldShowClaimedAccountSettings} from '@app/features/user/components/settings_utils/search_index/SearchIndexHelpers';+import {shouldShowClaimedAccountSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import type {SearchableSettingDescriptor} from '@app/features/user/components/settings_utils/search_index/SearchIndexTypes';import {CONNECTIONS_DESCRIPTOR} from '@app/features/user/components/settings_utils/section_registry/SharedDescriptors';import {msg} from '@lingui/core/macro';diff --git a/fluxer_app/src/features/user/components/settings_utils/search_index/MyProfileIndex.ts b/fluxer_app/src/features/user/components/settings_utils/search_index/MyProfileIndex.tsindex 229c1655b..a853249a7 100644--- a/fluxer_app/src/features/user/components/settings_utils/search_index/MyProfileIndex.ts+++ b/fluxer_app/src/features/user/components/settings_utils/search_index/MyProfileIndex.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport {shouldShowPremiumFeatures} from '@app/features/premium/utils/PremiumUtils';-import {shouldShowClaimedAccountSettings} from '@app/features/user/components/settings_utils/search_index/SearchIndexHelpers';+import {shouldShowClaimedAccountSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import type {SearchableSettingDescriptor} from '@app/features/user/components/settings_utils/search_index/SearchIndexTypes';import {BACKGROUND_DESCRIPTOR,diff --git a/fluxer_app/src/features/user/components/settings_utils/section_registry/AccountSecuritySections.ts b/fluxer_app/src/features/user/components/settings_utils/section_registry/AccountSecuritySections.tsindex 7f7f904e9..0c54d69a7 100644--- a/fluxer_app/src/features/user/components/settings_utils/section_registry/AccountSecuritySections.ts+++ b/fluxer_app/src/features/user/components/settings_utils/section_registry/AccountSecuritySections.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport {EMAIL_DESCRIPTOR, PASSWORD_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';-import {shouldShowClaimedAccountSections} from '@app/features/user/components/settings_utils/section_registry/SectionRegistryHelpers';+import {shouldShowClaimedAccountSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import type {SectionDefinition} from '@app/features/user/components/settings_utils/section_registry/SectionRegistryTypes';import {ACCOUNT_DESCRIPTOR,@@ -105,7 +105,7 @@ export const accountSecuritySections = [CHANGE_PASSWORD_DESCRIPTOR,],isAdvanced: false,- isVisible: shouldShowClaimedAccountSections,+ isVisible: shouldShowClaimedAccountSettings,},{id: 'security',@@ -143,7 +143,7 @@ export const accountSecuritySections = [LINKED_DEVICES_DESCRIPTOR,],isAdvanced: false,- isVisible: shouldShowClaimedAccountSections,+ isVisible: shouldShowClaimedAccountSettings,},{id: 'danger_zone',@@ -164,6 +164,6 @@ export const accountSecuritySections = [label: BLOCKED_USERS_DESCRIPTOR,keywords: [BLOCKED_USERS_DESCRIPTOR],isAdvanced: false,- isVisible: shouldShowClaimedAccountSections,+ isVisible: shouldShowClaimedAccountSettings,},] as const satisfies ReadonlyArray<SectionDefinition>;diff --git a/fluxer_app/src/features/user/components/settings_utils/section_registry/PrivacySafetySections.ts b/fluxer_app/src/features/user/components/settings_utils/section_registry/PrivacySafetySections.tsindex de2865913..748a546aa 100644--- a/fluxer_app/src/features/user/components/settings_utils/section_registry/PrivacySafetySections.ts+++ b/fluxer_app/src/features/user/components/settings_utils/section_registry/PrivacySafetySections.ts@@ -8,6 +8,11 @@ import {GROUP_DM_DESCRIPTOR,} from '@app/features/i18n/utils/CommonMessageDescriptors';import {ADD_FRIEND_DESCRIPTOR} from '@app/features/relationship/utils/RelationshipMessageDescriptors';+import {+ shouldShowDirectMessageSettings,+ shouldShowFriendSettings,+ shouldShowFriendsAndDirectMessageSettings,+} from '@app/features/user/components/settings_utils/SettingsVisibility';import type {SectionDefinition} from '@app/features/user/components/settings_utils/section_registry/SectionRegistryTypes';import {ACTIVE_NOW_DESCRIPTOR,@@ -30,6 +35,7 @@ import {PROFILE_PRIVACY_LABEL_DESCRIPTOR as PROFILE_PRIVACY_DESCRIPTOR,SENSITIVE_CONTENT_2_DESCRIPTOR,} from '@app/features/user/utils/UserMessageDescriptors';+import type {MessageDescriptor} from '@lingui/core';import {msg} from '@lingui/core/macro';const FRIEND_REQUESTS_DESCRIPTOR = msg({@@ -242,6 +248,17 @@ const FRIENDS_AND_DIRECT_MESSAGES_DESCRIPTOR = msg({context: 'privacy-settings-section',comment: 'Privacy settings section for who can send friend requests and direct messages.',});+const FRIEND_REQUESTS_SECTION_DESCRIPTOR = msg({+ message: 'Friend requests',+ context: 'privacy-settings-section',+ comment:+ 'Privacy settings section for who can send friend requests, shown when the instance has direct messages turned off.',+});+const DIRECT_MESSAGES_SECTION_DESCRIPTOR = msg({+ message: 'Direct messages',+ context: 'privacy-settings-section',+ comment: 'Privacy settings section for who can send direct messages, shown when the instance has friends turned off.',+});const COMMUNICATION_DESCRIPTOR = msg({message: 'Communication',context: 'privacy-settings-section',@@ -268,6 +285,34 @@ const CHOOSE_WHAT_FRIENDS_SEE_ON_THEIR_ACTIVE_NOW_PANEL_DESCRIPTOR = msg({comment: 'Settings section description. One-line summary of what the settings section controls.',});+const FRIEND_REQUEST_KEYWORDS = [+ FRIEND_REQUESTS_DESCRIPTOR,+ FRIEND_REQUEST_DESCRIPTOR,+ WHO_CAN_FRIEND_DESCRIPTOR,+ FRIENDS_DESCRIPTOR,+ ADD_FRIEND_DESCRIPTOR,+ FRIENDS_OF_FRIENDS_DESCRIPTOR,+ MUTUAL_FRIENDS_DESCRIPTOR,+ COMMUNITY_MEMBERS_DESCRIPTOR,+ MUTUAL_GUILDS_DESCRIPTOR,+];++const DIRECT_MESSAGE_KEYWORDS = [+ DIRECT_MESSAGES_DESCRIPTOR,+ DM_DESCRIPTOR,+ DM_PERMISSIONS_DESCRIPTOR,+ WHO_CAN_DM_DESCRIPTOR,+ BOT_DM_DESCRIPTOR,+ COMMUNITY_DM_DESCRIPTOR,+ INCOMING_DM_DESCRIPTOR,+];++export function getFriendsAndDirectMessagesSectionLabel(): MessageDescriptor {+ if (!shouldShowDirectMessageSettings()) return FRIEND_REQUESTS_SECTION_DESCRIPTOR;+ if (!shouldShowFriendSettings()) return DIRECT_MESSAGES_SECTION_DESCRIPTOR;+ return FRIENDS_AND_DIRECT_MESSAGES_DESCRIPTOR;+}+export const privacySafetySections = [{id: 'profile-privacy',@@ -288,26 +333,17 @@ export const privacySafetySections = [{id: 'connections',tabType: 'privacy_safety',- label: FRIENDS_AND_DIRECT_MESSAGES_DESCRIPTOR,- keywords: [- FRIEND_REQUESTS_DESCRIPTOR,- FRIEND_REQUEST_DESCRIPTOR,- WHO_CAN_FRIEND_DESCRIPTOR,- FRIENDS_DESCRIPTOR,- ADD_FRIEND_DESCRIPTOR,- FRIENDS_OF_FRIENDS_DESCRIPTOR,- MUTUAL_FRIENDS_DESCRIPTOR,- COMMUNITY_MEMBERS_DESCRIPTOR,- MUTUAL_GUILDS_DESCRIPTOR,- DIRECT_MESSAGES_DESCRIPTOR,- DM_DESCRIPTOR,- DM_PERMISSIONS_DESCRIPTOR,- WHO_CAN_DM_DESCRIPTOR,- BOT_DM_DESCRIPTOR,- COMMUNITY_DM_DESCRIPTOR,- INCOMING_DM_DESCRIPTOR,- ],+ get label() {+ return getFriendsAndDirectMessagesSectionLabel();+ },+ get keywords() {+ return [+ ...(shouldShowFriendSettings() ? FRIEND_REQUEST_KEYWORDS : []),+ ...(shouldShowDirectMessageSettings() ? DIRECT_MESSAGE_KEYWORDS : []),+ ];+ },isAdvanced: false,+ isVisible: shouldShowFriendsAndDirectMessageSettings,},{id: 'communication',@@ -347,6 +383,7 @@ export const privacySafetySections = [COMMUNITY_MEMBERS_DESCRIPTOR,],isAdvanced: false,+ isVisible: shouldShowDirectMessageSettings,},{id: 'active-now',@@ -361,6 +398,7 @@ export const privacySafetySections = [PRIVACY_DESCRIPTOR,],isAdvanced: false,+ isVisible: shouldShowFriendSettings,},{id: 'sensitive-content',diff --git a/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryHelpers.ts b/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryHelpers.tsdeleted file mode 100644index 733542628..000000000--- a/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryHelpers.ts+++ /dev/null@@ -1,7 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import Users from '@app/features/user/state/Users';--export function shouldShowClaimedAccountSections(): boolean {- return Users.getCurrentUser()?.isClaimed() ?? true;-}