From 910b82e231fd3a6fe2e53990d87972066fe1a23c Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 14 Jan 2020 11:13:59 +0200 Subject: Use last seen notif instead of first unseen notif for sinceId --- .../notifications_fetcher/notifications_fetcher.service.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (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 47008026..64499a1b 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -2,7 +2,6 @@ import apiService from '../api/api.service.js' const update = ({ store, notifications, older }) => { store.dispatch('setNotificationsError', { value: false }) - store.dispatch('addNewNotifications', { notifications, older }) } @@ -30,9 +29,9 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { // load unread notifications repeatedly to provide consistency between browser tabs const notifications = timelineData.data - const unread = notifications.filter(n => !n.seen).map(n => n.id) - if (unread.length) { - args['since'] = Math.min(...unread) + const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id) + if (readNotifsIds.length) { + args['since'] = Math.max(...readNotifsIds) fetchNotifications({ store, args, older }) } -- cgit v1.2.3-70-g09d2 From a06f3a7fbc40cd51df3c2d04406494cf60b0cf8a Mon Sep 17 00:00:00 2001 From: kPherox Date: Tue, 4 Feb 2020 04:37:29 +0900 Subject: Add `with_move` param for fetching notification --- src/services/api/api.service.js | 6 +++++- src/services/notifications_fetcher/notifications_fetcher.service.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) (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 11aa0675..b794fd58 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -495,7 +495,8 @@ const fetchTimeline = ({ until = false, userId = false, tag = false, - withMuted = false + withMuted = false, + withMove = false }) => { const timelineUrls = { public: MASTODON_PUBLIC_TIMELINE, @@ -535,6 +536,9 @@ const fetchTimeline = ({ if (timeline === 'public' || timeline === 'publicAndExternal') { params.push(['only_media', false]) } + if (timeline === 'notifications') { + params.push(['with_move', withMove]) + } params.push(['count', 20]) params.push(['with_muted', withMuted]) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 64499a1b..864e32f8 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -11,9 +11,12 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { const rootState = store.rootState || store.state const timelineData = rootState.statuses.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts + const allowFollowingMove = rootState.users.currentUser.allow_following_move args['withMuted'] = !hideMutedPosts + args['withMove'] = !allowFollowingMove + args['timeline'] = 'notifications' if (older) { if (timelineData.minId !== Number.POSITIVE_INFINITY) { -- cgit v1.2.3-70-g09d2 From 02c8a9e3143f2b12f44d24f307e2718dec22987b Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Fri, 1 May 2020 17:26:07 +0300 Subject: remove with_move param --- src/services/api/api.service.js | 6 +----- src/services/notifications_fetcher/notifications_fetcher.service.js | 3 --- 2 files changed, 1 insertion(+), 8 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 ad2b2ad5..3c6b8f4e 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -495,8 +495,7 @@ const fetchTimeline = ({ until = false, userId = false, tag = false, - withMuted = false, - withMove = false + withMuted = false }) => { const timelineUrls = { public: MASTODON_PUBLIC_TIMELINE, @@ -536,9 +535,6 @@ const fetchTimeline = ({ if (timeline === 'public' || timeline === 'publicAndExternal') { params.push(['only_media', false]) } - if (timeline === 'notifications') { - params.push(['with_move', withMove]) - } params.push(['limit', 20]) params.push(['with_muted', withMuted]) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 864e32f8..64499a1b 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -11,12 +11,9 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { const rootState = store.rootState || store.state const timelineData = rootState.statuses.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts - const allowFollowingMove = rootState.users.currentUser.allow_following_move args['withMuted'] = !hideMutedPosts - args['withMove'] = !allowFollowingMove - args['timeline'] = 'notifications' if (older) { if (timelineData.minId !== Number.POSITIVE_INFINITY) { -- cgit v1.2.3-70-g09d2