appview/pages: fix pages.RepoComparedDiffFragment() #811

merged
opened by boltless.me targeting master from sl/yurolxtlpsmz
  • remove unused parameters
  • pass correct parameters
  • rename with *Fragment suffix

Signed-off-by: Seongmin Lee git@boltless.me

Changed files
+10 -12
appview
pages
templates
repo
compare
fragments
pulls
+5 -6
appview/pages/pages.go
···
return p.executePlain("repo/fragments/compareAllowPull", w, params)
}
-
type RepoCompareDiffParams struct {
-
LoggedInUser *oauth.User
-
RepoInfo repoinfo.RepoInfo
-
Diff types.NiceDiff
}
-
func (p *Pages) RepoCompareDiff(w io.Writer, params RepoCompareDiffParams) error {
-
return p.executePlain("repo/fragments/diff", w, []any{params.RepoInfo.FullName, &params.Diff})
}
type LabelPanelParams struct {
···
return p.executePlain("repo/fragments/compareAllowPull", w, params)
}
+
type RepoCompareDiffFragmentParams struct {
+
Diff types.NiceDiff
+
DiffOpts types.DiffOpts
}
+
func (p *Pages) RepoCompareDiffFragment(w io.Writer, params RepoCompareDiffFragmentParams) error {
+
return p.executePlain("repo/fragments/diff", w, []any{&params.Diff, &params.DiffOpts})
}
type LabelPanelParams struct {
+1 -1
appview/pages/templates/repo/commit.html
···
{{ end }}
{{ define "contentAfter" }}
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff .DiffOpts) }}
{{end}}
{{ define "contentAfterLeft" }}
···
{{ end }}
{{ define "contentAfter" }}
+
{{ template "repo/fragments/diff" (list .Diff .DiffOpts) }}
{{end}}
{{ define "contentAfterLeft" }}
+1 -1
appview/pages/templates/repo/compare/compare.html
···
{{ end }}
{{ define "contentAfter" }}
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff .DiffOpts) }}
{{end}}
{{ define "contentAfterLeft" }}
···
{{ end }}
{{ define "contentAfter" }}
+
{{ template "repo/fragments/diff" (list .Diff .DiffOpts) }}
{{end}}
{{ define "contentAfterLeft" }}
+2 -3
appview/pages/templates/repo/fragments/diff.html
···
{{ define "repo/fragments/diff" }}
-
{{ $repo := index . 0 }}
-
{{ $diff := index . 1 }}
-
{{ $opts := index . 2 }}
{{ $commit := $diff.Commit }}
{{ $diff := $diff.Diff }}
···
{{ define "repo/fragments/diff" }}
+
{{ $diff := index . 0 }}
+
{{ $opts := index . 1 }}
{{ $commit := $diff.Commit }}
{{ $diff := $diff.Diff }}
+1 -1
appview/pages/templates/repo/pulls/patch.html
···
{{ end }}
{{ define "contentAfter" }}
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff .DiffOpts) }}
{{end}}
{{ define "contentAfterLeft" }}
···
{{ end }}
{{ define "contentAfter" }}
+
{{ template "repo/fragments/diff" (list .Diff .DiffOpts) }}
{{end}}
{{ define "contentAfterLeft" }}