Plumbing to pass role
for room participants
This commit is contained in:
parent
a801c85a1b
commit
88ed5f7290
7 changed files with 11 additions and 4 deletions
|
@ -161,7 +161,8 @@ CREATE TABLE "room_participants" (
|
||||||
"calling_user_id" INTEGER NOT NULL REFERENCES users (id),
|
"calling_user_id" INTEGER NOT NULL REFERENCES users (id),
|
||||||
"calling_connection_id" INTEGER NOT NULL,
|
"calling_connection_id" INTEGER NOT NULL,
|
||||||
"calling_connection_server_id" INTEGER REFERENCES servers (id) ON DELETE SET NULL,
|
"calling_connection_server_id" INTEGER REFERENCES servers (id) ON DELETE SET NULL,
|
||||||
"participant_index" INTEGER
|
"participant_index" INTEGER,
|
||||||
|
"role" TEXT
|
||||||
);
|
);
|
||||||
CREATE UNIQUE INDEX "index_room_participants_on_user_id" ON "room_participants" ("user_id");
|
CREATE UNIQUE INDEX "index_room_participants_on_user_id" ON "room_participants" ("user_id");
|
||||||
CREATE INDEX "index_room_participants_on_room_id" ON "room_participants" ("room_id");
|
CREATE INDEX "index_room_participants_on_room_id" ON "room_participants" ("room_id");
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE room_participants ADD COLUMN role TEXT;
|
|
@ -1126,6 +1126,7 @@ impl Database {
|
||||||
projects: Default::default(),
|
projects: Default::default(),
|
||||||
location: Some(proto::ParticipantLocation { variant: location }),
|
location: Some(proto::ParticipantLocation { variant: location }),
|
||||||
participant_index: participant_index as u32,
|
participant_index: participant_index as u32,
|
||||||
|
role: db_participant.role.unwrap_or(ChannelRole::Member).into(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1137,6 +1138,7 @@ impl Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drop(db_participants);
|
drop(db_participants);
|
||||||
|
dbg!(&participants);
|
||||||
|
|
||||||
let mut db_projects = db_room
|
let mut db_projects = db_room
|
||||||
.find_related(project::Entity)
|
.find_related(project::Entity)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::db::{ProjectId, RoomId, RoomParticipantId, ServerId, UserId};
|
use crate::db::{ChannelRole, ProjectId, RoomId, RoomParticipantId, ServerId, UserId};
|
||||||
use rpc::ConnectionId;
|
use rpc::ConnectionId;
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ pub struct Model {
|
||||||
pub calling_connection_id: i32,
|
pub calling_connection_id: i32,
|
||||||
pub calling_connection_server_id: Option<ServerId>,
|
pub calling_connection_server_id: Option<ServerId>,
|
||||||
pub participant_index: Option<i32>,
|
pub participant_index: Option<i32>,
|
||||||
|
pub role: Option<ChannelRole>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
impl Model {
|
||||||
|
|
|
@ -1504,7 +1504,7 @@ async fn join_project(
|
||||||
// First, we send the metadata associated with each worktree.
|
// First, we send the metadata associated with each worktree.
|
||||||
response.send(proto::JoinProjectResponse {
|
response.send(proto::JoinProjectResponse {
|
||||||
worktrees: worktrees.clone(),
|
worktrees: worktrees.clone(),
|
||||||
replica_id: replica_id.0 as u32,
|
replica_id: Some(replica_id.0 as u32),
|
||||||
collaborators: collaborators.clone(),
|
collaborators: collaborators.clone(),
|
||||||
language_servers: project.language_servers.clone(),
|
language_servers: project.language_servers.clone(),
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -713,7 +713,8 @@ impl Project {
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
let this = cx.new_model(|cx| {
|
let this = cx.new_model(|cx| {
|
||||||
let replica_id = response.payload.replica_id as ReplicaId;
|
// todo!()
|
||||||
|
let replica_id = response.payload.replica_id.unwrap() as ReplicaId;
|
||||||
|
|
||||||
let mut worktrees = Vec::new();
|
let mut worktrees = Vec::new();
|
||||||
for worktree in response.payload.worktrees {
|
for worktree in response.payload.worktrees {
|
||||||
|
|
|
@ -269,6 +269,7 @@ message Participant {
|
||||||
repeated ParticipantProject projects = 3;
|
repeated ParticipantProject projects = 3;
|
||||||
ParticipantLocation location = 4;
|
ParticipantLocation location = 4;
|
||||||
uint32 participant_index = 5;
|
uint32 participant_index = 5;
|
||||||
|
ChannelRole role = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PendingParticipant {
|
message PendingParticipant {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue