mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-04 02:12:30 +02:00
Disabling Stars should disable the routes too
Similarly to how `[repository].DISABLE_FORKS` works, lets make `[repository].DISABLE_STARS` disable the routes too, not just hide the functionality from the UI. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
3d3196eb3c
commit
0b4a9c4ec2
6 changed files with 96 additions and 15 deletions
|
@ -16,7 +16,9 @@ import (
|
|||
unit_model "code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/routers"
|
||||
files_service "code.gitea.io/gitea/services/repository/files"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
|
@ -107,6 +109,14 @@ func TestBadges(t *testing.T) {
|
|||
resp := MakeRequest(t, req, http.StatusSeeOther)
|
||||
|
||||
assertBadge(t, resp, "stars-0-blue")
|
||||
|
||||
t.Run("disabled stars", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
defer test.MockVariableValue(&setting.Repository.DisableStars, true)()
|
||||
defer test.MockVariableValue(&testWebRoutes, routers.NormalRoutes())()
|
||||
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Issues", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue