Files
upstream-rocketchat/apps/meteor/client/views/account/preferences/useAccountPreferencesValues.ts
upstream-mirror 30810eecd7
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 2s
snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:21:02 +05:00

116 lines
4.5 KiB
TypeScript

import { useUserPreference } from '@rocket.chat/ui-contexts';
export type AccountPreferencesData = {
language?: string;
dontAskAgainList?: string[];
enableAutoAway?: boolean;
idleTimeLimit?: number;
desktopNotificationRequireInteraction?: boolean;
desktopNotifications?: string;
pushNotifications?: string;
emailNotificationMode?: string;
receiveLoginDetectionEmail?: boolean;
notifyCalendarEvents?: boolean;
enableMobileRinging?: boolean;
unreadAlert?: boolean;
showThreadsInMainChannel?: boolean;
alsoSendThreadToChannel?: 'default' | 'always' | 'never';
useEmojis?: boolean;
convertAsciiEmoji?: boolean;
autoImageLoad?: boolean;
saveMobileBandwidth?: boolean;
collapseMediaByDefault?: boolean;
hideFlexTab?: boolean;
sendOnEnter?: 'normal' | 'alternative' | 'desktop';
highlights?: string;
newRoomNotification?: string;
newMessageNotification?: string;
muteFocusedConversations?: boolean;
enableNewMessageTemplate?: boolean;
displayAvatars?: boolean;
sidebarShowFavorites?: boolean;
sidebarShowUnread?: boolean;
sidebarSortby?: string;
sidebarViewMode?: string;
sidebarDisplayAvatar?: boolean;
sidebarGroupByType?: boolean;
masterVolume?: number;
notificationsSoundVolume?: number;
voipRingerVolume?: number;
desktopNotificationVoiceCalls?: boolean;
};
export const useAccountPreferencesValues = (): AccountPreferencesData => {
const language = useUserPreference<string>('language') || '';
const userDontAskAgainList = useUserPreference<{ action: string; label: string }[]>('dontAskAgainList') || [];
const dontAskAgainList = userDontAskAgainList.map(({ action }) => action);
const enableAutoAway = useUserPreference<boolean>('enableAutoAway');
const idleTimeLimit = useUserPreference<number>('idleTimeLimit');
const desktopNotificationRequireInteraction = useUserPreference<boolean>('desktopNotificationRequireInteraction');
const desktopNotifications = useUserPreference<string>('desktopNotifications');
const pushNotifications = useUserPreference<string>('pushNotifications');
const emailNotificationMode = useUserPreference<string>('emailNotificationMode');
const receiveLoginDetectionEmail = useUserPreference<boolean>('receiveLoginDetectionEmail', true);
const notifyCalendarEvents = useUserPreference<boolean>('notifyCalendarEvents');
const enableMobileRinging = useUserPreference<boolean>('enableMobileRinging');
const unreadAlert = useUserPreference<boolean>('unreadAlert');
const showThreadsInMainChannel = useUserPreference<boolean>('showThreadsInMainChannel');
const alsoSendThreadToChannel = useUserPreference<'default' | 'always' | 'never'>('alsoSendThreadToChannel');
const useEmojis = useUserPreference<boolean>('useEmojis');
const convertAsciiEmoji = useUserPreference<boolean>('convertAsciiEmoji');
const autoImageLoad = useUserPreference<boolean>('autoImageLoad');
const saveMobileBandwidth = useUserPreference<boolean>('saveMobileBandwidth');
const collapseMediaByDefault = useUserPreference<boolean>('collapseMediaByDefault');
const hideFlexTab = useUserPreference<boolean>('hideFlexTab');
const sendOnEnter = useUserPreference<'normal' | 'alternative' | 'desktop'>('sendOnEnter');
const displayAvatars = useUserPreference<boolean>('displayAvatars');
const highlights = useUserPreference<string[]>('highlights')?.join(',\n') ?? '';
const newRoomNotification = useUserPreference<string>('newRoomNotification');
const newMessageNotification = useUserPreference<string>('newMessageNotification');
const muteFocusedConversations = useUserPreference<boolean>('muteFocusedConversations');
const masterVolume = useUserPreference<number>('masterVolume', 100);
const notificationsSoundVolume = useUserPreference<number>('notificationsSoundVolume', 100);
const voipRingerVolume = useUserPreference<number>('voipRingerVolume', 100);
const desktopNotificationVoiceCalls = useUserPreference<boolean>('desktopNotificationVoiceCalls');
return {
language,
dontAskAgainList,
enableAutoAway,
idleTimeLimit,
desktopNotificationRequireInteraction,
desktopNotifications,
pushNotifications,
emailNotificationMode,
receiveLoginDetectionEmail,
notifyCalendarEvents,
enableMobileRinging,
unreadAlert,
showThreadsInMainChannel,
alsoSendThreadToChannel,
useEmojis,
convertAsciiEmoji,
autoImageLoad,
saveMobileBandwidth,
collapseMediaByDefault,
hideFlexTab,
sendOnEnter,
displayAvatars,
highlights,
newRoomNotification,
newMessageNotification,
muteFocusedConversations,
masterVolume,
notificationsSoundVolume,
voipRingerVolume,
desktopNotificationVoiceCalls,
};
};