Site Gallery: Default to friends only
This commit is contained in:
parent
81da502f17
commit
61c47c032d
|
@ -25,6 +25,7 @@ func SiteGallery() http.HandlerFunc {
|
||||||
viewStyle = r.FormValue("view") // cards (default), full
|
viewStyle = r.FormValue("view") // cards (default), full
|
||||||
|
|
||||||
// Search filters.
|
// Search filters.
|
||||||
|
who = r.FormValue("who")
|
||||||
filterExplicit = r.FormValue("explicit")
|
filterExplicit = r.FormValue("explicit")
|
||||||
filterVisibility = r.FormValue("visibility")
|
filterVisibility = r.FormValue("visibility")
|
||||||
adminView = r.FormValue("admin_view") == "true"
|
adminView = r.FormValue("admin_view") == "true"
|
||||||
|
@ -47,6 +48,9 @@ func SiteGallery() http.HandlerFunc {
|
||||||
if viewStyle != "full" {
|
if viewStyle != "full" {
|
||||||
viewStyle = "cards"
|
viewStyle = "cards"
|
||||||
}
|
}
|
||||||
|
if who != "friends" && who != "everybody" {
|
||||||
|
who = "friends"
|
||||||
|
}
|
||||||
|
|
||||||
// Load the current user.
|
// Load the current user.
|
||||||
currentUser, err := session.CurrentUser(r)
|
currentUser, err := session.CurrentUser(r)
|
||||||
|
@ -73,7 +77,7 @@ func SiteGallery() http.HandlerFunc {
|
||||||
Explicit: filterExplicit,
|
Explicit: filterExplicit,
|
||||||
Visibility: filterVisibility,
|
Visibility: filterVisibility,
|
||||||
AdminView: adminView,
|
AdminView: adminView,
|
||||||
ShyView: isShy,
|
FriendsOnly: isShy || who == "friends",
|
||||||
}, pager)
|
}, pager)
|
||||||
|
|
||||||
// Bulk load the users associated with these photos.
|
// Bulk load the users associated with these photos.
|
||||||
|
@ -105,6 +109,7 @@ func SiteGallery() http.HandlerFunc {
|
||||||
|
|
||||||
// Search filters
|
// Search filters
|
||||||
"Sort": sort,
|
"Sort": sort,
|
||||||
|
"FilterWho": who,
|
||||||
"FilterExplicit": filterExplicit,
|
"FilterExplicit": filterExplicit,
|
||||||
"FilterVisibility": filterVisibility,
|
"FilterVisibility": filterVisibility,
|
||||||
"AdminView": adminView,
|
"AdminView": adminView,
|
||||||
|
|
|
@ -399,7 +399,7 @@ type Gallery struct {
|
||||||
Explicit string // Explicit filter
|
Explicit string // Explicit filter
|
||||||
Visibility string // Visibility filter
|
Visibility string // Visibility filter
|
||||||
AdminView bool // Show all images
|
AdminView bool // Show all images
|
||||||
ShyView bool // Current user is shy (self/friends only)
|
FriendsOnly bool // Only show self/friends instead of everybody's pics
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -412,7 +412,7 @@ func PaginateGalleryPhotos(user *User, conf Gallery, pager *Pagination) ([]*Phot
|
||||||
filterExplicit = conf.Explicit
|
filterExplicit = conf.Explicit
|
||||||
filterVisibility = conf.Visibility
|
filterVisibility = conf.Visibility
|
||||||
adminView = conf.AdminView
|
adminView = conf.AdminView
|
||||||
isShy = conf.ShyView
|
friendsOnly = conf.FriendsOnly
|
||||||
p = []*Photo{}
|
p = []*Photo{}
|
||||||
query *gorm.DB
|
query *gorm.DB
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ func PaginateGalleryPhotos(user *User, conf Gallery, pager *Pagination) ([]*Phot
|
||||||
friendIDs = append(friendIDs, userID)
|
friendIDs = append(friendIDs, userID)
|
||||||
|
|
||||||
// Whose photos can you see on the Site Gallery?
|
// Whose photos can you see on the Site Gallery?
|
||||||
if isShy {
|
if friendsOnly {
|
||||||
// Shy users can only see their Friends photos (public or friends visibility)
|
// Shy users can only see their Friends photos (public or friends visibility)
|
||||||
// and any Private photos to whom they were granted access.
|
// and any Private photos to whom they were granted access.
|
||||||
wheres = append(wheres,
|
wheres = append(wheres,
|
||||||
|
|
|
@ -223,6 +223,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Indicator if friends-only is selected. -->
|
||||||
|
{{if eq .FilterWho "friends"}}
|
||||||
|
<div class="notification is-success is-light">
|
||||||
|
Showing you all recent photos from <strong>your friends.</strong>
|
||||||
|
<a href="{{.Request.URL.Path}}?who=everybody">See all certified members' gallery photos?</a>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<!-- Filters -->
|
<!-- Filters -->
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<form action="{{.Request.URL.Path}}" method="GET">
|
<form action="{{.Request.URL.Path}}" method="GET">
|
||||||
|
@ -241,6 +249,21 @@
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="columns is-multiline mb-0">
|
<div class="columns is-multiline mb-0">
|
||||||
|
|
||||||
|
<!-- Site Gallery: friends-only filter -->
|
||||||
|
{{if .IsSiteGallery}}
|
||||||
|
<div class="column">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="who">Whose photos:</label>
|
||||||
|
<div class="select is-fullwidth">
|
||||||
|
<select id="who" name="who">
|
||||||
|
<option value="friends"{{if eq .FilterWho "friends"}} selected{{end}}>My friends only</option>
|
||||||
|
<option value="everybody"{{if eq .FilterWho "everybody"}} selected{{end}}>All certified members</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{if or .CurrentUser.Explicit .IsOwnPhotos}}
|
{{if or .CurrentUser.Explicit .IsOwnPhotos}}
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user