mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 00:49:18 +08:00
Rename canWriteUnit
to canWriteProjects
(#23386)
A part of https://github.com/go-gitea/gitea/pull/22865
This commit is contained in:
parent
8bdc0acf97
commit
e6df743eca
@ -103,7 +103,7 @@ func Projects(ctx *context.Context) {
|
||||
pager.AddParam(ctx, "state", "State")
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["CanWriteProjects"] = canWriteUnit(ctx)
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
ctx.Data["IsShowClosed"] = isShowClosed
|
||||
ctx.Data["PageIsViewProjects"] = true
|
||||
ctx.Data["SortType"] = sortType
|
||||
@ -111,7 +111,7 @@ func Projects(ctx *context.Context) {
|
||||
ctx.HTML(http.StatusOK, tplProjects)
|
||||
}
|
||||
|
||||
func canWriteUnit(ctx *context.Context) bool {
|
||||
func canWriteProjects(ctx *context.Context) bool {
|
||||
if ctx.ContextUser.IsOrganization() {
|
||||
return ctx.Org.CanWriteUnit(ctx, unit.TypeProjects)
|
||||
}
|
||||
@ -122,7 +122,7 @@ func canWriteUnit(ctx *context.Context) bool {
|
||||
func NewProject(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.projects.new")
|
||||
ctx.Data["BoardTypes"] = project_model.GetBoardConfig()
|
||||
ctx.Data["CanWriteProjects"] = canWriteUnit(ctx)
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
ctx.Data["HomeLink"] = ctx.ContextUser.HomeLink()
|
||||
shared_user.RenderUserHeader(ctx)
|
||||
ctx.HTML(http.StatusOK, tplProjectsNew)
|
||||
@ -135,7 +135,7 @@ func NewProjectPost(ctx *context.Context) {
|
||||
shared_user.RenderUserHeader(ctx)
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.Data["CanWriteProjects"] = canWriteUnit(ctx)
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
ctx.Data["PageIsViewProjects"] = true
|
||||
ctx.Data["BoardTypes"] = project_model.GetBoardConfig()
|
||||
ctx.HTML(http.StatusOK, tplProjectsNew)
|
||||
@ -214,7 +214,7 @@ func EditProject(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.projects.edit")
|
||||
ctx.Data["PageIsEditProjects"] = true
|
||||
ctx.Data["PageIsViewProjects"] = true
|
||||
ctx.Data["CanWriteProjects"] = canWriteUnit(ctx)
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
shared_user.RenderUserHeader(ctx)
|
||||
|
||||
p, err := project_model.GetProjectByID(ctx, ctx.ParamsInt64(":id"))
|
||||
@ -244,7 +244,7 @@ func EditProjectPost(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.projects.edit")
|
||||
ctx.Data["PageIsEditProjects"] = true
|
||||
ctx.Data["PageIsViewProjects"] = true
|
||||
ctx.Data["CanWriteProjects"] = canWriteUnit(ctx)
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
shared_user.RenderUserHeader(ctx)
|
||||
|
||||
if ctx.HasError() {
|
||||
@ -337,7 +337,7 @@ func ViewProject(ctx *context.Context) {
|
||||
project.RenderedContent = project.Description
|
||||
ctx.Data["LinkedPRs"] = linkedPrsMap
|
||||
ctx.Data["PageIsViewProjects"] = true
|
||||
ctx.Data["CanWriteProjects"] = canWriteUnit(ctx)
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
ctx.Data["Project"] = project
|
||||
ctx.Data["IssuesMap"] = issuesMap
|
||||
ctx.Data["Boards"] = boards
|
||||
|
Loading…
Reference in New Issue
Block a user