-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add ContextUser
#18798
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
Add ContextUser
#18798
Changes from all commits
8337fc5
09618ac
1ff193f
e29433c
a710228
726e9c5
0ccc171
6e678a5
29ecbb0
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 |
---|---|---|
|
@@ -15,7 +15,6 @@ import ( | |
"code.gitea.io/gitea/modules/convert" | ||
api "code.gitea.io/gitea/modules/structs" | ||
"code.gitea.io/gitea/modules/web" | ||
"code.gitea.io/gitea/routers/api/v1/user" | ||
"code.gitea.io/gitea/routers/api/v1/utils" | ||
) | ||
|
||
|
@@ -45,11 +44,8 @@ func CreateOrg(ctx *context.APIContext) { | |
// "$ref": "#/responses/forbidden" | ||
// "422": | ||
// "$ref": "#/responses/validationError" | ||
|
||
form := web.GetForm(ctx).(*api.CreateOrgOption) | ||
u := user.GetUserByParams(ctx) | ||
if ctx.Written() { | ||
return | ||
} | ||
|
||
visibility := api.VisibleTypePublic | ||
if form.Visibility != "" { | ||
|
@@ -67,7 +63,7 @@ func CreateOrg(ctx *context.APIContext) { | |
Visibility: visibility, | ||
} | ||
|
||
if err := models.CreateOrganization(org, u); err != nil { | ||
if err := models.CreateOrganization(org, ctx.ContextUser); err != nil { | ||
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. This may should be login user but not contextUser? It's not this PR but before. 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 comment says
so |
||
if user_model.IsErrUserAlreadyExist(err) || | ||
db.IsErrNameReserved(err) || | ||
db.IsErrNameCharsNotAllowed(err) || | ||
|
Uh oh!
There was an error while loading. Please reload this page.