diff --git a/models/user.go b/models/user.go index 8c136e25f..4203b54b7 100644 --- a/models/user.go +++ b/models/user.go @@ -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) diff --git a/modules/context/context.go b/modules/context/context.go index e96bf5bd3..f0d2c473b 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -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"] = "" } diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 4b1ab1834..d753a1ba6 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -6,10 +6,16 @@
{{range .Users}} + {{if (or (eq .Visibility 1) (and ($.SignedUser) (or (eq .Visibility 2) (and (.IsUserOrgPartOf $.SignedUserID) (eq .Visibility 3)) ($.IsAdmin))))}}
- {{.Name}} {{.FullName}} + + {{.Name}} {{.FullName}} + {{if eq .Visibility 3}} + + {{end}} +
{{if .Location}} {{.Location}} @@ -22,6 +28,7 @@
+ {{end}} {{else}}
{{$.i18n.Tr "explore.org_no_results"}}
{{end}}