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, Orientation: orientation,
MaritalStatus: maritalStatus, MaritalStatus: maritalStatus,
HereFor: hereFor, HereFor: hereFor,
Certified: isCertified != "false", Certified: isCertified == "true",
NotCertified: isCertified == "false",
InnerCircle: isCertified == "circle", InnerCircle: isCertified == "circle",
ShyAccounts: isCertified == "shy", ShyAccounts: isCertified == "shy",
Friends: friendSearch, Friends: friendSearch,

View File

@ -165,6 +165,7 @@ type UserSearch struct {
MaritalStatus string MaritalStatus string
HereFor string HereFor string
Certified bool Certified bool
NotCertified bool
InnerCircle bool InnerCircle bool
ShyAccounts bool ShyAccounts bool
Friends bool Friends bool
@ -272,6 +273,12 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
placeholders = append(placeholders, search.Certified, UserStatusActive) 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 { if search.InnerCircle {
wheres = append(wheres, "inner_circle = ? OR is_admin = ?") wheres = append(wheres, "inner_circle = ? OR is_admin = ?")
placeholders = append(placeholders, true, true) 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> <option value="circle"{{if eq $Root.Certified "circle"}} selected{{end}}>Inner circle only</option>
{{end}} {{end}}
<option value="shy"{{if eq $Root.Certified "shy"}} selected{{end}}>Shy Accounts</option> <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> </select>
</div> </div>
</div> </div>