From f3d97cf917172735d9058ad4f308ea401832e7d6 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 14 Jul 2022 18:49:36 -0400 Subject: [PATCH] Improve readability in fetchAnnouncements() --- src/modules/announcements.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/announcements.js b/src/modules/announcements.js index ab16626c..0f8b6d09 100644 --- a/src/modules/announcements.js +++ b/src/modules/announcements.js @@ -54,12 +54,14 @@ const announcements = { a[c.id] = c return a }, {}) + const getWithinVisible = announcement => visibleObject[announcement.id] all.forEach(announcement => { - if (!visibleObject[announcement.id]) { + const visibleAnnouncement = getWithinVisible(announcement) + if (!visibleAnnouncement) { announcement.inactive = true } else { - announcement.read = visibleObject[announcement.id].read + announcement.read = visibleAnnouncement.read } })