improvement: upgrade ruma and implement blurhashes

This commit is contained in:
Timo Kösters 2021-07-15 23:17:58 +02:00
parent 0fcefa4125
commit f5273f7eb1
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
22 changed files with 98 additions and 30 deletions

View file

@ -165,7 +165,7 @@ pub async fn invite_user_route(
if let invite_user::IncomingInvitationRecipient::UserId { user_id } = &body.recipient {
invite_helper(sender_user, user_id, &body.room_id, &db, false).await?;
db.flush().await?;
Ok(invite_user::Response.into())
Ok(invite_user::Response {}.into())
} else {
Err(Error::BadRequest(ErrorKind::NotFound, "User not found."))
}
@ -261,6 +261,7 @@ pub async fn ban_user_route(
avatar_url: db.users.avatar_url(&body.user_id)?,
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&body.user_id)?,
}),
|event| {
let mut event = serde_json::from_value::<Raw<member::MemberEventContent>>(
@ -556,6 +557,7 @@ async fn join_room_by_id_helper(
avatar_url: db.users.avatar_url(&sender_user)?,
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
})
.expect("event is valid, we just created it"),
);
@ -685,6 +687,7 @@ async fn join_room_by_id_helper(
avatar_url: db.users.avatar_url(&sender_user)?,
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
};
db.rooms.build_and_append_pdu(
@ -833,6 +836,7 @@ pub async fn invite_helper<'a>(
is_direct: Some(is_direct),
membership: MembershipState::Invite,
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
})
.expect("member event is valid value");
@ -1008,6 +1012,7 @@ pub async fn invite_helper<'a>(
avatar_url: db.users.avatar_url(&user_id)?,
is_direct: Some(is_direct),
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
})
.expect("event is valid, we just created it"),
unsigned: None,