From c2e80fb063463212d4089e08806ac285629ac7bd Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 2 Dec 2020 22:20:13 +0300 Subject: [PATCH 1/8] Process log message to render links to mentioned users --- src/views/moderation_log/LogEntryMessage.vue | 50 ++++++++++++-------- src/views/moderation_log/UserLink.vue | 28 +++++++++++ 2 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 src/views/moderation_log/UserLink.vue diff --git a/src/views/moderation_log/LogEntryMessage.vue b/src/views/moderation_log/LogEntryMessage.vue index d19ada81..ede85aa2 100644 --- a/src/views/moderation_log/LogEntryMessage.vue +++ b/src/views/moderation_log/LogEntryMessage.vue @@ -1,14 +1,7 @@ From 7cac1c7159f3cd3aba59a4478b96e42db319690e Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 2 Dec 2020 23:42:44 +0300 Subject: [PATCH 2/8] Pass nicknames instead of ids to user links from mod log --- src/views/moderation_log/LogEntryMessage.vue | 22 +++++--------------- src/views/moderation_log/UserLink.vue | 14 ++++--------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/views/moderation_log/LogEntryMessage.vue b/src/views/moderation_log/LogEntryMessage.vue index ede85aa2..cf5ab63e 100644 --- a/src/views/moderation_log/LogEntryMessage.vue +++ b/src/views/moderation_log/LogEntryMessage.vue @@ -38,28 +38,16 @@ export default { } }, computed: { - // logEntryMessage() { - // if (!this.actor.nickname) { - // return this.message - // } else { - // return this.message.split(this.actor.nickname).length > 2 - // ? this.message.split(this.actor.nickname)[1].concat(this.actor.nickname) - // : this.message.split(this.actor.nickname)[1] - // } - // }, // logEntryMessageWithoutId() { // return this.logEntryMessage.split(`#${this.subject.id}`) // }, processedHtml() { - const html = this.message.replace(/\@[\S]+/g, ``) + const html = [...this.message.matchAll(/\@(?([\w-]+))/g)].map(res => res.groups.nickname) + .reduce((acc, nickname) => { + return acc.replace(`@${nickname}`, ``) + }, this.message) return { - template: '
' + html + '
', - props: { - actor: { - type: null, - default: () => { return this.actor } - } - } + template: '
' + html + '
' } } } diff --git a/src/views/moderation_log/UserLink.vue b/src/views/moderation_log/UserLink.vue index 11f92128..cacfb1b1 100644 --- a/src/views/moderation_log/UserLink.vue +++ b/src/views/moderation_log/UserLink.vue @@ -1,10 +1,9 @@ @@ -15,14 +14,9 @@ export default { name: 'UserLink', props: { actor: { - type: Object, + type: String, required: true } - }, - methods: { - propertyExists(account, property) { - return account[property] - } } } From c9e9775eb1bbac4bb3c57d6730a35ff9567e0c8e Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 3 Dec 2020 01:49:39 +0300 Subject: [PATCH 3/8] Render links for reports on mod log page --- src/views/moderation_log/LogEntryMessage.vue | 23 ++++++++++---------- src/views/moderation_log/ReportLink.vue | 20 +++++++++++++++++ src/views/moderation_log/UserLink.vue | 4 +--- 3 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 src/views/moderation_log/ReportLink.vue diff --git a/src/views/moderation_log/LogEntryMessage.vue b/src/views/moderation_log/LogEntryMessage.vue index cf5ab63e..b0e3a6e8 100644 --- a/src/views/moderation_log/LogEntryMessage.vue +++ b/src/views/moderation_log/LogEntryMessage.vue @@ -1,22 +1,15 @@ diff --git a/src/views/moderation_log/UserLink.vue b/src/views/moderation_log/UserLink.vue index cacfb1b1..77ab82a4 100644 --- a/src/views/moderation_log/UserLink.vue +++ b/src/views/moderation_log/UserLink.vue @@ -2,9 +2,7 @@ - - @{{ actor }} - + @{{ actor }} From 27a4620dba64749e9ec75d2563e17ef64782cd39 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 3 Dec 2020 02:24:56 +0300 Subject: [PATCH 4/8] Remove LogEntryMessage component, move it to Mod Log index page --- src/views/moderation_log/LogEntryMessage.vue | 60 -------------------- src/views/moderation_log/index.vue | 32 +++++++++-- 2 files changed, 28 insertions(+), 64 deletions(-) delete mode 100644 src/views/moderation_log/LogEntryMessage.vue diff --git a/src/views/moderation_log/LogEntryMessage.vue b/src/views/moderation_log/LogEntryMessage.vue deleted file mode 100644 index b0e3a6e8..00000000 --- a/src/views/moderation_log/LogEntryMessage.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - - - diff --git a/src/views/moderation_log/index.vue b/src/views/moderation_log/index.vue index 283bf4d2..c8c350c4 100644 --- a/src/views/moderation_log/index.vue +++ b/src/views/moderation_log/index.vue @@ -43,8 +43,7 @@ v-for="(logEntry, index) in log" :key="index" :timestamp="normalizeTimestamp(logEntry.time)"> - - {{ logEntry.message }} +