diff --git a/pkg/controller/photo/site_gallery.go b/pkg/controller/photo/site_gallery.go index a10b875..ee09760 100644 --- a/pkg/controller/photo/site_gallery.go +++ b/pkg/controller/photo/site_gallery.go @@ -25,6 +25,7 @@ func SiteGallery() http.HandlerFunc { viewStyle = r.FormValue("view") // cards (default), full // Search filters. + who = r.FormValue("who") filterExplicit = r.FormValue("explicit") filterVisibility = r.FormValue("visibility") adminView = r.FormValue("admin_view") == "true" @@ -47,6 +48,9 @@ func SiteGallery() http.HandlerFunc { if viewStyle != "full" { viewStyle = "cards" } + if who != "friends" && who != "everybody" { + who = "friends" + } // Load the current user. currentUser, err := session.CurrentUser(r) @@ -70,10 +74,10 @@ func SiteGallery() http.HandlerFunc { } pager.ParsePage(r) photos, _ := models.PaginateGalleryPhotos(currentUser, models.Gallery{ - Explicit: filterExplicit, - Visibility: filterVisibility, - AdminView: adminView, - ShyView: isShy, + Explicit: filterExplicit, + Visibility: filterVisibility, + AdminView: adminView, + FriendsOnly: isShy || who == "friends", }, pager) // Bulk load the users associated with these photos. @@ -105,6 +109,7 @@ func SiteGallery() http.HandlerFunc { // Search filters "Sort": sort, + "FilterWho": who, "FilterExplicit": filterExplicit, "FilterVisibility": filterVisibility, "AdminView": adminView, diff --git a/pkg/models/photo.go b/pkg/models/photo.go index ce5f97f..6aa4d8e 100644 --- a/pkg/models/photo.go +++ b/pkg/models/photo.go @@ -396,10 +396,10 @@ func (u *User) DistinctPhotoTypes() (result map[PhotoVisibility]struct{}) { // Gallery config for the main Gallery paginator. type Gallery struct { - Explicit string // Explicit filter - Visibility string // Visibility filter - AdminView bool // Show all images - ShyView bool // Current user is shy (self/friends only) + Explicit string // Explicit filter + Visibility string // Visibility filter + AdminView bool // Show all images + 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 filterVisibility = conf.Visibility adminView = conf.AdminView - isShy = conf.ShyView + friendsOnly = conf.FriendsOnly p = []*Photo{} query *gorm.DB @@ -451,7 +451,7 @@ func PaginateGalleryPhotos(user *User, conf Gallery, pager *Pagination) ([]*Phot friendIDs = append(friendIDs, userID) // 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) // and any Private photos to whom they were granted access. wheres = append(wheres, diff --git a/web/templates/photo/gallery.html b/web/templates/photo/gallery.html index 8d16b3e..801477c 100644 --- a/web/templates/photo/gallery.html +++ b/web/templates/photo/gallery.html @@ -223,6 +223,14 @@ + + {{if eq .FilterWho "friends"}} +
+ Showing you all recent photos from your friends. + See all certified members' gallery photos? +
+ {{end}} +
@@ -241,6 +249,21 @@
+ + {{if .IsSiteGallery}} +
+
+ +
+ +
+
+
+ {{end}} + {{if or .CurrentUser.Explicit .IsOwnPhotos}}