mirror of https://github.com/go-gitea/gitea.git
Do not show arrows on comment diffs on pull comment pages (#12434)
* Do not show arrows on comment diffs on pull comment pages Prior to this PR it was possible that an expansion arrow could be displayed on comment diffs displayed on the comments pages of pulls These arrows would not successfully work because they were not attached to a commit id - nor can they necessarily be. This PR prevents these from being shown. Fix #10851 Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @silverwind Signed-off-by: Andrew Thornton <art27@cantab.net> * one more indentation fix Signed-off-by: Andrew Thornton <art27@cantab.net> * one more indentation fix Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
e770c2b850
commit
96add8c319
|
@ -1,75 +1,77 @@
|
||||||
{{$file := .file}}
|
{{$file := .file}}
|
||||||
{{range $j, $section := $file.Sections}}
|
{{range $j, $section := $file.Sections}}
|
||||||
{{range $k, $line := $section.Lines}}
|
{{range $k, $line := $section.Lines}}
|
||||||
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
|
{{if or $.root.AfterCommitID (ne .GetType 4)}}
|
||||||
{{if eq .GetType 4}}
|
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
|
||||||
<td colspan="2" class="lines-num">
|
{{if eq .GetType 4}}
|
||||||
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
|
<td colspan="2" class="lines-num">
|
||||||
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
|
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
|
||||||
{{svg "octicon-fold-down" 16}}
|
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
|
||||||
</a>
|
{{svg "octicon-fold-down" 16}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
|
||||||
|
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
|
||||||
|
{{svg "octicon-fold-up" 16}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $line.GetExpandDirection 2}}
|
||||||
|
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
|
||||||
|
{{svg "octicon-fold" 16}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
|
{{else}}
|
||||||
|
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
|
||||||
|
<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
|
<td class="lines-type-marker"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
|
||||||
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
|
{{if eq .GetType 4}}
|
||||||
{{svg "octicon-fold-up" 16}}
|
<td class="chroma lines-code blob-hunk"><span class="mono wrap">{{$section.GetComputedInlineDiffFor $line}}</span></td>
|
||||||
</a>
|
{{else}}
|
||||||
|
<td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles}}<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}" data-type-marker="+"></a>{{end}}<span class="mono wrap">{{$section.GetComputedInlineDiffFor $line}}</span></td>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $line.GetExpandDirection 2}}
|
</tr>
|
||||||
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
|
{{if gt (len $line.Comments) 0}}
|
||||||
{{svg "octicon-fold" 16}}
|
{{$resolved := (index $line.Comments 0).IsResolved}}
|
||||||
</a>
|
{{$resolveDoer := (index $line.Comments 0).ResolveDoer}}
|
||||||
{{end}}
|
{{$isNotPending := (not (eq (index $line.Comments 0).Review.Type 0))}}
|
||||||
</td>
|
<tr>
|
||||||
{{else}}
|
<td colspan="2" class="lines-num"></td>
|
||||||
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
|
<td class="add-comment-left add-comment-right" colspan="2">
|
||||||
<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
|
{{if $resolved}}
|
||||||
{{end}}
|
<div class = "ui attached header">
|
||||||
<td class="lines-type-marker"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
|
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.root.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
||||||
{{if eq .GetType 4}}
|
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
||||||
<td class="chroma lines-code blob-hunk"><span class="mono wrap">{{$section.GetComputedInlineDiffFor $line}}</span></td>
|
{{svg "octicon-unfold" 16}}
|
||||||
{{else}}
|
{{$.root.i18n.Tr "repo.issues.review.show_resolved"}}
|
||||||
<td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles}}<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}" data-type-marker="+"></a>{{end}}<span class="mono wrap">{{$section.GetComputedInlineDiffFor $line}}</span></td>
|
</button>
|
||||||
{{end}}
|
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
||||||
</tr>
|
{{svg "octicon-fold" 16}}
|
||||||
{{if gt (len $line.Comments) 0}}
|
{{$.root.i18n.Tr "repo.issues.review.hide_resolved"}}
|
||||||
{{$resolved := (index $line.Comments 0).IsResolved}}
|
</button>
|
||||||
{{$resolveDoer := (index $line.Comments 0).ResolveDoer}}
|
</div>
|
||||||
{{$isNotPending := (not (eq (index $line.Comments 0).Review.Type 0))}}
|
{{end}}
|
||||||
<tr>
|
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
||||||
<td colspan="2" class="lines-num"></td>
|
<div class="comment-list">
|
||||||
<td class="add-comment-left add-comment-right" colspan="2">
|
<ui class="ui comments">
|
||||||
{{if $resolved}}
|
{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
|
||||||
<div class = "ui attached header">
|
</ui>
|
||||||
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.root.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
</div>
|
||||||
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}}
|
||||||
{{svg "octicon-unfold" 16}}
|
{{if and $.root.CanMarkConversation $isNotPending}}
|
||||||
{{$.root.i18n.Tr "repo.issues.review.show_resolved"}}
|
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.root.RepoLink}}/issues/resolve_conversation" >
|
||||||
</button>
|
{{if $resolved}}
|
||||||
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
{{$.root.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
||||||
{{svg "octicon-fold" 16}}
|
{{else}}
|
||||||
{{$.root.i18n.Tr "repo.issues.review.hide_resolved"}}
|
{{$.root.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
||||||
</button>
|
{{end}}
|
||||||
</div>
|
</button>
|
||||||
{{end}}
|
|
||||||
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
|
||||||
<div class="comment-list">
|
|
||||||
<ui class="ui comments">
|
|
||||||
{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
|
|
||||||
</ui>
|
|
||||||
</div>
|
|
||||||
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}}
|
|
||||||
{{if and $.root.CanMarkConversation $isNotPending}}
|
|
||||||
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.root.RepoLink}}/issues/resolve_conversation" >
|
|
||||||
{{if $resolved}}
|
|
||||||
{{$.root.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
|
||||||
{{else}}
|
|
||||||
{{$.root.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</button>
|
</div>
|
||||||
{{end}}
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
</td>
|
{{end}}
|
||||||
</tr>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue