Add requires_zed_cla column to channels table

Don't allow granting guests write access in a call where the channel
or one of its ancestors requires the zed CLA, until that guest has
signed the Zed CLA.

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-01-22 16:38:54 -08:00
parent 676d2cb24a
commit 25708088b7
14 changed files with 225 additions and 40 deletions

View file

@ -67,6 +67,7 @@ impl Database {
.as_ref()
.map_or(String::new(), |parent| parent.path()),
),
requires_zed_cla: ActiveValue::NotSet,
}
.insert(&*tx)
.await?;
@ -261,6 +262,22 @@ impl Database {
.await
}
#[cfg(test)]
pub async fn set_channel_requires_zed_cla(
&self,
channel_id: ChannelId,
requires_zed_cla: bool,
) -> Result<()> {
self.transaction(move |tx| async move {
let channel = self.get_channel_internal(channel_id, &*tx).await?;
let mut model = channel.into_active_model();
model.requires_zed_cla = ActiveValue::Set(requires_zed_cla);
model.update(&*tx).await?;
Ok(())
})
.await
}
/// Deletes the channel with the specified ID.
pub async fn delete_channel(
&self,