mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add killswitch for notifications (#13794)
This commit is contained in:
@@ -6319,6 +6319,18 @@ func (q *sqlQuerier) GetLogoURL(ctx context.Context) (string, error) {
|
||||
return value, err
|
||||
}
|
||||
|
||||
const getNotificationsSettings = `-- name: GetNotificationsSettings :one
|
||||
SELECT
|
||||
COALESCE((SELECT value FROM site_configs WHERE key = 'notifications_settings'), '{}') :: text AS notifications_settings
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) GetNotificationsSettings(ctx context.Context) (string, error) {
|
||||
row := q.db.QueryRowContext(ctx, getNotificationsSettings)
|
||||
var notifications_settings string
|
||||
err := row.Scan(¬ifications_settings)
|
||||
return notifications_settings, err
|
||||
}
|
||||
|
||||
const getOAuthSigningKey = `-- name: GetOAuthSigningKey :one
|
||||
SELECT value FROM site_configs WHERE key = 'oauth_signing_key'
|
||||
`
|
||||
@@ -6431,6 +6443,16 @@ func (q *sqlQuerier) UpsertLogoURL(ctx context.Context, value string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertNotificationsSettings = `-- name: UpsertNotificationsSettings :exec
|
||||
INSERT INTO site_configs (key, value) VALUES ('notifications_settings', $1)
|
||||
ON CONFLICT (key) DO UPDATE SET value = $1 WHERE site_configs.key = 'notifications_settings'
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) UpsertNotificationsSettings(ctx context.Context, value string) error {
|
||||
_, err := q.db.ExecContext(ctx, upsertNotificationsSettings, value)
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertOAuthSigningKey = `-- name: UpsertOAuthSigningKey :exec
|
||||
INSERT INTO site_configs (key, value) VALUES ('oauth_signing_key', $1)
|
||||
ON CONFLICT (key) DO UPDATE set value = $1 WHERE site_configs.key = 'oauth_signing_key'
|
||||
|
||||
Reference in New Issue
Block a user