diff options
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r-- | webapp/utils/utils.jsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index ee2c4099f..1b4b504f2 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -1341,3 +1341,29 @@ export function localizeMessage(id, defaultMessage) { export function mod(a, b) { return ((a % b) + b) % b; } + +export function canCreateCustomEmoji(user) { + if (global.window.mm_license.IsLicensed !== 'true') { + return true; + } + + if (isSystemAdmin(user.roles)) { + return true; + } + + // already checked for system admin for both these cases + if (window.mm_config.RestrictCustomEmojiCreation === 'system_admin') { + return false; + } else if (window.mm_config.RestrictCustomEmojiCreation === 'admin') { + // check whether the user is an admin on any of their teams + for (const member of TeamStore.getTeamMembers()) { + if (isAdmin(member.roles)) { + return true; + } + } + + return false; + } + + return true; +}
\ No newline at end of file |