mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
Removed Mark visible button from org/members
This commit is contained in:
parent
3c061edafd
commit
a36e5bb83d
3 changed files with 16 additions and 24 deletions
|
@ -6,6 +6,7 @@ package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"forgejo.org/models"
|
"forgejo.org/models"
|
||||||
"forgejo.org/models/organization"
|
"forgejo.org/models/organization"
|
||||||
"forgejo.org/modules/base"
|
"forgejo.org/modules/base"
|
||||||
|
@ -18,6 +19,7 @@ import (
|
||||||
const (
|
const (
|
||||||
// tplMembers template for organization members page
|
// tplMembers template for organization members page
|
||||||
tplMembers base.TplName = "org/member/members"
|
tplMembers base.TplName = "org/member/members"
|
||||||
|
tplSettingsOrganization base.TplName = "/user/settings/organization"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Members render organization users page
|
// Members render organization users page
|
||||||
|
@ -79,7 +81,7 @@ func Members(ctx *context.Context) {
|
||||||
func MembersAction(ctx *context.Context) {
|
func MembersAction(ctx *context.Context) {
|
||||||
uid := ctx.FormInt64("uid")
|
uid := ctx.FormInt64("uid")
|
||||||
if uid == 0 {
|
if uid == 0 {
|
||||||
ctx.Redirect("/user/settings/organization")
|
ctx.Redirect(tplSettingsOrganization)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +108,7 @@ func MembersAction(ctx *context.Context) {
|
||||||
err = models.RemoveOrgUser(ctx, org.ID, uid)
|
err = models.RemoveOrgUser(ctx, org.ID, uid)
|
||||||
if organization.IsErrLastOrgOwner(err) {
|
if organization.IsErrLastOrgOwner(err) {
|
||||||
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
||||||
ctx.JSONRedirect("/user/settings/organization")
|
ctx.JSONRedirect(tplSettingsOrganization)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "leave":
|
case "leave":
|
||||||
|
@ -118,7 +120,7 @@ func MembersAction(ctx *context.Context) {
|
||||||
})
|
})
|
||||||
} else if organization.IsErrLastOrgOwner(err) {
|
} else if organization.IsErrLastOrgOwner(err) {
|
||||||
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
||||||
ctx.JSONRedirect("/user/settings/organization")
|
ctx.JSONRedirect(tplSettingsOrganization)
|
||||||
} else {
|
} else {
|
||||||
log.Error("RemoveOrgUser(%d,%d): %v", org.ID, ctx.Doer.ID, err)
|
log.Error("RemoveOrgUser(%d,%d): %v", org.ID, ctx.Doer.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -134,7 +136,7 @@ func MembersAction(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect := "/user/settings/organization"
|
redirect := tplSettingsOrganization
|
||||||
if ctx.Params(":action") == "leave" {
|
if ctx.Params(":action") == "leave" {
|
||||||
redirect = setting.AppSubURL + "/"
|
redirect = setting.AppSubURL + "/"
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,19 +216,19 @@ func Organization(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get public membership status for each organization
|
// Get public membership status for each organization
|
||||||
orgsIsPublicMember := make(map[int64]bool)
|
orgsIsPublicMember := make(map[int64]bool)
|
||||||
for _, org := range orgs {
|
for _, org := range orgs {
|
||||||
isPublic, err := organization.IsPublicMembership(ctx, org.ID, ctx.Doer.ID)
|
isPublic, err := organization.IsPublicMembership(ctx, org.ID, ctx.Doer.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("IsPublicMembership", err)
|
ctx.ServerError("IsPublicMembership", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
orgsIsPublicMember[org.ID] = isPublic
|
orgsIsPublicMember[org.ID] = isPublic
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Orgs"] = orgs
|
ctx.Data["Orgs"] = orgs
|
||||||
ctx.Data["Total"] = total
|
ctx.Data["Total"] = total
|
||||||
ctx.Data["OrgsIsPublicMember"] = orgsIsPublicMember
|
ctx.Data["OrgsIsPublicMember"] = orgsIsPublicMember
|
||||||
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
||||||
pager.SetDefaultParams(ctx)
|
pager.SetDefaultParams(ctx)
|
||||||
ctx.Data["Page"] = pager
|
ctx.Data["Page"] = pager
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
<div class="flex-item-main">
|
<div class="flex-item-main">
|
||||||
<div class="flex-item-title">
|
<div class="flex-item-title">
|
||||||
{{template "shared/user/name" .}}
|
{{template "shared/user/name" .}}
|
||||||
{{if not $isPublic}}
|
|
||||||
<span class="ui label">{{ctx.Locale.Tr "org.members.private"}}</span>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
</div>
|
||||||
{{if not $.PublicOnly}}
|
{{if not $.PublicOnly}}
|
||||||
<div class="flex-item-body">
|
<div class="flex-item-body">
|
||||||
|
@ -38,13 +35,6 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-item-trailing">
|
<div class="flex-item-trailing">
|
||||||
{{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}
|
|
||||||
{{if $isPublic}}
|
|
||||||
<a class="ui tiny button link-action" href data-url="{{$.OrgLink}}/members/action/private?uid={{.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="{{$.OrgLink}}/members/action/public?uid={{.ID}}">{{svg "octicon-eye" 12 "icon"}}{{ctx.Locale.Tr "org.members.private_helper"}}</a>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{if eq $.SignedUser.ID .ID}}
|
{{if eq $.SignedUser.ID .ID}}
|
||||||
<form>
|
<form>
|
||||||
<button class="ui red tiny button delete-button" data-modal-id="leave-organization"
|
<button class="ui red tiny button delete-button" data-modal-id="leave-organization"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue