diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-02-06 00:05:57 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-02-06 00:05:57 +0100 |
| commit | bd74717e10fb36e19893c15941876b2383b94714 (patch) | |
| tree | 5fc26ace64c37fb439ba94cc5ea437a0e93913d2 /server/src/git_root.rs | |
| parent | 350fc534de745f4cc62000fa25d67afcddb7918a (diff) | |
Add DELETE command for review
Only the owner or a maintainer of the project can remove a review.
Removing a review also removes the git branch.
Only reviews that are either draft or dropped can be removed.
Diffstat (limited to 'server/src/git_root.rs')
| -rw-r--r-- | server/src/git_root.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/git_root.rs b/server/src/git_root.rs index 31e4d45..f818495 100644 --- a/server/src/git_root.rs +++ b/server/src/git_root.rs @@ -62,6 +62,20 @@ impl Roots { Ok(()) } + + pub async fn del_branch(&self, project_id: &str, branch: &str) -> Result<(), git::Error> { + let repo; + { + let data = self.data.lock().unwrap(); + if let Some(tmp_repo) = data.project_repo.get(project_id) { + repo = tmp_repo.clone(); + } else { + return Ok(()); + } + } + + repo.delete_branch(branch).await + } } #[derive(Debug)] |
