mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 13:03:47 +03:00
Remove is_direct
flag from Join event
When I was investigating the DM issue, I found that join event contained the `is_direct` flag. According to the spec, this flag should only be set on "invite" events, but not on join. Other homeservers do not have this flag on join.
This commit is contained in:
parent
a49a572d76
commit
8f06d0258a
1 changed files with 7 additions and 28 deletions
|
@ -1390,34 +1390,13 @@ pub fn join_room_by_id_route(
|
|||
|
||||
// TODO: Ask a remote server if we don't have this room
|
||||
|
||||
let event = db
|
||||
.rooms
|
||||
.room_state_get(&body.room_id, &EventType::RoomMember, &user_id.to_string())?
|
||||
.map_or_else(
|
||||
|| {
|
||||
// There was no existing membership event
|
||||
Ok::<_, Error>(member::MemberEventContent {
|
||||
membership: member::MembershipState::Join,
|
||||
displayname: db.users.displayname(&user_id)?,
|
||||
avatar_url: db.users.avatar_url(&user_id)?,
|
||||
is_direct: None,
|
||||
third_party_invite: None,
|
||||
})
|
||||
},
|
||||
|pdu| {
|
||||
// We change the existing membership event
|
||||
let mut event = serde_json::from_value::<EventJson<member::MemberEventContent>>(
|
||||
pdu.content.clone(),
|
||||
)
|
||||
.map_err(|_| Error::bad_database("Invalid member event in db."))?
|
||||
.deserialize()
|
||||
.map_err(|_| Error::bad_database("Invalid member event in db."))?;
|
||||
event.membership = member::MembershipState::Join;
|
||||
event.displayname = db.users.displayname(&user_id)?;
|
||||
event.avatar_url = db.users.avatar_url(&user_id)?;
|
||||
Ok(event)
|
||||
},
|
||||
)?;
|
||||
let event = member::MemberEventContent {
|
||||
membership: member::MembershipState::Join,
|
||||
displayname: db.users.displayname(&user_id)?,
|
||||
avatar_url: db.users.avatar_url(&user_id)?,
|
||||
is_direct: None,
|
||||
third_party_invite: None,
|
||||
};
|
||||
|
||||
db.rooms.append_pdu(
|
||||
body.room_id.clone(),
|
||||
|
|
Loading…
Reference in a new issue