N
Novuβ€’2y ago
bigheartedkb

Deleting Notifications from the In-App Notification Center

I'm developing a website for a client and we're using the in-app notification center using React. He was asking about allowing users to delete or clear notifications after they've been read. Currently we can set them to 'read' status but not delete them. I looked through the docs, and briefly looked through the codebase and didn't see anything about deleting in app notifications. Is there currently a way I didn't see? We're using the cloud hosted version if that matters.
29 Replies
bigheartedkb
bigheartedkbβ€’2y ago
We're using a custom Item renderer so technically I could return an empty div when the notification has been read. Which fixes it 'visually' but the data is still being passed down to the website.
Novu_Bot
Novu_Botβ€’2y ago
@bigheartedkb, you just advanced to level 2!
Gali Baum
Gali Baumβ€’2y ago
We definitely have plans to add delete(among other options) for a notification item I have a suggestion that might help, just for now. You could use the stores - which are a way to query notifications for a parameter (like feedIdentifier and also seen state of notification) @bigheartedkb
<NovuProvider
stores={[{ storeId: 'default_store', query: { seen: false } }]}
backendUrl={API_ROOT}
socketUrl={WS_URL}
subscriberId={user?._id as string}
applicationIdentifier={environment?.identifier as string}
>
<PopoverWrapper />
</NovuProvider>
<NovuProvider
stores={[{ storeId: 'default_store', query: { seen: false } }]}
backendUrl={API_ROOT}
socketUrl={WS_URL}
subscriberId={user?._id as string}
applicationIdentifier={environment?.identifier as string}
>
<PopoverWrapper />
</NovuProvider>
That will query only the notifications that were not read yet and then
useNotifications(storeId)
useNotifications(storeId)
empe
empeβ€’2y ago
@bigheartedkb my mannnn!!!!!
Dima Grossman
Dima Grossmanβ€’2y ago
@davidsouthmountain I think you have added already the remove message enedpoint right?
DavidSouthmountain
DavidSouthmountainβ€’2y ago
Yes I did and it can be found here https://github.com/novuhq/novu/blob/main/apps/api/src/app/messages/messages.controller.ts#L75 πŸ™‚ @dimagrossman maybe we should add the Messages api tag to be shown in swagger json so it is shown in api doc?
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Dima Grossman
Dima Grossmanβ€’2y ago
Oh yes, looks like a mistake. We should add a Tag. @florian_lefebvre mind adding a github issue for this? !issue !issue
Novu_Bot
Novu_Botβ€’2y ago
Want to report a bug or request a feature? Let's open an issue. Just click here πŸ‘‡ https://github.com/novuhq/novu/issues/new/choose
DavidSouthmountain
DavidSouthmountainβ€’2y ago
@dimagrossman
DavidSouthmountain
DavidSouthmountainβ€’2y ago
this solves that problem
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Novu_Bot
Novu_Botβ€’2y ago
@florian_lefebvre, you just advanced to level 4!
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
DavidSouthmountain
DavidSouthmountainβ€’2y ago
you could use refetch that useNotification expose?
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
DavidSouthmountain
DavidSouthmountainβ€’2y ago
@arc.13 could you see if this works now as well?
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
DavidSouthmountain
DavidSouthmountainβ€’2y ago
okay so lets see if we can solve this as well πŸ™‚ Can I close the other one?
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
DavidSouthmountain
DavidSouthmountainβ€’2y ago
nice then I close both of them πŸ™‚
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Dima Grossman
Dima Grossmanβ€’2y ago
@george.d do you recall by chance if we also expose unreadCount here?
george.d
george.dβ€’2y ago
I don’t believe we do at the moment. The toggle between seen/read on the notifications center is still missing.
Dima Grossman
Dima Grossmanβ€’2y ago
Do you mind creating an issue for that?
george.d
george.dβ€’2y ago
Not sure if you meant me or someone else, but not problem at all i will create shortly πŸ™‚
george.d
george.dβ€’2y ago
Hopefully it is well detailed πŸ™ƒ https://github.com/novuhq/novu/issues/2123
GitHub
[NV-1266] Notification-Center bell seen/read toggle Β· Issue #2123 Β·...
At the current state notification-center bell counter uses the seen count in order to present the bell dot and counter on the notification center header. What we want is the ability for the user of...