@@ -851,6 +851,12 @@ func registerRoutes(m *web.Router) {
851851 }
852852 }
853853
854+ reqStarsEnabled := func (ctx * context.Context ) {
855+ if setting .Repository .DisableStars {
856+ ctx .Error (http .StatusForbidden , "stars are disabled" )
857+ }
858+ }
859+
854860 individualPermsChecker := func (ctx * context.Context ) {
855861 // org permissions have been checked in context.OrgAssignment(), but individual permissions haven't been checked.
856862 if ctx .ContextUser .IsIndividual () {
@@ -1603,7 +1609,9 @@ func registerRoutes(m *web.Router) {
16031609 m .Get ("/stars" , starsEnabled , repo .Stars )
16041610 m .Get ("/watchers" , repo .Watchers )
16051611 m .Get ("/search" , reqUnitCodeReader , repo .Search )
1606- m .Post ("/action/{action}" , reqSignIn , repo .Action )
1612+ m .Post ("/action/{action:star|unstar}" , reqSignIn , reqStarsEnabled , repo .Action )
1613+ m .Post ("/action/{action:watch|unwatch}" , reqSignIn , repo .Action )
1614+ m .Post ("/action/{action:accept_transfer|reject_transfer}" , reqSignIn , repo .Action )
16071615 }, optSignIn , context .RepoAssignment )
16081616
16091617 common .AddOwnerRepoGitLFSRoutes (m , optSignInIgnoreCsrf , lfsServerEnabled ) // "/{username}/{reponame}/{lfs-paths}": git-lfs support
0 commit comments