Added proto messages for updating the head text

This commit is contained in:
Mikayla Maki 2022-10-01 18:18:35 -07:00
parent 8c24c858c9
commit 512f817e2f
5 changed files with 69 additions and 7 deletions

View file

@ -1065,9 +1065,6 @@ async fn test_git_head_text(
);
});
//TODO: WAIT FOR REMOTE UPDATES TO FINISH on B
executor.run_until_parked();
// Smoke test B
buffer_b.read_with(cx_b, |buffer, _| {
assert_eq!(buffer.head_text(), Some(new_head_text.as_ref()));

View file

@ -205,7 +205,8 @@ impl Server {
.add_request_handler(Server::follow)
.add_message_handler(Server::unfollow)
.add_message_handler(Server::update_followers)
.add_request_handler(Server::get_channel_messages);
.add_request_handler(Server::get_channel_messages)
.add_message_handler(Server::update_head_text);
Arc::new(server)
}
@ -1727,6 +1728,21 @@ impl Server {
Ok(())
}
async fn update_head_text(
self: Arc<Server>,
request: TypedEnvelope<proto::UpdateHeadText>,
) -> Result<()> {
let receiver_ids = self.store().await.project_connection_ids(
ProjectId::from_proto(request.payload.project_id),
request.sender_id,
)?;
broadcast(request.sender_id, receiver_ids, |connection_id| {
self.peer
.forward_send(request.sender_id, connection_id, request.payload.clone())
});
Ok(())
}
pub(crate) async fn store(&self) -> StoreGuard<'_> {
#[cfg(test)]
tokio::task::yield_now().await;