mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Hide activity contributors, recent commits and code frequrency left tabs if there is no code permission (#34053)
When a team have no code unit permission of a repository, the member of the team should not view activity contributors, recent commits and code frequrency. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -4,12 +4,10 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/services/context"
|
||||
contributors_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -26,16 +24,3 @@ func RecentCommits(ctx *context.Context) {
|
||||
|
||||
ctx.HTML(http.StatusOK, tplRecentCommits)
|
||||
}
|
||||
|
||||
// RecentCommitsData returns JSON of recent commits data
|
||||
func RecentCommitsData(ctx *context.Context) {
|
||||
if contributorStats, err := contributors_service.GetContributorStats(ctx, ctx.Cache, ctx.Repo.Repository, ctx.Repo.Repository.DefaultBranch); err != nil {
|
||||
if errors.Is(err, contributors_service.ErrAwaitGeneration) {
|
||||
ctx.Status(http.StatusAccepted)
|
||||
return
|
||||
}
|
||||
ctx.ServerError("RecentCommitsData", err)
|
||||
} else {
|
||||
ctx.JSON(http.StatusOK, contributorStats["total"].Weeks)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user