Improve readability in fetchAnnouncements()

This commit is contained in:
Tusooa Zhu 2022-07-14 18:49:36 -04:00 committed by tusooa
parent 23a9a46580
commit f3d97cf917
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
1 changed files with 4 additions and 2 deletions

View File

@ -54,12 +54,14 @@ const announcements = {
a[c.id] = c a[c.id] = c
return a return a
}, {}) }, {})
const getWithinVisible = announcement => visibleObject[announcement.id]
all.forEach(announcement => { all.forEach(announcement => {
if (!visibleObject[announcement.id]) { const visibleAnnouncement = getWithinVisible(announcement)
if (!visibleAnnouncement) {
announcement.inactive = true announcement.inactive = true
} else { } else {
announcement.read = visibleObject[announcement.id].read announcement.read = visibleAnnouncement.read
} }
}) })