forked from AkkomaGang/admin-fe
Replace display_name with nickname in Reports and Report Notes, check if account is valid
This commit is contained in:
parent
54f6c90f06
commit
8b5bd59267
3 changed files with 15 additions and 19 deletions
|
@ -61,9 +61,8 @@ const reports = {
|
||||||
const optimisticNote = {
|
const optimisticNote = {
|
||||||
user: {
|
user: {
|
||||||
avatar: rootState.user.avatar,
|
avatar: rootState.user.avatar,
|
||||||
display_name: rootState.user.name,
|
nickname: rootState.user.name,
|
||||||
url: `${rootState.user.authHost}/${rootState.user.name}`,
|
id: rootState.user.id
|
||||||
acct: rootState.user.name
|
|
||||||
},
|
},
|
||||||
content: content,
|
content: content,
|
||||||
created_at: new Date().getTime()
|
created_at: new Date().getTime()
|
||||||
|
|
|
@ -4,12 +4,9 @@
|
||||||
<div class="note-header">
|
<div class="note-header">
|
||||||
<div class="note-actor-container">
|
<div class="note-actor-container">
|
||||||
<div class="note-actor">
|
<div class="note-actor">
|
||||||
<img :src="note.user.avatar" class="note-avatar-img">
|
<img v-if="isValid(note.user)" :src="note.user.avatar" class="note-avatar-img">
|
||||||
<h3 class="note-actor-name">{{ note.user.display_name }}</h3>
|
<h3 v-if="isValid(note.user)" class="note-actor-name">{{ note.user.nickname }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<a :href="note.user.url" target="_blank">
|
|
||||||
@{{ note.user.display_name }}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
|
@ -47,6 +44,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isValid(account) {
|
||||||
|
return account.nickname && account.id
|
||||||
|
},
|
||||||
parseTimestamp(timestamp) {
|
parseTimestamp(timestamp) {
|
||||||
return moment(timestamp).format('YYYY-MM-DD HH:mm')
|
return moment(timestamp).format('YYYY-MM-DD HH:mm')
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<el-card class="report">
|
<el-card class="report">
|
||||||
<div class="report-header-container">
|
<div class="report-header-container">
|
||||||
<div class="title-container">
|
<div class="title-container">
|
||||||
<h3 v-if="accountExists(report.account, 'display_name')" class="report-title">{{ $t('reports.reportOn') }} {{ report.account.display_name }}</h3>
|
<h3 v-if="isValid(report.account)" class="report-title">{{ $t('reports.reportOn') }} {{ report.account.nickname }}</h3>
|
||||||
<h3 v-else class="report-title">{{ $t('reports.report') }}</h3>
|
<h3 v-else class="report-title">{{ $t('reports.report') }}</h3>
|
||||||
<h5 class="id">{{ $t('reports.id') }}: {{ report.id }}</h5>
|
<h5 class="id">{{ $t('reports.id') }}: {{ report.id }}</h5>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,16 +30,16 @@
|
||||||
<div>
|
<div>
|
||||||
<el-divider class="divider"/>
|
<el-divider class="divider"/>
|
||||||
<span class="report-row-key">{{ $t('reports.account') }}:</span>
|
<span class="report-row-key">{{ $t('reports.account') }}:</span>
|
||||||
<span v-if="accountExists(report.account, 'avatar') && accountExists(report.account, 'display_name')">
|
<span v-if="isValid(report.account)">
|
||||||
<img
|
<img
|
||||||
:src="report.account.avatar"
|
:src="report.account.avatar"
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
class="avatar-img">
|
class="avatar-img">
|
||||||
<a v-if="!report.account.deactivated" :href="report.account.url" target="_blank" class="account">
|
<a v-if="isValid(report.account)" :href="report.account.url" target="_blank" class="account">
|
||||||
<span>{{ report.account.display_name }}</span>
|
<span>{{ report.account.nickname }}</span>
|
||||||
</a>
|
</a>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ report.account.display_name }}
|
{{ report.account.nickname }}
|
||||||
<span class="deactivated"> (deactivated)</span>
|
<span class="deactivated"> (deactivated)</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -54,13 +54,13 @@
|
||||||
<div :style="showStatuses(report.statuses) ? '' : 'margin-bottom:15px'">
|
<div :style="showStatuses(report.statuses) ? '' : 'margin-bottom:15px'">
|
||||||
<el-divider class="divider"/>
|
<el-divider class="divider"/>
|
||||||
<span class="report-row-key">{{ $t('reports.actor') }}:</span>
|
<span class="report-row-key">{{ $t('reports.actor') }}:</span>
|
||||||
<span v-if="accountExists(report.actor, 'avatar') && accountExists(report.actor, 'display_name')">
|
<span v-if="isValid(report.actor)">
|
||||||
<img
|
<img
|
||||||
:src="report.actor.avatar"
|
:src="report.actor.avatar"
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
class="avatar-img">
|
class="avatar-img">
|
||||||
<a :href="report.actor.url" target="_blank" class="account">
|
<a :href="report.actor.url" target="_blank" class="account">
|
||||||
<span>{{ report.actor.display_name }}</span>
|
<span>{{ report.actor.nickname }}</span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="deactivated">({{ $t('reports.notFound') }})</span>
|
<span v-else class="deactivated">({{ $t('reports.notFound') }})</span>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
<el-collapse>
|
<el-collapse>
|
||||||
<el-collapse-item :title="getStatusesTitle(report.statuses)">
|
<el-collapse-item :title="getStatusesTitle(report.statuses)">
|
||||||
<div v-for="status in report.statuses" :key="status.id">
|
<div v-for="status in report.statuses" :key="status.id">
|
||||||
<status :status="status" :account="status.account.display_name ? status.account : report.account" :show-checkbox="false" :page="currentPage"/>
|
<status :status="status" :account="status.account.nickname ? status.account : report.account" :show-checkbox="false" :page="currentPage"/>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
|
@ -142,9 +142,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
accountExists(account, key) {
|
|
||||||
return account[key]
|
|
||||||
},
|
|
||||||
changeReportState(state, id) {
|
changeReportState(state, id) {
|
||||||
this.$store.dispatch('ChangeReportState', [{ state, id }])
|
this.$store.dispatch('ChangeReportState', [{ state, id }])
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue