Actually fix notifications
This commit is contained in:
parent
9ceb3f3e78
commit
bbc2f7ff5f
3 changed files with 7 additions and 5 deletions
|
|
@ -349,7 +349,6 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
|||
// Only add a new notification if we don't have one for the same action
|
||||
if (!state.notifications.idStore.hasOwnProperty(notification.id)) {
|
||||
updateNotificationsMinMaxId(state, notification)
|
||||
notification.seen = false
|
||||
|
||||
state.notifications.data.push(notification)
|
||||
state.notifications.idStore[notification.id] = notification
|
||||
|
|
|
|||
|
|
@ -775,7 +775,7 @@ const fetchTimeline = ({
|
|||
let statusText = ''
|
||||
|
||||
let pagination = {}
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
return markerPromise.then(() => fetch(url, { headers: authHeaders(credentials) }))
|
||||
.then((data) => {
|
||||
status = data.status
|
||||
statusText = data.statusText
|
||||
|
|
@ -794,7 +794,10 @@ const fetchTimeline = ({
|
|||
throw new Error(data.error)
|
||||
}
|
||||
if (!data.errors) {
|
||||
if (isNotifications) data.map((val) => val.last_read = markers.last_read_id)
|
||||
if (isNotifications) data = data.map((val) => {
|
||||
val.last_read = markers.last_read_id
|
||||
return val
|
||||
})
|
||||
return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination }
|
||||
} else {
|
||||
data.status = status
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { filter, sortBy, includes } from 'lodash'
|
||||
import { filter, orderBy, includes } from 'lodash'
|
||||
import { muteWordHits } from '../status_parser/status_parser.js'
|
||||
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ export const maybeShowNotification = (store, notification) => {
|
|||
export const filteredNotificationsFromStore = (store, types) => {
|
||||
// map is just to clone the array since sort mutates it and it causes some issues
|
||||
let sortedNotifications = notificationsFromStore(store).map(_ => _).sort(sortById)
|
||||
sortedNotifications = sortBy(sortedNotifications, 'seen')
|
||||
sortedNotifications = orderBy(sortedNotifications, 'id', 'desc')
|
||||
return sortedNotifications.filter(
|
||||
(notification) => (types || visibleTypes(store)).includes(notification.type)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue