-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix 404 error when remove self from an organization #26362
Fix 404 error when remove self from an organization #26362
Conversation
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.
Overall LGTM. ps: there is a handy function: ctx.JSONRedirect(....)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
routers/web/org/teams.go
Outdated
redirect := ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName) | ||
if isOrgMember, err := org_model.IsOrganizationMember(ctx, ctx.Org.Organization.ID, ctx.Doer.ID); err != nil { | ||
ctx.ServerError("IsOrganizationMember", err) | ||
return | ||
} else if !isOrgMember { | ||
if ctx.Org.Organization.Visibility.IsPrivate() { | ||
redirect = setting.AppSubURL + "/" | ||
} else { | ||
redirect = ctx.Org.Organization.HomeLink() | ||
} | ||
} | ||
ctx.JSONRedirect(redirect) |
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.
What about extracting this check into a separate method and giving it a parameter defaultRedirect
?
You call it twice at the moment (90-101 and 128-139).
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.
Done.
* upstream/main: (24 commits) Update zh-cn documentation (go-gitea#26406) Fix NuGet search endpoints (go-gitea#25613) Fix tooltip of commit select button (go-gitea#26472) fix grab cursor on default column (go-gitea#26476) Fix storage path logic especially for relative paths (go-gitea#26441) Rename `Sync2` -> `Sync` (go-gitea#26479) Add ThreadID parameter for Telegram webhooks (go-gitea#25996) Fix stderr usages (go-gitea#26477) Use correct pull request commit link instead of a generic commit link (go-gitea#26434) Close stdout correctly for "git blame" (go-gitea#26470) Refactor tests (go-gitea#26464) Remove last newline from config file (go-gitea#26468) Add matrix to support (go-gitea#26382) Refactor project templates (go-gitea#26448) Avoiding accessing undefined mentionValues (go-gitea#26461) Tweak actions menu (go-gitea#26278) Adjust minio new sequence, now it will check whether bucket exist first and then create one if it doesn't exist (go-gitea#26420) Set commit id when ref used explicitly (go-gitea#26447) Fix 404 error when remove self from an organization (go-gitea#26362) Update index doc (go-gitea#26455) ...
Same to #24322
Not only
leave
action but alsoremove
action should check whether user still belongs to the org.