Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76d4ca5

Browse files
committed
Self-review
Signed-off-by: Danny Kopping <[email protected]>
1 parent 46a6d51 commit 76d4ca5

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

coderd/database/dbauthz/dbauthz.go

-1
Original file line numberDiff line numberDiff line change
@@ -3034,7 +3034,6 @@ func (q *querier) UpdateMemberRoles(ctx context.Context, arg database.UpdateMemb
30343034
}
30353035

30363036
func (q *querier) UpdateNotificationTemplateMethodByID(ctx context.Context, arg database.UpdateNotificationTemplateMethodByIDParams) (database.NotificationTemplate, error) {
3037-
// TODO: how to restrict this to admins?
30383037
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceNotificationTemplate); err != nil {
30393038
return database.NotificationTemplate{}, err
30403039
}

coderd/database/queries.sql.go

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/notifications.sql

+2-4
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,11 @@ FROM notification_preferences
146146
WHERE user_id = @user_id::uuid;
147147

148148
-- name: UpdateUserNotificationPreferences :execrows
149-
WITH new_values AS
150-
(SELECT UNNEST(@notification_template_ids::uuid[]) AS notification_template_id,
151-
UNNEST(@disableds::bool[]) AS disabled)
152149
INSERT
153150
INTO notification_preferences (user_id, notification_template_id, disabled)
154151
SELECT @user_id::uuid, new_values.notification_template_id, new_values.disabled
155-
FROM new_values
152+
FROM (SELECT UNNEST(@notification_template_ids::uuid[]) AS notification_template_id,
153+
UNNEST(@disableds::bool[]) AS disabled) AS new_values
156154
ON CONFLICT (user_id, notification_template_id) DO UPDATE
157155
SET disabled = EXCLUDED.disabled,
158156
updated_at = CURRENT_TIMESTAMP;

0 commit comments

Comments
 (0)