summaryrefslogtreecommitdiff
path: root/internal/subscriptions/domainperms.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-03-19 12:06:50 +0100
committerLibravatar GitHub <noreply@github.com>2025-03-19 12:06:50 +0100
commitcecb1fd00955ab8670d3099f016eeaa5af663dc5 (patch)
treeea7187d9d98beb6576ef71d1e14fc6d4f4066e6c /internal/subscriptions/domainperms.go
parent[bugfix] Avoid nil ptr if maintenance router can't be started (#3919) (diff)
downloadgotosocial-cecb1fd00955ab8670d3099f016eeaa5af663dc5.tar.xz
[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
Diffstat (limited to 'internal/subscriptions/domainperms.go')
-rw-r--r--internal/subscriptions/domainperms.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/subscriptions/domainperms.go b/internal/subscriptions/domainperms.go
index b94f284bf..c9f569f94 100644
--- a/internal/subscriptions/domainperms.go
+++ b/internal/subscriptions/domainperms.go
@@ -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) {