diff --git a/models/issue.go b/models/issue.go
index 288163707a466..ef31f416ad3ad 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -753,6 +753,24 @@ func (issue *Issue) ChangeRef(doer *User, oldRef string) (err error) {
return fmt.Errorf("updateIssueCols: %v", err)
}
+ if err = issue.loadRepo(db.GetEngine(ctx)); err != nil {
+ return fmt.Errorf("loadRepo: %v", err)
+ }
+ oldRefFriendly := strings.TrimPrefix(oldRef, "refs/heads/")
+ newRefFriendly := strings.TrimPrefix(issue.Ref, "refs/heads/")
+
+ opts := &CreateCommentOptions{
+ Type: CommentTypeChangeIssueRef,
+ Doer: doer,
+ Repo: issue.Repo,
+ Issue: issue,
+ OldRef: oldRefFriendly,
+ NewRef: newRefFriendly,
+ }
+ if _, err = createComment(db.GetEngine(ctx), opts); err != nil {
+ return fmt.Errorf("createComment: %v", err)
+ }
+
return committer.Commit()
}
diff --git a/models/issue_comment.go b/models/issue_comment.go
index a41f4cb298a46..1936695732158 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -101,8 +101,10 @@ const (
CommentTypeProject
// 31 Project board changed
CommentTypeProjectBoard
- // Dismiss Review
+ // 32 Dismiss Review
CommentTypeDismissReview
+ // 33 Change issue ref
+ CommentTypeChangeIssueRef
)
// RoleDescriptor defines comment tag type
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 499b60db46d07..6c5c610419ad6 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1173,6 +1173,9 @@ issues.add_assignee_at = `was assigned by %s %s`
issues.remove_assignee_at = `was unassigned by %s %s`
issues.remove_self_assignment = `removed their assignment %s`
issues.change_title_at = `changed title from %s to %s %s`
+issues.change_ref_at = `changed reference from %s to %s %s`
+issues.remove_ref_at = `removed reference %s %s`
+issues.add_ref_at = `added reference %s %s`
issues.delete_branch_at = `deleted branch %s %s`
issues.open_tab = %d Open
issues.close_tab = %d Closed
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 9907246d9f403..77925d8e29efe 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -781,5 +781,22 @@
{{end}}
+ {{else if eq .Type 33}}
+