From d5e11e279ff70aab7f82611cdbafec6b6d6c252a Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 8 Apr 2020 18:56:01 +0300 Subject: [PATCH 1/3] Update displaying accounts in reports and statuses --- src/api/__mocks__/reports.js | 14 +-- src/components/Status/index.vue | 21 +++- src/views/reports/components/NoteCard.vue | 2 +- src/views/reports/components/Report.vue | 15 ++- src/views/reports/components/ReportCard.vue | 127 -------------------- src/views/statuses/index.vue | 1 + src/views/users/show.vue | 2 +- 7 files changed, 36 insertions(+), 146 deletions(-) delete mode 100644 src/views/reports/components/ReportCard.vue diff --git a/src/api/__mocks__/reports.js b/src/api/__mocks__/reports.js index 36fc2008..5c6fe3a1 100644 --- a/src/api/__mocks__/reports.js +++ b/src/api/__mocks__/reports.js @@ -1,14 +1,14 @@ const reports = [ - { created_at: '2019-05-21T21:35:33.000Z', account: { acct: 'benj', display_name: 'Benjamin Fame', tags: [] }, actor: { acct: 'admin' }, state: 'open', id: '2', content: 'This is a report', statuses: [] }, - { created_at: '2019-05-20T22:45:33.000Z', account: { acct: 'alice', display_name: 'Alice Pool', tags: [] }, actor: { acct: 'admin2' }, state: 'resolved', id: '1', content: 'Please block this user', statuses: [] }, - { created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys', tags: [] }, actor: { acct: 'admin' }, state: 'closed', id: '3', content: '', statuses: [] }, - { created_at: '2019-05-21T21:35:33.000Z', account: { acct: 'benj', display_name: 'Benjamin Fame', tags: [] }, actor: { acct: 'admin' }, state: 'open', id: '5', content: 'This is a report', statuses: [] }, - { created_at: '2019-05-20T22:45:33.000Z', account: { acct: 'alice', display_name: 'Alice Pool', tags: [] }, actor: { acct: 'admin2' }, state: 'resolved', id: '7', content: 'Please block this user', statuses: [ + { created_at: '2019-05-21T21:35:33.000Z', account: { display_name: 'Benjamin Fame', tags: [] }, actor: {}, state: 'open', id: '2', content: 'This is a report', statuses: [] }, + { created_at: '2019-05-20T22:45:33.000Z', account: { display_name: 'Alice Pool', tags: [] }, actor: {}, state: 'resolved', id: '1', content: 'Please block this user', statuses: [] }, + { created_at: '2019-05-18T13:01:33.000Z', account: { display_name: 'Nick Keys', tags: [] }, actor: {}, state: 'closed', id: '3', content: '', statuses: [] }, + { created_at: '2019-05-21T21:35:33.000Z', account: { display_name: 'Benjamin Fame', tags: [] }, actor: {}, state: 'open', id: '5', content: 'This is a report', statuses: [] }, + { created_at: '2019-05-20T22:45:33.000Z', account: { display_name: 'Alice Pool', tags: [] }, actor: {}, state: 'resolved', id: '7', content: 'Please block this user', statuses: [ { account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'public', sensitive: false, id: '11', content: 'Hey!', url: '', created_at: '2019-05-10T21:35:33.000Z' }, { account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'unlisted', sensitive: true, id: '10', content: 'Bye!', url: '', created_at: '2019-05-10T21:00:33.000Z' } ] }, - { created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys', tags: [] }, actor: { acct: 'admin' }, state: 'closed', id: '6', content: '', statuses: [] }, - { created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys', tags: [] }, actor: { acct: 'admin' }, state: 'closed', id: '4', content: '', statuses: [] } + { created_at: '2019-05-18T13:01:33.000Z', account: { display_name: 'Nick Keys', tags: [] }, actor: {}, state: 'closed', id: '6', content: '', statuses: [] }, + { created_at: '2019-05-18T13:01:33.000Z', account: { display_name: 'Nick Keys', tags: [] }, actor: {}, state: 'closed', id: '4', content: '', statuses: [] } ] export async function fetchReports(filter, page, pageSize, authHost, token) { diff --git a/src/components/Status/index.vue b/src/components/Status/index.vue index 50fbcfb0..90058332 100644 --- a/src/components/Status/index.vue +++ b/src/components/Status/index.vue @@ -5,13 +5,17 @@
{{ $t('reports.sensitive') }} @@ -121,6 +125,11 @@ import moment from 'moment' export default { name: 'Status', props: { + account: { + type: Object, + required: false, + default: () => { return {} } + }, fetchStatusesByInstance: { type: Boolean, required: false, diff --git a/src/views/reports/components/NoteCard.vue b/src/views/reports/components/NoteCard.vue index 379e752b..79637f16 100644 --- a/src/views/reports/components/NoteCard.vue +++ b/src/views/reports/components/NoteCard.vue @@ -8,7 +8,7 @@

{{ note.user.display_name }}

- @{{ note.user.acct }} + @{{ note.user.display_name }}
diff --git a/src/views/reports/components/Report.vue b/src/views/reports/components/Report.vue index 4df72383..b0cb6eb2 100644 --- a/src/views/reports/components/Report.vue +++ b/src/views/reports/components/Report.vue @@ -33,9 +33,13 @@ :src="report.account.avatar" alt="avatar" class="avatar-img"> - + + {{ report.account.display_name }} + (deactivated) +
@@ -51,14 +55,14 @@ alt="avatar" class="avatar-img">
- +
@@ -183,6 +187,9 @@ export default { .divider { margin: 15px 0; } + .deactivated { + color: gray; + } .el-card__body { padding: 17px; } diff --git a/src/views/reports/components/ReportCard.vue b/src/views/reports/components/ReportCard.vue deleted file mode 100644 index 430b58bb..00000000 --- a/src/views/reports/components/ReportCard.vue +++ /dev/null @@ -1,127 +0,0 @@ - - - - - diff --git a/src/views/statuses/index.vue b/src/views/statuses/index.vue index 88bfab6c..fab0c221 100644 --- a/src/views/statuses/index.vue +++ b/src/views/statuses/index.vue @@ -40,6 +40,7 @@
diff --git a/src/views/users/show.vue b/src/views/users/show.vue index 23c87247..e6a27458 100644 --- a/src/views/users/show.vue +++ b/src/views/users/show.vue @@ -91,7 +91,7 @@ - +

{{ $t('userProfile.noStatuses') }}

From ac6799211d7036d9c9b9b7a2f902dabaeb4fb8ff Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 8 Apr 2020 23:16:14 +0300 Subject: [PATCH 2/3] Exclude cases when length can be called on null or undefined --- src/views/reports/components/Report.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/reports/components/Report.vue b/src/views/reports/components/Report.vue index b0cb6eb2..9a66c206 100644 --- a/src/views/reports/components/Report.vue +++ b/src/views/reports/components/Report.vue @@ -41,7 +41,7 @@ (deactivated)
-
+
{{ $t('reports.content') }}: {{ report.content }} @@ -151,7 +151,7 @@ export default { return 'primary' } }, - getStatusesTitle(statuses) { + getStatusesTitle(statuses = []) { return `Reported statuses: ${statuses.length} item(s)` }, getNotesTitle(notes = []) { @@ -167,7 +167,7 @@ export default { parseTimestamp(timestamp) { return moment(timestamp).format('L HH:mm') }, - showStatuses(statuses) { + showStatuses(statuses = []) { return statuses.length > 0 } } From 1f7d78406c5c1e971888ddb748aa4a007a9c3463 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 19 Apr 2020 02:25:04 +0300 Subject: [PATCH 3/3] Update Reports for cases when actor or account is missing --- src/lang/en.js | 4 +- .../components/ModerateUserDropdown.vue | 31 +++++++------ src/views/reports/components/Report.vue | 46 +++++++++++-------- 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/lang/en.js b/src/lang/en.js index 74891c59..74eaa909 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -293,6 +293,7 @@ export default { }, reports: { reports: 'Reports', + report: 'Report', reply: 'Reply', from: 'From', showNotes: 'Show notes', @@ -332,7 +333,8 @@ export default { statusDeleted: 'This status has been deleted', leaveNote: 'Leave a note', postNote: 'Send', - deleteNote: 'Delete' + deleteNote: 'Delete', + notFound: 'account not found' }, reportsFilter: { inputPlaceholder: 'Select filter', diff --git a/src/views/reports/components/ModerateUserDropdown.vue b/src/views/reports/components/ModerateUserDropdown.vue index 2d368999..fdae9c18 100644 --- a/src/views/reports/components/ModerateUserDropdown.vue +++ b/src/views/reports/components/ModerateUserDropdown.vue @@ -1,6 +1,6 @@