diff --git a/pkg/controller/photo/user_gallery.go b/pkg/controller/photo/user_gallery.go index d87d039..f9c56e1 100644 --- a/pkg/controller/photo/user_gallery.go +++ b/pkg/controller/photo/user_gallery.go @@ -46,7 +46,7 @@ func UserPhotos() http.HandlerFunc { var ( isOwnPhotos = currentUser.ID == user.ID isShy = currentUser.IsShy() - isShyFrom = currentUser.IsShyFrom(user) || (isShy && !models.AreFriends(currentUser.ID, user.ID)) + isShyFrom = !isOwnPhotos && (currentUser.IsShyFrom(user) || (isShy && !models.AreFriends(currentUser.ID, user.ID))) ) // Bail early if we are shy from this user. diff --git a/pkg/middleware/authentication.go b/pkg/middleware/authentication.go index c6a72a7..63a34e5 100644 --- a/pkg/middleware/authentication.go +++ b/pkg/middleware/authentication.go @@ -95,6 +95,19 @@ func CertRequired(handler http.Handler) http.Handler { return } + // Are they banned or disabled? + if currentUser.Status == models.UserStatusDisabled { + session.LogoutUser(w, r) + session.FlashError(w, r, "Your account has been disabled and you are now logged out.") + templates.Redirect(w, "/") + return + } else if currentUser.Status == models.UserStatusBanned { + session.LogoutUser(w, r) + session.FlashError(w, r, "Your account has been banned and you are now logged out.") + templates.Redirect(w, "/") + return + } + // User must be certified. if !currentUser.Certified || currentUser.ProfilePhoto.ID == 0 { log.Error("CertRequired: user is not certified") diff --git a/pkg/models/user.go b/pkg/models/user.go index 9d751ed..e8dabde 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -245,8 +245,8 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er } if search.Certified { - wheres = append(wheres, "certified = ?") - placeholders = append(placeholders, search.Certified) + wheres = append(wheres, "certified = ?", "status = ?") + placeholders = append(placeholders, search.Certified, UserStatusActive) } if search.AgeMin > 0 { diff --git a/web/templates/account/search.html b/web/templates/account/search.html index 4db9e8b..962477a 100644 --- a/web/templates/account/search.html +++ b/web/templates/account/search.html @@ -184,7 +184,11 @@

- {{.NameOrUsername}} + {{if ne .Status "active"}} + {{.NameOrUsername}} + {{else}} + {{.NameOrUsername}} + {{end}} {{if eq .Visibility "private"}} @@ -200,6 +204,9 @@ {{end}} + + {{if ne .Status "active"}}({{.Status}}){{end}} + {{if .IsAdmin}} diff --git a/web/templates/friend/friends.html b/web/templates/friend/friends.html index bf2e36c..f8430dc 100644 --- a/web/templates/friend/friends.html +++ b/web/templates/friend/friends.html @@ -88,7 +88,13 @@

- {{.NameOrUsername}} + + {{if ne .Status "active"}} + {{.NameOrUsername}} + {{else}} + {{.NameOrUsername}} + {{end}} +

@@ -100,6 +106,9 @@ {{end}} + + {{if ne .Status "active"}}({{.Status}}){{end}} + {{if .IsAdmin}}