Skip to content

Commit 0030472

Browse files
committed
policyeval/execute: AutoSuspendPrefix need not be a pointer
1 parent 15a2411 commit 0030472

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

config/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type WatchedPolicyList struct {
2020
DontApplyACL bool `json:"dont_apply_acl"`
2121
AutoUnban bool `json:"auto_unban"`
2222
AutoSuspend bool `json:"auto_suspend"`
23-
AutoSuspendPrefix *string `json:"auto_suspend_prefix,omitempty"`
23+
AutoSuspendPrefix string `json:"auto_suspend_prefix"`
2424

2525
DontNotifyOnChange bool `json:"dont_notify_on_change"`
2626
}

policyeval/execute.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,7 @@ func (pe *PolicyEvaluator) maybeApplySuspend(ctx context.Context, userID id.User
136136
return
137137
}
138138
plist := pe.GetWatchedListMeta(policy.RoomID)
139-
if !plist.AutoSuspend {
140-
return
141-
}
142-
if plist.AutoSuspendPrefix != nil && !strings.HasPrefix(*plist.AutoSuspendPrefix, policy.Reason) {
139+
if !plist.AutoSuspend || !strings.HasPrefix(plist.AutoSuspendPrefix, policy.Reason) {
143140
return
144141
}
145142
err := pe.Bot.SynapseAdmin.SuspendAccount(ctx, userID, synapseadmin.ReqSuspendUser{Suspend: true})

0 commit comments

Comments
 (0)