mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-19 16:18:11 +00:00
refactor: clean up pull request comment related code and template dict (#39789)
1. drop comment.commit_id 2. refactor templates, remove `dict "." .` from templates
This commit is contained in:
@@ -437,6 +437,7 @@ func prepareMigrationTasks() []*migration {
|
||||
newMigration(358, "Track previous remember-me token hashes", v29.AddPreviousAuthTokenHash),
|
||||
newMigration(359, "Add stage and number columns to action_task_step", v29.AddStageAndNumberToActionTaskStep),
|
||||
newMigration(360, "Move branch protection settings to JSON", v29.MoveBranchProtectionConfigToJSON),
|
||||
newMigration(361, "Drop legacy commit_id column from comment", v29.DropCommentCommitID),
|
||||
}
|
||||
return preparedMigrations
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2026 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v29
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func DropCommentCommitID(ctx context.Context, x base.EngineMigration) error {
|
||||
exists, err := x.Dialect().IsColumnExist(x.DB(), ctx, "comment", "commit_id")
|
||||
if err != nil || !exists {
|
||||
return err
|
||||
}
|
||||
|
||||
return base.EngineTransaction(x, func(sess base.Session) error {
|
||||
return base.DropTableColumns(sess, "comment", "commit_id")
|
||||
})
|
||||
}
|
||||
@@ -15,23 +15,7 @@ import (
|
||||
"gitea.dev/modules/setting"
|
||||
)
|
||||
|
||||
func dictMerge(base map[string]any, arg any) bool {
|
||||
if arg == nil {
|
||||
return true
|
||||
}
|
||||
rv := reflect.ValueOf(arg)
|
||||
if rv.Kind() == reflect.Map {
|
||||
for _, k := range rv.MapKeys() {
|
||||
base[k.String()] = rv.MapIndex(k).Interface()
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// dict is a helper function for creating a map[string]any from a list of key-value pairs.
|
||||
// If the key is dot ".", the value is merged into the base map, just like Golang template's dot syntax: dot means current
|
||||
// The dot syntax is highly discouraged because it might cause unclear key conflicts. It's always good to use explicit keys.
|
||||
func dict(args ...any) (map[string]any, error) {
|
||||
if len(args)%2 != 0 {
|
||||
return nil, errors.New("invalid dict constructor syntax: must have key-value pairs")
|
||||
@@ -42,13 +26,7 @@ func dict(args ...any) (map[string]any, error) {
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid dict constructor syntax: unable to merge args[%d]", i)
|
||||
}
|
||||
if key == "." {
|
||||
if ok = dictMerge(m, args[i+1]); !ok {
|
||||
return nil, fmt.Errorf("invalid dict constructor syntax: dot arg[%d] must be followed by a dict", i)
|
||||
}
|
||||
} else {
|
||||
m[key] = args[i+1]
|
||||
}
|
||||
m[key] = args[i+1]
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
@@ -18,18 +18,17 @@ func TestDict(t *testing.T) {
|
||||
args []any
|
||||
want map[string]any
|
||||
}{
|
||||
{nil, M{}},
|
||||
{[]any{"a", nil}, M{"a": nil}},
|
||||
{[]any{"a", 1, "b", 2}, M{"a": 1, "b": 2}},
|
||||
{[]any{".", M{"base": 1}, "b", 2}, M{"base": 1, "b": 2}},
|
||||
{[]any{"a", 1, ".", M{"extra": 2}}, M{"a": 1, "extra": 2}},
|
||||
{[]any{"a", 1, ".", map[string]int{"int": 2}}, M{"a": 1, "int": 2}},
|
||||
{[]any{".", nil, "b", 2}, M{"b": 2}},
|
||||
{[]any{"a", 1, "a", 2}, M{"a": 2}},
|
||||
{[]any{"nested", map[string]int{"int": 2}}, M{"nested": map[string]int{"int": 2}}},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
got, err := dict(c.args...)
|
||||
if assert.NoError(t, err) {
|
||||
assert.Equal(t, c.want, got)
|
||||
}
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, c.want, got)
|
||||
}
|
||||
|
||||
bads := []struct {
|
||||
@@ -38,6 +37,7 @@ func TestDict(t *testing.T) {
|
||||
{[]any{"a", 1, "b"}},
|
||||
{[]any{1}},
|
||||
{[]any{struct{}{}}},
|
||||
{[]any{1, "value"}},
|
||||
}
|
||||
for _, c := range bads {
|
||||
_, err := dict(c.args...)
|
||||
|
||||
@@ -142,12 +142,13 @@ const (
|
||||
MaxFullFileHighlightTimeLimit = 2 * time.Second
|
||||
)
|
||||
|
||||
// GetType returns the type of DiffLine.
|
||||
func (d *DiffLine) GetType() int {
|
||||
return int(d.Type)
|
||||
}
|
||||
func (d *DiffLine) IsDiffLinePlain() bool { return d.Type == DiffLinePlain }
|
||||
func (d *DiffLine) IsDiffLineAdd() bool { return d.Type == DiffLineAdd }
|
||||
func (d *DiffLine) IsDiffLineDel() bool { return d.Type == DiffLineDel }
|
||||
func (d *DiffLine) IsDiffLineSection() bool { return d.Type == DiffLineSection }
|
||||
|
||||
// GetHTMLDiffLineType returns the diff line type name for HTML
|
||||
// GetHTMLDiffLineType returns the diff line type name for HTML,
|
||||
// it will generate CSS names for styles ".del-code", ".add-code", ".same-code", ".tag-code"
|
||||
func (d *DiffLine) GetHTMLDiffLineType() string {
|
||||
switch d.Type {
|
||||
case DiffLineAdd:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{$diffBlobExcerptData := .DiffBlobExcerptData}}
|
||||
{{$canCreateComment := and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex}}
|
||||
{{if $.IsSplitStyle}}
|
||||
{{range $k, $line := $.section.Lines}}
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
{{if eq .GetType 4}}
|
||||
{{range $line := $.section.Lines}}
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code line-expanded" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
{{if $line.IsDiffLineSection}}
|
||||
<td class="lines-num lines-num-old">{{$line.RenderBlobExcerptButtons $.FileNameHash $diffBlobExcerptData}}</td>
|
||||
<td colspan="7" class="lines-code lines-code-old">
|
||||
{{- $inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale -}}
|
||||
@@ -17,7 +17,7 @@
|
||||
<td class="lines-code lines-code-old">
|
||||
{{/* ATTENTION: BLOB-EXCERPT-COMMENT-RIGHT: here it intentionally use "right" side to comment, because the backend code depends on the assumption that the comment only happens on right side*/}}
|
||||
{{- if and $canCreateComment $line.RightIdx -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment {{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
{{- end -}}
|
||||
@@ -32,7 +32,7 @@
|
||||
<td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td>
|
||||
<td class="lines-code lines-code-new">
|
||||
{{- if and $canCreateComment $line.RightIdx -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment {{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
{{- end -}}
|
||||
@@ -48,21 +48,21 @@
|
||||
<tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
<td class="add-comment-left" colspan="4">
|
||||
{{if eq $line.GetCommentSide "previous"}}
|
||||
{{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="add-comment-right" colspan="4">
|
||||
{{if eq $line.GetCommentSide "proposed"}}
|
||||
{{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{range $k, $line := $.section.Lines}}
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
{{if eq .GetType 4}}
|
||||
{{range $line := $.section.Lines}}
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code line-expanded" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
{{if $line.IsDiffLineSection}}
|
||||
<td colspan="2" class="lines-num">{{$line.RenderBlobExcerptButtons $.FileNameHash $diffBlobExcerptData}}</td>
|
||||
{{else}}
|
||||
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$.FileNameHash}}L{{$line.LeftIdx}}{{end}}"></span></td>
|
||||
@@ -83,7 +83,7 @@
|
||||
{{if $line.Comments}}
|
||||
<tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
<td class="add-comment-left add-comment-right" colspan="5">
|
||||
{{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
{{end}}
|
||||
<div id="diff-file-boxes">
|
||||
{{range $i, $file := .Diff.Files}}
|
||||
{{range $file := .Diff.Files}}
|
||||
{{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}}
|
||||
{{$isImage:= $file.IsBlobTypeImage}}
|
||||
{{$isCsv := $file.IsBlobTypeCsv}}
|
||||
@@ -193,9 +193,9 @@
|
||||
{{else if $file.Sections}}
|
||||
<table class="chroma" data-new-comment-url="{{$.Issue.Link}}/files/reviews/new_comment" data-path="{{$file.Name}}">
|
||||
{{if $.IsSplitStyle}}
|
||||
{{template "repo/diff/section_split" dict "file" . "root" $}}
|
||||
{{template "repo/diff/section_split" dict "file" $file}}
|
||||
{{else}}
|
||||
{{template "repo/diff/section_unified" dict "file" . "root" $}}
|
||||
{{template "repo/diff/section_unified" dict "file" $file}}
|
||||
{{end}}
|
||||
</table>
|
||||
{{else if $file.IsRenamed}}
|
||||
|
||||
@@ -1,46 +1,47 @@
|
||||
{{if and ctx.RootData.SignedUserID (not ctx.RootData.Repository.IsArchived)}}
|
||||
<form class="ui form {{if $.hidden}}tw-hidden comment-form{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post">
|
||||
<input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
|
||||
<input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}">
|
||||
<input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}">
|
||||
<input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}">
|
||||
<input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}">
|
||||
{{$root := ctx.RootData -}}
|
||||
{{$replyReviewComment := $.ReplyReviewComment -}}{{/* can be nil */ -}}
|
||||
{{$canAddComment := and $root.SignedUserID (not $root.Repository.IsArchived) -}}
|
||||
{{if $canAddComment}}
|
||||
<form class="ui form {{if $replyReviewComment}}tw-hidden comment-form{{end}}" action="{{$root.Issue.Link}}/files/reviews/comments" method="post">
|
||||
<input type="hidden" name="origin" value="{{if $root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
|
||||
<input type="hidden" name="latest_commit_id" value="{{$root.AfterCommitID}}">
|
||||
<input type="hidden" name="side" value="{{$replyReviewComment.DiffSide}}">
|
||||
<input type="hidden" name="line" value="{{$replyReviewComment.UnsignedLine}}">
|
||||
<input type="hidden" name="path" value="{{$replyReviewComment.TreePath}}">
|
||||
<input type="hidden" name="diff_start_cid">
|
||||
<input type="hidden" name="diff_end_cid">
|
||||
<input type="hidden" name="diff_base_cid">
|
||||
<div class="field">
|
||||
{{template "shared/combomarkdowneditor" (dict
|
||||
"CustomInit" true
|
||||
"MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorComment ctx.RootData.Repository)
|
||||
"MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorComment $root.Repository)
|
||||
"TextareaName" "content"
|
||||
"TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder")
|
||||
"DropzoneParentContainer" "form"
|
||||
"DisableAutosize" "true"
|
||||
)}}
|
||||
</div>
|
||||
{{if $.root.IsAttachmentEnabled}}
|
||||
{{if $root.IsAttachmentEnabled}}
|
||||
<div class="field">
|
||||
{{template "repo/upload" dict "UploadOptions" ctx.RootData.UploadOptions}}
|
||||
{{template "repo/upload" dict "UploadOptions" $root.UploadOptions}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="field footer">
|
||||
<div class="flex-text-block tw-justify-end">
|
||||
{{if $.reply}}
|
||||
{{if $replyReviewComment}}
|
||||
<button class="ui submit primary tiny button" type="submit">{{ctx.Locale.Tr "repo.diff.comment.reply"}}</button>
|
||||
<input type="hidden" name="reply" value="{{$.reply}}">
|
||||
<input type="hidden" name="reply" value="{{$replyReviewComment.ReviewID}}">
|
||||
<input type="hidden" name="single_review" value="true">
|
||||
{{else}}
|
||||
{{if $.root.CurrentReview}}
|
||||
{{if $root.CurrentReview}}
|
||||
<button name="pending_review" type="submit" class="ui submit primary tiny button">{{ctx.Locale.Tr "repo.diff.comment.add_review_comment"}}</button>
|
||||
{{else}}
|
||||
<button name="pending_review" type="submit" class="ui submit primary tiny button">{{ctx.Locale.Tr "repo.diff.comment.start_review"}}</button>
|
||||
<button name="single_review" value="true" type="submit" class="ui submit tiny basic button">{{ctx.Locale.Tr "repo.diff.comment.add_single_comment"}}</button>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if or (not $.HasComments) $.hidden}}
|
||||
<button type="button" class="ui submit tiny basic button" data-global-click="onCancelCodeComment">{{ctx.Locale.Tr "cancel"}}</button>
|
||||
{{end}}
|
||||
<button type="button" class="ui submit tiny basic button" data-global-click="onCancelCodeComment">{{ctx.Locale.Tr "cancel"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{{if $.comment}}
|
||||
{{template "repo/diff/comment_form" dict "root" $.root "hidden" $.hidden "reply" $.reply "Line" $.comment.UnsignedLine "File" $.comment.TreePath "Side" $.comment.DiffSide "HasComments" true}}
|
||||
{{else if $.root}}
|
||||
{{template "repo/diff/comment_form" $}}
|
||||
{{else}}
|
||||
{{template "repo/diff/comment_form" dict "root" $}}
|
||||
{{end}}
|
||||
@@ -1,46 +1,51 @@
|
||||
{{range $comment := .comments}}
|
||||
|
||||
{{$createdStr:= DateUtils.TimeSince .CreatedUnix}}
|
||||
<div class="comment" id="{{.HashTag}}">
|
||||
{{$root := ctx.RootData -}}
|
||||
{{$repo := $root.Repository -}}
|
||||
{{$repoLink := $root.RepoLink -}}
|
||||
{{$issue := $root.Issue -}}
|
||||
{{$canWrite := or $root.Permission.IsAdmin $root.HasIssuesOrPullsWritePermission -}}
|
||||
{{$signedUserID := or $root.SignedUserID NIL -}}
|
||||
{{range $comment := $.comments}}
|
||||
{{$createdStr:= DateUtils.TimeSince $comment.CreatedUnix}}
|
||||
<div class="comment" id="{{$comment.HashTag}}">
|
||||
<div class="tw-mt-2 tw-mr-4">
|
||||
{{if .OriginalAuthor}}
|
||||
{{if $comment.OriginalAuthor}}
|
||||
<span class="avatar">{{ctx.AvatarUtils.Avatar nil}}</span>
|
||||
{{else}}
|
||||
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||
{{template "shared/user/avatarlink" dict "user" $comment.Poster}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="content comment-container">
|
||||
<div class="comment-header avatar-content-left-arrow">
|
||||
<div class="comment-header-left">
|
||||
{{if .OriginalAuthor}}
|
||||
{{if $comment.OriginalAuthor}}
|
||||
<span class="tw-text-text tw-font-semibold tw-mr-1">
|
||||
{{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}}
|
||||
{{.OriginalAuthor}}
|
||||
{{svg (MigrationIcon $repo.GetOriginalURLHostname)}}
|
||||
{{$comment.OriginalAuthor}}
|
||||
</span>
|
||||
<span class="tw-text-text-light muted-links">
|
||||
{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}}
|
||||
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdStr}}
|
||||
</span>
|
||||
<span class="text migrate">
|
||||
{{if $.root.Repository.OriginalURL}}
|
||||
({{ctx.Locale.Tr "repo.migrated_from" $.root.Repository.OriginalURL $.root.Repository.GetOriginalURLHostname}})
|
||||
{{if $repo.OriginalURL}}
|
||||
({{ctx.Locale.Tr "repo.migrated_from" $repo.OriginalURL $repo.GetOriginalURLHostname}})
|
||||
{{end}}
|
||||
</span>
|
||||
{{else}}
|
||||
<span class="tw-text-text-light muted-links">
|
||||
{{template "shared/user/namelink" .Poster}}
|
||||
{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}}
|
||||
{{template "shared/user/namelink" $comment.Poster}}
|
||||
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdStr}}
|
||||
</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="comment-header-right">
|
||||
{{if .Invalidated}}
|
||||
{{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}}
|
||||
{{if $comment.Invalidated}}
|
||||
{{$referenceUrl := printf "%s#%s" $issue.Link $comment.HashTag}}
|
||||
<a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
|
||||
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .Review}}
|
||||
{{if eq .Review.Type 0}}
|
||||
{{if $comment.Review}}
|
||||
{{if eq $comment.Review.Type 0}}
|
||||
<div class="ui label basic small yellow pending-label" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.pending.tooltip" (ctx.Locale.Tr "repo.diff.review") (ctx.Locale.Tr "repo.diff.review.approve") (ctx.Locale.Tr "repo.diff.review.comment") (ctx.Locale.Tr "repo.diff.review.reject")}}">
|
||||
{{ctx.Locale.Tr "repo.issues.review.pending"}}
|
||||
</div>
|
||||
@@ -50,29 +55,30 @@
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if not $.root.Repository.IsArchived}}
|
||||
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}}
|
||||
{{if not $repo.IsArchived}}
|
||||
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID)}}
|
||||
{{end}}
|
||||
{{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_comment" "ConvContentPage" "pr-files" "ConvContentItem" $comment}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui attached segment comment-body">
|
||||
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
|
||||
{{if .RenderedContent}}
|
||||
{{.RenderedContent}}
|
||||
{{$doerIsPoster := eq $signedUserID $comment.PosterID}}
|
||||
<div class="render-content markup" {{if or $canWrite $doerIsPoster}}data-can-edit="true"{{end}}>
|
||||
{{if $comment.RenderedContent}}
|
||||
{{$comment.RenderedContent}}
|
||||
{{else}}
|
||||
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div id="{{.HashTag}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
|
||||
<div class="edit-content-zone tw-hidden" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.root.RepoLink}}" data-attachment-url="{{$.root.RepoLink}}/comments/{{.ID}}/attachments"></div>
|
||||
{{if .Attachments}}
|
||||
{{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
|
||||
<div id="{{$comment.HashTag}}-raw" class="raw-content tw-hidden">{{$comment.Content}}</div>
|
||||
<div class="edit-content-zone tw-hidden" data-update-url="{{$repoLink}}/comments/{{$comment.ID}}" data-content-version="{{$comment.ContentVersion}}" data-context="{{$repoLink}}" data-attachment-url="{{$repoLink}}/comments/{{$comment.ID}}/attachments"></div>
|
||||
{{if $comment.Attachments}}
|
||||
{{template "repo/issue/view_content/attachments" dict "Attachments" $comment.Attachments "RenderedContent" $comment.RenderedContent}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{$reactions := .Reactions.GroupByType}}
|
||||
{{$reactions := $comment.Reactions.GroupByType}}
|
||||
{{if $reactions}}
|
||||
{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
|
||||
{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID) "Reactions" $reactions}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
{{if len .comments}}
|
||||
{{$comment := index .comments 0}}
|
||||
{{$resolved := $comment.IsResolved}}
|
||||
{{$invalid := $comment.Invalidated}}
|
||||
{{$resolveDoer := $comment.ResolveDoer}}
|
||||
{{$hasReview := and $comment.Review}}
|
||||
{{$isReviewPending := and $hasReview (eq $comment.Review.Type 0)}}
|
||||
{{$referenceUrl := printf "%s#%s" $.Issue.Link $comment.HashTag}}
|
||||
<div class="conversation-holder" data-path="{{$comment.TreePath}}" data-side="{{if lt $comment.Line 0}}left{{else}}right{{end}}" data-idx="{{$comment.UnsignedLine}}">
|
||||
{{$root := ctx.RootData}}
|
||||
{{$comments := $.comments}}
|
||||
{{$firstComment := index $comments 0}}
|
||||
{{$resolved := $firstComment.IsResolved}}
|
||||
{{$invalid := $firstComment.Invalidated}}
|
||||
{{$resolveDoer := $firstComment.ResolveDoer}}
|
||||
{{$hasReview := and $firstComment.Review}}
|
||||
{{$isReviewPending := and $hasReview (eq $firstComment.Review.Type 0)}}
|
||||
{{$referenceUrl := printf "%s#%s" $root.Issue.Link $firstComment.HashTag}}
|
||||
{{$canAddComment := and $root.SignedUserID (not $root.Repository.IsArchived)}}
|
||||
{{$canMarkAsResolved := and $root.CanMarkConversation $hasReview (not $isReviewPending)}}
|
||||
{{$repoLink := $root.RepoLink}}
|
||||
<div class="conversation-holder" data-path="{{$firstComment.TreePath}}" data-side="{{if lt $firstComment.Line 0}}left{{else}}right{{end}}" data-idx="{{$firstComment.UnsignedLine}}">
|
||||
{{if $resolved}}
|
||||
<div class="resolved-placeholder">
|
||||
<div class="flex-text-block tw-flex-wrap tw-text-text-light">
|
||||
@@ -23,19 +28,19 @@
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="flex-text-block">
|
||||
<button type="button" id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny show-outdated">
|
||||
<button type="button" id="show-outdated-{{$firstComment.ID}}" data-comment="{{$firstComment.ID}}" class="btn tiny show-outdated">
|
||||
{{svg "octicon-unfold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.show_resolved"}}
|
||||
</button>
|
||||
<button type="button" id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny hide-outdated tw-hidden">
|
||||
<button type="button" id="hide-outdated-{{$firstComment.ID}}" data-comment="{{$firstComment.ID}}" class="btn tiny hide-outdated tw-hidden">
|
||||
{{svg "octicon-fold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}">
|
||||
<div id="code-comments-{{$firstComment.ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}">
|
||||
<div class="comment-list">
|
||||
<div class="ui comments">
|
||||
{{template "repo/diff/comments" dict "root" $ "comments" .comments}}
|
||||
{{template "repo/diff/comments" dict "comments" $comments}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-text-block tw-mt-2 tw-flex-wrap tw-justify-end">
|
||||
@@ -47,8 +52,8 @@
|
||||
{{svg "octicon-arrow-down" 12}} {{ctx.Locale.Tr "repo.issues.next"}}
|
||||
</button>
|
||||
</div>
|
||||
{{if and $.CanMarkConversation $hasReview (not $isReviewPending)}}
|
||||
<button type="button" class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
|
||||
{{if $canMarkAsResolved}}
|
||||
<button type="button" class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$firstComment.ID}}" data-update-url="{{$repoLink}}/issues/resolve_conversation">
|
||||
{{if $resolved}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}}
|
||||
{{else}}
|
||||
@@ -56,13 +61,13 @@
|
||||
{{end}}
|
||||
</button>
|
||||
{{end}}
|
||||
{{if and $.SignedUserID (not $.Repository.IsArchived)}}
|
||||
{{if $canAddComment}}
|
||||
<button type="button" class="comment-form-reply ui primary icon tiny button">
|
||||
{{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}}
|
||||
{{template "repo/diff/comment_form" dict "ReplyReviewComment" $firstComment}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="conversation-holder">
|
||||
<div class="field comment-code-cloud">
|
||||
{{template "repo/diff/comment_form_datahandler" .}}
|
||||
{{template "repo/diff/comment_form"}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{$file := .file}}
|
||||
{{$diffBlobExcerptData := $.root.DiffBlobExcerptData}}
|
||||
{{$file := $.file -}}
|
||||
{{$diffBlobExcerptData := ctx.RootData.DiffBlobExcerptData -}}
|
||||
{{$canAddComment := and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex -}}
|
||||
<colgroup>
|
||||
<col width="50">
|
||||
<col width="10">
|
||||
@@ -10,17 +11,17 @@
|
||||
<col width="10">
|
||||
<col>
|
||||
</colgroup>
|
||||
{{range $j, $section := $file.Sections}}
|
||||
{{range $k, $line := $section.Lines}}
|
||||
{{$hasmatch := ne $line.Match -1}}
|
||||
{{if or (ne .GetType 2) (not $hasmatch)}}
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
{{if eq .GetType 4}}
|
||||
{{range $section := $file.Sections}}
|
||||
{{range $line := $section.Lines}}
|
||||
{{$hasMatch := ne $line.Match -1}}
|
||||
{{if or (not $line.IsDiffLineAdd) (not $hasMatch)}}
|
||||
<tr class="{{$line.GetHTMLDiffLineType}}-code" data-line-type="{{$line.GetHTMLDiffLineType}}">
|
||||
{{if $line.IsDiffLineSection}}
|
||||
{{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}}
|
||||
<td class="lines-num lines-num-old">{{$line.RenderBlobExcerptButtons $file.NameHash $diffBlobExcerptData}}</td>
|
||||
<td class="lines-escape lines-escape-old">{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}}</td>
|
||||
<td colspan="6" class="lines-code lines-code-old">{{template "repo/diff/section_code" dict "diff" $inlineDiff}}</td>
|
||||
{{else if and (eq .GetType 3) $hasmatch}}{{/* DEL */}}
|
||||
{{else if and $line.IsDiffLineDel $hasMatch}}
|
||||
{{$match := index $section.Lines $line.Match}}
|
||||
{{- $leftDiff := ""}}{{if $line.LeftIdx}}{{$leftDiff = $section.GetComputedInlineDiffFor $line ctx.Locale}}{{end}}
|
||||
{{- $rightDiff := ""}}{{if $match.RightIdx}}{{$rightDiff = $section.GetComputedInlineDiffFor $match ctx.Locale}}{{end}}
|
||||
@@ -28,8 +29,8 @@
|
||||
<td class="lines-escape del-code lines-escape-old">{{if $line.LeftIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $leftDiff.EscapeStatus}}{{end}}</td>
|
||||
<td class="lines-type-marker lines-type-marker-old del-code"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
|
||||
<td class="lines-code lines-code-old del-code">
|
||||
{{- if and $.root.SignedUserID $.root.PageIsPullFiles -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">
|
||||
{{- if $canAddComment -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment {{if (not $line.CanComment)}}tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
{{- end -}}
|
||||
@@ -43,8 +44,8 @@
|
||||
<td class="lines-escape add-code lines-escape-new">{{if $match.RightIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $rightDiff.EscapeStatus}}{{end}}</td>
|
||||
<td class="lines-type-marker lines-type-marker-new add-code">{{if $match.RightIdx}}<span class="tw-font-mono" data-type-marker="{{$match.GetLineTypeMarker}}"></span>{{end}}</td>
|
||||
<td class="lines-code lines-code-new add-code">
|
||||
{{- if and $.root.SignedUserID $.root.PageIsPullFiles -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $match.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$match.RightIdx}}">
|
||||
{{- if $canAddComment -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment {{if (not $match.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$match.RightIdx}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
{{- end -}}
|
||||
@@ -60,8 +61,8 @@
|
||||
<td class="lines-escape lines-escape-old">{{if $line.LeftIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}}{{end}}</td>
|
||||
<td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
|
||||
<td class="lines-code lines-code-old">
|
||||
{{- if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2)) -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">
|
||||
{{- if and $canAddComment (not $line.IsDiffLineAdd) -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment {{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
{{- end -}}
|
||||
@@ -75,8 +76,8 @@
|
||||
<td class="lines-escape lines-escape-new">{{if $line.RightIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}}{{end}}</td>
|
||||
<td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
|
||||
<td class="lines-code lines-code-new">
|
||||
{{- if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3)) -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
|
||||
{{- if and $canAddComment (not $line.IsDiffLineDel) -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment {{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
{{- end -}}
|
||||
@@ -88,46 +89,46 @@
|
||||
</td>
|
||||
{{end}}
|
||||
</tr>
|
||||
{{if and (eq .GetType 3) $hasmatch}}
|
||||
{{if and $line.IsDiffLineDel $hasMatch}}
|
||||
{{$match := index $section.Lines $line.Match}}
|
||||
{{if or $line.Comments $match.Comments}}
|
||||
<tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
<td class="add-comment-left" colspan="4">
|
||||
{{if $line.Comments}}
|
||||
{{if eq $line.GetCommentSide "previous"}}
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if $match.Comments}}
|
||||
{{if eq $match.GetCommentSide "previous"}}
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $match.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $match.Comments}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="add-comment-right" colspan="4">
|
||||
{{if $line.Comments}}
|
||||
{{if eq $line.GetCommentSide "proposed"}}
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if $match.Comments}}
|
||||
{{if eq $match.GetCommentSide "proposed"}}
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $match.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $match.Comments}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else if $line.Comments}}
|
||||
<tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
<tr class="add-comment" data-line-type="{{$line.GetHTMLDiffLineType}}">
|
||||
<td class="add-comment-left" colspan="4">
|
||||
{{if eq $line.GetCommentSide "previous"}}
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="add-comment-right" colspan="4">
|
||||
{{if eq $line.GetCommentSide "proposed"}}
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{{$file := .file}}
|
||||
{{$file := $.file}}
|
||||
{{/* this tmpl is also used by the PR Conversation page, so "DiffBlobExcerptData" may not exist */}}
|
||||
{{$diffBlobExcerptData := $.root.DiffBlobExcerptData}}
|
||||
{{$diffBlobExcerptData := ctx.RootData.DiffBlobExcerptData}}
|
||||
{{$canAddComment := and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex}}
|
||||
<colgroup>
|
||||
<col width="50">
|
||||
<col width="50">
|
||||
@@ -8,10 +9,10 @@
|
||||
<col width="10">
|
||||
<col>
|
||||
</colgroup>
|
||||
{{range $j, $section := $file.Sections}}
|
||||
{{range $k, $line := $section.Lines}}
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
{{if eq .GetType 4}}
|
||||
{{range $section := $file.Sections}}
|
||||
{{range $line := $section.Lines}}
|
||||
<tr class="{{$line.GetHTMLDiffLineType}}-code" data-line-type="{{$line.GetHTMLDiffLineType}}">
|
||||
{{if $line.IsDiffLineSection}}
|
||||
{{if $diffBlobExcerptData}}
|
||||
<td colspan="2" class="lines-num">{{$line.RenderBlobExcerptButtons $file.NameHash $diffBlobExcerptData}}</td>
|
||||
{{else}}
|
||||
@@ -27,11 +28,11 @@
|
||||
{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}}
|
||||
</td>
|
||||
<td class="lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
|
||||
{{if eq .GetType 4}}
|
||||
{{if $line.IsDiffLineSection}}
|
||||
<td class="chroma lines-code blob-hunk">{{template "repo/diff/section_code" dict "diff" $inlineDiff}}</td>
|
||||
{{else}}
|
||||
<td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">
|
||||
{{- if and $.root.SignedUserID $.root.PageIsPullFiles -}}
|
||||
{{- if $canAddComment -}}
|
||||
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">
|
||||
{{- svg "octicon-plus" -}}
|
||||
</button>
|
||||
@@ -41,9 +42,9 @@
|
||||
{{end}}
|
||||
</tr>
|
||||
{{if $line.Comments}}
|
||||
<tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}">
|
||||
<tr class="add-comment" data-line-type="{{$line.GetHTMLDiffLineType}}">
|
||||
<td class="add-comment-left add-comment-right" colspan="5">
|
||||
{{template "repo/diff/conversation" dict "." $.root "comments" $line.Comments}}
|
||||
{{template "repo/diff/conversation" dict "comments" $line.Comments}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="file-body file-code code-diff code-diff-unified unicode-escaped">
|
||||
<table>
|
||||
<tbody>
|
||||
{{template "repo/diff/section_unified" dict "file" .File "root" $}}
|
||||
{{template "repo/diff/section_unified" dict "file" .File}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{{$useMarkdownEditor := not .item.Attributes.render}}
|
||||
{{$root := ctx.RootData -}}
|
||||
{{$useMarkdownEditor := not .item.Attributes.render -}}
|
||||
<div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}} {{if $useMarkdownEditor}}combo-editor-dropzone{{end}}">
|
||||
{{template "repo/issue/fields/header" .}}
|
||||
|
||||
@@ -9,15 +10,15 @@
|
||||
{{template "shared/combomarkdowneditor" (dict
|
||||
"CustomInit" true
|
||||
"ContainerClasses" "tw-hidden"
|
||||
"MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorComment ctx.RootData.Repository)
|
||||
"MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorComment $root.Repository)
|
||||
"TextareaContent" .item.Attributes.value
|
||||
"TextareaPlaceholder" .item.Attributes.placeholder
|
||||
"DropzoneParentContainer" ".combo-editor-dropzone"
|
||||
)}}
|
||||
|
||||
{{if .root.IsAttachmentEnabled}}
|
||||
{{if $root.IsAttachmentEnabled}}
|
||||
<div class="tw-mt-4 form-field-dropzone tw-hidden">{{/*TODO: need to refactor the "repo/upload" template and remove this wrapper */}}
|
||||
{{template "repo/upload" dict "UploadOptions" ctx.RootData.UploadOptions}}
|
||||
{{template "repo/upload" dict "UploadOptions" $root.UploadOptions}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
{{template "repo/issue/filter_actions" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "shared/issuelist" dict "." . "listType" "repo"}}
|
||||
{{template "shared/issuelist" dict "listType" "repo"}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
{{template "repo/issue/filters" .}}
|
||||
|
||||
{{template "shared/issuelist" dict "." . "listType" "milestone"}}
|
||||
{{template "shared/issuelist" dict "listType" "milestone"}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
{{else if eq .Type "markdown"}}
|
||||
{{template "repo/issue/fields/markdown" dict "item" .}}
|
||||
{{else if eq .Type "textarea"}}
|
||||
{{template "repo/issue/fields/textarea" dict "item" . "root" $}}
|
||||
{{template "repo/issue/fields/textarea" dict "item" .}}
|
||||
{{else if eq .Type "dropdown"}}
|
||||
{{template "repo/issue/fields/dropdown" dict "item" .}}
|
||||
{{else if eq .Type "checkboxes"}}
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
</p>
|
||||
{{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}}
|
||||
{{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}}
|
||||
{{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}}
|
||||
{{template "base/modal_actions_confirm" (dict "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}}
|
||||
</div>
|
||||
</form>
|
||||
{{end}}
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
<div class="timeline-item event code-comments-list">
|
||||
{{range $filename, $lines := .Review.CodeComments}}
|
||||
{{range $line, $comms := $lines}}
|
||||
{{template "repo/issue/view_content/conversation" dict "." $ "comments" $comms}}
|
||||
{{template "repo/issue/view_content/conversation" dict "comments" $comms}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
{{/* FIXME: DIFF-CONVERSATION-DATA: in the future this template should be refactor to avoid called by {{... "." $}}
|
||||
At the moment, two kinds of request handler call this template:
|
||||
{{/* TODO: At the moment, two kinds of request handler call this template:
|
||||
* ExcerptBlob -> blob_excerpt.tmpl -> this
|
||||
* Other compare and diff pages -> ... -> {section_unified.tmpl|section_split.tmpl} -> this)
|
||||
The variables in "ctx.Data" are different in each case, making this template fragile, hard to read and maintain. */}}
|
||||
{{if len .comments}}
|
||||
{{$firstComment := index .comments 0}}
|
||||
{{$invalid := $firstComment.Invalidated}}
|
||||
{{$resolved := $firstComment.IsResolved}}
|
||||
{{$resolveDoer := $firstComment.ResolveDoer}}
|
||||
{{$hasReview := and $firstComment.Review}}
|
||||
{{$isReviewPending := and $hasReview (eq $firstComment.Review.Type 0)}}
|
||||
{{$firstComment := index .comments 0 -}}
|
||||
{{$invalid := $firstComment.Invalidated -}}
|
||||
{{$resolved := $firstComment.IsResolved -}}
|
||||
{{$resolveDoer := $firstComment.ResolveDoer -}}
|
||||
{{$hasReview := and $firstComment.Review -}}
|
||||
{{$isReviewPending := and $hasReview (eq $firstComment.Review.Type 0) -}}
|
||||
{{$root := ctx.RootData -}}
|
||||
{{$repo := $root.Repository -}}
|
||||
{{$repoLink := $root.RepoLink -}}
|
||||
{{$editorconfig := $root.Editorconfig -}}
|
||||
{{$canWrite := or $root.Permission.IsAdmin $root.HasIssuesOrPullsWritePermission -}}
|
||||
{{$signedUserID := or $root.SignedUserID NIL -}}
|
||||
{{$canMarkAsResolved := and $root.CanMarkConversation $hasReview (not $isReviewPending)}}
|
||||
{{$canAddComment := and $root.SignedUserID (not $root.Repository.IsArchived)}}
|
||||
<div class="ui segments conversation-holder">
|
||||
<div class="ui segment collapsible-comment-box tw-py-2 flex-left-right">
|
||||
<div class="tw-flex tw-items-center">
|
||||
@@ -30,7 +37,7 @@ The variables in "ctx.Data" are different in each case, making this template fra
|
||||
{{ctx.Locale.Tr "repo.issues.review.show_outdated"}}
|
||||
{{end}}
|
||||
</button>
|
||||
<button type="button" id="hide-outdated-{{$firstComment.ID}}" data-comment="{{$firstComment.ID}}" class="{{if $resolved}}tw-hidden {{end}} btn tiny hide-outdated">
|
||||
<button type="button" id="hide-outdated-{{$firstComment.ID}}" data-comment="{{$firstComment.ID}}" class="{{if $resolved}}tw-hidden{{end}} btn tiny hide-outdated">
|
||||
{{svg "octicon-fold" 16 "tw-mr-2"}}
|
||||
{{if $resolved}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
|
||||
@@ -44,71 +51,70 @@ The variables in "ctx.Data" are different in each case, making this template fra
|
||||
{{$diff := (CommentMustAsDiff ctx $firstComment)}}
|
||||
{{if $diff}}
|
||||
{{$file := (index $diff.Files 0)}}
|
||||
<div id="code-preview-{{$firstComment.ID}}" class="ui table segment{{if $resolved}} tw-hidden{{end}}">
|
||||
<div class="diff-file-box file-content {{TabSizeClass $.Editorconfig $file.Name}}">
|
||||
<div id="code-preview-{{$firstComment.ID}}" class="ui table segment {{if $resolved}}tw-hidden{{end}}">
|
||||
<div class="diff-file-box file-content {{TabSizeClass $editorconfig $file.Name}}">
|
||||
<div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped">
|
||||
<table>
|
||||
<tbody>
|
||||
{{template "repo/diff/section_unified" dict "file" $file "root" $}}
|
||||
{{template "repo/diff/section_unified" dict "file" $file}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div id="code-comments-{{$firstComment.ID}}" class="comment-code-cloud ui segment{{if $resolved}} tw-hidden{{end}}">
|
||||
<div id="code-comments-{{$firstComment.ID}}" class="comment-code-cloud ui segment {{if $resolved}}tw-hidden{{end}}">
|
||||
<div class="ui comments tw-mb-0">
|
||||
{{range $comment := .comments}}
|
||||
{{$createdSubStr:= DateUtils.TimeSince .CreatedUnix}}
|
||||
<div class="comment code-comment" id="{{.HashTag}}">
|
||||
{{$createdSubStr:= DateUtils.TimeSince $comment.CreatedUnix}}
|
||||
<div class="comment code-comment" id="{{$comment.HashTag}}">
|
||||
<div class="content comment-container">
|
||||
<div class="comment-header">
|
||||
<div class="comment-header-left">
|
||||
{{if not .OriginalAuthor}}
|
||||
<a class="avatar">
|
||||
{{ctx.AvatarUtils.Avatar .Poster 20}}
|
||||
</a>
|
||||
{{if not $comment.OriginalAuthor}}
|
||||
<a class="avatar">{{ctx.AvatarUtils.Avatar $comment.Poster 20}}</a>
|
||||
{{end}}
|
||||
<span class="tw-text-text-light muted-links">
|
||||
{{if .OriginalAuthor}}
|
||||
{{if $comment.OriginalAuthor}}
|
||||
<span class="tw-text-text">
|
||||
{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
|
||||
{{.OriginalAuthor}}
|
||||
{{svg (MigrationIcon $repo.GetOriginalURLHostname)}}
|
||||
{{$comment.OriginalAuthor}}
|
||||
</span>
|
||||
{{if $.Repository.OriginalURL}}
|
||||
<span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}})</span>
|
||||
{{if $repo.OriginalURL}}
|
||||
<span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" $repo.OriginalURL $repo.GetOriginalURLHostname}})</span>
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{template "shared/user/authorlink" .Poster}}
|
||||
{{template "shared/user/authorlink" $comment.Poster}}
|
||||
{{end}}
|
||||
{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdSubStr}}
|
||||
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdSubStr}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="comment-header-right">
|
||||
{{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}}
|
||||
{{if not $.Repository.IsArchived}}
|
||||
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
|
||||
{{template "repo/issue/view_content/show_role" dict "ShowRole" $comment.ShowRole}}
|
||||
{{if not $repo.IsArchived}}
|
||||
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID)}}
|
||||
{{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_comment" "ConvContentItem" $comment}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text comment-content">
|
||||
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
|
||||
{{if .RenderedContent}}
|
||||
{{.RenderedContent}}
|
||||
{{$doerIsPoster := eq $signedUserID $comment.PosterID}}
|
||||
<div class="render-content markup" {{if or $canWrite $doerIsPoster}}data-can-edit="true"{{end}}>
|
||||
{{if $comment.RenderedContent}}
|
||||
{{$comment.RenderedContent}}
|
||||
{{else}}
|
||||
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div id="{{.HashTag}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
|
||||
<div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
|
||||
{{if .Attachments}}
|
||||
{{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
|
||||
<div id="{{$comment.HashTag}}-raw" class="raw-content tw-hidden">{{$comment.Content}}</div>
|
||||
<div class="edit-content-zone tw-hidden" data-update-url="{{$repoLink}}/comments/{{$comment.ID}}" data-content-version="{{$comment.ContentVersion}}" data-context="{{$repoLink}}" data-attachment-url="{{$repoLink}}/comments/{{$comment.ID}}/attachments"></div>
|
||||
{{if $comment.Attachments}}
|
||||
{{template "repo/issue/view_content/attachments" dict "Attachments" $comment.Attachments "RenderedContent" $comment.RenderedContent}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{$reactions := .Reactions.GroupByType}}
|
||||
{{$reactions := $comment.Reactions.GroupByType}}
|
||||
{{if $reactions}}
|
||||
{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
|
||||
{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID) "Reactions" $reactions}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -124,8 +130,8 @@ The variables in "ctx.Data" are different in each case, making this template fra
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="flex-text-block">
|
||||
{{if and $.CanMarkConversation $hasReview (not $isReviewPending)}}
|
||||
<button type="button" class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$firstComment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
|
||||
{{if $canMarkAsResolved}}
|
||||
<button type="button" class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{Iif $resolved "UnResolve" "Resolve"}}" data-comment-id="{{$firstComment.ID}}" data-update-url="{{$repoLink}}/issues/resolve_conversation">
|
||||
{{if $resolved}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}}
|
||||
{{else}}
|
||||
@@ -133,14 +139,14 @@ The variables in "ctx.Data" are different in each case, making this template fra
|
||||
{{end}}
|
||||
</button>
|
||||
{{end}}
|
||||
{{if and $.SignedUserID (not $.Repository.IsArchived)}}
|
||||
{{if $canAddComment}}
|
||||
<button type="button" class="comment-form-reply ui primary icon tiny button">
|
||||
{{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $firstComment.ReviewID "root" $ "comment" $firstComment}}
|
||||
{{template "repo/diff/comment_form" dict "ReplyReviewComment" $firstComment}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
|
||||
@@ -1,117 +1,119 @@
|
||||
{{$root := ctx.RootData -}}
|
||||
{{$listType := .listType -}}
|
||||
<div id="issue-list" class="flex-divided-list items-with-main">
|
||||
{{$approvalCounts := .ApprovalCounts}}
|
||||
{{range .Issues}}
|
||||
{{$approvalCounts := $root.ApprovalCounts}}
|
||||
{{range $issue := $root.Issues}}
|
||||
<div class="item">
|
||||
|
||||
<div class="item-leading">
|
||||
{{/* using some tw helpers is the only way to align the checkbox */}}
|
||||
<div class="flex-text-inline tw-mt-[3px]">
|
||||
{{if $.CanWriteIssuesOrPulls}}
|
||||
<input type="checkbox" autocomplete="off" class="issue-checkbox tw-mr-[14px]" data-issue-id="{{.ID}}" aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}}: {{.Title}}">
|
||||
{{if $root.CanWriteIssuesOrPulls}}
|
||||
<input type="checkbox" autocomplete="off" class="issue-checkbox tw-mr-[14px]" data-issue-id="{{$issue.ID}}" aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}}: {{$issue.Title}}">
|
||||
{{end}}
|
||||
{{template "shared/issueicon" .}}
|
||||
{{template "shared/issueicon" $issue}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item-main">
|
||||
<div class="item-header">
|
||||
<div>
|
||||
<a class="list-item-large-title" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{.Title | ctx.RenderUtils.RenderIssueSimpleTitle}}</a>
|
||||
{{if .IsPull}}
|
||||
{{if (index $.CommitStatuses .PullRequest.ID)}}
|
||||
<a class="list-item-large-title" href="{{if $issue.Link}}{{$issue.Link}}{{else}}{{$root.Link}}/{{$issue.Index}}{{end}}">{{$issue.Title | ctx.RenderUtils.RenderIssueSimpleTitle}}</a>
|
||||
{{if $issue.IsPull}}
|
||||
{{if (index $root.CommitStatuses $issue.PullRequest.ID)}}
|
||||
<span class="tw-align-[1px]">{{/* make the "flex" children align with parent "inline" */}}
|
||||
{{template "repo/commit_statuses" dict "Status" (index $.CommitLastStatus .PullRequest.ID) "Statuses" (index $.CommitStatuses .PullRequest.ID)}}
|
||||
{{template "repo/commit_statuses" dict "Status" (index $root.CommitLastStatus $issue.PullRequest.ID) "Statuses" (index $root.CommitStatuses $issue.PullRequest.ID)}}
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<span class="labels-list">
|
||||
{{- range .Labels -}}
|
||||
<a class="item" href="?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.RenderUtils.RenderLabel .}}</a>
|
||||
{{- range $label := $issue.Labels -}}
|
||||
<a class="item" href="?q={{$root.Keyword}}&type={{$root.ViewType}}&state={{$root.State}}&labels={{$label.ID}}{{if ne $listType "milestone"}}&milestone={{$root.MilestoneID}}{{end}}&assignee={{$root.AssigneeID}}&poster={{$root.PosterID}}{{if $root.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.RenderUtils.RenderLabel $label}}</a>
|
||||
{{- end -}}
|
||||
</span>
|
||||
</div>
|
||||
{{if .TotalTrackedTime}}
|
||||
{{if $issue.TotalTrackedTime}}
|
||||
<div class="tw-text-text-light flex-text-block">
|
||||
{{svg "octicon-clock" 16}}
|
||||
{{.TotalTrackedTime | Sec2Hour}}
|
||||
{{$issue.TotalTrackedTime | Sec2Hour}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="item-body tw-gap-2">
|
||||
<a class="index flex-text-inline" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
|
||||
{{if eq $.listType "dashboard"}}
|
||||
{{.Repo.FullName}}#{{.Index}}
|
||||
<a class="index flex-text-inline" href="{{if $issue.Link}}{{$issue.Link}}{{else}}{{$root.Link}}/{{$issue.Index}}{{end}}">
|
||||
{{if eq $listType "dashboard"}}
|
||||
{{$issue.Repo.FullName}}#{{$issue.Index}}
|
||||
{{else}}
|
||||
#{{.Index}}
|
||||
#{{$issue.Index}}
|
||||
{{end}}
|
||||
</a>
|
||||
|
||||
<div class="flex-text-inline">
|
||||
{{$timeStr := DateUtils.TimeSince .GetLastEventTimestamp}}
|
||||
{{if .OriginalAuthor}}
|
||||
{{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}}
|
||||
{{else if gt .Poster.ID 0}}
|
||||
{{ctx.Locale.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.GetDisplayName}}
|
||||
{{$timeStr := DateUtils.TimeSince $issue.GetLastEventTimestamp}}
|
||||
{{if $issue.OriginalAuthor}}
|
||||
{{ctx.Locale.Tr $issue.GetLastEventLabelFake $timeStr $issue.OriginalAuthor}}
|
||||
{{else if gt $issue.Poster.ID 0}}
|
||||
{{ctx.Locale.Tr $issue.GetLastEventLabel $timeStr $issue.Poster.HomeLink $issue.Poster.GetDisplayName}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .Poster.GetDisplayName}}
|
||||
{{ctx.Locale.Tr $issue.GetLastEventLabelFake $timeStr $issue.Poster.GetDisplayName}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{if .IsPull}}
|
||||
{{if $issue.IsPull}}
|
||||
<div class="branches flex-text-inline">
|
||||
<div class="branch">
|
||||
<a href="{{.PullRequest.BaseRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.BaseBranch}}">
|
||||
<a href="{{$issue.PullRequest.BaseRepo.Link}}/src/branch/{{PathEscapeSegments $issue.PullRequest.BaseBranch}}">
|
||||
{{/* inline to remove the spaces between spans */}}
|
||||
{{if ne .RepoID .PullRequest.BaseRepoID}}<span class="truncated-name">{{.PullRequest.BaseRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.BaseBranch}}</span>
|
||||
{{if ne $issue.RepoID $issue.PullRequest.BaseRepoID}}<span class="truncated-name">{{$issue.PullRequest.BaseRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{$issue.PullRequest.BaseBranch}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{svg "gitea-double-chevron-left" 12}}
|
||||
{{if .PullRequest.HeadRepo}}
|
||||
{{if $issue.PullRequest.HeadRepo}}
|
||||
<div class="branch">
|
||||
<a href="{{.PullRequest.HeadRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.HeadBranch}}">
|
||||
<a href="{{$issue.PullRequest.HeadRepo.Link}}/src/branch/{{PathEscapeSegments $issue.PullRequest.HeadBranch}}">
|
||||
{{/* inline to remove the spaces between spans */}}
|
||||
{{if ne .RepoID .PullRequest.HeadRepoID}}<span class="truncated-name">{{.PullRequest.HeadRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.HeadBranch}}</span>
|
||||
{{if ne $issue.RepoID $issue.PullRequest.HeadRepoID}}<span class="truncated-name">{{$issue.PullRequest.HeadRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{$issue.PullRequest.HeadBranch}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if and .Milestone (ne $.listType "milestone")}}
|
||||
<a class="milestone flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{.Repo.Link}}/milestone/{{.Milestone.ID}}"{{end}}>
|
||||
{{if and $issue.Milestone (ne $listType "milestone")}}
|
||||
<a class="milestone flex-text-inline tw-max-w-[300px]" {{if $root.RepoLink}}href="{{$root.RepoLink}}/milestone/{{$issue.Milestone.ID}}"{{else}}href="{{$issue.Repo.Link}}/milestone/{{$issue.Milestone.ID}}"{{end}}>
|
||||
{{svg "octicon-milestone" 14}}
|
||||
<span class="gt-ellipsis">{{.Milestone.Name}}</span>
|
||||
<span class="gt-ellipsis">{{$issue.Milestone.Name}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
{{range $project := .Projects}}
|
||||
{{range $project := $issue.Projects}}
|
||||
<a class="project flex-text-inline tw-max-w-[300px]" href="{{$project.Link ctx}}">
|
||||
{{svg $project.IconName 14}}
|
||||
<span class="gt-ellipsis">{{$project.Title}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .Ref}}{{/* TODO: ISSUE-SIDEBAR-REF-SELECTOR: see "repo/issue/branch_selector_field.tmpl" */}}
|
||||
<a class="ref flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{.Repo.Link}}{{index $.IssueRefURLs .ID}}"{{end}}>
|
||||
{{if $issue.Ref}}{{/* TODO: ISSUE-SIDEBAR-REF-SELECTOR: see "repo/issue/branch_selector_field.tmpl" */}}
|
||||
<a class="ref flex-text-inline tw-max-w-[300px]" {{if $root.RepoLink}}href="{{index $root.IssueRefURLs $issue.ID}}"{{else}}href="{{$issue.Repo.Link}}{{index $root.IssueRefURLs $issue.ID}}"{{end}}>
|
||||
{{svg "octicon-git-branch" 14}}
|
||||
<span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span>
|
||||
<span class="gt-ellipsis">{{index $root.IssueRefEndNames $issue.ID}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
{{$tasks := .GetTasks}}
|
||||
{{$tasks := $issue.GetTasks}}
|
||||
{{if gt $tasks 0}}
|
||||
{{$tasksDone := .GetTasksDone}}
|
||||
{{$tasksDone := $issue.GetTasksDone}}
|
||||
<span class="checklist flex-text-inline">
|
||||
{{svg "octicon-checklist" 14}}{{$tasksDone}} / {{$tasks}}
|
||||
<progress value="{{$tasksDone}}" max="{{$tasks}}"></progress>
|
||||
</span>
|
||||
{{end}}
|
||||
{{if ne .DeadlineUnix 0}}
|
||||
<span class="due-date flex-text-inline {{if .IsOverdue}}tw-text-red{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}">
|
||||
{{if ne $issue.DeadlineUnix 0}}
|
||||
<span class="due-date flex-text-inline {{if $issue.IsOverdue}}tw-text-red{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}">
|
||||
{{svg "octicon-calendar" 14}}
|
||||
{{DateUtils.AbsoluteShort .DeadlineUnix}}
|
||||
{{DateUtils.AbsoluteShort $issue.DeadlineUnix}}
|
||||
</span>
|
||||
{{end}}
|
||||
{{if .IsPull}}
|
||||
{{$approveOfficial := call $approvalCounts .ID "approve"}}
|
||||
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
|
||||
{{$waitingOfficial := call $approvalCounts .ID "waiting"}}
|
||||
{{if $issue.IsPull}}
|
||||
{{$approveOfficial := call $approvalCounts $issue.ID "approve"}}
|
||||
{{$rejectOfficial := call $approvalCounts $issue.ID "reject"}}
|
||||
{{$waitingOfficial := call $approvalCounts $issue.ID "waiting"}}
|
||||
{{if gt $approveOfficial 0}}
|
||||
<span class="approvals green flex-text-inline">
|
||||
{{svg "octicon-check" 14}}
|
||||
@@ -130,30 +132,30 @@
|
||||
{{ctx.Locale.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}}
|
||||
</span>
|
||||
{{end}}
|
||||
{{if and (not .PullRequest.HasMerged) .PullRequest.ConflictedFiles}}
|
||||
{{if and (not $issue.PullRequest.HasMerged) $issue.PullRequest.ConflictedFiles}}
|
||||
<span class="conflicting flex-text-inline">
|
||||
{{svg "octicon-x" 14}}
|
||||
{{ctx.Locale.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}}
|
||||
{{ctx.Locale.TrN (len $issue.PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len $issue.PullRequest.ConflictedFiles)}}
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{if or .Assignees .NumComments}}
|
||||
{{if or $issue.Assignees $issue.NumComments}}
|
||||
<div class="item-trailing">
|
||||
{{if .Assignees}}
|
||||
{{if $issue.Assignees}}
|
||||
<div class="tw-text-text-light">
|
||||
{{range .Assignees}}
|
||||
<a class="ui assignee tw-no-underline" href="{{.HomeLink}}" data-tooltip-content="{{.GetDisplayName}}">
|
||||
{{ctx.AvatarUtils.Avatar . 20}}
|
||||
{{range $assignee := $issue.Assignees}}
|
||||
<a class="ui assignee tw-no-underline" href="{{$assignee.HomeLink}}" data-tooltip-content="{{$assignee.GetDisplayName}}">
|
||||
{{ctx.AvatarUtils.Avatar $assignee 20}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .NumComments}}
|
||||
{{if $issue.NumComments}}
|
||||
<div class="tw-text-text-light">
|
||||
<a class="tw-no-underline muted flex-text-block" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
|
||||
{{svg "octicon-comment" 16}}{{.NumComments}}
|
||||
<a class="tw-no-underline muted flex-text-block" href="{{if $issue.Link}}{{$issue.Link}}{{else}}{{$root.Link}}/{{$issue.Index}}{{end}}">
|
||||
{{svg "octicon-comment" 16}}{{$issue.NumComments}}
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -166,10 +168,10 @@
|
||||
<p class="tw-text-placeholder-text">{{ctx.Locale.Tr "repo.issues.filter_no_results_placeholder"}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .IssueIndexerUnavailable}}
|
||||
{{if $root.IssueIndexerUnavailable}}
|
||||
<div class="ui error message">
|
||||
<p>{{ctx.Locale.Tr "search.keyword_search_unavailable"}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{template "base/paginate" .}}
|
||||
{{template "base/paginate" $root}}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<div class="ui attached table segment">
|
||||
{{template "shared/searchfile" dict "RepoLink" $repo.Link "SearchResult" .}}
|
||||
</div>
|
||||
{{template "shared/searchbottom" dict "root" $ "result" .}}
|
||||
{{template "shared/searchbottom" dict "result" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "shared/issuelist" dict "." . "listType" "dashboard"}}
|
||||
{{template "shared/issuelist" dict "listType" "dashboard"}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
{{if not .Issues}}
|
||||
{{ctx.Locale.Tr "notification.no_subscriptions"}}
|
||||
{{else}}
|
||||
{{template "shared/issuelist" dict "." . "listType" "dashboard"}}
|
||||
{{template "shared/issuelist" dict "listType" "dashboard"}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{template "shared/repo/search" .}}
|
||||
|
||||
@@ -94,6 +94,9 @@ test('pr review flow', async ({page, request}) => {
|
||||
const conversation = fileBox.locator('.conversation-holder');
|
||||
await conversation.locator('.comment-form-reply').click();
|
||||
const replyForm = conversation.locator('form');
|
||||
await replyForm.getByRole('button', {name: 'Cancel', exact: true}).click();
|
||||
await expect(replyForm).toBeHidden();
|
||||
await conversation.locator('.comment-form-reply').click();
|
||||
await replyForm.locator('textarea[name="content"]').fill('my reply body');
|
||||
await replyForm.getByRole('button', {name: 'Reply', exact: true}).click();
|
||||
await expect(conversation.locator('.comment-body')).toContainText(['inline to reply to', 'my reply body']);
|
||||
@@ -103,6 +106,9 @@ test('pr review flow', async ({page, request}) => {
|
||||
await page.goto(`${pullUrl}/files`);
|
||||
await fileBox.locator('tr.add-code').nth(1).getByRole('button', {name: 'Add line comment', exact: true}).click();
|
||||
const pendingForm = fileBox.locator('form').filter({has: page.getByRole('button', {name: 'Start review', exact: true})});
|
||||
await pendingForm.getByRole('button', {name: 'Cancel', exact: true}).click();
|
||||
await expect(pendingForm).toHaveCount(0);
|
||||
await fileBox.locator('tr.add-code').nth(1).getByRole('button', {name: 'Add line comment', exact: true}).click();
|
||||
await pendingForm.getByRole('textbox', {name: 'Leave a comment', exact: true}).fill('pending review comment');
|
||||
await pendingForm.getByRole('button', {name: 'Start review', exact: true}).click();
|
||||
const counter = page.locator('.review-box-button .review-comments-counter');
|
||||
|
||||
@@ -62,7 +62,39 @@ func TestNoLoginViewIssues(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/issues")
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
issue := htmlDoc.doc.Find("#issue-list .list-item-large-title[href='/user2/repo1/issues/1']").Closest(".item")
|
||||
assert.Equal(t, "label1", strings.TrimSpace(issue.Find(".labels-list").Text()))
|
||||
assignee := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
assert.Equal(t, assignee.HomeLink(), issue.Find(".assignee").AttrOr("href", ""))
|
||||
assert.Equal(t, assignee.GetDisplayName(), issue.Find(".assignee").AttrOr("data-tooltip-content", ""))
|
||||
}
|
||||
|
||||
func TestViewIssueListContexts(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
t.Run("dashboard", func(t *testing.T) {
|
||||
req := NewRequest(t, "GET", "/issues")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
assert.Equal(t, "user2/repo1#1", strings.TrimSpace(htmlDoc.doc.Find("#issue-list .index[href='/user2/repo1/issues/1']").Text()))
|
||||
})
|
||||
t.Run("milestone", func(t *testing.T) {
|
||||
req := NewRequest(t, "GET", "/user2/repo1/milestone/1")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
assert.Equal(t, 1, getIssuesSelection(t, htmlDoc).Length())
|
||||
assert.Empty(t, htmlDoc.doc.Find("#issue-list .milestone").Nodes)
|
||||
labels := htmlDoc.doc.Find("#issue-list .labels-list a")
|
||||
assert.Equal(t, 2, labels.Length())
|
||||
labels.Each(func(_ int, label *goquery.Selection) {
|
||||
link, err := url.Parse(label.AttrOr("href", ""))
|
||||
assert.NoError(t, err)
|
||||
assert.NotContains(t, link.Query(), "milestone")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestViewIssuesSortByType(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user