- Notifications
You must be signed in to change notification settings - Fork928
feat: add notification for suspended/activated account#14367
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
20 commits Select commitHold shift + click to select a range
000a917
migrations
mtojek62cf15f
notify
mtojek323680c
fix
mtojekbbfb296
TestNotifyUserSuspended
mtojeke1b6c28
TestNotifyUserReactivate
mtojek9ef46de
Merge branch 'main' into 17-suspended-reactivated
mtojekc7783ac
post merge
mtojek55e4e13
fix escape
mtojek38bca28
TestNotificationTemplatesCanRender
mtojek37add7d
links and events
mtojekbaf1a95
notifyEnq
mtojeka674476
findUserAdmins
mtojek96611b1
notifyUserStatusChanged
mtojekfabba3c
go build
mtojeke72bf2a
your and admin
mtojek80b227a
tests
mtojekd27bc78
refactor
mtojeka9d8fb6
Merge branch 'main' into 17-suspended-reactivated
mtojekb789a53
247
mtojek9931bbf
Danny's review
mtojekFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletionscoderd/database/migrations/000247_notifications_user_suspended.down.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,4 @@ | ||
DELETE FROM notification_templates WHERE id = 'b02ddd82-4733-4d02-a2d7-c36f3598997d'; | ||
DELETE FROM notification_templates WHERE id = '6a2f0609-9b69-4d36-a989-9f5925b6cbff'; | ||
DELETE FROM notification_templates WHERE id = '9f5af851-8408-4e73-a7a1-c6502ba46689'; | ||
DELETE FROM notification_templates WHERE id = '1a6a6bea-ee0a-43e2-9e7c-eabdb53730e4'; |
31 changes: 31 additions & 0 deletionscoderd/database/migrations/000247_notifications_user_suspended.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,31 @@ | ||
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions) | ||
VALUES ('b02ddd82-4733-4d02-a2d7-c36f3598997d', 'User account suspended', E'User account "{{.Labels.suspended_account_name}}" suspended', | ||
E'Hi {{.UserName}},\nUser account **{{.Labels.suspended_account_name}}** has been suspended.', | ||
'User Events', '[ | ||
{ | ||
"label": "View suspended accounts", | ||
"url": "{{ base_url }}/deployment/users?filter=status%3Asuspended" | ||
} | ||
]'::jsonb); | ||
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions) | ||
VALUES ('6a2f0609-9b69-4d36-a989-9f5925b6cbff', 'Your account has been suspended', E'Your account "{{.Labels.suspended_account_name}}" has been suspended', | ||
E'Hi {{.UserName}},\nYour account **{{.Labels.suspended_account_name}}** has been suspended.', | ||
'User Events', '[]'::jsonb); | ||
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions) | ||
VALUES ('9f5af851-8408-4e73-a7a1-c6502ba46689', 'User account activated', E'User account "{{.Labels.activated_account_name}}" activated', | ||
E'Hi {{.UserName}},\nUser account **{{.Labels.activated_account_name}}** has been activated.', | ||
'User Events', '[ | ||
{ | ||
"label": "View accounts", | ||
"url": "{{ base_url }}/deployment/users?filter=status%3Aactive" | ||
} | ||
]'::jsonb); | ||
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions) | ||
VALUES ('1a6a6bea-ee0a-43e2-9e7c-eabdb53730e4', 'Your account has been activated', E'Your account "{{.Labels.activated_account_name}}" has been activated', | ||
E'Hi {{.UserName}},\nYour account **{{.Labels.activated_account_name}}** has been activated.', | ||
'User Events', '[ | ||
{ | ||
"label": "Open Coder", | ||
"url": "{{ base_url }}" | ||
} | ||
]'::jsonb); |
5 changes: 5 additions & 0 deletionscoderd/notifications/events.go
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
40 changes: 40 additions & 0 deletionscoderd/notifications/notifications_test.go
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
54 changes: 51 additions & 3 deletionscoderd/users.go
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
104 changes: 104 additions & 0 deletionscoderd/users_test.go
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.
Uh oh!
There was an error while loading.Please reload this page.
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.