abstract account-data deserializations for serde_json::from_elim
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
48a767d52c
commit
da34b43302
12 changed files with 133 additions and 210 deletions
|
@ -98,19 +98,9 @@ impl Service {
|
|||
pub async fn user_is_ignored(&self, sender_user: &UserId, recipient_user: &UserId) -> bool {
|
||||
self.services
|
||||
.account_data
|
||||
.get(
|
||||
None,
|
||||
recipient_user,
|
||||
GlobalAccountDataEventType::IgnoredUserList
|
||||
.to_string()
|
||||
.into(),
|
||||
)
|
||||
.get_global(recipient_user, GlobalAccountDataEventType::IgnoredUserList)
|
||||
.await
|
||||
.and_then(|event| {
|
||||
serde_json::from_str::<IgnoredUserListEvent>(event.get())
|
||||
.map_err(|e| err!(Database(warn!("Invalid account data event in db: {e:?}"))))
|
||||
})
|
||||
.map_or(false, |ignored| {
|
||||
.map_or(false, |ignored: IgnoredUserListEvent| {
|
||||
ignored
|
||||
.content
|
||||
.ignored_users
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue