diff --git a/pkg/controller/account/search.go b/pkg/controller/account/search.go
index a9bb18a..48aba96 100644
--- a/pkg/controller/account/search.go
+++ b/pkg/controller/account/search.go
@@ -96,6 +96,7 @@ func Search() http.HandlerFunc {
NotCertified: isCertified == "false",
InnerCircle: isCertified == "circle",
ShyAccounts: isCertified == "shy",
+ IsBanned: isCertified == "banned",
Friends: friendSearch,
AgeMin: ageMin,
AgeMax: ageMax,
diff --git a/pkg/models/user.go b/pkg/models/user.go
index b641dcf..c144eca 100644
--- a/pkg/models/user.go
+++ b/pkg/models/user.go
@@ -168,6 +168,7 @@ type UserSearch struct {
NotCertified bool
InnerCircle bool
ShyAccounts bool
+ IsBanned bool
Friends bool
AgeMin int
AgeMax int
@@ -267,16 +268,28 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
placeholders = append(placeholders, "here_for", "%"+search.HereFor+"%")
}
+ // All user searches will show active accounts only, unless we are admin.
+ if user.IsAdmin && search.IsBanned {
+ wheres = append(wheres, "status IN ?")
+ placeholders = append(placeholders, []string{
+ UserStatusBanned,
+ UserStatusDisabled,
+ })
+ } else if !user.IsAdmin {
+ wheres = append(wheres, "status = ?")
+ placeholders = append(placeholders, UserStatusActive)
+ }
+
// Certified filter (including if Shy Accounts are asked for)
if search.Certified {
- wheres = append(wheres, "certified = ?", "status = ?")
- placeholders = append(placeholders, search.Certified, UserStatusActive)
+ wheres = append(wheres, "certified = ?")
+ placeholders = append(placeholders, search.Certified)
}
// Expressly Not Certified filtering
if search.NotCertified {
- wheres = append(wheres, "certified = ?", "status = ?")
- placeholders = append(placeholders, false, UserStatusActive)
+ wheres = append(wheres, "certified = ?")
+ placeholders = append(placeholders, false)
}
if search.InnerCircle {
diff --git a/web/templates/account/search.html b/web/templates/account/search.html
index 2b67792..a69f01e 100644
--- a/web/templates/account/search.html
+++ b/web/templates/account/search.html
@@ -88,6 +88,9 @@
+ {{if .CurrentUser.IsAdmin}}
+
+ {{end}}