From d00b74b607f5bf77a7c695262d9690c2f5d31023 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Mon, 4 Feb 2019 18:05:56 +0300 Subject: [PATCH] Refactor visibleRole for better readability Improve translation --- .../user_card_content/user_card_content.js | 15 +++------------ src/i18n/ru.json | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js index 427cb32d..1888f8c6 100644 --- a/src/components/user_card_content/user_card_content.js +++ b/src/components/user_card_content/user_card_content.js @@ -81,19 +81,10 @@ export default { } }, visibleRole () { - const user = this.user + const validRole = (this.user.role === 'admin' || this.user.role === 'moderator') + const showRole = this.isOtherUser || this.user.show_role - if (!(user.role === 'admin' || user.role === 'moderator')) { - return undefined - } - - if (this.isOtherUser) { - return user.role - } - - if (user.show_role) { - return user.role - } + return validRole && showRole && this.user.role } }, components: { diff --git a/src/i18n/ru.json b/src/i18n/ru.json index b5686a5c..4b0bd4b4 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -129,8 +129,8 @@ "no_rich_text_description": "Убрать форматирование из всех постов", "hide_follows_description": "Не показывать кого я читаю", "hide_followers_description": "Не показывать кто читает меня", - "show_admin_badge": "Показывать значок администратора на моей карточке пользователя", - "show_moderator_badge": "Показывать значок модератора на моей карточке пользователя", + "show_admin_badge": "Показывать значок администратора в моем профиле", + "show_moderator_badge": "Показывать значок модератора в моем профиле", "nsfw_clickthrough": "Включить скрытие NSFW вложений", "panelRadius": "Панели", "pause_on_unfocused": "Приостановить загрузку когда вкладка не в фокусе",