-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
130 additions
and
57 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import type { IUser } from '@rocket.chat/core-typings'; | ||
|
||
import { Users } from '../../../models/client'; | ||
import { settings } from '../../../settings/client'; | ||
|
||
/** | ||
* Get a user preference | ||
* @param user The user ID | ||
* @param key The preference name | ||
* @returns The preference value | ||
*/ | ||
export function getUserPreference<TValue>(user: IUser['_id'] | null | undefined, key: string): TValue | undefined; | ||
/** | ||
* Get a user preference | ||
* @param user The user | ||
* @param key The preference name | ||
* @returns The preference value | ||
*/ | ||
export function getUserPreference<TValue>(user: Pick<IUser, '_id' | 'settings'> | null | undefined, key: string): TValue | undefined; | ||
/** | ||
* Get a user preference | ||
* @param user The user ID | ||
* @param key The preference name | ||
* @param defaultValue The default value | ||
* @returns The preference value or the default value | ||
*/ | ||
export function getUserPreference<TValue>(user: IUser['_id'] | null | undefined, key: string, defaultValue: TValue): TValue; | ||
/** | ||
* Get a user preference | ||
* @param user The user | ||
* @param key The preference name | ||
* @param defaultValue The default value | ||
* @returns The preference value or the default value | ||
*/ | ||
export function getUserPreference<TValue>( | ||
user: Pick<IUser, '_id' | 'settings'> | null | undefined, | ||
key: string, | ||
defaultValue: TValue, | ||
): TValue; | ||
export function getUserPreference<TValue>( | ||
userIdOrUser: IUser['_id'] | Pick<IUser, '_id' | 'settings'> | null | undefined, | ||
key: string, | ||
defaultValue?: TValue, | ||
): TValue { | ||
const user = | ||
typeof userIdOrUser === 'string' ? Users.findOne(userIdOrUser, { fields: { [`settings.preferences.${key}`]: 1 } }) : userIdOrUser; | ||
return user?.settings?.preferences[key] ?? defaultValue ?? settings.get(`Accounts_Default_User_ Preferences_${key}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import type { ICustomEmojiDescriptor } from '@rocket.chat/core-typings'; | ||
import { Meteor } from 'meteor/meteor'; | ||
|
||
import { deleteEmojiCustom } from '../../app/emoji-custom/client/lib/emojiCustom'; | ||
import { Notifications } from '../../app/notifications/client'; | ||
|
||
Meteor.startup(() => Notifications.onLogged('deleteEmojiCustom', (data: { emojiData: any }) => deleteEmojiCustom(data.emojiData))); | ||
Meteor.startup(() => | ||
Notifications.onLogged('deleteEmojiCustom', (data: { emojiData: ICustomEmojiDescriptor }) => deleteEmojiCustom(data.emojiData)), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.