Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
defelmnq merged 12 commits intomainfromcoder-inbox/internal-506
Mar 20, 2025

Conversation

defelmnq
Copy link
Contributor

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.

@defelmnqdefelmnq self-assigned thisMar 18, 2025
@defelmnqdefelmnq marked this pull request as ready for reviewMarch 18, 2025 17:56
Comment on lines 9509 to 9511
q.inboxNotifications[idx].ReadAt = sql.NullTime{
Time: dbtime.Now(),
Valid: true,
Copy link
Member

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?

Copy link
ContributorAuthor

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'.

Copy link
Member

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:

  1. RemoveReadAt from the arg.
  2. Modify dbmem to takedbtime.Now() from coderd.

Let me know if this is clear. I can hop on zoom to explain.

Copy link
ContributorAuthor

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. 🙏

@mtojek
Copy link
Member

@defelmnq Feel free to re-request reviews when the PR is ready for another look 👍 . I'll watch email notifications.

@defelmnq
Copy link
ContributorAuthor

Should be all good for another review ✅

Comment on lines 9509 to 9511
q.inboxNotifications[idx].ReadAt = sql.NullTime{
Time: dbtime.Now(),
Valid: true,
Copy link
Member

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:

  1. RemoveReadAt from the arg.
  2. Modify dbmem to takedbtime.Now() from coderd.

Let me know if this is clear. I can hop on zoom to explain.

@defelmnqdefelmnq requested a review frommtojekMarch 20, 2025 12:19
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks 👍

@defelmnqdefelmnq merged commit4960a1e intomainMar 20, 2025
32 checks passed
@defelmnqdefelmnq deleted the coder-inbox/internal-506 branchMarch 20, 2025 12:41
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 20, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mtojekmtojekmtojek approved these changes

@BrunoQuaresmaBrunoQuaresmaAwaiting requested review from BrunoQuaresma

@johnstcnjohnstcnAwaiting requested review from johnstcn

@DanielleMaywoodDanielleMaywoodAwaiting requested review from DanielleMaywood

Assignees

@defelmnqdefelmnq

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@defelmnq@mtojek@DanielleMaywood

[8]ページ先頭

©2009-2025 Movatter.jp