From e5e1d4c643d6b69217fb9a62b60f3f9c94ef4714 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 14 Mar 2019 07:55:39 -0400 Subject: [PATCH] #436: fix notification order, follow type link issue, duplicate key --- src/components/notification/notification.vue | 7 ++++++- src/components/notifications/notifications.vue | 2 +- src/modules/statuses.js | 8 ++++---- .../entity_normalizer/entity_normalizer.service.js | 2 +- src/services/notification_utils/notification_utils.js | 6 +++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 87b0fde2..6e8e9844 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -30,7 +30,12 @@ {{$t('notifications.followed_you')}} -
+
+ + + +
+
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 6438361d..5a5f8ed8 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -13,7 +13,7 @@
-
+
diff --git a/src/modules/statuses.js b/src/modules/statuses.js index fde783a5..4cc3907d 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -269,11 +269,11 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us } const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes }) => { - const allStatuses = state.allStatuses - const allStatusesObject = state.allStatusesObject + // const allStatuses = state.allStatuses + // const allStatusesObject = state.allStatusesObject each(notifications, (notification) => { - notification.action = mergeOrAdd(allStatuses, allStatusesObject, notification.action).item - notification.status = notification.status && mergeOrAdd(allStatuses, allStatusesObject, notification.status).item + // notification.action = mergeOrAdd(allStatuses, allStatusesObject, notification.action).item + // notification.status = notification.status && mergeOrAdd(allStatuses, allStatusesObject, notification.status).item // Only add a new notification if we don't have one for the same action if (!state.notifications.idStore.hasOwnProperty(notification.id)) { diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 5444a1e3..4ca7f56b 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -275,7 +275,7 @@ export const parseNotification = (data) => { output.status = output.type === 'follow' ? parseFollow(data) : parseStatus(data.status) - if (data.type === 'reblog') { + if (data.type === 'reblog' || data.type === 'favourite') { output.status.user = parseUser(data.account) output.status.created_at = new Date(data.created_at) } diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index cd8f3f9e..8afd114e 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(_ => _)) const sortById = (a, b) => { - const seqA = Number(a.action.id) - const seqB = Number(b.action.id) + const seqA = Number(a.id) + const seqB = Number(b.id) const isSeqA = !Number.isNaN(seqA) const isSeqB = !Number.isNaN(seqB) if (isSeqA && isSeqB) { @@ -21,7 +21,7 @@ const sortById = (a, b) => { } else if (!isSeqA && isSeqB) { return -1 } else { - return a.action.id > b.action.id ? -1 : 1 + return a.id > b.id ? -1 : 1 } }