0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-03 21:12:09 +02:00
gitea/templates/repo/diff/commit_comments.tmpl
yuvrajangadsingh 80cea11be0 refactor: drop junction table, add RepoID to Comment model
- Remove commit_comment junction table, query Comment directly via
  repo_id + commit_sha + type filter
- Add RepoID column to Comment (migration v326)
- Add reqRepoCodeWriter permission checks to all commit comment routes
- Fix delete auth: use CanWrite(TypeCode) instead of IsAdmin()
- Fix CanComment: gate on write access, not read
- Guard LoadIssue against IssueID=0 (commit comments have no issue)
- Extract duplicated markdown rendering loop in commit.go
- Fix template dict keys: use "root" instead of "."
- Show delete button for users with code write access
- Add unit tests for create, delete, get, find operations
2026-04-02 16:56:30 +05:30

36 lines
1.2 KiB
Handlebars

{{range .comments}}
{{$createdStr := DateUtils.TimeSince .CreatedUnix}}
<div class="comment" id="{{.HashTag}}">
<div class="tw-mt-2 tw-mr-4">
{{template "shared/user/avatarlink" dict "user" .Poster}}
</div>
<div class="content comment-container">
<div class="comment-header avatar-content-left-arrow">
<div class="comment-header-left">
<span class="tw-text-text-light muted-links">
{{template "shared/user/namelink" .Poster}}
{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}}
</span>
</div>
<div class="comment-header-right">
{{if and $.root.IsSigned (or (eq $.root.SignedUserID .PosterID) $.root.CanWriteCode)}}
<div class="item context js-aria-clickable delete-comment" data-comment-id="{{.HashTag}}" data-url="{{$.root.RepoLink}}/commit/{{.CommitSHA}}/comment/{{.ID}}/delete" data-locale="{{ctx.Locale.Tr "repo.issues.delete_comment_confirm"}}">
{{svg "octicon-trash" 14}}
</div>
{{end}}
</div>
</div>
<div class="ui attached segment comment-body">
<div class="render-content markup">
{{if .RenderedContent}}
{{.RenderedContent}}
{{else}}
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
{{end}}
</div>
</div>
</div>
</div>
{{end}}