Fix PR review comments on cookie banner branding
- Add scope parameter to UpdateShowBranding to prevent cross-tenant updates - Use cmd.Context() instead of context.Background() in proboctl CLI - Drop SQL column default after backfill in migration - Add bounds check for int-to-int32 conversion in PG_POOL_SIZE - Update branding link to getprobo.com homepage Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -431,6 +431,7 @@ WHERE
|
||||
func (b *CookieBanner) UpdateShowBranding(
|
||||
ctx context.Context,
|
||||
tx pg.Tx,
|
||||
scope Scoper,
|
||||
show bool,
|
||||
) error {
|
||||
q := `
|
||||
@@ -439,14 +440,20 @@ SET
|
||||
show_branding = @show_branding,
|
||||
updated_at = @updated_at
|
||||
WHERE
|
||||
id = @id
|
||||
%s
|
||||
AND id = @id
|
||||
`
|
||||
|
||||
result, err := tx.Exec(ctx, q, pgx.StrictNamedArgs{
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{
|
||||
"id": b.ID,
|
||||
"show_branding": show,
|
||||
"updated_at": time.Now(),
|
||||
})
|
||||
}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
result, err := tx.Exec(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot update cookie banner show_branding: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user