aboutsummaryrefslogtreecommitdiff
path: root/matrix/pushrules/pushrules.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-09-05 10:55:48 +0300
committerTulir Asokan <tulir@maunium.net>2018-09-05 10:55:48 +0300
commitcfb2cc057c32330be0ca0a68cfbd245cb2b8e31b (patch)
treef0d02d40d41091fd052582fe1fe701c80decf0d7 /matrix/pushrules/pushrules.go
parent68db26bcace31297471641fe95f8882e301f5699 (diff)
Update to latest gomatrix. Things are broken
Diffstat (limited to 'matrix/pushrules/pushrules.go')
-rw-r--r--matrix/pushrules/pushrules.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/matrix/pushrules/pushrules.go b/matrix/pushrules/pushrules.go
index 876713b..b383c66 100644
--- a/matrix/pushrules/pushrules.go
+++ b/matrix/pushrules/pushrules.go
@@ -21,19 +21,17 @@ func GetScopedPushRules(client *gomatrix.Client, scope string) (resp *PushRulese
return
}
+type contentWithRuleset struct {
+ Ruleset *PushRuleset `json:"global"`
+}
+
// EventToPushRules converts a m.push_rules event to a PushRuleset by passing the data through JSON.
func EventToPushRules(event *gomatrix.Event) (*PushRuleset, error) {
- content, _ := event.Content["global"]
- raw, err := json.Marshal(content)
- if err != nil {
- return nil, err
- }
-
- ruleset := &PushRuleset{}
- err = json.Unmarshal(raw, ruleset)
+ content := &contentWithRuleset{}
+ err := json.Unmarshal(event.Content.VeryRaw, content)
if err != nil {
return nil, err
}
- return ruleset, nil
+ return content.Ruleset, nil
}