Filter for expressly non-certified

This commit is contained in:
Noah Petherbridge 2023-09-01 17:20:34 -07:00
parent 444699632a
commit 577c92386e
3 changed files with 11 additions and 2 deletions

View File

@ -92,7 +92,8 @@ func Search() http.HandlerFunc {
Orientation: orientation,
MaritalStatus: maritalStatus,
HereFor: hereFor,
Certified: isCertified != "false",
Certified: isCertified == "true",
NotCertified: isCertified == "false",
InnerCircle: isCertified == "circle",
ShyAccounts: isCertified == "shy",
Friends: friendSearch,

View File

@ -165,6 +165,7 @@ type UserSearch struct {
MaritalStatus string
HereFor string
Certified bool
NotCertified bool
InnerCircle bool
ShyAccounts bool
Friends bool
@ -272,6 +273,12 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
placeholders = append(placeholders, search.Certified, UserStatusActive)
}
// Expressly Not Certified filtering
if search.NotCertified {
wheres = append(wheres, "certified = ?", "status = ?")
placeholders = append(placeholders, false, UserStatusActive)
}
if search.InnerCircle {
wheres = append(wheres, "inner_circle = ? OR is_admin = ?")
placeholders = append(placeholders, true, true)

View File

@ -86,7 +86,8 @@
<option value="circle"{{if eq $Root.Certified "circle"}} selected{{end}}>Inner circle only</option>
{{end}}
<option value="shy"{{if eq $Root.Certified "shy"}} selected{{end}}>Shy Accounts</option>
<option value="false"{{if eq $Root.Certified "false"}} selected{{end}}>Show all users</option>
<option value="false"{{if eq $Root.Certified "false"}} selected{{end}}>Non-certified only</option>
<option value="all"{{if eq $Root.Certified "all"}} selected{{end}}>Show all users</option>
</select>
</div>
</div>