mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 19:54:28 +01:00
Added comment for changing issue ref (#17672)
* Added comment for changing issue ref - Add a comment when someone changes the ref(erence?) of a issue.
This commit is contained in:
parent
00448ebe91
commit
381e131fc8
4 changed files with 41 additions and 1 deletions
|
@ -753,6 +753,24 @@ func (issue *Issue) ChangeRef(doer *User, oldRef string) (err error) {
|
||||||
return fmt.Errorf("updateIssueCols: %v", err)
|
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()
|
return committer.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,10 @@ const (
|
||||||
CommentTypeProject
|
CommentTypeProject
|
||||||
// 31 Project board changed
|
// 31 Project board changed
|
||||||
CommentTypeProjectBoard
|
CommentTypeProjectBoard
|
||||||
// Dismiss Review
|
// 32 Dismiss Review
|
||||||
CommentTypeDismissReview
|
CommentTypeDismissReview
|
||||||
|
// 33 Change issue ref
|
||||||
|
CommentTypeChangeIssueRef
|
||||||
)
|
)
|
||||||
|
|
||||||
// RoleDescriptor defines comment tag type
|
// RoleDescriptor defines comment tag type
|
||||||
|
|
|
@ -1173,6 +1173,9 @@ issues.add_assignee_at = `was assigned by <b>%s</b> %s`
|
||||||
issues.remove_assignee_at = `was unassigned by <b>%s</b> %s`
|
issues.remove_assignee_at = `was unassigned by <b>%s</b> %s`
|
||||||
issues.remove_self_assignment = `removed their assignment %s`
|
issues.remove_self_assignment = `removed their assignment %s`
|
||||||
issues.change_title_at = `changed title from <b><strike>%s</strike></b> to <b>%s</b> %s`
|
issues.change_title_at = `changed title from <b><strike>%s</strike></b> to <b>%s</b> %s`
|
||||||
|
issues.change_ref_at = `changed reference from <b><strike>%s</strike></b> to <b>%s</b> %s`
|
||||||
|
issues.remove_ref_at = `removed reference <b>%s</b> %s`
|
||||||
|
issues.add_ref_at = `added reference <b>%s</b> %s`
|
||||||
issues.delete_branch_at = `deleted branch <b>%s</b> %s`
|
issues.delete_branch_at = `deleted branch <b>%s</b> %s`
|
||||||
issues.open_tab = %d Open
|
issues.open_tab = %d Open
|
||||||
issues.close_tab = %d Closed
|
issues.close_tab = %d Closed
|
||||||
|
|
|
@ -781,5 +781,22 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
{{else if eq .Type 33}}
|
||||||
|
<div class="timeline-item event" id="{{.HashTag}}">
|
||||||
|
<span class="badge">{{svg "octicon-git-branch"}}</span>
|
||||||
|
<a href="{{.Poster.HomeLink}}">
|
||||||
|
{{avatar .Poster}}
|
||||||
|
</a>
|
||||||
|
<span class="text grey">
|
||||||
|
<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
|
||||||
|
{{if and .OldRef .NewRef}}
|
||||||
|
{{$.i18n.Tr "repo.issues.change_ref_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
|
||||||
|
{{else if .OldRef}}
|
||||||
|
{{$.i18n.Tr "repo.issues.remove_ref_at" (.OldRef|Escape) $createdStr | Safe}}
|
||||||
|
{{else}}
|
||||||
|
{{$.i18n.Tr "repo.issues.add_ref_at" (.NewRef|Escape) $createdStr | Safe}}
|
||||||
|
{{end}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue