Allow to configure visibility for admin and moderator badges
This commit is contained in:
parent
c714eb2600
commit
648f635429
8 changed files with 35 additions and 6 deletions
|
@ -79,6 +79,21 @@ export default {
|
||||||
set (color) {
|
set (color) {
|
||||||
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color })
|
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color })
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
visibleRole () {
|
||||||
|
const user = this.user
|
||||||
|
|
||||||
|
if (!(user.role === 'admin' || user.role === 'moderator')) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isOtherUser) {
|
||||||
|
return user.role
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.show_role) {
|
||||||
|
return user.role
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
|
|
||||||
<router-link class='user-screen-name' :to="userProfileLink(user)">
|
<router-link class='user-screen-name' :to="userProfileLink(user)">
|
||||||
<span class="handle">@{{user.screen_name}}
|
<span class="handle">@{{user.screen_name}}
|
||||||
<span class="staff" v-if="user.is_admin">Admin</span>
|
<span class="staff" v-if="!!visibleRole">{{visibleRole}}</span>
|
||||||
<span class="staff" v-else-if="user.is_moderator">Moderator</span>
|
|
||||||
</span><span v-if="user.locked"><i class="icon icon-lock"></i></span>
|
</span><span v-if="user.locked"><i class="icon icon-lock"></i></span>
|
||||||
<span v-if="!hideUserStatsLocal && !hideBio" class="dailyAvg">{{dailyAvg}} {{ $t('user_card.per_day') }}</span>
|
<span v-if="!hideUserStatsLocal && !hideBio" class="dailyAvg">{{dailyAvg}} {{ $t('user_card.per_day') }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
@ -254,6 +253,7 @@
|
||||||
.staff {
|
.staff {
|
||||||
border: 1px solid $admin-border-color;
|
border: 1px solid $admin-border-color;
|
||||||
color: $admin-color;
|
color: $admin-color;
|
||||||
|
text-transform: capitalize;
|
||||||
background-color: $admin-background-color;
|
background-color: $admin-background-color;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
|
@ -14,6 +14,8 @@ const UserSettings = {
|
||||||
newDefaultScope: this.$store.state.users.currentUser.default_scope,
|
newDefaultScope: this.$store.state.users.currentUser.default_scope,
|
||||||
hideFollows: this.$store.state.users.currentUser.hide_follows,
|
hideFollows: this.$store.state.users.currentUser.hide_follows,
|
||||||
hideFollowers: this.$store.state.users.currentUser.hide_followers,
|
hideFollowers: this.$store.state.users.currentUser.hide_followers,
|
||||||
|
showRole: this.$store.state.users.currentUser.show_role,
|
||||||
|
role: this.$store.state.users.currentUser.role,
|
||||||
followList: null,
|
followList: null,
|
||||||
followImportError: false,
|
followImportError: false,
|
||||||
followsImported: false,
|
followsImported: false,
|
||||||
|
@ -71,6 +73,8 @@ const UserSettings = {
|
||||||
const no_rich_text = this.newNoRichText
|
const no_rich_text = this.newNoRichText
|
||||||
const hide_follows = this.hideFollows
|
const hide_follows = this.hideFollows
|
||||||
const hide_followers = this.hideFollowers
|
const hide_followers = this.hideFollowers
|
||||||
|
const show_role = this.showRole
|
||||||
|
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
this.$store.state.api.backendInteractor
|
this.$store.state.api.backendInteractor
|
||||||
.updateProfile({
|
.updateProfile({
|
||||||
|
@ -83,7 +87,8 @@ const UserSettings = {
|
||||||
default_scope,
|
default_scope,
|
||||||
no_rich_text,
|
no_rich_text,
|
||||||
hide_follows,
|
hide_follows,
|
||||||
hide_followers
|
hide_followers,
|
||||||
|
show_role
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
}}).then((user) => {
|
}}).then((user) => {
|
||||||
if (!user.error) {
|
if (!user.error) {
|
||||||
|
|
|
@ -37,6 +37,11 @@
|
||||||
<input type="checkbox" v-model="hideFollowers" id="account-hide-followers">
|
<input type="checkbox" v-model="hideFollowers" id="account-hide-followers">
|
||||||
<label for="account-hide-followers">{{$t('settings.hide_followers_description')}}</label>
|
<label for="account-hide-followers">{{$t('settings.hide_followers_description')}}</label>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="checkbox" v-model="showRole" id="account-show-role">
|
||||||
|
<label for="account-show-role" v-if="role === 'admin'">{{$t('settings.show_admin_badge')}}</label>
|
||||||
|
<label for="account-show-role" v-if="role === 'moderator'">{{$t('settings.show_moderator_badge')}}</label>
|
||||||
|
</p>
|
||||||
<button :disabled='newName && newName.length === 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
|
<button :disabled='newName && newName.length === 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
|
|
|
@ -166,6 +166,8 @@
|
||||||
"no_rich_text_description": "Strip rich text formatting from all posts",
|
"no_rich_text_description": "Strip rich text formatting from all posts",
|
||||||
"hide_follows_description": "Don't show who I'm following",
|
"hide_follows_description": "Don't show who I'm following",
|
||||||
"hide_followers_description": "Don't show who's following me",
|
"hide_followers_description": "Don't show who's following me",
|
||||||
|
"show_admin_badge": "Show Admin badge on my user card",
|
||||||
|
"show_moderator_badge": "Show Moderator badge on my user card",
|
||||||
"nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding",
|
"nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding",
|
||||||
"panelRadius": "Panels",
|
"panelRadius": "Panels",
|
||||||
"pause_on_unfocused": "Pause streaming when tab is not focused",
|
"pause_on_unfocused": "Pause streaming when tab is not focused",
|
||||||
|
|
|
@ -129,6 +129,8 @@
|
||||||
"no_rich_text_description": "Убрать форматирование из всех постов",
|
"no_rich_text_description": "Убрать форматирование из всех постов",
|
||||||
"hide_follows_description": "Не показывать кого я читаю",
|
"hide_follows_description": "Не показывать кого я читаю",
|
||||||
"hide_followers_description": "Не показывать кто читает меня",
|
"hide_followers_description": "Не показывать кто читает меня",
|
||||||
|
"show_admin_badge": "Показывать значок администратора на моей карточке пользователя",
|
||||||
|
"show_moderator_badge": "Показывать значок модератора на моей карточке пользователя",
|
||||||
"nsfw_clickthrough": "Включить скрытие NSFW вложений",
|
"nsfw_clickthrough": "Включить скрытие NSFW вложений",
|
||||||
"panelRadius": "Панели",
|
"panelRadius": "Панели",
|
||||||
"pause_on_unfocused": "Приостановить загрузку когда вкладка не в фокусе",
|
"pause_on_unfocused": "Приостановить загрузку когда вкладка не в фокусе",
|
||||||
|
|
|
@ -130,7 +130,7 @@ const updateBanner = ({credentials, params}) => {
|
||||||
// description
|
// description
|
||||||
const updateProfile = ({credentials, params}) => {
|
const updateProfile = ({credentials, params}) => {
|
||||||
// Always include these fields, because they might be empty or false
|
// Always include these fields, because they might be empty or false
|
||||||
const fields = ['description', 'locked', 'no_rich_text', 'hide_follows', 'hide_followers']
|
const fields = ['description', 'locked', 'no_rich_text', 'hide_follows', 'hide_followers', 'show_role']
|
||||||
let url = PROFILE_UPDATE_URL
|
let url = PROFILE_UPDATE_URL
|
||||||
|
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
|
|
|
@ -90,8 +90,8 @@ export const parseUser = (data) => {
|
||||||
output.statusnet_blocking = data.statusnet_blocking
|
output.statusnet_blocking = data.statusnet_blocking
|
||||||
|
|
||||||
output.is_local = data.is_local
|
output.is_local = data.is_local
|
||||||
output.is_admin = data.is_admin
|
output.role = data.role
|
||||||
output.is_moderator = data.is_moderator
|
output.show_role = data.show_role
|
||||||
|
|
||||||
output.follows_you = data.follows_you
|
output.follows_you = data.follows_you
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue