From ca7178d1d11744fe285c322691befeab0905348a Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Thu, 29 Aug 2019 14:25:58 +0200 Subject: [PATCH] See #890: fixed some front-end issues when report target is deleted --- .../manage/moderation/ReportCard.vue | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/front/src/components/manage/moderation/ReportCard.vue b/front/src/components/manage/moderation/ReportCard.vue index bbf475b88..f2bf1d923 100644 --- a/front/src/components/manage/moderation/ReportCard.vue +++ b/front/src/components/manage/moderation/ReportCard.vue @@ -82,6 +82,15 @@ N/A + + + Moderator notes + + + + {{ obj.notes.length }} + + @@ -102,19 +111,22 @@

Reported object

- +
+ The object associated with this report was deleted. +
+ Open in moderation interface - + @@ -210,26 +222,29 @@ export default { return this.currentState }, detailUrl () { - if (!this.obj.target) { + if (!this.target) { return '' } let namespace - let id = this.obj.target.id - if (this.obj.target.type === 'track') { + let id = this.target.id + if (this.target.type === 'track') { namespace = 'library.tracks.edit.detail' } - if (this.obj.target.type === 'album') { + if (this.target.type === 'album') { namespace = 'library.albums.edit.detail' } - if (this.obj.target.type === 'artist') { + if (this.target.type === 'artist') { namespace = 'library.artists.edit.detail' } return this.$router.resolve({name: namespace, params: {id, editId: this.obj.uuid}}).href }, targetFields () { + if (!this.target) { + return [] + } let payload = this.obj.target_state - let fields = this.configs[this.obj.target.type].moderatedFields + let fields = this.configs[this.target.type].moderatedFields let self = this return fields.map((fieldConfig) => { let dummyRepr = (v) => { return v } @@ -242,6 +257,13 @@ export default { } return d }) + }, + target () { + if (this.obj.target) { + return this.obj.target + } else { + return this.obj.target_state._target + } } }, methods: {
Type - - {{ configs[obj.target.type].label }} + + {{ configs[target.type].label }}