diff --git a/doc/comment_action.md b/doc/comment_action.md index 55d154b..3adae83 100644 --- a/doc/comment_action.md +++ b/doc/comment_action.md @@ -6,22 +6,26 @@ To determine if it was any operation, you see the `ACTION` column. And in the case of some actions, `CONTENT` column value contains additional information. -|ACTION |CONTENT | -|----------------|----------------------| -|comment |comment | -|close_comment |comment | -|reopen_comment |comment | -|close |"Close" | -|reopen |"Reopen" | -|commit |comment commitId | -|merge |comment | -|delete_branch |branchName | -|refer |issueId:title | -|add_label |labelName | -|delete_label |labelName | -|change_priority |oldPriority:priority | -|change_milestone|oldMilestone:milestone| -|assign |oldAssigned:assigned | +|ACTION |CONTENT | +|----------------|--------------------------| +|comment |comment | +|close_comment |comment | +|reopen_comment |comment | +|close |"Close" | +|reopen |"Reopen" | +|commit |comment commitId | +|merge |comment | +|delete_branch |branchName | +|refer |issueId:title | +|add_label |labelName | +|delete_label |labelName | +|change_priority |oldPriority:priority | +|change_milestone|oldMilestone:milestone | +|assign |oldAssigned:assigned | +|change_title |oldTitle(CRLF)title \[1\] | + +\[1\]: (CRLF) is "\r\n" + ### comment @@ -79,3 +83,7 @@ ### assign This value is saved when users have assign issue/PR to user or remove the assign. + +### change_title + +This value is saved when users have changed the title. diff --git a/src/main/scala/gitbucket/core/controller/IssuesController.scala b/src/main/scala/gitbucket/core/controller/IssuesController.scala index 8fb441a..7c93fa5 100644 --- a/src/main/scala/gitbucket/core/controller/IssuesController.scala +++ b/src/main/scala/gitbucket/core/controller/IssuesController.scala @@ -154,15 +154,25 @@ ajaxPost("/:owner/:repository/issues/edit_title/:id", issueTitleEditForm)(readableUsersOnly { (title, repository) => defining(repository.owner, repository.name) { case (owner, name) => - getIssue(owner, name, params("id")).map { issue => - if (isEditableContent(owner, name, issue.openedUserName)) { - // update issue - updateIssue(owner, name, issue.issueId, title, issue.content) - // extract references and create refer comment - createReferComment(owner, name, issue.copy(title = title), title, context.loginAccount.get) - - redirect(s"/${owner}/${name}/issues/_data/${issue.issueId}") - } else Unauthorized() + getIssue(owner, name, params("id")).map { + issue => + if (isEditableContent(owner, name, issue.openedUserName)) { + if (issue.title != title) { + // update issue + updateIssue(owner, name, issue.issueId, title, issue.content) + // extract references and create refer comment + createReferComment(owner, name, issue.copy(title = title), title, context.loginAccount.get) + createComment( + owner, + name, + context.loginAccount.get.userName, + issue.issueId, + issue.title + "\r\n" + title, + "change_title" + ) + } + redirect(s"/${owner}/${name}/issues/_data/${issue.issueId}") + } else Unauthorized() } getOrElse NotFound() } }) diff --git a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html index f4490a4..6fdecdd 100644 --- a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html @@ -228,6 +228,17 @@ } + case "change_title" => { +
+
+ + @helpers.avatar(comment.commentedUserName, 16) + @helpers.user(comment.commentedUserName, styleClass="username strong") + change title from @comment.content.split("\r\n")(0) to @comment.content.split("\r\n")(1) + @gitbucket.core.helper.html.datetimeago(comment.registeredDate) +
+
+ } case _ => { @showFormattedComment(comment) }