From ecf790257c2bdcc6b399e5ad51c20d1e77edd56d Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 21 Oct 2020 23:34:00 +0300 Subject: [PATCH] Make report ID in moderation log a link to the respective report --- src/router/index.js | 12 ++++++++++ src/views/moderation_log/LogEntryMessage.vue | 23 ++++++++++++++++++-- src/views/moderation_log/index.vue | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index b61e7b44..60be0f88 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -199,5 +199,17 @@ export const asyncRouterMap = [ ], hidden: true }, + { + path: '/reports/:id', + component: Layout, + children: [ + { + path: '', + name: 'ReportsShow', + component: () => import('@/views/reports/show') + } + ], + hidden: true + }, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/views/moderation_log/LogEntryMessage.vue b/src/views/moderation_log/LogEntryMessage.vue index d9cc8547..d19ada81 100644 --- a/src/views/moderation_log/LogEntryMessage.vue +++ b/src/views/moderation_log/LogEntryMessage.vue @@ -8,7 +8,16 @@ @{{ actor.nickname }} - {{ logEntryMessage }} + + {{ logEntryMessageWithoutId[0] }} + + #{{ subject.id }} + + {{ logEntryMessageWithoutId[1] }} + + {{ logEntryMessage }} @@ -24,11 +33,21 @@ export default { message: { type: String, required: true + }, + subject: { + type: [Object, Array], + required: false, + default: function() { + return {} + } } }, computed: { logEntryMessage() { - return this.message.split(this.actor.nickname)[1] + return this.actor.nickname ? this.message.split(this.actor.nickname)[1] : this.message + }, + logEntryMessageWithoutId() { + return this.logEntryMessage.split(`#${this.subject.id}`) } }, methods: { diff --git a/src/views/moderation_log/index.vue b/src/views/moderation_log/index.vue index af123e22..283bf4d2 100644 --- a/src/views/moderation_log/index.vue +++ b/src/views/moderation_log/index.vue @@ -43,7 +43,7 @@ v-for="(logEntry, index) in log" :key="index" :timestamp="normalizeTimestamp(logEntry.time)"> - + {{ logEntry.message }}