- Notifications
You must be signed in to change notification settings - Fork913
feat(coderd): add mark-all-as-read endpoint for inbox notifications#16976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
coderd/database/dbmem/dbmem.go Outdated
q.inboxNotifications[idx].ReadAt = sql.NullTime{ | ||
Time: dbtime.Now(), | ||
Valid: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Shouldn't you useReadAt
fromarg
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not sure if you have a use case in mind - having it as an arg would mean the user can set the notification as read 'in the past'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Take a look atcoderd/inboxnotifications.go
:
err := api.Database.MarkAllInboxNotificationsAsRead(ctx, database.MarkAllInboxNotificationsAsReadParams{UserID: apikey.UserID,ReadAt: sql.NullTime{Time: dbtime.Now(), Valid: true},})
This is precisely how you're calling it. You need to go one way or another:
- Remove
ReadAt
from the arg. - Modify dbmem to take
dbtime.Now()
from coderd.
Let me know if this is clear. I can hop on zoom to explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ok sorry - I understood and indeed make sense :D Should be better - otherwise please tell me. 🙏
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@defelmnq Feel free to re-request reviews when the PR is ready for another look 👍 . I'll watch email notifications. |
Should be all good for another review ✅ |
Uh oh!
There was an error while loading.Please reload this page.
coderd/database/dbmem/dbmem.go Outdated
q.inboxNotifications[idx].ReadAt = sql.NullTime{ | ||
Time: dbtime.Now(), | ||
Valid: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Take a look atcoderd/inboxnotifications.go
:
err := api.Database.MarkAllInboxNotificationsAsRead(ctx, database.MarkAllInboxNotificationsAsReadParams{UserID: apikey.UserID,ReadAt: sql.NullTime{Time: dbtime.Now(), Valid: true},})
This is precisely how you're calling it. You need to go one way or another:
- Remove
ReadAt
from the arg. - Modify dbmem to take
dbtime.Now()
from coderd.
Let me know if this is clear. I can hop on zoom to explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks 👍
4960a1e
intomainUh oh!
There was an error while loading.Please reload this page.
Resolve this issue
Add a mark-all-as-read endpoint which is marking as read all notifications that are not read for the authenticated user.
Also adds the DB logic.