mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
MembersAction handler changes
This commit is contained in:
parent
b369bc8a57
commit
3c061edafd
2 changed files with 6 additions and 13 deletions
|
@ -79,12 +79,10 @@ func Members(ctx *context.Context) {
|
|||
func MembersAction(ctx *context.Context) {
|
||||
uid := ctx.FormInt64("uid")
|
||||
if uid == 0 {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/members")
|
||||
ctx.Redirect("/user/settings/organization")
|
||||
return
|
||||
}
|
||||
|
||||
redirectURL := ctx.FormString("redirect")
|
||||
|
||||
org := ctx.Org.Organization
|
||||
var err error
|
||||
switch ctx.Params(":action") {
|
||||
|
@ -108,7 +106,7 @@ func MembersAction(ctx *context.Context) {
|
|||
err = models.RemoveOrgUser(ctx, org.ID, uid)
|
||||
if organization.IsErrLastOrgOwner(err) {
|
||||
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
||||
ctx.JSONRedirect(ctx.Org.OrgLink + "/members")
|
||||
ctx.JSONRedirect("/user/settings/organization")
|
||||
return
|
||||
}
|
||||
case "leave":
|
||||
|
@ -120,7 +118,7 @@ func MembersAction(ctx *context.Context) {
|
|||
})
|
||||
} else if organization.IsErrLastOrgOwner(err) {
|
||||
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
||||
ctx.JSONRedirect(ctx.Org.OrgLink + "/members")
|
||||
ctx.JSONRedirect("/user/settings/organization")
|
||||
} else {
|
||||
log.Error("RemoveOrgUser(%d,%d): %v", org.ID, ctx.Doer.ID, err)
|
||||
}
|
||||
|
@ -136,12 +134,7 @@ func MembersAction(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if redirectURL != "" {
|
||||
ctx.JSONRedirect(redirectURL)
|
||||
return
|
||||
}
|
||||
|
||||
redirect := ctx.Org.OrgLink + "/members"
|
||||
redirect := "/user/settings/organization"
|
||||
if ctx.Params(":action") == "leave" {
|
||||
redirect = setting.AppSubURL + "/"
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
<div class="flex-item-trailing">
|
||||
{{$isPublic := index $.OrgsIsPublicMember .ID}}
|
||||
{{if $isPublic}}
|
||||
<a class="ui tiny button link-action" href data-url="{{.OrganisationLink}}/members/action/private?uid={{$.SignedUser.ID}}&redirect=/user/settings/organization">{{svg "octicon-eye-closed" 12 "icon"}}{{ctx.Locale.Tr "org.members.public_helper"}}</a>
|
||||
<a class="ui tiny button link-action" href data-url="{{.OrganisationLink}}/members/action/private?uid={{$.SignedUser.ID}}">{{svg "octicon-eye-closed" 12 "icon"}}{{ctx.Locale.Tr "org.members.public_helper"}}</a>
|
||||
{{else}}
|
||||
<a class="ui tiny button link-action" href data-url="{{.OrganisationLink}}/members/action/public?uid={{$.SignedUser.ID}}&redirect=/user/settings/organization">{{svg "octicon-eye" 12 "icon"}}{{ctx.Locale.Tr "org.members.private_helper"}}</a>
|
||||
<a class="ui tiny button link-action" href data-url="{{.OrganisationLink}}/members/action/public?uid={{$.SignedUser.ID}}">{{svg "octicon-eye" 12 "icon"}}{{ctx.Locale.Tr "org.members.private_helper"}}</a>
|
||||
{{end}}
|
||||
<form>
|
||||
{{$.CsrfTokenHtml}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue