-
Notifications
You must be signed in to change notification settings - Fork 876
feat: add notifications inbox db #16599
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
90c7b64
work on db queries
defelmnq e205049
work on dbauthz
defelmnq ef91969
work on dbauthz
defelmnq 72e6de4
fmt and lint
defelmnq 9edb384
change queries to match targets
defelmnq dc74ac4
test dbauthz
defelmnq 6c9e41f
move notification migration
defelmnq 1f18eca
make gen
defelmnq d02609f
Merge remote-tracking branch 'origin/main' into notif-inbox/int-334
defelmnq 3bb9c57
rename inbox notifications
defelmnq 27c1592
rename inbox notifications
defelmnq 08c55c3
Improve authz
defelmnq b441448
add references in db
defelmnq 1814c58
fix test icon
defelmnq 9f46f51
improve foreign keys
defelmnq ddc65e6
add back querier file
defelmnq d1ce11e
improve uuid in seeding
defelmnq 1f2fa24
improve dbauthz testing
defelmnq 791ed76
format migration
defelmnq e141354
format migration
defelmnq a14723b
format migration
defelmnq e413ab9
rename functions
defelmnq 452583e
add back index
defelmnq 5aa54e1
fix query name missing
defelmnq da56e8f
regen file
defelmnq 30b5ac4
add count queries
defelmnq 8230ef3
improve queries to add pagination
defelmnq 783bfe0
fix dbauthz tests
defelmnq c5aa917
fix sqlc queries
defelmnq da50947
improve dbauthz testing
defelmnq c1da7f8
improve sql queries
defelmnq f03976c
add type for read status
defelmnq 94763e8
iterate on testing dbauthz
defelmnq 0c5d322
change zero value of timestamp
defelmnq 66d6fd6
add returns check in tests
defelmnq c45dfce
Merge remote-tracking branch 'origin/main' into notif-inbox/int-334
defelmnq b54dbef
rename migration
defelmnq e2e895b
improve queries comments
defelmnq e6abcbd
cange type for read status
defelmnq f691cf5
merge
defelmnq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
rename inbox notifications
fix rbac roles
- Loading branch information
commit 27c159281997b82ec09ed92225e49bfc0775c42e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
DROP TABLE IF EXISTS notifications_inbox; | ||
DROP TABLE IF EXISTS inbox_notifications; |
25 changes: 25 additions & 0 deletions
25
coderd/database/migrations/testdata/fixtures/000296_notifications_inbox.up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
INSERT INTO | ||
inbox_notifications ( | ||
id, | ||
user_id, | ||
template_id, | ||
targets, | ||
title, | ||
content, | ||
icon, | ||
actions, | ||
read_at, | ||
created_at | ||
) | ||
VALUES ( | ||
'68b396aa-7f53-4bf1-b8d8-4cbf5fa244e5', -- uuid | ||
'45e89705-e09d-4850-bcec-f9a937f5d78d', -- uuid | ||
'193590e9-918f-4ef9-be47-04625f49c4c3', -- uuid | ||
ARRAY[]::UUID[], -- uuid[] | ||
'Test Notification', | ||
'This is a test notification', | ||
'https://test.coder.com/favicon.ico', | ||
'{}', | ||
'2024-01-01 00:00:00', | ||
'2024-01-01 00:00:00' | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why does
orgMemberMe
have privileges topolicy.ActionCreate
inbox notifications?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.
From my RBAC understanding
orgMemberMe
is the current user.Associated to this part on the which we use the
currentUser
id.In the definition of the ResourceInboxNotification, I assign the
currentUser
toInboxNotification
using theWithOwner(currentUser.String())
method.TL;DR -
orgMemberMe
is the owner of the resource in the test - and the owner of the resource should be able to access it.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.
I think we might want
memberMe
in here as well?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.
@defelmnq I understand why the current user should be able to read their own messages, but why should they be allowed to create new messages? That should be a system privilege.