Inner circle removal requests

This commit is contained in:
Noah Petherbridge 2023-10-14 11:37:01 -07:00
parent 85c945579b
commit 0f35f135d2
5 changed files with 75 additions and 13 deletions

View File

@ -1,6 +1,7 @@
package account
import (
"fmt"
"net/http"
"code.nonshy.com/nonshy/website/pkg/config"
@ -124,12 +125,33 @@ func RemoveCircle() http.HandlerFunc {
return
}
// Add them!
if err := models.RemoveFromInnerCircle(user); err != nil {
session.FlashError(w, r, "Couldn't remove from the inner circle: %s", err)
// Admin (with the correct scope): remove them now.
if currentUser.HasAdminScope(config.ScopeCircleModerator) {
if err := models.RemoveFromInnerCircle(user); err != nil {
session.FlashError(w, r, "Couldn't remove from the inner circle: %s", err)
}
session.Flash(w, r, "%s has been removed from the inner circle!", user.Username)
} else {
// Non-admin user: request removal only.
fb := &models.Feedback{
Intent: "report.circle",
Subject: "Inner Circle Removal Request",
TableName: "users",
TableID: user.ID,
Message: fmt.Sprintf(
"An inner circle member has flagged that **%s** no longer qualifies to be a part of the inner circle and should be removed.",
user.Username,
),
}
if err := models.CreateFeedback(fb); err != nil {
session.FlashError(w, r, "Couldn't create admin notification: %s", err)
} else {
session.Flash(w, r, "A request to remove %s from the inner circle has been sent to the site admin.", user.Username)
}
}
session.Flash(w, r, "%s has been removed from the inner circle!", user.Username)
templates.Redirect(w, "/u/"+user.Username)
return
}

View File

@ -92,7 +92,7 @@ func New() http.Handler {
mux.Handle("/admin/maintenance", middleware.AdminRequired(config.ScopeMaintenance, admin.Maintenance()))
mux.Handle("/forum/admin", middleware.AdminRequired(config.ScopeForumAdmin, forum.Manage()))
mux.Handle("/forum/admin/edit", middleware.AdminRequired(config.ScopeForumAdmin, forum.AddEdit()))
mux.Handle("/inner-circle/remove", middleware.AdminRequired(config.ScopeCircleModerator, account.RemoveCircle()))
mux.Handle("/inner-circle/remove", middleware.LoginRequired(account.RemoveCircle()))
// JSON API endpoints.
mux.HandleFunc("/v1/version", api.Version())

View File

@ -111,6 +111,25 @@
</li>
</ul>
<h2 id="qualify">How does one qualify to be part of the inner circle?</h2>
<p>
The minimum qualifications for somebody to be in the inner circle include:
</p>
<p>
On <strong>public</strong> visibility, they have at least <strong>5 (five)</strong> photos
that show their <strong>face</strong> <em>and</em> <strong>nude body</strong> together.
</p>
<p>
If you see an inner circle member who had dropped below that threshold later (e.g., they moved
all of their pictures to private or they deleted them all from their page), you may
<strong>request removal</strong> from the circle when viewing their photo gallery page. Help
us keep the integrity of the inner circle by requesting removals when you see somebody who
should no longer qualify to be in the circle. <strong>Removal requests are anonymous!</strong>
</p>
<h2>How do I invite others to join the inner circle?</h2>
<p>

View File

@ -42,6 +42,7 @@
{{InputCSRF}}
<input type="hidden" name="to" value="{{.User.Username}}">
{{if .CurrentUser.IsAdmin}}
<div class="content">
<p>
Do you want to <strong class="has-text-danger">remove</strong> {{.User.Username}} from
@ -60,10 +61,31 @@
</li>
</ul>
</div>
{{else}}
<div class="content">
<p>
Do you want to <strong class="has-text-danger">request removal</strong> of {{.User.Username}}
from the {{PrettyCircle}}?
</p>
<p>
If {{.User.Username}} should no longer <a href="/inner-circle#qualify">qualify</a> to be a
part of the inner circle, you may flag them to be removed from the circle. For example: to
be invited into the circle someone should need to have <strong>at least 5 (five) pictures</strong>
that are on <strong>public</strong> visibility and which show their <strong>face and nude body</strong>
together. But if they have taken down their pictures and should no longer qualify to remain in
the {{PrettyCircle}}, you may request them to be removed and an admin will check them out.
</p>
<p>
Note: removal requests are <strong>completely anonymous</strong>: we trust your judgment when
inviting others to join the circle so we also trust you to help maintain the integrity of the
circle when flagging people for removal.
</p>
</div>
{{end}}
<div class="field has-text-centered">
<button type="submit" name="intent" value="confirm" class="button is-danger">
Remove from the inner circle
{{if .CurrentUser.IsAdmin}}Remove{{else}}Request removal{{end}} from the inner circle
</button>
<button type="submit" name="intent" value="cancel" class="button is-warning ml-1">
Cancel

View File

@ -339,11 +339,10 @@
<div class="block mt-0">
<span class="icon"><img src="/static/img/circle-16.png"></span>
<strong>{{.User.Username}}</strong> is a part of the {{PrettyCircle}}.
{{if .CurrentUser.IsAdmin}}
<a href="/inner-circle/remove?to={{.User.Username}}" class="has-text-danger ml-2">
<i class="fa fa-peace"></i> Remove from circle?
</a>
{{end}}
Do they <a href="/inner-circle#qualify">still qualify</a> to be in the circle?
<a href="/inner-circle/remove?to={{.User.Username}}" class="has-text-danger">
<ins>Request removal</ins>
</a> if they do not.
</div>
{{end}}
{{end}}