add basic validation for statusless status notifications

This commit is contained in:
Shpuld Shpuldson 2021-02-26 14:27:25 +02:00
parent 59db4582b0
commit cd2f5ced31
3 changed files with 30 additions and 7 deletions

View file

@ -22,6 +22,13 @@ const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reactio
export const isStatusNotification = (type) => includes(statusNotifications, type)
export const isValidNotification = (notification) => {
if (isStatusNotification(notification.type) && !notification.status) {
return false
}
return true
}
const sortById = (a, b) => {
const seqA = Number(a.id)
const seqB = Number(b.id)