Broadcast new peer ids for rejoined channel collaborators
This commit is contained in:
parent
d7e4cb4ab1
commit
e6babce556
7 changed files with 104 additions and 44 deletions
|
@ -2553,13 +2553,31 @@ async fn rejoin_channel_buffers(
|
|||
session: Session,
|
||||
) -> Result<()> {
|
||||
let db = session.db().await;
|
||||
let rejoin_response = db
|
||||
let buffers = db
|
||||
.rejoin_channel_buffers(&request.buffers, session.user_id, session.connection_id)
|
||||
.await?;
|
||||
|
||||
// TODO: inform channel buffer collaborators that this user has rejoined.
|
||||
for buffer in &buffers {
|
||||
let collaborators_to_notify = buffer
|
||||
.buffer
|
||||
.collaborators
|
||||
.iter()
|
||||
.filter_map(|c| Some(c.peer_id?.into()));
|
||||
channel_buffer_updated(
|
||||
session.connection_id,
|
||||
collaborators_to_notify,
|
||||
&proto::UpdateChannelBufferCollaborator {
|
||||
channel_id: buffer.buffer.channel_id,
|
||||
old_peer_id: Some(buffer.old_connection_id.into()),
|
||||
new_peer_id: Some(session.connection_id.into()),
|
||||
},
|
||||
&session.peer,
|
||||
);
|
||||
}
|
||||
|
||||
response.send(rejoin_response)?;
|
||||
response.send(proto::RejoinChannelBuffersResponse {
|
||||
buffers: buffers.into_iter().map(|b| b.buffer).collect(),
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue