mirror of
https://git.pleroma.social/sjw/pleroma-fe.git
synced 2024-12-25 02:25:57 +01:00
remove unnecessary fetchAndUpdate, change notifications fetcher to not double fetch
This commit is contained in:
parent
82944f862d
commit
62d0bc47b3
@ -56,11 +56,6 @@ const Notifications = {
|
|||||||
components: {
|
components: {
|
||||||
Notification
|
Notification
|
||||||
},
|
},
|
||||||
created () {
|
|
||||||
const { dispatch } = this.$store
|
|
||||||
|
|
||||||
dispatch('fetchAndUpdateNotifications')
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
unseenCount (count) {
|
unseenCount (count) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
@ -138,9 +138,6 @@ const api = {
|
|||||||
if (!fetcher) return
|
if (!fetcher) return
|
||||||
store.commit('removeFetcher', { fetcherName: 'notifications', fetcher })
|
store.commit('removeFetcher', { fetcherName: 'notifications', fetcher })
|
||||||
},
|
},
|
||||||
fetchAndUpdateNotifications (store) {
|
|
||||||
store.state.backendInteractor.fetchAndUpdateNotifications({ store })
|
|
||||||
},
|
|
||||||
|
|
||||||
// Follow requests
|
// Follow requests
|
||||||
startFetchingFollowRequests (store) {
|
startFetchingFollowRequests (store) {
|
||||||
|
@ -12,10 +12,6 @@ const backendInteractorService = credentials => ({
|
|||||||
return notificationsFetcher.startFetching({ store, credentials })
|
return notificationsFetcher.startFetching({ store, credentials })
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchAndUpdateNotifications ({ store }) {
|
|
||||||
return notificationsFetcher.fetchAndUpdate({ store, credentials })
|
|
||||||
},
|
|
||||||
|
|
||||||
startFetchingFollowRequests ({ store }) {
|
startFetchingFollowRequests ({ store }) {
|
||||||
return followRequestFetcher.startFetching({ store, credentials })
|
return followRequestFetcher.startFetching({ store, credentials })
|
||||||
},
|
},
|
||||||
|
@ -31,8 +31,11 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => {
|
|||||||
const notifications = timelineData.data
|
const notifications = timelineData.data
|
||||||
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
|
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
|
||||||
if (readNotifsIds.length) {
|
if (readNotifsIds.length) {
|
||||||
args['since'] = Math.max(...readNotifsIds)
|
const possibleMax = Math.max(...readNotifsIds)
|
||||||
fetchNotifications({ store, args, older })
|
if (possibleMax !== timelineData.maxId) {
|
||||||
|
args['since'] = possibleMax
|
||||||
|
fetchNotifications({ store, args, older })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user