mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 14:33:10 -06:00
Empty actions are now allowed
This commit is contained in:
parent
5ced1a11e7
commit
6abc40a896
|
|
@ -18,9 +18,6 @@ func ValidateRule(kind Kind, rule *Rule) []error {
|
|||
errs = append(errs, fmt.Errorf("invalid rule ID: %s", rule.RuleID))
|
||||
}
|
||||
|
||||
if len(rule.Actions) == 0 {
|
||||
errs = append(errs, fmt.Errorf("missing actions"))
|
||||
}
|
||||
for _, action := range rule.Actions {
|
||||
errs = append(errs, validateAction(action)...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ func TestValidateRuleNegatives(t *testing.T) {
|
|||
{Name: "emptyRuleID", Kind: OverrideKind, Rule: Rule{}, WantErrString: "invalid rule ID"},
|
||||
{Name: "invalidKind", Kind: Kind("something else"), Rule: Rule{}, WantErrString: "invalid rule kind"},
|
||||
{Name: "ruleIDBackslash", Kind: OverrideKind, Rule: Rule{RuleID: "#foo\\:example.com"}, WantErrString: "invalid rule ID"},
|
||||
{Name: "noActions", Kind: OverrideKind, Rule: Rule{}, WantErrString: "missing actions"},
|
||||
{Name: "invalidAction", Kind: OverrideKind, Rule: Rule{Actions: []*Action{{}}}, WantErrString: "invalid rule action kind"},
|
||||
{Name: "invalidCondition", Kind: OverrideKind, Rule: Rule{Conditions: []*Condition{{}}}, WantErrString: "invalid rule condition kind"},
|
||||
{Name: "overrideNoCondition", Kind: OverrideKind, Rule: Rule{}, WantErrString: "missing rule conditions"},
|
||||
|
|
|
|||
Loading…
Reference in a new issue