feat: add killswitch for notifications (#13794)

This commit is contained in:
Marcin Tojek
2024-07-10 16:15:06 +02:00
committed by GitHub
parent 542fff7df0
commit bf392ffea4
31 changed files with 774 additions and 25 deletions
+22
View File
@@ -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(&notifications_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'