From 1f8cc9ef15a48c0709a8a268cb5fc7c9c1f5b2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Fri, 27 Sep 2019 09:56:48 +0200 Subject: [PATCH] Sorted notifications after concatenation by Roberts suggestion --- .../NotificationMenu/NotificationMenu.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/components/notifications/NotificationMenu/NotificationMenu.vue b/webapp/components/notifications/NotificationMenu/NotificationMenu.vue index 0b600a701..cf9cd4514 100644 --- a/webapp/components/notifications/NotificationMenu/NotificationMenu.vue +++ b/webapp/components/notifications/NotificationMenu/NotificationMenu.vue @@ -125,7 +125,15 @@ export default { const newNotifications = data.notifications.filter(newN => { return !this.displayedNotifications.find(oldN => this.equalNotification(newN, oldN)) }) - this.displayedNotifications = newNotifications.concat(this.displayedNotifications) + this.displayedNotifications = newNotifications + .concat(this.displayedNotifications) + .sort((a, b) => { + return a.createdAt === b.createdAt + ? 0 + : new Date(a.createdAt) < new Date(b.createdAt) + ? 1 + : -1 + }) this.updateOn = false return data.notifications },