Add router link to user's profile to log entry message

This commit is contained in:
Angelina Filippova 2020-06-11 21:41:05 +03:00
parent f96d495612
commit 2c6f699a1f
2 changed files with 10 additions and 10 deletions

View file

@ -4,7 +4,7 @@
v-if="propertyExists(actor, 'id')"
:to="{ name: 'UsersShow', params: { id: actor.id }}"
class="router-link">
<span v-if="propertyExists(actor, 'nickname')">
<span v-if="propertyExists(actor, 'nickname')" style="font-weight: 600">
@{{ actor.nickname }}
</span>
</router-link>
@ -24,15 +24,11 @@ export default {
message: {
type: String,
required: true
},
data: {
type: Object,
required: true
}
},
computed: {
logEntryMessage() {
return this.message
return this.message.split(this.actor.nickname)[1]
}
},
methods: {

View file

@ -43,7 +43,8 @@
v-for="(logEntry, index) in log"
:key="index"
:timestamp="normalizeTimestamp(logEntry.time)">
<log-entry-message :actor="logEntry.data.actor" :data="logEntry.data" :message="logEntry.message"/>
<log-entry-message v-if="propertyExists(logEntry.data.actor, 'nickname')" :actor="logEntry.data.actor" :message="logEntry.message"/>
<span v-else>{{ logEntry.message }}</span>
</el-timeline-item>
</el-timeline>
<div class="pagination">
@ -115,9 +116,6 @@ export default {
this.$store.dispatch('FetchAdmins')
},
methods: {
normalizeTimestamp(timestamp) {
return moment(timestamp * 1000).format('YYYY-MM-DD HH:mm')
},
fetchLogWithFilters() {
const filters = _.omitBy({
start_date: this.dateRange ? this.dateRange[0].toISOString() : null,
@ -128,6 +126,12 @@ export default {
}, val => val === '' || val === null)
this.$store.dispatch('FetchModerationLog', filters)
},
normalizeTimestamp(timestamp) {
return moment(timestamp * 1000).format('YYYY-MM-DD HH:mm')
},
propertyExists(account, property) {
return account[property]
}
}
}