aboutsummaryrefslogtreecommitdiff
path: root/src/services/notification_utils/notification_utils.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-01-17 19:16:45 +0300
committerHenry Jameson <me@hjkos.com>2019-01-17 19:16:45 +0300
commit5251de317dcd67d123109d64a0c39037267e1705 (patch)
tree9b780b8239063558a46430a4735076af963a021e /src/services/notification_utils/notification_utils.js
parentd7bd294666cba08b6f6a8d447fbdf4cd59e66b2b (diff)
parent387bf794ffbfb202fc426a578f174e7d6e3681d6 (diff)
Merge branch 'switch-to-string-ids' into favorites
with some changes/merge conflicts resolution * switch-to-string-ids: fixx????? fix notifications? fix lint fix tests, removed one unused function, fix real problem that tests helped to surface added some more explicit to string conversion since BE seem to be sending numbers and it could cause an issue. Remove all explicit and implicit conversions of statusId to number, changed explicit ones so that they convert them to string
Diffstat (limited to 'src/services/notification_utils/notification_utils.js')
-rw-r--r--src/services/notification_utils/notification_utils.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js
index f5ac0d47..c3879677 100644
--- a/src/services/notification_utils/notification_utils.js
+++ b/src/services/notification_utils/notification_utils.js
@@ -10,8 +10,8 @@ export const visibleTypes = store => ([
].filter(_ => _))
export const visibleNotificationsFromStore = store => {
- // Don't know why, but sortBy([seen, -action.id]) doesn't work.
- let sortedNotifications = sortBy(notificationsFromStore(store), ({action}) => -action.id)
+ // map is just to clone the array since sort mutates it and it causes some issues
+ let sortedNotifications = notificationsFromStore(store).map(_ => _).sort((a, b) => a.action.id > b.action.id ? -1 : 1)
sortedNotifications = sortBy(sortedNotifications, 'seen')
return sortedNotifications.filter((notification) => visibleTypes(store).includes(notification.type))
}