Show moderator badge

This commit is contained in:
syuilo 2020-01-31 05:09:52 +09:00
parent db24dddeff
commit 99b5d94b11
3 changed files with 11 additions and 6 deletions

View file

@ -5,6 +5,8 @@
</router-link> </router-link>
<span class="is-bot" v-if="note.user.isBot">bot</span> <span class="is-bot" v-if="note.user.isBot">bot</span>
<span class="username"><mk-acct :user="note.user"/></span> <span class="username"><mk-acct :user="note.user"/></span>
<span class="admin" v-if="note.user.isAdmin"><fa :icon="faBookmark"/></span>
<span class="moderator" v-if="!note.user.isAdmin && note.user.isModerator"><fa :icon="farBookmark"/></span>
<div class="info"> <div class="info">
<span class="mobile" v-if="note.viaMobile"><fa :icon="faMobileAlt"/></span> <span class="mobile" v-if="note.viaMobile"><fa :icon="faMobileAlt"/></span>
<router-link class="created-at" :to="note | notePage"> <router-link class="created-at" :to="note | notePage">
@ -21,7 +23,8 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { faHome, faUnlock, faEnvelope, faMobileAlt } from '@fortawesome/free-solid-svg-icons'; import { faHome, faUnlock, faEnvelope, faMobileAlt, faBookmark } from '@fortawesome/free-solid-svg-icons';
import { faBookmark as farBookmark } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({ export default Vue.extend({
props: { props: {
@ -33,7 +36,7 @@ export default Vue.extend({
data() { data() {
return { return {
faHome, faUnlock, faEnvelope, faMobileAlt faHome, faUnlock, faEnvelope, faMobileAlt, faBookmark, farBookmark
}; };
} }
}); });
@ -67,8 +70,7 @@ export default Vue.extend({
margin: 0 .5em 0 0; margin: 0 .5em 0 0;
padding: 1px 6px; padding: 1px 6px;
font-size: 80%; font-size: 80%;
color: var(--noteHeaderBadgeFg); border: solid 1px var(--divider);
background: var(--noteHeaderBadgeBg);
border-radius: 3px; border-radius: 3px;
} }

View file

@ -14,6 +14,7 @@
<div class="bottom"> <div class="bottom">
<span class="username"><mk-acct :user="user" :detail="true" /></span> <span class="username"><mk-acct :user="user" :detail="true" /></span>
<span v-if="user.isAdmin" :title="$t('isAdmin')"><fa :icon="faBookmark"/></span> <span v-if="user.isAdmin" :title="$t('isAdmin')"><fa :icon="faBookmark"/></span>
<span v-if="!user.isAdmin && user.isModerator" :title="$t('isModerator')"><fa :icon="farBookmark"/></span>
<span v-if="user.isLocked" :title="$t('isLocked')"><fa :icon="faLock"/></span> <span v-if="user.isLocked" :title="$t('isLocked')"><fa :icon="faLock"/></span>
<span v-if="user.isBot" :title="$t('isBot')"><fa :icon="faRobot"/></span> <span v-if="user.isBot" :title="$t('isBot')"><fa :icon="faRobot"/></span>
</div> </div>
@ -30,6 +31,7 @@
<div class="bottom"> <div class="bottom">
<span class="username"><mk-acct :user="user" :detail="true" /></span> <span class="username"><mk-acct :user="user" :detail="true" /></span>
<span v-if="user.isAdmin" :title="$t('isAdmin')"><fa :icon="faBookmark"/></span> <span v-if="user.isAdmin" :title="$t('isAdmin')"><fa :icon="faBookmark"/></span>
<span v-if="!user.isAdmin && user.isModerator" :title="$t('isModerator')"><fa :icon="farBookmark"/></span>
<span v-if="user.isLocked" :title="$t('isLocked')"><fa :icon="faLock"/></span> <span v-if="user.isLocked" :title="$t('isLocked')"><fa :icon="faLock"/></span>
<span v-if="user.isBot" :title="$t('isBot')"><fa :icon="faRobot"/></span> <span v-if="user.isBot" :title="$t('isBot')"><fa :icon="faRobot"/></span>
</div> </div>
@ -106,7 +108,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { faEllipsisH, faRobot, faLock, faBookmark, faExclamationTriangle, faChartBar, faImage, faBirthdayCake, faMapMarker } from '@fortawesome/free-solid-svg-icons'; import { faEllipsisH, faRobot, faLock, faBookmark, faExclamationTriangle, faChartBar, faImage, faBirthdayCake, faMapMarker } from '@fortawesome/free-solid-svg-icons';
import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons'; import { faCalendarAlt, faBookmark as farBookmark } from '@fortawesome/free-regular-svg-icons';
import * as age from 's-age'; import * as age from 's-age';
import XUserTimeline from './index.timeline.vue'; import XUserTimeline from './index.timeline.vue';
import XUserMenu from '../../components/user-menu.vue'; import XUserMenu from '../../components/user-menu.vue';
@ -137,7 +139,7 @@ export default Vue.extend({
user: null, user: null,
error: null, error: null,
parallaxAnimationId: null, parallaxAnimationId: null,
faEllipsisH, faRobot, faLock, faBookmark, faExclamationTriangle, faChartBar, faImage, faBirthdayCake, faMapMarker, faCalendarAlt faEllipsisH, faRobot, faLock, faBookmark, farBookmark, faExclamationTriangle, faChartBar, faImage, faBirthdayCake, faMapMarker, faCalendarAlt
}; };
}, },

View file

@ -159,6 +159,7 @@ export class UserRepository extends Repository<User> {
avatarUrl: user.avatarUrl ? user.avatarUrl : config.url + '/avatar/' + user.id, avatarUrl: user.avatarUrl ? user.avatarUrl : config.url + '/avatar/' + user.id,
avatarColor: user.avatarColor, avatarColor: user.avatarColor,
isAdmin: user.isAdmin || falsy, isAdmin: user.isAdmin || falsy,
isModerator: user.isModerator || falsy,
isBot: user.isBot || falsy, isBot: user.isBot || falsy,
isCat: user.isCat || falsy, isCat: user.isCat || falsy,