[bugfix] Fix set obfuscate = null error in adoptPerm (#3922)

* [chore] More tests for domain allow + block subscriptions

* [bugfix] Fix set `obfuscate = null` error in adoptPerm

* fmt
This commit is contained in:
tobi 2025-03-19 12:06:50 +01:00 committed by tobi
commit b6e56feeda
3 changed files with 175 additions and 1 deletions

View file

@ -19,6 +19,7 @@ package subscriptions
import (
"bufio"
"cmp"
"context"
"encoding/csv"
"encoding/json"
@ -869,10 +870,13 @@ func (s *Subscriptions) adoptPerm(
perm.SetCreatedByAccount(permSub.CreatedByAccount)
// Set new metadata on the perm.
perm.SetObfuscate(obfuscate)
perm.SetPrivateComment(privateComment)
perm.SetPublicComment(publicComment)
// Avoid trying to blat nil into the db directly by
// defaulting to false if not set on wanted perm.
perm.SetObfuscate(cmp.Or(obfuscate, util.Ptr(false)))
// Update the perm in the db.
var err error
switch p := perm.(type) {