Skip to content

Commit b1b91f7

Browse files
committed
Self-review
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent c96a215 commit b1b91f7

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 0 additions & 1 deletion
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

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/notifications.sql

Lines changed: 2 additions & 4 deletions
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)