abstract account-data deserializations for serde_json::from_elim

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-10-02 07:57:18 +00:00 committed by strawberry
parent 48a767d52c
commit da34b43302
12 changed files with 133 additions and 210 deletions

View file

@ -407,9 +407,8 @@ impl Service {
let rules_for_user = self
.services
.account_data
.get(None, user, GlobalAccountDataEventType::PushRules.to_string().into())
.get_global(user, GlobalAccountDataEventType::PushRules)
.await
.and_then(|event| serde_json::from_str::<PushRulesEvent>(event.get()).map_err(Into::into))
.map_or_else(|_| Ruleset::server_default(user), |ev: PushRulesEvent| ev.content.global);
let mut highlight = false;