#436: implement is_seen logic
This commit is contained in:
parent
55d7bd6d4e
commit
060d3b0713
@ -280,7 +280,7 @@ export const parseNotification = (data) => {
|
|||||||
|
|
||||||
if (masto) {
|
if (masto) {
|
||||||
output.type = mastoDict[data.type] || data.type
|
output.type = mastoDict[data.type] || data.type
|
||||||
// output.seen = ??? missing
|
output.seen = data.pleroma.is_seen
|
||||||
output.status = output.type === 'follow'
|
output.status = output.type === 'follow'
|
||||||
? parseFollow(data)
|
? parseFollow(data)
|
||||||
: parseStatus(data.status)
|
: parseStatus(data.status)
|
||||||
|
@ -11,30 +11,32 @@ const fetchAndUpdate = ({store, credentials, older = false}) => {
|
|||||||
const rootState = store.rootState || store.state
|
const rootState = store.rootState || store.state
|
||||||
const timelineData = rootState.statuses.notifications
|
const timelineData = rootState.statuses.notifications
|
||||||
|
|
||||||
|
args['timeline'] = 'notifications'
|
||||||
if (older) {
|
if (older) {
|
||||||
if (timelineData.minId !== Number.POSITIVE_INFINITY) {
|
if (timelineData.minId !== Number.POSITIVE_INFINITY) {
|
||||||
args['until'] = timelineData.minId
|
args['until'] = timelineData.minId
|
||||||
}
|
}
|
||||||
|
return fetchNotifications({ store, args, older })
|
||||||
} else {
|
} else {
|
||||||
|
// fetch new notifications
|
||||||
if (timelineData.maxId !== Number.POSITIVE_INFINITY) {
|
if (timelineData.maxId !== Number.POSITIVE_INFINITY) {
|
||||||
args['since'] = timelineData.maxId
|
args['since'] = timelineData.maxId
|
||||||
}
|
}
|
||||||
// # disabled until is_seen is impelented on the BE
|
const result = fetchNotifications({ store, args, older })
|
||||||
// load unread notifications repeadedly to provide consistency between browser tabs
|
|
||||||
// const notifications = timelineData.data
|
// load unread notifications repeatedly to provide consistency between browser tabs
|
||||||
// const unread = notifications.filter(n => !n.seen).map(n => n.id)
|
const notifications = timelineData.data
|
||||||
// if (!unread.length) {
|
const unread = notifications.filter(n => !n.seen).map(n => n.id)
|
||||||
// args['since'] = timelineData.maxId
|
if (unread.length) {
|
||||||
// } else {
|
args['since'] = Math.min(...unread)
|
||||||
// args['since'] = Math.min(...unread) - 1
|
fetchNotifications({ store, args, older })
|
||||||
// if (timelineData.maxId !== Math.max(...unread)) {
|
|
||||||
// args['until'] = Math.max(...unread, args['since'] + 20)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
args['timeline'] = 'notifications'
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchNotifications = ({ store, args, older }) => {
|
||||||
return apiService.fetchTimeline(args)
|
return apiService.fetchTimeline(args)
|
||||||
.then((notifications) => {
|
.then((notifications) => {
|
||||||
update({ store, notifications, older })
|
update({ store, notifications, older })
|
||||||
|
Loading…
Reference in New Issue
Block a user