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
Этот коммит содержится в:
Harrison Healey
2016-07-06 13:52:28 -04:00
коммит произвёл Joram Wilander
родитель fd880ad047
Коммит 1a3f952c56
6 изменённых файлов: 75 добавлений и 69 удалений

Просмотреть файл

@@ -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;
}