aboutsummaryrefslogtreecommitdiff
path: root/src/services/notifications_fetcher/notifications_fetcher.service.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2020-10-17 19:24:07 +0300
committerHenry Jameson <me@hjkos.com>2020-10-17 19:24:07 +0300
commit29ff0be92cfd87ba95d1f78323794dfb1223b514 (patch)
tree79836b7fb5b3e325274a833c34fd4c5f6155ba2d /src/services/notifications_fetcher/notifications_fetcher.service.js
parenta463959a365a5d618a79c96a26f6506e700d6ea3 (diff)
parent3ca729d09880813420a263221cdc68bcca13a1fb (diff)
Merge remote-tracking branch 'origin/develop' into settings-changed
* origin/develop: (48 commits) fix/leftover-emoji-checkboxes-in-settings Apply 1 suggestion(s) to 1 file(s) Translated using Weblate (Spanish) Translated using Weblate (Persian) Translated using Weblate (Persian) Translated using Weblate (Polish) update changelog Stop click propagation when unhiding nsfw Fix Follow Requests title style Translated using Weblate (Persian) Translated using Weblate (Persian) Translated using Weblate (French) Added translation using Weblate (Persian) Translated using Weblate (Chinese (Traditional)) Translated using Weblate (Chinese (Simplified)) Translated using Weblate (Italian) Translated using Weblate (English) Translated using Weblate (English) Translated using Weblate (Basque) Translated using Weblate (Spanish) ...
Diffstat (limited to 'src/services/notifications_fetcher/notifications_fetcher.service.js')
-rw-r--r--src/services/notifications_fetcher/notifications_fetcher.service.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js
index 80be02ca..c908b644 100644
--- a/src/services/notifications_fetcher/notifications_fetcher.service.js
+++ b/src/services/notifications_fetcher/notifications_fetcher.service.js
@@ -1,4 +1,5 @@
import apiService from '../api/api.service.js'
+import { promiseInterval } from '../promise_interval/promise_interval.js'
const update = ({ store, notifications, older }) => {
store.dispatch('setNotificationsError', { value: false })
@@ -39,6 +40,7 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => {
args['since'] = Math.max(...readNotifsIds)
fetchNotifications({ store, args, older })
}
+
return result
}
}
@@ -53,13 +55,13 @@ const fetchNotifications = ({ store, args, older }) => {
}
const startFetching = ({ credentials, store }) => {
- fetchAndUpdate({ credentials, store })
- const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
// Initially there's set flag to silence all desktop notifications so
// that there won't spam of them when user just opened up the FE we
// reset that flag after a while to show new notifications once again.
setTimeout(() => store.dispatch('setNotificationsSilence', false), 10000)
- return setInterval(boundFetchAndUpdate, 10000)
+ const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
+ boundFetchAndUpdate()
+ return promiseInterval(boundFetchAndUpdate, 10000)
}
const notificationsFetcher = {