Direct message rooms should be encrypted from creation (#29)

This commit is contained in:
Ulyssa 2023-03-03 16:37:11 -08:00
parent 0ed1d53946
commit 11625262f1
No known key found for this signature in database
GPG key ID: 1B3965A3D18B9B64
3 changed files with 110 additions and 9 deletions

View file

@ -185,8 +185,16 @@ impl RoomState {
match act {
RoomAction::InviteAccept => {
if let Some(room) = store.application.worker.client.get_invited_room(self.id()) {
let details = room.invite_details().await.map_err(IambError::from)?;
let details = details.invitee.event().original_content();
let is_direct = details.and_then(|ev| ev.is_direct).unwrap_or_default();
room.accept_invitation().await.map_err(IambError::from)?;
if is_direct {
room.set_is_direct(true).await.map_err(IambError::from)?;
}
Ok(vec![])
} else {
Err(IambError::NotInvited.into())