mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
WIP
This commit is contained in:
parent
7380eac5a2
commit
282b0d1a30
3 changed files with 20 additions and 1 deletions
|
@ -6,7 +6,6 @@ package org
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"forgejo.org/models"
|
||||
"forgejo.org/models/organization"
|
||||
"forgejo.org/modules/base"
|
||||
|
@ -135,6 +134,7 @@ func MembersAction(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Info("redirecting to", ctx.Org.OrgLink)
|
||||
redirect := ctx.Org.OrgLink + "/members"
|
||||
if ctx.Params(":action") == "leave" {
|
||||
redirect = setting.AppSubURL + "/"
|
||||
|
|
|
@ -215,7 +215,20 @@ func Organization(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// Get public membership status for each organization
|
||||
orgsIsPublicMember := make(map[int64]bool)
|
||||
for _, org := range orgs {
|
||||
isPublic, err := organization.IsPublicMembership(ctx, org.ID, ctx.Doer.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("IsPublicMembership", err)
|
||||
return
|
||||
}
|
||||
orgsIsPublicMember[org.ID] = isPublic
|
||||
}
|
||||
|
||||
ctx.Data["Orgs"] = orgs
|
||||
ctx.Data["Total"] = total
|
||||
ctx.Data["OrgsIsPublicMember"] = orgsIsPublicMember
|
||||
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<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}}">{{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}}">{{svg "octicon-eye" 12 "icon"}}{{ctx.Locale.Tr "org.members.private_helper"}}</a>
|
||||
{{end}}
|
||||
<form>
|
||||
{{$.CsrfTokenHtml}}
|
||||
<button class="ui red button delete-button" data-modal-id="leave-organization"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue