From c519ce55e399b04224078a7c2e77f79a4513ca54 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Wed, 17 Apr 2019 14:48:09 +0200 Subject: [PATCH] Fixed failing integration test refs #9875 - Moved the comment about filtering by version closer to version checks as it doesn't apply to whole `.filter(...)` block --- core/server/api/v2/notifications.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/server/api/v2/notifications.js b/core/server/api/v2/notifications.js index f5ddcd42c8..96a54cd2c7 100644 --- a/core/server/api/v2/notifications.js +++ b/core/server/api/v2/notifications.js @@ -29,11 +29,11 @@ module.exports = { let allNotifications = _private.fetchAllNotifications(); allNotifications = _.orderBy(allNotifications, 'addedAt', 'desc'); - // NOTE: Filtering below is just a patch for bigger problem - notifications are not removed - // after Ghost update. Logic below should be removed when Ghost upgrade detection - // is done (https://github.com/TryGhost/Ghost/issues/10236) and notifications are - // be removed permanently on upgrade event. allNotifications = allNotifications.filter((notification) => { + // NOTE: Filtering by version below is just a patch for bigger problem - notifications are not removed + // after Ghost update. Logic below should be removed when Ghost upgrade detection + // is done (https://github.com/TryGhost/Ghost/issues/10236) and notifications are + // be removed permanently on upgrade event. const ghost20RegEx = /Ghost 2.0 is now available/gi; // CASE: do not return old release notification @@ -42,7 +42,7 @@ module.exports = { if (notification.message.match(ghost20RegEx)) { notificationVersion = '2.0.0'; - } else { + } else if (notificationVersion){ notificationVersion = notificationVersion[0]; }