commit: f3d97cf917172735d9058ad4f308ea401832e7d6
parent 23a9a46580355edd8f87ed14c48ccf4279d6fef1
Author: Tusooa Zhu <tusooa@kazv.moe>
Date: Thu, 14 Jul 2022 18:49:36 -0400
Improve readability in fetchAnnouncements()
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git 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
}
})