diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-07-06 13:52:28 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-07-06 13:52:28 -0400 |
commit | 1a3f952c56ba080b5eb3913ba579680afb98089f (patch) | |
tree | 7981fd83a2da54b7453058879aa78b32ad2dae3c /webapp/utils/utils.jsx | |
parent | fd880ad047d7bb199115c2000a85c0e0ec3aedfa (diff) | |
download | chat-1a3f952c56ba080b5eb3913ba579680afb98089f.tar.gz chat-1a3f952c56ba080b5eb3913ba579680afb98089f.tar.bz2 chat-1a3f952c56ba080b5eb3913ba579680afb98089f.zip |
PLT-3518/PLT-3519 Custom emoji followup (#3507)
* Fixed emoji list filter when full name or nickname are enabled
* Changed custom emoji list to only be visible if the user can create custom emoji
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 |