Skip to content

Commit

Permalink
Rename canWriteUnit to canWriteProjects (go-gitea#23386)
Browse files Browse the repository at this point in the history
A part of go-gitea#22865
  • Loading branch information
yp05327 authored and GiteaBot committed Mar 9, 2023
1 parent e269e89 commit cd43295
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions routers/web/org/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ 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

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)
}
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -243,7 +243,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() {
Expand Down Expand Up @@ -332,7 +332,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
Expand Down

0 comments on commit cd43295

Please sign in to comment.