From cf50fb05281ddf649c85556694926500087879fc Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 24 May 2019 13:34:07 +0200 Subject: [PATCH] Do not render content and statuses rows if there is no data --- src/store/modules/reports.js | 20 +------- src/views/reports/components/TimelineItem.vue | 46 ++++--------------- 2 files changed, 11 insertions(+), 55 deletions(-) diff --git a/src/store/modules/reports.js b/src/store/modules/reports.js index b4c9548f..c1f523fc 100644 --- a/src/store/modules/reports.js +++ b/src/store/modules/reports.js @@ -15,9 +15,6 @@ const reports = { SET_LOADING: (state, status) => { state.loading = status }, - SET_REPORT: (state, { reportIndex, data }) => { - state.fetchedReports[reportIndex] = data - }, SET_REPORTS: (state, reports) => { state.fetchedReports = reports }, @@ -28,8 +25,8 @@ const reports = { actions: { async ChangeReportState({ commit, getters, state }, { reportState, reportId }) { const { data } = await changeState(reportState, reportId, getters.authHost, getters.token) - const reportIndex = state.fetchedReports.findIndex(report => report.id === reportId) - commit('SET_REPORT', { reportIndex, data }) + const updatedReports = state.fetchedReports.map(report => report.id === reportId ? data : report) + commit('SET_REPORTS', updatedReports) }, async FetchReports({ commit, getters, state }) { commit('SET_LOADING', true) @@ -60,19 +57,6 @@ const reports = { commit('SET_LOADING', false) } } - // async AddNote({ commit, state, getters }, { reportId, note }) { - // const report = state.fetchedReports.find(report => report.id === reportId) - // report.notes = [...report.notes, note] - // const reportIndex = state.fetchedReports.findIndex(report => report.id === reportId) - // commit('SET_REPORT', { reportIndex, report }) - // }, - // async DeleteNote({ commit, state }, { reportId, noteId }) { - // const response = deleteNote(reportId, noteId) - // const report = state.fetchedReports.find(report => report.id === reportId) - // report.notes = response - // const reportIndex = state.fetchedReports.findIndex(report => report.id === reportId) - // commit('SET_REPORT', { reportIndex, report }) - // } } } diff --git a/src/views/reports/components/TimelineItem.vue b/src/views/reports/components/TimelineItem.vue index 3a45a9d2..1e4b531a 100644 --- a/src/views/reports/components/TimelineItem.vue +++ b/src/views/reports/components/TimelineItem.vue @@ -4,21 +4,20 @@

Report on {{ report.account.display_name }}

- {{ capitalizeFirstLetter(report.state) }} + {{ capitalizeFirstLetter(report.state) }} {{ $t('reports.changeState') }} Resolve - Open + Reopen Close -
ID: {{ report.id }}
-
+
Account: {{ report.account.acct }}
-
-
+
+
Content: - {{ report.content.length > 0 ? report.content : '-' }} + {{ report.content }}
-
+
Actor: {{ report.actor.acct }}
-
+
@@ -68,33 +67,6 @@
- @@ -162,7 +134,7 @@ export default { case 'resolved': return 'success' default: - return '' + return 'primary' } }, getStatusesTitle(statuses) {