diff --git a/src/main/scala/app/IssuesController.scala b/src/main/scala/app/IssuesController.scala
index d01984a..458c3a3 100644
--- a/src/main/scala/app/IssuesController.scala
+++ b/src/main/scala/app/IssuesController.scala
@@ -8,11 +8,11 @@
import org.scalatra.Ok
class IssuesController extends IssuesControllerBase
- with IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService
+ with IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService with ActivityService
with ReadableUsersAuthenticator with ReferrerAuthenticator with CollaboratorsAuthenticator
trait IssuesControllerBase extends ControllerBase {
- self: IssuesService with RepositoryService with LabelsService with MilestonesService
+ self: IssuesService with RepositoryService with LabelsService with MilestonesService with ActivityService
with ReadableUsersAuthenticator with ReferrerAuthenticator with CollaboratorsAuthenticator =>
case class IssueCreateForm(title: String, content: Option[String],
@@ -86,8 +86,9 @@
val owner = repository.owner
val name = repository.name
val writable = hasWritePermission(owner, name, context.loginAccount)
+ val userName = context.loginAccount.get.userName
- val issueId = createIssue(owner, name, context.loginAccount.get.userName, form.title, form.content,
+ val issueId = createIssue(owner, name, userName, form.title, form.content,
if(writable) form.assignedUserName else None,
if(writable) form.milestoneId else None)
@@ -102,6 +103,8 @@
}
}
+ recordCreateIssue(owner, name, userName, issueId)
+
redirect("/%s/%s/issues/%d".format(owner, name, issueId))
})
diff --git a/src/main/scala/service/ActivityService.scala b/src/main/scala/service/ActivityService.scala
index 2e9102f..85cc45a 100644
--- a/src/main/scala/service/ActivityService.scala
+++ b/src/main/scala/service/ActivityService.scala
@@ -21,10 +21,13 @@
.list
}
- def recordCreateRepository(userName: String, repositoryName: String, activityUserName: String): Unit = {
+ def recordCreateRepository(userName: String, repositoryName: String, activityUserName: String): Unit =
Activities.autoInc insert(userName, repositoryName, activityUserName,
"[[%s]] created [[%s/%s]]".format(activityUserName, userName, repositoryName),
currentDate)
- }
+ def recordCreateIssue(userName: String, repositoryName: String, activityUserName: String, issueId: Int): Unit =
+ Activities.autoInc insert(userName, repositoryName, activityUserName,
+ "[[%s]] opened issue [[%s/%s#%d]]".format(activityUserName, userName, repositoryName, issueId),
+ currentDate)
}
diff --git a/src/main/scala/view/helpers.scala b/src/main/scala/view/helpers.scala
index 88c24d6..35086d3 100644
--- a/src/main/scala/view/helpers.scala
+++ b/src/main/scala/view/helpers.scala
@@ -35,6 +35,7 @@
def activityMessage(message: String)(implicit context: app.Context): Html = {
Html(message
+ .replaceAll("\\[\\[([^\\s]+?)/([^\\s]+?)#((\\d+))\\]\\]", "$1/$2#$3".format(context.path))
.replaceAll("\\[\\[([^\\s]+?)/([^\\s]+?)\\]\\]", "$1/$2".format(context.path))
.replaceAll("\\[\\[([^\\s]+?)\\]\\]", "$1".format(context.path))
)