Implement visibility in explore/organizations
This commit is contained in:
parent
4df763c3b1
commit
9d73ff4b3e
|
|
@ -76,7 +76,7 @@ var (
|
|||
type VisibleType int
|
||||
|
||||
const (
|
||||
// VisibleType Visible for everyone
|
||||
// VisibleTypePublic Visible for everyone
|
||||
VisibleTypePublic VisibleType = iota + 1
|
||||
|
||||
// VisibleTypeLimited Visible for every connected user
|
||||
|
|
@ -521,6 +521,11 @@ func (u *User) IsUserOrgOwner(orgID int64) bool {
|
|||
return IsOrganizationOwner(orgID, u.ID)
|
||||
}
|
||||
|
||||
// IsUserOrgPartOf returns true if user is part of the organization
|
||||
func (u *User) IsUserOrgPartOf(userID int64) bool {
|
||||
return IsOrganizationMember(u.ID, userID)
|
||||
}
|
||||
|
||||
// IsPublicMember returns true if user public his/her membership in given organization.
|
||||
func (u *User) IsPublicMember(orgID int64) bool {
|
||||
return IsPublicMembership(orgID, u.ID)
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ func Contexter() macaron.Handler {
|
|||
ctx.Data["SignedUserName"] = ctx.User.Name
|
||||
ctx.Data["IsAdmin"] = ctx.User.IsAdmin
|
||||
} else {
|
||||
ctx.Data["SignedUserID"] = 0
|
||||
ctx.Data["SignedUserID"] = int64(0)
|
||||
ctx.Data["SignedUserName"] = ""
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,16 @@
|
|||
|
||||
<div class="ui user list">
|
||||
{{range .Users}}
|
||||
{{if (or (eq .Visibility 1) (and ($.SignedUser) (or (eq .Visibility 2) (and (.IsUserOrgPartOf $.SignedUserID) (eq .Visibility 3)) ($.IsAdmin))))}}
|
||||
<div class="item">
|
||||
<img class="ui avatar image" src="{{.RelAvatarLink}}">
|
||||
<div class="content">
|
||||
<span class="header"><a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}</span>
|
||||
<span class="header">
|
||||
<a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}
|
||||
{{if eq .Visibility 3}}
|
||||
<span class="text gold"><i class="octicon octicon-lock"></i></span>
|
||||
{{end}}
|
||||
</span>
|
||||
<div class="description">
|
||||
{{if .Location}}
|
||||
<i class="octicon octicon-location"></i> {{.Location}}
|
||||
|
|
@ -22,6 +28,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div>{{$.i18n.Tr "explore.org_no_results"}}</div>
|
||||
{{end}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user