From 53fa60b0f8f4723e7e3c491f37048b9701654021 Mon Sep 17 00:00:00 2001 From: takezoe Date: Thu, 24 Oct 2013 02:00:14 +0900 Subject: [PATCH 1/3] Exclude owner from assigned user list in the group repository. --- src/main/scala/app/IssuesController.scala | 6 +++--- src/main/scala/app/PullRequestsController.scala | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/app/IssuesController.scala b/src/main/scala/app/IssuesController.scala index f62b86f40..22544e71f 100644 --- a/src/main/scala/app/IssuesController.scala +++ b/src/main/scala/app/IssuesController.scala @@ -14,7 +14,7 @@ class IssuesController extends IssuesControllerBase with ReadableUsersAuthenticator with ReferrerAuthenticator with CollaboratorsAuthenticator trait IssuesControllerBase extends ControllerBase { - self: IssuesService with RepositoryService with LabelsService with MilestonesService with ActivityService + self: IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService with ActivityService with ReadableUsersAuthenticator with ReferrerAuthenticator with CollaboratorsAuthenticator => case class IssueCreateForm(title: String, content: Option[String], @@ -65,7 +65,7 @@ trait IssuesControllerBase extends ControllerBase { _, getComments(owner, name, issueId.toInt), getIssueLabels(owner, name, issueId.toInt), - (getCollaborators(owner, name) :+ owner).sorted, + (getCollaborators(owner, name) ::: (if(getAccountByUserName(owner).get.isGroupAccount) Nil else List(owner))).sorted, getMilestonesWithIssueCount(owner, name), getLabels(owner, name), hasWritePermission(owner, name, context.loginAccount), @@ -77,7 +77,7 @@ trait IssuesControllerBase extends ControllerBase { get("/:owner/:repository/issues/new")(readableUsersOnly { repository => defining(repository.owner, repository.name){ case (owner, name) => issues.html.create( - (getCollaborators(owner, name) :+ owner).sorted, + (getCollaborators(owner, name) ::: (if(getAccountByUserName(owner).get.isGroupAccount) Nil else List(owner))).sorted, getMilestones(owner, name), getLabels(owner, name), hasWritePermission(owner, name, context.loginAccount), diff --git a/src/main/scala/app/PullRequestsController.scala b/src/main/scala/app/PullRequestsController.scala index c234bc64d..9e811efcf 100644 --- a/src/main/scala/app/PullRequestsController.scala +++ b/src/main/scala/app/PullRequestsController.scala @@ -24,7 +24,7 @@ class PullRequestsController extends PullRequestsControllerBase with ReferrerAuthenticator with CollaboratorsAuthenticator trait PullRequestsControllerBase extends ControllerBase { - self: RepositoryService with IssuesService with MilestonesService with ActivityService with PullRequestService + self: RepositoryService with AccountService with IssuesService with MilestonesService with ActivityService with PullRequestService with ReferrerAuthenticator with CollaboratorsAuthenticator => val pullRequestForm = mapping( @@ -74,7 +74,7 @@ trait PullRequestsControllerBase extends ControllerBase { pulls.html.pullreq( issue, pullreq, getComments(owner, name, issueId), - (getCollaborators(owner, name) :+ owner).sorted, + (getCollaborators(owner, name) ::: (if(getAccountByUserName(owner).get.isGroupAccount) Nil else List(owner))).sorted, getMilestonesWithIssueCount(owner, name), commits, diffs, From 0d0bf4ad3f207b00ee64bc18112df865c40e4f72 Mon Sep 17 00:00:00 2001 From: takezoe Date: Thu, 24 Oct 2013 02:08:14 +0900 Subject: [PATCH 2/3] Don't add group account as a collaborator. --- src/main/scala/app/RepositorySettingsController.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/scala/app/RepositorySettingsController.scala b/src/main/scala/app/RepositorySettingsController.scala index a9285fd1f..cd2b47f80 100644 --- a/src/main/scala/app/RepositorySettingsController.scala +++ b/src/main/scala/app/RepositorySettingsController.scala @@ -188,6 +188,8 @@ trait RepositorySettingsControllerBase extends ControllerBase with FlashMapSuppo override def validate(name: String, value: String): Option[String] = getAccountByUserName(value) match { case None => Some("User does not exist.") + case Some(x) if(x.isGroupAccount) + => Some("User does not exist.") case Some(x) if(x.userName == params("owner") || getCollaborators(params("owner"), params("repository")).contains(x.userName)) => Some("User can access this repository already.") case _ => None From 2968b926774f8eebb9dc2b4be9e2ebca7f473607 Mon Sep 17 00:00:00 2001 From: takezoe Date: Thu, 24 Oct 2013 04:25:50 +0900 Subject: [PATCH 3/3] Add the commit link to refs comment. --- src/main/scala/servlet/GitRepositoryServlet.scala | 2 +- src/main/twirl/issues/commentlist.scala.html | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/scala/servlet/GitRepositoryServlet.scala b/src/main/scala/servlet/GitRepositoryServlet.scala index e16f48c8a..1ae0062d4 100644 --- a/src/main/scala/servlet/GitRepositoryServlet.scala +++ b/src/main/scala/servlet/GitRepositoryServlet.scala @@ -149,7 +149,7 @@ class CommitLogHook(owner: String, repository: String, userName: String, baseURL "(^|\\W)#(\\d+)(\\W|$)".r.findAllIn(commit.fullMessage).matchData.foreach { matchData => val issueId = matchData.group(2) if(getAccountByUserName(commit.committer).isDefined && getIssue(owner, repository, issueId).isDefined){ - createComment(owner, repository, commit.committer, issueId.toInt, commit.fullMessage, "commit") + createComment(owner, repository, commit.committer, issueId.toInt, commit.id + " " + commit.fullMessage, "commit") } } } diff --git a/src/main/twirl/issues/commentlist.scala.html b/src/main/twirl/issues/commentlist.scala.html index 3c19aa4a9..4071dcf67 100644 --- a/src/main/twirl/issues/commentlist.scala.html +++ b/src/main/twirl/issues/commentlist.scala.html @@ -21,7 +21,14 @@
- @markdown(comment.content, repository, false, true) + @if(comment.action == "commit" && comment.content.split(" ").last.matches("[a-f0-9]{40}")){ + @defining(comment.content.substring(comment.content.length - 40)){ id => + + @markdown(comment.content.substring(0, comment.content.length - 41), repository, false, true) + } + } else { + @markdown(comment.content, repository, false, true) + }
}