]> source.dussan.org Git - gitea.git/commitdiff
Use AfterCommitId to get commit for Viewed functionality (#25529)
authorsebastian-sauer <sauer.sebastian@gmail.com>
Fri, 30 Jun 2023 16:08:18 +0000 (18:08 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2023 16:08:18 +0000 (00:08 +0800)
the PullHeadCommitID is not always available when the PR is merged.

Not sure if this is the best solution but in my simple tests it looks
like this fixes the problem - happy to get any feedback.

hopefully fixes https://github.com/go-gitea/gitea/issues/24813

templates/repo/diff/box.tmpl

index 1198452f7e567f325703a4bd8b4c40c7bafceb17..8f570e5efcc600b44e111cf4307595ca075db15b 100644 (file)
                                                                                {{end}}
                                                                        {{end}}
                                                                        {{if $isReviewFile}}
-                                                                               <label data-link="{{$.Issue.Link}}/viewed-files" data-headcommit="{{$.PullHeadCommitID}}" class="viewed-file-form unselectable{{if $file.IsViewed}} viewed-file-checked-form{{end}}">
+                                                                               <label data-link="{{$.Issue.Link}}/viewed-files" data-headcommit="{{$.AfterCommitID}}" class="viewed-file-form unselectable{{if $file.IsViewed}} viewed-file-checked-form{{end}}">
                                                                                        <input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{$.locale.Tr "repo.pulls.has_viewed_file"}}
                                                                                </label>
                                                                        {{end}}