From d00b74b607f5bf77a7c695262d9690c2f5d31023 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Mon, 4 Feb 2019 18:05:56 +0300 Subject: Refactor visibleRole for better readability Improve translation --- src/components/user_card_content/user_card_content.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/components/user_card_content/user_card_content.js') 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: { -- cgit v1.2.3-70-g09d2