diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 26ffbab6c46e5019cdb22bd585d38aea46322f6b..e999a18e6f0cefb984f1cf18b6294465636a992d 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -56,11 +56,6 @@ const Notifications = { components: { Notification }, - created () { - const { dispatch } = this.$store - - dispatch('fetchAndUpdateNotifications') - }, watch: { unseenCount (count) { if (count > 0) { diff --git a/src/modules/api.js b/src/modules/api.js index 748570e5649262242de9cf8ddb81b3fe1ac54e4b..04ef6ab422b10119a1b0f7da6ca1034c4f514b57 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -138,9 +138,6 @@ const api = { if (!fetcher) return store.commit('removeFetcher', { fetcherName: 'notifications', fetcher }) }, - fetchAndUpdateNotifications (store) { - store.state.backendInteractor.fetchAndUpdateNotifications({ store }) - }, // Follow requests startFetchingFollowRequests (store) { diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index e1c32860de0aa9daf1d6de9af8bceef77b778793..45e6bd0e1735868976c6f59fba540d2679053246 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -12,10 +12,6 @@ const backendInteractorService = credentials => ({ return notificationsFetcher.startFetching({ store, credentials }) }, - fetchAndUpdateNotifications ({ store }) { - return notificationsFetcher.fetchAndUpdate({ store, credentials }) - }, - startFetchingFollowRequests ({ store }) { return followRequestFetcher.startFetching({ store, credentials }) }, diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 64499a1b65b137cff7d7df78ecc30245ad00f7a9..581931f5b5eb7306e29d787db2ee606dedaee254 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -31,8 +31,11 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { const notifications = timelineData.data const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id) if (readNotifsIds.length) { - args['since'] = Math.max(...readNotifsIds) - fetchNotifications({ store, args, older }) + const possibleMax = Math.max(...readNotifsIds) + if (possibleMax !== timelineData.maxId) { + args['since'] = possibleMax + fetchNotifications({ store, args, older }) + } } return result