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 = {
|
||||
user: {
|
||||
avatar: rootState.user.avatar,
|
||||
display_name: rootState.user.name,
|
||||
url: `${rootState.user.authHost}/${rootState.user.name}`,
|
||||
acct: rootState.user.name
|
||||
nickname: rootState.user.name,
|
||||
id: rootState.user.id
|
||||
},
|
||||
content: content,
|
||||
created_at: new Date().getTime()
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
<div class="note-header">
|
||||
<div class="note-actor-container">
|
||||
<div class="note-actor">
|
||||
<img :src="note.user.avatar" class="note-avatar-img">
|
||||
<h3 class="note-actor-name">{{ note.user.display_name }}</h3>
|
||||
<img v-if="isValid(note.user)" :src="note.user.avatar" class="note-avatar-img">
|
||||
<h3 v-if="isValid(note.user)" class="note-actor-name">{{ note.user.nickname }}</h3>
|
||||
</div>
|
||||
<a :href="note.user.url" target="_blank">
|
||||
@{{ note.user.display_name }}
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<el-popconfirm
|
||||
|
@ -47,6 +44,9 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
isValid(account) {
|
||||
return account.nickname && account.id
|
||||
},
|
||||
parseTimestamp(timestamp) {
|
||||
return moment(timestamp).format('YYYY-MM-DD HH:mm')
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<el-card class="report">
|
||||
<div class="report-header-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>
|
||||
<h5 class="id">{{ $t('reports.id') }}: {{ report.id }}</h5>
|
||||
</div>
|
||||
|
@ -30,16 +30,16 @@
|
|||
<div>
|
||||
<el-divider class="divider"/>
|
||||
<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
|
||||
:src="report.account.avatar"
|
||||
alt="avatar"
|
||||
class="avatar-img">
|
||||
<a v-if="!report.account.deactivated" :href="report.account.url" target="_blank" class="account">
|
||||
<span>{{ report.account.display_name }}</span>
|
||||
<a v-if="isValid(report.account)" :href="report.account.url" target="_blank" class="account">
|
||||
<span>{{ report.account.nickname }}</span>
|
||||
</a>
|
||||
<span v-else>
|
||||
{{ report.account.display_name }}
|
||||
{{ report.account.nickname }}
|
||||
<span class="deactivated"> (deactivated)</span>
|
||||
</span>
|
||||
</span>
|
||||
|
@ -54,13 +54,13 @@
|
|||
<div :style="showStatuses(report.statuses) ? '' : 'margin-bottom:15px'">
|
||||
<el-divider class="divider"/>
|
||||
<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
|
||||
:src="report.actor.avatar"
|
||||
alt="avatar"
|
||||
class="avatar-img">
|
||||
<a :href="report.actor.url" target="_blank" class="account">
|
||||
<span>{{ report.actor.display_name }}</span>
|
||||
<span>{{ report.actor.nickname }}</span>
|
||||
</a>
|
||||
</span>
|
||||
<span v-else class="deactivated">({{ $t('reports.notFound') }})</span>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<el-collapse>
|
||||
<el-collapse-item :title="getStatusesTitle(report.statuses)">
|
||||
<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>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
|
@ -142,9 +142,6 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
accountExists(account, key) {
|
||||
return account[key]
|
||||
},
|
||||
changeReportState(state, id) {
|
||||
this.$store.dispatch('ChangeReportState', [{ state, id }])
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue