mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
(refs #224)Record delete branch activity
This commit is contained in:
@@ -15,13 +15,13 @@ import java.util.zip.{ZipEntry, ZipOutputStream}
|
|||||||
import scala.Some
|
import scala.Some
|
||||||
|
|
||||||
class RepositoryViewerController extends RepositoryViewerControllerBase
|
class RepositoryViewerController extends RepositoryViewerControllerBase
|
||||||
with RepositoryService with AccountService with ReferrerAuthenticator with CollaboratorsAuthenticator
|
with RepositoryService with AccountService with ActivityService with ReferrerAuthenticator with CollaboratorsAuthenticator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository viewer.
|
* The repository viewer.
|
||||||
*/
|
*/
|
||||||
trait RepositoryViewerControllerBase extends ControllerBase {
|
trait RepositoryViewerControllerBase extends ControllerBase {
|
||||||
self: RepositoryService with AccountService with ReferrerAuthenticator with CollaboratorsAuthenticator =>
|
self: RepositoryService with AccountService with ActivityService with ReferrerAuthenticator with CollaboratorsAuthenticator =>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns converted HTML from Markdown for preview.
|
* Returns converted HTML from Markdown for preview.
|
||||||
@@ -160,9 +160,11 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
*/
|
*/
|
||||||
get("/:owner/:repository/delete/:branchName")(collaboratorsOnly { repository =>
|
get("/:owner/:repository/delete/:branchName")(collaboratorsOnly { repository =>
|
||||||
val branchName = params("branchName")
|
val branchName = params("branchName")
|
||||||
|
val userName = context.loginAccount.get.userName
|
||||||
if(repository.repository.defaultBranch != branchName){
|
if(repository.repository.defaultBranch != branchName){
|
||||||
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||||
git.branchDelete().setBranchNames(branchName).call()
|
git.branchDelete().setBranchNames(branchName).call()
|
||||||
|
recordDeleteBranchActivity(repository.owner, repository.name, userName, branchName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redirect(s"/${repository.owner}/${repository.name}/branches")
|
redirect(s"/${repository.owner}/${repository.name}/branches")
|
||||||
|
|||||||
Reference in New Issue
Block a user