Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow/fix review (approve/reject) of empty PRs #25690

Merged
30 changes: 12 additions & 18 deletions templates/repo/diff/box.tmpl
Original file line number Original file line Diff line number Diff line change
@@ -1,20 +1,7 @@
{{if .DiffNotAvailable}}
<div>
<div class="diff-detail-box diff-box sticky">
<div class="ui right">
{{template "repo/diff/whitespace_dropdown" .}}
{{template "repo/diff/options_dropdown" .}}
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}}
{{template "repo/diff/new_review" .}}
{{end}}
</div>
</div>
</div>
<h4>{{.locale.Tr "repo.diff.data_not_available"}}</h4>
{{else}}
<div> <div>
<div class="diff-detail-box diff-box sticky gt-df gt-sb gt-ac gt-fw"> <div class="diff-detail-box diff-box sticky gt-df gt-sb gt-ac gt-fw">
<div class="gt-df gt-ac gt-fw"> <div class="gt-df gt-ac gt-fw">
{{if not .DiffNotAvailable}}
<button class="diff-toggle-file-tree-button gt-df gt-ac not-mobile" data-show-text="{{.locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{.locale.Tr "repo.diff.hide_file_tree"}}"> <button class="diff-toggle-file-tree-button gt-df gt-ac not-mobile" data-show-text="{{.locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{.locale.Tr "repo.diff.hide_file_tree"}}">
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}} {{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
{{svg "octicon-sidebar-collapse" 20 "icon gt-hidden"}} {{svg "octicon-sidebar-collapse" 20 "icon gt-hidden"}}
Expand All @@ -31,9 +18,10 @@
<div class="diff-detail-stats gt-df gt-ac gt-fw"> <div class="diff-detail-stats gt-df gt-ac gt-fw">
{{svg "octicon-diff" 16 "gt-mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} {{svg "octicon-diff" 16 "gt-mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
</div> </div>
{{end}}
</div> </div>
<div class="diff-detail-actions gt-df gt-ac gt-gap-2 gt-fw"> <div class="diff-detail-actions gt-df gt-ac gt-gap-2 gt-fw">
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}}
<div class="gt-df gt-ac gt-fc gt-whitespace-nowrap gt-mr-2"> <div class="gt-df gt-ac gt-fc gt-whitespace-nowrap gt-mr-2">
<label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}"> <label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}">
{{.locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}} {{.locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}}
Expand All @@ -48,6 +36,7 @@
{{end}} {{end}}
</div> </div>
</div> </div>
{{if not .DiffNotAvailable}}
<script id="diff-data-script" type="module"> <script id="diff-data-script" type="module">
const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}},IsViewed:{{$file.IsViewed}}},{{end}}]; const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}},IsViewed:{{$file.IsViewed}}},{{end}}];
const diffData = { const diffData = {
Expand All @@ -74,7 +63,11 @@
window.config.pageData.diffFileInfo = diffFileInfo; window.config.pageData.diffFileInfo = diffFileInfo;
</script> </script>
<div id="diff-file-list"></div> <div id="diff-file-list"></div>
{{end}}
<div id="diff-container"> <div id="diff-container">
{{if .DiffNotAvailable}}
<h4>{{.locale.Tr "repo.diff.data_not_available"}}</h4>
{{else}}
<div id="diff-file-tree" class="gt-hidden"></div> <div id="diff-file-tree" class="gt-hidden"></div>
<script> <script>
if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('gt-hidden'); if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('gt-hidden');
Expand Down Expand Up @@ -203,9 +196,10 @@
</div> </div>
{{end}} {{end}}
</div> </div>
{{end}}
</div> </div>


{{if not $.Repository.IsArchived}} {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}}
<template id="issue-comment-editor-template"> <template id="issue-comment-editor-template">
<div class="ui comment form"> <div class="ui comment form">
{{template "shared/combomarkdowneditor" (dict {{template "shared/combomarkdowneditor" (dict
Expand All @@ -222,7 +216,7 @@
</div> </div>
</template> </template>
{{end}} {{end}}

{{if (not .DiffNotAvailable)}}
{{template "repo/issue/view_content/reference_issue_dialog" .}} {{template "repo/issue/view_content/reference_issue_dialog" .}}
</div>
{{end}} {{end}}
</div>
2 changes: 1 addition & 1 deletion templates/repo/pulls/tab_menu.tmpl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{$.locale.Tr "repo.pulls.tab_commits"}} {{$.locale.Tr "repo.pulls.tab_commits"}}
<span class="ui small label">{{if .NumCommits}}{{.NumCommits}}{{else}}-{{end}}</span> <span class="ui small label">{{if .NumCommits}}{{.NumCommits}}{{else}}-{{end}}</span>
</a> </a>
<a class="item {{if .PageIsPullFiles}}active{{end}}" {{if .NumFiles}}href="{{.Issue.Link}}/files"{{end}}> <a class="item {{if .PageIsPullFiles}}active{{end}}" href="{{.Issue.Link}}/files">
{{svg "octicon-diff"}} {{svg "octicon-diff"}}
{{$.locale.Tr "repo.pulls.tab_files"}} {{$.locale.Tr "repo.pulls.tab_files"}}
<span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span> <span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span>
Expand Down