From 868eb9dc7159d8efdadf72c4b73ba3c8eaa86fa9 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 27 Feb 2020 19:29:05 +0300 Subject: [PATCH 1/3] Remove grouped reports from admin-fe --- CHANGELOG.md | 1 - src/api/__mocks__/reports.js | 28 --- src/api/reports.js | 9 - src/lang/en.js | 1 - src/store/modules/reports.js | 27 +-- src/store/modules/status.js | 4 - .../reports/components/GroupedReport.vue | 169 ------------------ src/views/reports/index.vue | 41 +---- test/views/reports/groupedReport.test.js | 47 ----- 9 files changed, 6 insertions(+), 321 deletions(-) delete mode 100644 src/views/reports/components/GroupedReport.vue delete mode 100644 test/views/reports/groupedReport.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 24db7aec..085e4981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Optimistic update for actions in users module and fetching users after api function finished its execution - Relay management - Ability to fetch all statuses from a given instance -- Grouped reports: now you can view reports, which are grouped by status (pagination is not implemented yet, though) - Ability to confirm users' emails and resend confirmation emails - Report notes - Ability to moderate users on the statuses page diff --git a/src/api/__mocks__/reports.js b/src/api/__mocks__/reports.js index ba4e412e..36fc2008 100644 --- a/src/api/__mocks__/reports.js +++ b/src/api/__mocks__/reports.js @@ -11,40 +11,12 @@ const reports = [ { 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: [] } ] -const groupedReports = [ - { account: { avatar: 'http://localhost:4000/images/avi.png', confirmation_pending: false, deactivated: false, display_name: 'leo', id: '9oG0YghgBi94EATI9I', local: true, nickname: 'leo', roles: { admin: false, moderator: false }, tags: [] }, - actors: [{ acct: 'admin', avatar: 'http://localhost:4000/images/avi.png', deactivated: false, display_name: 'admin', id: '9oFz4pTauG0cnJ581w', local: true, nickname: 'admin', roles: { admin: false, moderator: false }, tags: [], url: 'http://localhost:4000/users/admin', username: 'admin' }], - date: '2019-11-23T12:56:11.969772Z', - 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: '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' } - ] } - ], - status: { - account: { acct: 'leo' }, - content: 'At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis', - created_at: '2019-11-23T12:55:20.000Z', - id: '9pFoQO69piu7cUDnJg', - url: 'http://localhost:4000/notice/9pFoQO69piu7cUDnJg', - visibility: 'unlisted', - sensitive: true - }, - status_deleted: false - } -] - export async function fetchReports(filter, page, pageSize, authHost, token) { return filter.length > 0 ? Promise.resolve({ data: { reports: reports.filter(report => report.state === filter) }}) : Promise.resolve({ data: { reports }}) } -export async function fetchGroupedReports(authHost, token) { - return Promise.resolve({ data: { reports: groupedReports }}) -} - export async function changeState(reportsData, authHost, token) { return Promise.resolve({ data: '' }) } diff --git a/src/api/reports.js b/src/api/reports.js index 3454da2f..abd371c1 100644 --- a/src/api/reports.js +++ b/src/api/reports.js @@ -24,15 +24,6 @@ export async function fetchReports(filter, page, pageSize, authHost, token) { }) } -export async function fetchGroupedReports(authHost, token) { - return await request({ - baseURL: baseName(authHost), - url: `/api/pleroma/admin/grouped_reports`, - method: 'get', - headers: authHeaders(token) - }) -} - export async function createNote(content, reportID, authHost, token) { return await request({ baseURL: baseName(authHost), diff --git a/src/lang/en.js b/src/lang/en.js index 5130a100..7512ecbf 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -273,7 +273,6 @@ export default { }, reports: { reports: 'Reports', - groupedReports: 'Grouped reports', reply: 'Reply', from: 'From', showNotes: 'Show notes', diff --git a/src/store/modules/reports.js b/src/store/modules/reports.js index c1b07b51..3a836a2f 100644 --- a/src/store/modules/reports.js +++ b/src/store/modules/reports.js @@ -1,13 +1,11 @@ -import { changeState, fetchReports, fetchGroupedReports, createNote, deleteNote } from '@/api/reports' +import { changeState, fetchReports, createNote, deleteNote } from '@/api/reports' const reports = { state: { fetchedReports: [], - fetchedGroupedReports: [], totalReportsCount: 0, currentPage: 1, pageSize: 50, - groupReports: false, stateFilter: '', loading: true }, @@ -24,17 +22,11 @@ const reports = { SET_REPORTS: (state, reports) => { state.fetchedReports = reports }, - SET_GROUPED_REPORTS: (state, reports) => { - state.fetchedGroupedReports = reports - }, SET_REPORTS_COUNT: (state, total) => { state.totalReportsCount = total }, SET_REPORTS_FILTER: (state, filter) => { state.stateFilter = filter - }, - SET_REPORTS_GROUPING: (state) => { - state.groupReports = !state.groupReports } }, actions: { @@ -46,14 +38,7 @@ const reports = { return updatedReportsIds.includes(report.id) ? { ...report, state: reportsData[0].state } : report }) - const updatedGroupedReports = state.fetchedGroupedReports.map(group => { - const updatedReportsIds = reportsData.map(({ id }) => id) - const updatedReports = group.reports.map(report => updatedReportsIds.includes(report.id) ? { ...report, state: reportsData[0].state } : report) - return { ...group, reports: updatedReports } - }) - commit('SET_REPORTS', updatedReports) - commit('SET_GROUPED_REPORTS', updatedGroupedReports) }, ClearFetchedReports({ commit }) { commit('SET_REPORTS', []) @@ -67,19 +52,9 @@ const reports = { commit('SET_PAGE', page) commit('SET_LOADING', false) }, - async FetchGroupedReports({ commit, getters }) { - commit('SET_LOADING', true) - const { data } = await fetchGroupedReports(getters.authHost, getters.token) - - commit('SET_GROUPED_REPORTS', data.reports) - commit('SET_LOADING', false) - }, SetFilter({ commit }, filter) { commit('SET_REPORTS_FILTER', filter) }, - ToggleReportsGrouping({ commit }) { - commit('SET_REPORTS_GROUPING') - }, CreateReportNote({ commit, getters, state, rootState }, { content, reportID }) { createNote(content, reportID, getters.authHost, getters.token) diff --git a/src/store/modules/status.js b/src/store/modules/status.js index 228e03f1..81e86dba 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -36,8 +36,6 @@ const status = { dispatch('FetchUserStatuses', { userId, godmode }) } else if (fetchStatusesByInstance) { // called from Statuses by Instance dispatch('FetchStatusesByInstance') - } else { // called from GroupedReports - dispatch('FetchGroupedReports') } }, async DeleteStatus({ dispatch, getters }, { statusId, reportCurrentPage, userId, godmode, fetchStatusesByInstance }) { @@ -48,8 +46,6 @@ const status = { dispatch('FetchUserStatuses', { userId, godmode }) } else if (fetchStatusesByInstance) { // called from Statuses by Instance dispatch('FetchStatusesByInstance') - } else { // called from GroupedReports - dispatch('FetchGroupedReports') } }, async FetchStatusesByInstance({ commit, getters, state }) { diff --git a/src/views/reports/components/GroupedReport.vue b/src/views/reports/components/GroupedReport.vue deleted file mode 100644 index 54ee5b1a..00000000 --- a/src/views/reports/components/GroupedReport.vue +++ /dev/null @@ -1,169 +0,0 @@ - - - - - diff --git a/src/views/reports/index.vue b/src/views/reports/index.vue index 8c37e6a1..64993da3 100644 --- a/src/views/reports/index.vue +++ b/src/views/reports/index.vue @@ -1,22 +1,14 @@ @@ -77,9 +49,6 @@ export default { margin: 22px 15px 22px 15px; padding-bottom: 0 } - .group-reports-checkbox { - margin-top: 10px; - } h1 { margin: 22px 0 0 15px; } diff --git a/test/views/reports/groupedReport.test.js b/test/views/reports/groupedReport.test.js deleted file mode 100644 index b24d05e4..00000000 --- a/test/views/reports/groupedReport.test.js +++ /dev/null @@ -1,47 +0,0 @@ -import Vuex from 'vuex' -import { mount, createLocalVue, config } from '@vue/test-utils' -import Element from 'element-ui' -import GroupedReport from '@/views/reports/components/GroupedReport' -import storeConfig from './store.conf' -import { cloneDeep } from 'lodash' -import flushPromises from 'flush-promises' - -config.mocks["$t"] = () => {} - -const localVue = createLocalVue() -localVue.use(Vuex) -localVue.use(Element) - -jest.mock('@/api/reports') - -describe('Grouped report', () => { - let store - - beforeEach(async() => { - store = new Vuex.Store(cloneDeep(storeConfig)) - store.dispatch('FetchGroupedReports') - await flushPromises() - }) - - it('changes state of all reports in a group', async (done) => { - const groupedReports = store.state.reports.fetchedGroupedReports - const wrapper = mount(GroupedReport, { - store, - localVue, - propsData: { - groupedReports - } - }) - - expect(groupedReports[0].reports[0].state).toBe('open') - expect(groupedReports[0].reports[1].state).toBe('resolved') - - const button = wrapper.find(`.grouped-report .el-dropdown-menu__item:nth-child(3)`) - button.trigger('click') - await flushPromises() - - expect(store.state.reports.fetchedGroupedReports[0].reports[0].state).toBe('closed') - expect(store.state.reports.fetchedGroupedReports[0].reports[1].state).toBe('closed') - done() - }) -}) From f4d40cb157ababaaed5d8e5ce68bb415146940c9 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 27 Feb 2020 19:40:24 +0300 Subject: [PATCH 2/3] Add styles for divider on report tab --- src/views/reports/components/Report.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/views/reports/components/Report.vue b/src/views/reports/components/Report.vue index 5911ad7d..4df72383 100644 --- a/src/views/reports/components/Report.vue +++ b/src/views/reports/components/Report.vue @@ -180,6 +180,9 @@ export default { height: 15px; margin-left: 5px; } + .divider { + margin: 15px 0; + } .el-card__body { padding: 17px; } From a1a90d948efa33e57f47b62bbb978f451aa54493 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 27 Feb 2020 20:11:09 +0300 Subject: [PATCH 3/3] Update Changelog --- CHANGELOG.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 085e4981..bfd8927e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,20 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## Unreleased - -### Changed - -- **breaking** PleromaFE login feature relies on `admin` scope presence in PleromaFE token (older versions of PleromaFE don't support it) -- Moves emoji pack configuration from the main menu to settings tab, redesigns it and fixes bugs -- `mailerEnabled` must be set to `true` in order to require password reset (password reset currently only works via email) -- Remove fetching initial data for configuring server settings -- Actions in users module (ActivateUsers, AddRight, DeactivateUsers, DeleteRight, DeleteUsers) now accept an array of users instead of one user -- Leave dropdown menu open after clicking an action -- Move current try/catch error handling from view files to module, add it where necessary -- Display checkboxes in status card and fetch statuses only when status card was rendered from Statuses by instance page -- Move statuses by instance state from local state to store state -- Pass user's ID to actions that moderate users when action is called from user's profile page +## [2.0] - 2020-02-27 ### Added @@ -28,8 +15,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Report notes - Ability to moderate users on the statuses page - Ability to moderate user on the user's page +- Ability to remove setting's updated value and set it back to initial value - Ability to restart an application when settings that require instance reboot were changed -- Mobile UI for Settings tab +- Mobile and Tablet UI for all sections + +### Changed + +- **breaking** PleromaFE login feature relies on `admin` scope presence in PleromaFE token (older versions of PleromaFE don't support it) +- `mailerEnabled` must be set to `true` in order to require password reset (password reset currently only works via email) +- Render inputs for configuring settings based on description that comes from the BE +- Remove fetching initial data for configuring server settings +- Actions in users module (ActivateUsers, AddRight, DeactivateUsers, DeleteRight, DeleteUsers) now accept an array of users instead of one user +- Leave dropdown menu open after clicking an action +- Display checkboxes in status card and fetch statuses only when status card was rendered from Statuses by instance page +- Move statuses by instance state from local state to store state ### Fixed @@ -38,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Remove duplicated success message - Fix styles for Statuses by instance page - Fix styles for Reports section +- Fix listing remote emoji ## [1.2.0] - 2019-09-27