mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-28 11:14:54 -04:00
ench: use GET for lastcommit route (#12670)
When it was introduced the route did receive for which entries it should get the last commit for. It was refactored in 1e29bccddb to HTMX and now simply gets the last commit for all entries.
In the spirit of using the correct HTTP methods, switch it to GET.
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12670
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
This commit is contained in:
parent
294952b774
commit
4131cc4159
3 changed files with 4 additions and 4 deletions
|
|
@ -1743,7 +1743,7 @@ func registerRoutes(m *web.Route) {
|
|||
m.Post("/sync_fork", context.RepoMustNotBeArchived(), repo.MustBeNotEmpty, reqRepoCodeWriter, repo.SyncFork)
|
||||
}, ignSignIn, context.RepoAssignment, context.UnitTypes())
|
||||
|
||||
m.Post("/{username}/{reponame}/lastcommit/*", ignSignIn, context.RepoAssignment, context.UnitTypes(), context.RepoRefByType(context.RepoRefCommit), reqRepoCodeReader, repo.LastCommit)
|
||||
m.Get("/{username}/{reponame}/lastcommit/*", ignSignIn, context.RepoAssignment, context.UnitTypes(), context.RepoRefByType(context.RepoRefCommit), reqRepoCodeReader, repo.LastCommit)
|
||||
|
||||
m.Group("/{username}/{reponame}", func() {
|
||||
if !setting.Repository.DisableStars {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<table id="repo-files-table" class="ui single line table tw-mt-0" {{if .HasFilesWithoutLatestCommit}}hx-indicator="tr.notready td.message span" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
|
||||
<table id="repo-files-table" class="ui single line table tw-mt-0" {{if .HasFilesWithoutLatestCommit}}hx-indicator="tr.notready td.message span" hx-trigger="load" hx-swap="morph" hx-get="{{.LastCommitLoaderURL}}"{{end}}>
|
||||
<caption class="tw-sr-only">
|
||||
{{ctx.Locale.Tr "repo.files.caption"}}
|
||||
</caption>
|
||||
|
|
|
|||
|
|
@ -87,14 +87,14 @@ func TestLastCommit(t *testing.T) {
|
|||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
t.Run("Anonymous", func(t *testing.T) {
|
||||
req := NewRequest(t, "POST", "/user2/repo1/lastcommit/65f1bf27bc3bf70f64657658635e66094edbcb4d")
|
||||
req := NewRequest(t, "GET", "/user2/repo1/lastcommit/65f1bf27bc3bf70f64657658635e66094edbcb4d")
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
})
|
||||
|
||||
t.Run("Signed in", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
req := NewRequest(t, "POST", "/user2/repo1/lastcommit/65f1bf27bc3bf70f64657658635e66094edbcb4d")
|
||||
req := NewRequest(t, "GET", "/user2/repo1/lastcommit/65f1bf27bc3bf70f64657658635e66094edbcb4d")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue