@@ -62,6 +62,71 @@ |
| 62 | 62 | </article> |
| 63 | 63 | |
| 64 | 64 | <aside class="shithub-pull-merge"> |
| 65 | + {{ if .Reviews }} |
| 66 | + <section class="shithub-pull-reviews"> |
| 67 | + <h3>Reviews</h3> |
| 68 | + <ul class="shithub-pull-reviews-list"> |
| 69 | + {{ range .Reviews }} |
| 70 | + <li class="shithub-pull-review-{{ printf "%s" .R.State }}{{ if .R.DismissedAt.Valid }} shithub-pull-review-dismissed{{ end }}"> |
| 71 | + <span class="shithub-pull-review-state"> |
| 72 | + {{ if eq (printf "%s" .R.State) "approve" }}✓ approved{{ else if eq (printf "%s" .R.State) "request_changes" }}✗ changes requested{{ else }}● commented{{ end }} |
| 73 | + </span> |
| 74 | + {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 75 | + <time datetime="{{ .R.SubmittedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .R.SubmittedAt.Time }}</time> |
| 76 | + {{ if .R.DismissedAt.Valid }}<small>dismissed</small>{{ end }} |
| 77 | + </li> |
| 78 | + {{ end }} |
| 79 | + </ul> |
| 80 | + </section> |
| 81 | + {{ end }} |
| 82 | + |
| 83 | + {{ if .ReviewRequests }} |
| 84 | + <section class="shithub-pull-reviewers"> |
| 85 | + <h3>Reviewers</h3> |
| 86 | + <ul class="shithub-pull-reviewers-list"> |
| 87 | + {{ range .ReviewRequests }} |
| 88 | + {{ if not .R.DismissedAt.Valid }} |
| 89 | + <li> |
| 90 | + <a href="/{{ .Username }}">@{{ .Username }}</a> |
| 91 | + {{ if .R.SatisfiedByReviewID.Valid }}<small>reviewed</small>{{ else }}<small>pending</small>{{ end }} |
| 92 | + </li> |
| 93 | + {{ end }} |
| 94 | + {{ end }} |
| 95 | + </ul> |
| 96 | + </section> |
| 97 | + {{ end }} |
| 98 | + |
| 99 | + {{ if .Viewer.ID }} |
| 100 | + <details class="shithub-pull-request-reviewer"> |
| 101 | + <summary class="shithub-button">Request review</summary> |
| 102 | + <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/reviewers"> |
| 103 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 104 | + <input type="text" name="username" placeholder="username" required> |
| 105 | + <button type="submit" class="shithub-button">Request</button> |
| 106 | + </form> |
| 107 | + </details> |
| 108 | + |
| 109 | + {{ if not .PR.MergedAt.Valid }} |
| 110 | + {{ if eq (printf "%s" .PR.IState) "open" }} |
| 111 | + <details class="shithub-pull-submit-review"> |
| 112 | + <summary class="shithub-button">Submit review</summary> |
| 113 | + <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/reviews" class="shithub-pull-review-form"> |
| 114 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 115 | + <textarea name="body" rows="4" placeholder="Leave a review comment (optional)"></textarea> |
| 116 | + <select name="state"> |
| 117 | + <option value="comment">Comment</option> |
| 118 | + {{ if not (and .PR.IAuthorUserID.Valid (eq .PR.IAuthorUserID.Int64 .Viewer.ID)) }} |
| 119 | + <option value="approve">Approve</option> |
| 120 | + <option value="request_changes">Request changes</option> |
| 121 | + {{ end }} |
| 122 | + </select> |
| 123 | + <button type="submit" class="shithub-button shithub-button-primary">Submit</button> |
| 124 | + </form> |
| 125 | + </details> |
| 126 | + {{ end }} |
| 127 | + {{ end }} |
| 128 | + {{ end }} |
| 129 | + |
| 65 | 130 | {{ if .PR.MergedAt.Valid }} |
| 66 | 131 | <p>Merged via <code>{{ printf "%s" .PR.MergeMethod.PrMergeMethod }}</code>.</p> |
| 67 | 132 | {{ else if eq (printf "%s" .PR.IState) "closed" }} |
@@ -121,6 +186,62 @@ |
| 121 | 186 | {{ else }} |
| 122 | 187 | <p class="shithub-muted">No diff available.</p> |
| 123 | 188 | {{ end }} |
| 189 | + |
| 190 | + {{ if .ThreadsByFile }} |
| 191 | + <section class="shithub-pull-threads"> |
| 192 | + <h3>Inline comments</h3> |
| 193 | + {{ range $path, $threads := .ThreadsByFile }} |
| 194 | + {{ if $threads }} |
| 195 | + <details class="shithub-pull-thread-file" open> |
| 196 | + <summary><code>{{ $path }}</code> · {{ len $threads }}</summary> |
| 197 | + {{ range $threads }} |
| 198 | + <div class="shithub-pull-thread{{ if not .C.CurrentPosition.Valid }} shithub-pull-thread-outdated{{ end }}{{ if .C.ResolvedAt.Valid }} shithub-pull-thread-resolved{{ end }}"> |
| 199 | + <div class="shithub-comment-head"> |
| 200 | + {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 201 | + line {{ .C.OriginalLine }} |
| 202 | + <time datetime="{{ .C.CreatedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .C.CreatedAt.Time }}</time> |
| 203 | + {{ if not .C.CurrentPosition.Valid }}<span class="shithub-pill">outdated</span>{{ end }} |
| 204 | + {{ if .C.ResolvedAt.Valid }}<span class="shithub-pill">resolved</span>{{ end }} |
| 205 | + </div> |
| 206 | + <div class="shithub-comment-body markdown-body"> |
| 207 | + {{ if .C.BodyHtmlCached.Valid }}{{ safeHTML .C.BodyHtmlCached.String }}{{ else }}<p>{{ .C.Body }}</p>{{ end }} |
| 208 | + </div> |
| 209 | + {{ if $.Viewer.ID }} |
| 210 | + <div class="shithub-pull-thread-actions"> |
| 211 | + <form method="post" action="/{{ $.Owner }}/{{ $.Repo.Name }}/pulls/{{ $.PR.INumber }}/review-comments/{{ .C.ID }}/reply"> |
| 212 | + <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 213 | + <textarea name="body" rows="2" placeholder="Reply…"></textarea> |
| 214 | + <button type="submit" class="shithub-button">Reply</button> |
| 215 | + </form> |
| 216 | + <form method="post" action="/{{ $.Owner }}/{{ $.Repo.Name }}/pulls/{{ $.PR.INumber }}/review-comments/{{ .C.ID }}/{{ if .C.ResolvedAt.Valid }}reopen{{ else }}resolve{{ end }}"> |
| 217 | + <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 218 | + <button type="submit" class="shithub-button">{{ if .C.ResolvedAt.Valid }}Reopen{{ else }}Resolve{{ end }}</button> |
| 219 | + </form> |
| 220 | + </div> |
| 221 | + {{ end }} |
| 222 | + </div> |
| 223 | + {{ end }} |
| 224 | + </details> |
| 225 | + {{ end }} |
| 226 | + {{ end }} |
| 227 | + |
| 228 | + {{ if .Viewer.ID }} |
| 229 | + <details class="shithub-pull-add-comment"> |
| 230 | + <summary class="shithub-button">Add inline comment</summary> |
| 231 | + <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/pulls/{{ .PR.INumber }}/review-comments"> |
| 232 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 233 | + <input type="text" name="file_path" placeholder="path" required> |
| 234 | + <input type="number" name="line" placeholder="line" required> |
| 235 | + <input type="number" name="position" placeholder="position" required> |
| 236 | + <input type="hidden" name="commit_sha" value="{{ .PR.HeadOid }}"> |
| 237 | + <input type="hidden" name="side" value="right"> |
| 238 | + <textarea name="body" rows="3" required></textarea> |
| 239 | + <button type="submit" class="shithub-button">Add comment</button> |
| 240 | + </form> |
| 241 | + </details> |
| 242 | + {{ end }} |
| 243 | + </section> |
| 244 | + {{ end }} |
| 124 | 245 | {{ else if eq .Tab "checks" }} |
| 125 | 246 | <p class="shithub-muted">Check engine ships in S24. Today this tab is a placeholder.</p> |
| 126 | 247 | {{ end }} |