mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Update defaults
This commit is contained in:
parent
4ce5fece5b
commit
1aa25b38da
|
|
@ -16,7 +16,7 @@ type Action struct {
|
||||||
Tweak TweakKey `json:"-"`
|
Tweak TweakKey `json:"-"`
|
||||||
|
|
||||||
// Value is some value interpreted according to Kind and Tweak.
|
// Value is some value interpreted according to Kind and Tweak.
|
||||||
Value interface{} `json:"value,omitempty"`
|
Value interface{} `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Action) MarshalJSON() ([]byte, error) {
|
func (a *Action) MarshalJSON() ([]byte, error) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ func mRuleContainsUserNameDefinition(localpart string) *Rule {
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: HighlightTweak,
|
Tweak: HighlightTweak,
|
||||||
|
Value: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ var (
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: HighlightTweak,
|
Tweak: HighlightTweak,
|
||||||
|
Value: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -95,6 +96,7 @@ var (
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: HighlightTweak,
|
Tweak: HighlightTweak,
|
||||||
|
Value: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -118,6 +120,7 @@ var (
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: HighlightTweak,
|
Tweak: HighlightTweak,
|
||||||
|
Value: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +158,7 @@ func mRuleInviteForMeDefinition(userID string) *Rule {
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: HighlightTweak,
|
Tweak: HighlightTweak,
|
||||||
|
Value: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,11 @@ var (
|
||||||
Tweak: SoundTweak,
|
Tweak: SoundTweak,
|
||||||
Value: "ring",
|
Value: "ring",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Kind: SetTweakAction,
|
||||||
|
Tweak: HighlightTweak,
|
||||||
|
Value: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
mRuleEncryptedRoomOneToOneDefinition = Rule{
|
mRuleEncryptedRoomOneToOneDefinition = Rule{
|
||||||
|
|
@ -56,8 +61,8 @@ var (
|
||||||
{Kind: NotifyAction},
|
{Kind: NotifyAction},
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: SoundTweak,
|
Tweak: HighlightTweak,
|
||||||
Value: "default",
|
Value: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -80,8 +85,8 @@ var (
|
||||||
{Kind: NotifyAction},
|
{Kind: NotifyAction},
|
||||||
{
|
{
|
||||||
Kind: SetTweakAction,
|
Kind: SetTweakAction,
|
||||||
Tweak: SoundTweak,
|
Tweak: HighlightTweak,
|
||||||
Value: "default",
|
Value: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +101,7 @@ var (
|
||||||
Pattern: "m.room.message",
|
Pattern: "m.room.message",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Actions: []*Action{{Kind: NotifyAction}},
|
Actions: []*Action{{Kind: DontNotifyAction}},
|
||||||
}
|
}
|
||||||
mRuleEncryptedDefinition = Rule{
|
mRuleEncryptedDefinition = Rule{
|
||||||
RuleID: MRuleEncrypted,
|
RuleID: MRuleEncrypted,
|
||||||
|
|
@ -109,6 +114,6 @@ var (
|
||||||
Pattern: "m.room.encrypted",
|
Pattern: "m.room.encrypted",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Actions: []*Action{{Kind: NotifyAction}},
|
Actions: []*Action{{Kind: DontNotifyAction}},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ type Rule struct {
|
||||||
|
|
||||||
// Conditions provide the rule's conditions for OverrideKind and
|
// Conditions provide the rule's conditions for OverrideKind and
|
||||||
// UnderrideKind. Not allowed for other kinds.
|
// UnderrideKind. Not allowed for other kinds.
|
||||||
Conditions []*Condition `json:"conditions,omitempty"`
|
Conditions []*Condition `json:"conditions"`
|
||||||
|
|
||||||
// Pattern is the body pattern to match for ContentKind. Required
|
// Pattern is the body pattern to match for ContentKind. Required
|
||||||
// for that kind. The interpretation is the same as that of
|
// for that kind. The interpretation is the same as that of
|
||||||
// Condition.Pattern.
|
// Condition.Pattern.
|
||||||
Pattern string `json:"pattern,omitempty"`
|
Pattern string `json:"pattern"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scope only has one valid value. See also AccountRuleSets.
|
// Scope only has one valid value. See also AccountRuleSets.
|
||||||
|
|
|
||||||
|
|
@ -749,6 +749,8 @@ func (a *UserInternalAPI) QueryPushRules(ctx context.Context, req *api.QueryPush
|
||||||
if err := a.DB.SaveAccountData(ctx, localpart, "", pushRulesAccountDataType, json.RawMessage(prbs)); err != nil {
|
if err := a.DB.SaveAccountData(ctx, localpart, "", pushRulesAccountDataType, json.RawMessage(prbs)); err != nil {
|
||||||
return fmt.Errorf("failed to save default push rules: %w", err)
|
return fmt.Errorf("failed to save default push rules: %w", err)
|
||||||
}
|
}
|
||||||
|
res.RuleSets = pushRuleSets
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
var data pushrules.AccountRuleSets
|
var data pushrules.AccountRuleSets
|
||||||
if err := json.Unmarshal([]byte(bs), &data); err != nil {
|
if err := json.Unmarshal([]byte(bs), &data); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue