-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow forks to org if you can create repos #17783
Changes from 3 commits
8e91135
55994b4
8120b16
23b53b9
d533838
2ec9351
0c59ebd
07d2f37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,9 +112,9 @@ func getForkRepository(ctx *context.Context) *models.Repository { | |
|
||
ctx.Data["ForkRepo"] = forkRepo | ||
|
||
ownedOrgs, err := models.GetOwnedOrgsByUserID(ctx.User.ID) | ||
ownedOrgs, err := models.GetOrgsCanCreateRepoByUserID(ctx.User.ID) | ||
if err != nil { | ||
ctx.ServerError("GetOwnedOrgsByUserID", err) | ||
ctx.ServerError("GetOrgsCanCreateRepoByUserID", err) | ||
return nil | ||
} | ||
var orgs []*models.Organization | ||
|
@@ -217,9 +217,9 @@ func ForkPost(ctx *context.Context) { | |
|
||
// Check ownership of organization. | ||
qwerty287 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ctxUser.IsOrganization() { | ||
isOwner, err := models.OrgFromUser(ctxUser).IsOwnedBy(ctx.User.ID) | ||
isOwner, err := models.OrgFromUser(ctxUser).CanCreateOrgRepo(ctx.User.ID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe change the the name of this variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And the comment on Line 218 ;)
qwerty287 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if err != nil { | ||
ctx.ServerError("IsOwnedBy", err) | ||
ctx.ServerError("CanCreateOrgRepo", err) | ||
return | ||
} else if !isOwner { | ||
qwerty287 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ctx.Error(http.StatusForbidden) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an performance regression for all pages with fork button. This should be fixed in v1.16.