Prototype cursor sharing (the inefficient way)

I think this will be a key user experience driver, but we do need to
find a way to enable it without widening our vector clocks.
This commit is contained in:
Conrad Irwin 2024-01-08 22:32:12 -07:00
parent ca0c06b577
commit 82f7dd9bbb
2 changed files with 19 additions and 4 deletions

View file

@ -883,6 +883,7 @@ impl Database {
&self,
project_id: ProjectId,
connection_id: ConnectionId,
requires_write: bool,
) -> Result<RoomGuard<Vec<ProjectCollaborator>>> {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
@ -893,9 +894,10 @@ impl Database {
.await?
.ok_or_else(|| anyhow!("no such room"))?;
if !current_participant
.role
.map_or(false, |role| role.can_edit_projects())
if requires_write
&& !current_participant
.role
.map_or(false, |role| role.can_edit_projects())
{
Err(anyhow!("not authorized to edit projects"))?;
}