diff options
| author | eugenijm <eugenijm@protonmail.com> | 2019-02-04 18:05:56 +0300 |
|---|---|---|
| committer | eugenijm <eugenijm@protonmail.com> | 2019-02-06 18:07:37 +0300 |
| commit | d00b74b607f5bf77a7c695262d9690c2f5d31023 (patch) | |
| tree | ae967a422049ac6f5d981e6433ee1fce467e72ca /src/components/user_card_content/user_card_content.js | |
| parent | 648f635429da929e7090b103b9c8d354a1d3860a (diff) | |
Refactor visibleRole for better readability
Improve translation
Diffstat (limited to 'src/components/user_card_content/user_card_content.js')
| -rw-r--r-- | src/components/user_card_content/user_card_content.js | 15 |
1 files changed, 3 insertions, 12 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: { |
