Skip to content

Commit 2dcf1d0

Browse files
committed
policyeval/execute: Add capability to auto-suspend on prefix
1 parent 7e9d781 commit 2dcf1d0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

config/event.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ var (
1313
)
1414

1515
type WatchedPolicyList struct {
16-
RoomID id.RoomID `json:"room_id"`
17-
Name string `json:"name"`
18-
Shortcode string `json:"shortcode"`
19-
DontApply bool `json:"dont_apply"`
20-
DontApplyACL bool `json:"dont_apply_acl"`
21-
AutoUnban bool `json:"auto_unban"`
22-
AutoSuspend bool `json:"auto_suspend"`
16+
RoomID id.RoomID `json:"room_id"`
17+
Name string `json:"name"`
18+
Shortcode string `json:"shortcode"`
19+
DontApply bool `json:"dont_apply"`
20+
DontApplyACL bool `json:"dont_apply_acl"`
21+
AutoUnban bool `json:"auto_unban"`
22+
AutoSuspendPrefix *string `json:"auto_suspend_prefix,omitempty"`
2323

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

policyeval/execute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +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 {
139+
if plist.AutoSuspendPrefix == nil || !strings.HasPrefix(*plist.AutoSuspendPrefix, policy.Reason) {
140140
return
141141
}
142142
err := pe.Bot.SynapseAdmin.SuspendAccount(ctx, userID, synapseadmin.ReqSuspendUser{Suspend: true})

0 commit comments

Comments
 (0)