Fix syncing preferences from account data
This commit is contained in:
parent
e5db799fa3
commit
d0c0af811e
@ -262,9 +262,15 @@ func (c *Container) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) HandlePreferences(source EventSource, evt *mautrix.Event) {
|
func (c *Container) HandlePreferences(source EventSource, evt *mautrix.Event) {
|
||||||
|
if source&EventSourceAccountData == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
orig := c.config.Preferences
|
orig := c.config.Preferences
|
||||||
rt, _ := json.Marshal(&evt.Content)
|
err := json.Unmarshal(evt.Content.VeryRaw, &c.config.Preferences)
|
||||||
json.Unmarshal(rt, &c.config.Preferences)
|
if err != nil {
|
||||||
|
debug.Print("Failed to parse updated preferences:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
debug.Print("Updated preferences:", orig, "->", c.config.Preferences)
|
debug.Print("Updated preferences:", orig, "->", c.config.Preferences)
|
||||||
c.ui.HandleNewPreferences()
|
c.ui.HandleNewPreferences()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user