Search users by admin, privacy policy update

main
Noah Petherbridge 2024-04-25 21:52:43 -07:00
parent ff2eb285eb
commit 106ca56198
4 changed files with 64 additions and 32 deletions

View File

@ -96,6 +96,8 @@ func Search() http.HandlerFunc {
InnerCircle: isCertified == "circle", InnerCircle: isCertified == "circle",
ShyAccounts: isCertified == "shy", ShyAccounts: isCertified == "shy",
IsBanned: isCertified == "banned", IsBanned: isCertified == "banned",
IsDisabled: isCertified == "disabled",
IsAdmin: isCertified == "admin",
Friends: friendSearch, Friends: friendSearch,
AgeMin: ageMin, AgeMin: ageMin,
AgeMax: ageMax, AgeMax: ageMax,

View File

@ -263,6 +263,8 @@ type UserSearch struct {
InnerCircle bool InnerCircle bool
ShyAccounts bool ShyAccounts bool
IsBanned bool IsBanned bool
IsDisabled bool
IsAdmin bool // search for admin users
Friends bool Friends bool
AgeMin int AgeMin int
AgeMax int AgeMax int
@ -362,14 +364,22 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
placeholders = append(placeholders, "here_for", "%"+search.HereFor+"%") placeholders = append(placeholders, "here_for", "%"+search.HereFor+"%")
} }
// All user searches will show active accounts only, unless we are admin. // Only admin user can show disabled/banned users.
if user.IsAdmin && search.IsBanned { var statuses = []string{}
if user.IsAdmin {
if search.IsBanned {
statuses = append(statuses, UserStatusBanned)
}
if search.IsDisabled {
statuses = append(statuses, UserStatusDisabled)
}
}
// Non-admin user only ever sees active accounts.
if user.IsAdmin && len(statuses) > 0 {
wheres = append(wheres, "status IN ?") wheres = append(wheres, "status IN ?")
placeholders = append(placeholders, []string{ placeholders = append(placeholders, statuses)
UserStatusBanned, } else {
UserStatusDisabled,
})
} else if !user.IsAdmin {
wheres = append(wheres, "status = ?") wheres = append(wheres, "status = ?")
placeholders = append(placeholders, UserStatusActive) placeholders = append(placeholders, UserStatusActive)
} }
@ -386,6 +396,10 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
placeholders = append(placeholders, false) placeholders = append(placeholders, false)
} }
if search.IsAdmin {
wheres = append(wheres, "is_admin = true")
}
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

@ -33,16 +33,7 @@
<div class="notification is-success is-light"> <div class="notification is-success is-light">
Currently searching within your <i class="fa fa-user-group"></i> Friends list. Currently searching within your <i class="fa fa-user-group"></i> Friends list.
</div> </div>
{{else if not (eq .Sort "distance")}} {{else if eq .Sort "distance"}}
<div class="notification is-success is-light">
<strong>New feature:</strong> you can now see <strong>Who's Nearby!</strong>
{{if not .MyLocation.Source}}
You will need to <a href="/settings#location">set your location</a> first.
{{else}}
<a href="{{.Request.URL.Path}}?sort=distance">See who's nearby now!</a>
{{end}}
</div>
{{else}}
<div class="notification is-success is-light content"> <div class="notification is-success is-light content">
<p> <p>
Showing you <i class="fa fa-location-dot mr-1"></i> <strong>Who's Nearby.</strong> Showing you <i class="fa fa-location-dot mr-1"></i> <strong>Who's Nearby.</strong>
@ -64,6 +55,18 @@
{{end}} {{end}}
</p> </p>
</div> </div>
{{else if eq .Certified "shy"}}
<div class="notification is-success is-light content">
<p>
Showing you <i class="fa fa-ghost"></i> <strong>Shy Accounts</strong>. These profiles may be marked as private or
have no photo available to you, as all of theirs are set to 'friends-only' or 'private.'
</p>
<p>
Shy Accounts are limited in the way they can interact with our non-shy members.
<a href="/faq#shy-faqs" target="_blank">Learn more <i class="fa fa-external-link"></i></a>
</p>
</div>
{{end}} {{end}}
<div class="block"> <div class="block">
@ -87,16 +90,24 @@
<label class="label">Status:</label> <label class="label">Status:</label>
<div class="select is-fullwidth"> <div class="select is-fullwidth">
<select id="certified" name="certified"> <select id="certified" name="certified">
<option value="true">Only certified users</option> <optgroup label="Certification Status">
{{if .CurrentUser.IsInnerCircle}} <option value="true">Only certified users</option>
<option value="circle"{{if eq $Root.Certified "circle"}} selected{{end}}>Inner circle only</option> <option value="false"{{if eq $Root.Certified "false"}} selected{{end}}>Non-certified only</option>
{{end}} </optgroup>
<option value="shy"{{if eq $Root.Certified "shy"}} selected{{end}}>Shy Accounts</option> <optgroup label="Profile Status">
<option value="false"{{if eq $Root.Certified "false"}} selected{{end}}>Non-certified only</option> <option value="shy"{{if eq $Root.Certified "shy"}} selected{{end}}>Shy Accounts</option>
<option value="all"{{if eq $Root.Certified "all"}} selected{{end}}>Show all users</option> {{if .CurrentUser.IsInnerCircle}}
<option value="circle"{{if eq $Root.Certified "circle"}} selected{{end}}>Inner circle only</option>
{{end}}
<option value="admin"{{if eq $Root.Certified "admin"}} selected{{end}}>Website administrators</option>
</optgroup>
{{if .CurrentUser.IsAdmin}} {{if .CurrentUser.IsAdmin}}
<option value="banned"{{if eq $Root.Certified "banned"}} selected{{end}}>Banned or disabled</option> <optgroup label="Admin Options">
<option value="banned"{{if eq $Root.Certified "banned"}} selected{{end}}>☮ Banned</option>
<option value="disabled"{{if eq $Root.Certified "disabled"}} selected{{end}}>☮ Disabled</option>
</optgroup>
{{end}} {{end}}
<option value="all"{{if eq $Root.Certified "all"}} selected{{end}}>Show all users</option>
</select> </select>
</div> </div>
</div> </div>

View File

@ -576,17 +576,22 @@
<strong>IP Address</strong> <strong>IP Address</strong>
<ul> <ul>
<li> <li>
<strong>How we collect it:</strong>
Your IP address may appear as part of standard web server logs as you access and browse the Your IP address may appear as part of standard web server logs as you access and browse the
website - for example in HTTP access logs captured by our <a href="https://nginx.org">NGINX</a> website - for example in HTTP access logs captured by our <a href="https://nginx.org">NGINX</a>
reverse proxy server. Your IP address in these logs is <strong>NOT</strong> associated with your reverse proxy server. These logs are NOT associated with any specific user account, and
user account. rotate on a regular basis.
</li> </li>
<li> <li>
<strong>How we store it:</strong> Your IP address is logged to your account during certain crucial account lifecycle events, such
Your IP address is logged during certain crucial account lifecycle events, such as when your as when your account is first created and when you upload your certification photo, for the
account is created and when you upload your certification photo, for the purpose of abuse and purpose of detecting abuse and fraud prevention.
fraud prevention. </li>
<li>
While logged in to your account, a list of the distinct IP addresses you have logged in from is
recorded (date/time of first and last visit, count of visits). This is expressly for record keeping
purposes in case it can assist with law enforcement, and is not displayed on the website (even to
admin users).
<span class="tag is-success">As of: Apr 25 2024</span>
</li> </li>
</ul> </ul>
</li> </li>