From 5e96260a4f855e2d93915c1b428a7209a882c8cb Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Fri, 4 Dec 2020 12:48:15 +0200 Subject: add test data for dev --- src/services/notifications_fetcher/notifications_fetcher.service.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/services/notifications_fetcher/notifications_fetcher.service.js') diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index beeb167c..91861b21 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -61,6 +61,7 @@ const fetchNotifications = ({ store, args, older }) => { messageArgs: [error.message], timeout: 5000 }) + console.error(error) }) } -- cgit v1.2.3-70-g09d2 From 3822a73a49f82c71217bc610720324a4303626cf Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 1 Feb 2021 12:55:23 +0200 Subject: Fix report modal not working, add include_types --- .../user_reporting_modal/user_reporting_modal.js | 12 +++++++----- src/modules/reports.js | 2 +- src/services/api/api.service.js | 8 +++++++- .../notifications_fetcher.service.js | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 7 deletions(-) (limited to 'src/services/notifications_fetcher/notifications_fetcher.service.js') diff --git a/src/components/user_reporting_modal/user_reporting_modal.js b/src/components/user_reporting_modal/user_reporting_modal.js index 8d171b2d..85ffc661 100644 --- a/src/components/user_reporting_modal/user_reporting_modal.js +++ b/src/components/user_reporting_modal/user_reporting_modal.js @@ -1,4 +1,3 @@ - import Status from '../status/status.vue' import List from '../list/list.vue' import Checkbox from '../checkbox/checkbox.vue' @@ -21,14 +20,17 @@ const UserReportingModal = { } }, computed: { + reportModal () { + return this.$store.state.reports.reportModal + }, isLoggedIn () { return !!this.$store.state.users.currentUser }, isOpen () { - return this.isLoggedIn && this.$store.state.reports.modalActivated + return this.isLoggedIn && this.reportModal.activated }, userId () { - return this.$store.state.reports.userId + return this.reportModal.userId }, user () { return this.$store.getters.findUser(this.userId) @@ -37,10 +39,10 @@ const UserReportingModal = { return !this.user.is_local && this.user.screen_name.substr(this.user.screen_name.indexOf('@') + 1) }, statuses () { - return this.$store.state.reports.statuses + return this.reportModal.statuses }, preTickedIds () { - return this.$store.state.reports.preTickedIds + return this.reportModal.preTickedIds } }, watch: { diff --git a/src/modules/reports.js b/src/modules/reports.js index e800cfed..93866e20 100644 --- a/src/modules/reports.js +++ b/src/modules/reports.js @@ -18,7 +18,7 @@ const reports = { state.reportModal.activated = true }, closeUserReportingModal (state) { - state.reportModal.modalActivated = false + state.reportModal.activated = false }, setReportState (reportsState, { id, state }) { reportsState.reports[id].state = state diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 4e5f674b..9bc90887 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -498,7 +498,8 @@ const fetchTimeline = ({ userId = false, tag = false, withMuted = false, - replyVisibility = 'all' + replyVisibility = 'all', + includeTypes = [] }) => { const timelineUrls = { public: MASTODON_PUBLIC_TIMELINE, @@ -545,6 +546,11 @@ const fetchTimeline = ({ if (replyVisibility !== 'all') { params.push(['reply_visibility', replyVisibility]) } + if (includeTypes.length > 0) { + includeTypes.forEach(type => { + params.push(['include_types[]', type]) + }) + } params.push(['limit', 20]) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 91861b21..2da6d646 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -1,6 +1,18 @@ import apiService from '../api/api.service.js' import { promiseInterval } from '../promise_interval/promise_interval.js' +// For using include_types when fetching notifications. +// Note: chat_mention excluded as pleroma-fe polls them separately +const mastoApiNotificationTypes = [ + 'mention', + 'favourite', + 'reblog', + 'follow', + 'move', + 'pleroma:emoji_reaction', + 'pleroma:report' +] + const update = ({ store, notifications, older }) => { store.dispatch('addNewNotifications', { notifications, older }) } @@ -12,6 +24,9 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { const timelineData = rootState.statuses.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts + if (rootState.users.currentUser.role === 'admin') { + args['includeTypes'] = mastoApiNotificationTypes + } args['withMuted'] = !hideMutedPosts args['timeline'] = 'notifications' -- cgit v1.2.3-70-g09d2 From 819b76026101ddc0363118f240049a0019ebb4d6 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sat, 26 Feb 2022 01:53:01 +0100 Subject: Fix up and code review * Check if it works properly * Notifs are shown as BE returns them * The Interaction view has Reports, but only when you're mod or admin * Do some extra translations * Fix some console spam --- src/components/interactions/interactions.js | 3 ++- src/i18n/en.json | 2 ++ src/i18n/nl.json | 13 +++++++++++++ src/modules/reports.js | 5 +---- src/services/api/api.service.js | 3 ++- src/services/notification_utils/notification_utils.js | 2 +- .../notifications_fetcher/notifications_fetcher.service.js | 4 +--- 7 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src/services/notifications_fetcher/notifications_fetcher.service.js') diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js index 54275a7b..53ec7d49 100644 --- a/src/components/interactions/interactions.js +++ b/src/components/interactions/interactions.js @@ -13,7 +13,8 @@ const Interactions = { data () { return { allowFollowingMove: this.$store.state.users.currentUser.allow_following_move, - filterMode: tabModeDict['mentions'] + filterMode: tabModeDict['mentions'], + canSeeReports: ['moderator', 'admin'].includes(this.$store.state.users.currentUser.role) } }, methods: { diff --git a/src/i18n/en.json b/src/i18n/en.json index 3bdd42e3..9e74840f 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -176,6 +176,8 @@ "interactions": { "favs_repeats": "Repeats and Favorites", "follows": "New follows", + "emoji_reactions": "Emoji Reactions", + "reports": "Reports", "moves": "User migrates", "load_older": "Load older interactions" }, diff --git a/src/i18n/nl.json b/src/i18n/nl.json index a01e57a0..8da07ac7 100644 --- a/src/i18n/nl.json +++ b/src/i18n/nl.json @@ -661,6 +661,8 @@ "interactions": { "favs_repeats": "Herhalingen en Favorieten", "follows": "Nieuwe volgingen", + "emoji_reactions": "Emoji Reacties", + "reports": "Rapportages", "moves": "Gebruiker migreert", "load_older": "Oudere interacties laden" }, @@ -669,6 +671,17 @@ "error": "Niet gevonden.", "remote_user_resolver": "Externe gebruikers zoeker" }, + "report": { + "reporter": "Reporteerder:", + "reported_user": "Gerapporteerde gebruiker:", + "reported_statuses": "Gerapporteerde statussen:", + "notes": "Notas:", + "state": "Status:", + "state_open": "Open", + "state_closed": "Gesloten", + "state_resolved": "Opgelost" + }, + "selectable_list": { "select_all": "Alles selecteren" }, diff --git a/src/modules/reports.js b/src/modules/reports.js index b25e9ee9..925792c0 100644 --- a/src/modules/reports.js +++ b/src/modules/reports.js @@ -43,11 +43,8 @@ const reports = { }, setReportState ({ commit, dispatch, rootState }, { id, state }) { const oldState = rootState.reports.reports[id].state - console.log(oldState, state) commit('setReportState', { id, state }) - rootState.api.backendInteractor.setReportState({ id, state }).then(report => { - console.log(report) - }).catch(e => { + rootState.api.backendInteractor.setReportState({ id, state }).catch(e => { console.error('Failed to set report state', e) dispatch('pushGlobalNotice', { level: 'error', diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index e60010fe..27ea5199 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -1270,7 +1270,8 @@ const deleteChatMessage = ({ chatId, messageId, credentials }) => { } const setReportState = ({ id, state, credentials }) => { - // Can't use promisedRequest because on OK this does not return json + // TODO: Can't use promisedRequest because on OK this does not return json + // See https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1322 return fetch(PLEROMA_ADMIN_REPORTS, { headers: { ...authHeaders(credentials), diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index dff97aa2..b338eb8b 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -93,7 +93,7 @@ export const prepareNotificationObject = (notification, i18n) => { i18nString = 'follow_request' break case 'pleroma:report': - i18nString = 'reported' + i18nString = 'submitted_report' break } diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 2da6d646..4ecb348e 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -24,9 +24,7 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { const timelineData = rootState.statuses.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts - if (rootState.users.currentUser.role === 'admin') { - args['includeTypes'] = mastoApiNotificationTypes - } + args['includeTypes'] = mastoApiNotificationTypes args['withMuted'] = !hideMutedPosts args['timeline'] = 'notifications' -- cgit v1.2.3-70-g09d2 From 6a2f4270727913b8e5d4670b5b3bbc3f57f51ec5 Mon Sep 17 00:00:00 2001 From: Sean King Date: Sat, 6 Aug 2022 22:15:34 -0600 Subject: Fix lint stuff --- src/services/api/api.service.js | 2 +- src/services/notifications_fetcher/notifications_fetcher.service.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/services/notifications_fetcher/notifications_fetcher.service.js') diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index df065cab..4a15b14b 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -1352,7 +1352,7 @@ const setReportState = ({ id, state, credentials }) => { return fetch(PLEROMA_ADMIN_REPORTS, { headers: { ...authHeaders(credentials), - 'Accept': 'application/json', + Accept: 'application/json', 'Content-Type': 'application/json' }, method: 'PATCH', diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 95138a16..6c247210 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -24,7 +24,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const timelineData = rootState.statuses.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts - args['includeTypes'] = mastoApiNotificationTypes + args.includeTypes = mastoApiNotificationTypes args.withMuted = !hideMutedPosts args.timeline = 'notifications' -- cgit v1.2.3-70-g09d2