Skip to content

Support org/user level projects#22235

Merged
lunny merged 28 commits into
go-gitea:mainfrom
lunny:lunny/org_project
Jan 20, 2023
Merged

Support org/user level projects#22235
lunny merged 28 commits into
go-gitea:mainfrom
lunny:lunny/org_project

Conversation

@lunny

@lunny lunny commented Dec 24, 2022

Copy link
Copy Markdown
Member

Fix #13405

image

@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Dec 24, 2022
@lunny lunny mentioned this pull request Dec 25, 2022
15 tasks
@lunny lunny marked this pull request as ready for review December 28, 2022 04:31
@lunny lunny changed the title WIP: Support org level projects Support org level projects Dec 28, 2022
@lunny lunny added this to the 1.19.0 milestone Dec 28, 2022
@lunny lunny changed the title Support org level projects Support org/user level projects Dec 28, 2022
@lafriks

lafriks commented Dec 29, 2022

Copy link
Copy Markdown
Member

Can we rename projects to boards? That naming is very confusing imho

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 29, 2022
@delvh

delvh commented Dec 29, 2022

Copy link
Copy Markdown
Member

Wasn't there even a PR already for that? Something like #22237?

Comment thread models/project/project.go Outdated
Comment thread templates/repo/issue/view_content/sidebar.tmpl Outdated
Comment thread models/issues/issue_project.go
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (main@e61ce93). Click here to learn what that means.
The diff coverage is 17.31%.

@@           Coverage Diff           @@
##             main   #22235   +/-   ##
=======================================
  Coverage        ?   47.93%           
=======================================
  Files           ?     1047           
  Lines           ?   143029           
  Branches        ?        0           
=======================================
  Hits            ?    68558           
  Misses          ?    66279           
  Partials        ?     8192           
Impacted Files Coverage Δ
models/issues/issue_project.go 31.29% <0.00%> (ø)
models/organization/team.go 58.00% <ø> (ø)
models/organization/team_user.go 66.66% <ø> (ø)
modules/context/org.go 56.42% <0.00%> (ø)
routers/web/shared/user/header.go 0.00% <0.00%> (ø)
routers/web/user/package.go 0.00% <0.00%> (ø)
routers/web/user/profile.go 46.94% <0.00%> (ø)
routers/web/org/projects.go 0.77% <0.77%> (ø)
models/project/project.go 36.90% <48.00%> (ø)
routers/web/web.go 84.04% <61.11%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 16, 2023
TobiasNils added a commit to TobiasNils/gitea-1 that referenced this pull request Jan 17, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 20, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 20, 2023
@lunny

lunny commented Jan 20, 2023

Copy link
Copy Markdown
Member Author

make LG-TM work

@lunny lunny merged commit 6fe3c8b into go-gitea:main Jan 20, 2023
@lunny lunny deleted the lunny/org_project branch January 20, 2023 11:42
@lunny lunny removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 20, 2023

@delvh delvh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah… Too late again.
But still, here is what I reviewed before this PR was merged:

Comment thread services/context/user.go
Comment on lines +60 to +64
} else {
if ctx.ContextUser.IsOrganization() {
ctx.Org.Organization = (*org_model.Organization)(ctx.ContextUser)
ctx.Data["Org"] = ctx.Org.Organization
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
if ctx.ContextUser.IsOrganization() {
ctx.Org.Organization = (*org_model.Organization)(ctx.ContextUser)
ctx.Data["Org"] = ctx.Org.Organization
}
} else if ctx.ContextUser.IsOrganization() {
ctx.Org.Organization = (*org_model.Organization)(ctx.ContextUser)
ctx.Data["Org"] = ctx.Org.Organization

Comment thread models/project/project.go
Comment on lines +85 to +89
Title string `xorm:"INDEX NOT NULL"`
Description string `xorm:"TEXT"`
OwnerID int64 `xorm:"INDEX"`
Owner *user_model.User `xorm:"-"`
RepoID int64 `xorm:"INDEX"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Title string `xorm:"INDEX NOT NULL"`
Description string `xorm:"TEXT"`
OwnerID int64 `xorm:"INDEX"`
Owner *user_model.User `xorm:"-"`
RepoID int64 `xorm:"INDEX"`
Title string `xorm:"INDEX UNIQUE(title_owner_repo) NOT NULL"`
Description string `xorm:"TEXT"`
OwnerID int64 `xorm:"INDEX UNIQUE(title_owner_repo)"`
Owner *user_model.User `xorm:"-"`
RepoID int64 `xorm:"INDEX UNIQUE(title_owner_repo)"`

I think this constraint makes sense.
However, if we add it, we should probably mark this PR as breaking as it would require to rename existing duplicated titles (that should not have ever been used already)

Comment thread routers/web/web.go
m.Get("", repo.Projects)
m.Get("/{id}", repo.ViewProject)
m.Group("", func() {
m.Group("", func() { //nolint:dupl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment thread services/context/user.go
Comment on lines +60 to +61
} else {
if ctx.ContextUser.IsOrganization() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if?

Comment on lines +36 to +39
if teamUnit.Type != tp {
continue
}
if teamUnit.AccessMode > maxAccess {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if teamUnit.Type != tp {
continue
}
if teamUnit.AccessMode > maxAccess {
if teamUnit.Type == tp && teamUnit.AccessMode > maxAccess {

?

@6543

6543 commented Jan 26, 2023

Copy link
Copy Markdown
Member

@delvh just send a pull rever to this ...

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project boards / kanban: Support for organization-level boards

8 participants