0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-25 05:02:49 +01:00
This commit is contained in:
yp05327 2024-10-21 04:58:48 +00:00
parent 0956e50893
commit 7486f27681
4 changed files with 9 additions and 2 deletions

View file

@ -22,6 +22,11 @@ func Activity(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.activity")
ctx.Data["PageIsActivity"] = true
if !ctx.Repo.CanReadAny(unit.TypePullRequests, unit.TypeIssues, unit.TypeReleases) {
ctx.Redirect(ctx.Repo.RepoLink + "/activity/contributors")
return
}
ctx.Data["PageIsPulse"] = true
ctx.Data["Period"] = ctx.PathParam("period")

View file

@ -1456,7 +1456,7 @@ func registerRoutes(m *web.Router) {
m.Get("/data", repo.RecentCommitsData)
}, reqRepoCodeReader)
},
ignSignIn, context.RepoAssignment, context.RequireRepoReaderOr(unit.TypePullRequests, unit.TypeIssues, unit.TypeReleases),
ignSignIn, context.RepoAssignment, context.RequireRepoReaderOr(unit.TypePullRequests, unit.TypeIssues, unit.TypeReleases, unit.TypeCode),
context.RepoRef(), repo.MustBeNotEmpty,
)
// end "/{username}/{reponame}/activity"

View file

@ -208,7 +208,7 @@
</a>
{{end}}
{{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}}
{{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}}
<a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
{{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}}
</a>

View file

@ -1,7 +1,9 @@
<div class="ui fluid vertical menu">
{{if (or (.Permission.CanRead ctx.Consts.RepoUnitTypeIssues) (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests))}}
<a class="{{if .PageIsPulse}}active {{end}}item" href="{{.RepoLink}}/activity">
{{ctx.Locale.Tr "repo.activity.navbar.pulse"}}
</a>
{{end}}
{{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
<a class="{{if .PageIsContributors}}active {{end}}item" href="{{.RepoLink}}/activity/contributors">
{{ctx.Locale.Tr "repo.activity.navbar.contributors"}}