Remove query from notif isSeen logic

This commit is contained in:
Ian Philips 2022-07-18 08:18:40 -06:00
parent d012561c50
commit eb4906cb97

View File

@ -289,15 +289,17 @@ function GroupsList(props: {
// Set notification as seen if our current page is equal to the isSeenOnHref property // Set notification as seen if our current page is equal to the isSeenOnHref property
useEffect(() => { useEffect(() => {
const currentPageGroupSlug = currentPage.split('/')[2] const currentPageWithoutQuery = currentPage.split('?')[0]
const currentPageGroupSlug = currentPageWithoutQuery.split('/')[2]
preferredNotifications.forEach((notification) => { preferredNotifications.forEach((notification) => {
if ( if (
notification.isSeenOnHref === currentPage || notification.isSeenOnHref === currentPage ||
// Old chat style group chat notif ended just with the group slug // Old chat style group chat notif was just /group/slug
notification.isSeenOnHref?.includes(currentPageGroupSlug) || (notification.isSeenOnHref &&
currentPageWithoutQuery.includes(notification.isSeenOnHref)) ||
// They're on the home page, so if they've a chat notif, they're seeing the chat // They're on the home page, so if they've a chat notif, they're seeing the chat
(notification.isSeenOnHref?.endsWith(GROUP_CHAT_SLUG) && (notification.isSeenOnHref?.endsWith(GROUP_CHAT_SLUG) &&
currentPage.endsWith(currentPageGroupSlug)) currentPageWithoutQuery.endsWith(currentPageGroupSlug))
) { ) {
setNotificationsAsSeen([notification]) setNotificationsAsSeen([notification])
} }