* Rename banned and comment_banned roles * Add data update script to rename roles containing 'ban' * Add named error for Suspended users * Update unidiomatic method names * Rename misc banned to suspended * Apply suggestions from code review Co-authored-by: Michael Kohl <me@citizen428.net> * Add unit tests for suspended methods This commit also adds TODO comments for removing banned and comment_banned from the codebase after data update scripts have successfully run on all of our Forems. Co-authored-by: Michael Kohl <me@citizen428.net>
107 lines
5 KiB
Text
107 lines
5 KiB
Text
<div>
|
|
<h2 class="crayons-title mb-4">Abuse reports</h2>
|
|
<ul class="nav nav-pills mb-4">
|
|
<li class="nav-item">
|
|
<a href="<%= admin_reports_path(state: @feedback_type, status: "Open") %>" class="nav-link <%= "active" if @status == "Open" %>">Open/Unresolved</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="<%= admin_reports_path(state: @feedback_type, status: "Resolved") %>" class="nav-link <%= "active" if @status == "Resolved" %>">Resolved</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="<%= admin_reports_path(state: @feedback_type, status: "Invalid") %>" class="nav-link <%= "active" if @status == "Invalid" %>">Invalid</a>
|
|
</ul>
|
|
|
|
<div id="vomitReactions">
|
|
<div class="crayons-card">
|
|
<div class="card-header flex items-center" id="vomitReactionsHeader">
|
|
<h4>Vomit Reactions</h4>
|
|
<button class="btn btn-secondary ml-auto" type="button" data-toggle="collapse" data-target="#vomitReactionsBodyContainer" aria-expanded="false" aria-controls="vomitReactionsBodyContainer">
|
|
Toggle
|
|
</button>
|
|
</div>
|
|
<div id="vomitReactionsBodyContainer" class="collapse hide" aria-labelledby="vomitReactionsHeader" data-parent="#vomitReactions">
|
|
<div class="card-body" style="overflow: scroll; max-height: 500px;">
|
|
<% @vomits.each do |reaction| %>
|
|
<% next if (reaction.reactable_type == "Article" && !reaction.reactable.published) || (reaction.reactable_type == "User" && reaction.reactable&.banished?) %>
|
|
|
|
<div
|
|
class="d-flex justify-content-between"
|
|
data-controller="reaction"
|
|
data-reaction-id-value="<%= reaction.id %>"
|
|
data-reaction-url-value="<%= admin_reaction_path(reaction.id) %>">
|
|
<span>
|
|
🤢 <a href="<%= reaction.user.path %>" target="_blank" rel="noopener">@<%= reaction.user.username %></a>
|
|
<% if reaction.user_id == SiteConfig.mascot_user_id %>
|
|
<strong>(auto-generated)</strong>
|
|
<% end %>
|
|
</span>
|
|
<span>
|
|
<strong><%= reaction.reactable_type %>:</strong>
|
|
<a href="<%= reaction.reactable.path %>" target="_blank" rel="noopener"><%= reaction.reactable_type == "User" ? reaction.reactable.username : reaction.reactable.title %></a>
|
|
<% if reaction.reactable_type == "User" && reaction.reactable.suspended? %>
|
|
<span class="badge badge-danger">Suspended</span>
|
|
<% end %>
|
|
<% if reaction.reactable_type == "User" && reaction.reactable.vomitted_on? %>
|
|
<span class="badge badge-warning">Vomitted</span>
|
|
<% end %>
|
|
</span>
|
|
<span>
|
|
<% if params[:status] == "Open" || params[:status].blank? %>
|
|
<% if reaction.reactable_type == "User" %>
|
|
<button
|
|
class="btn btn-success btn-sm"
|
|
type="button"
|
|
data-reactable="user"
|
|
data-status="confirmed"
|
|
data-reaction-target="confirmed"
|
|
data-action="reaction#reactableUserCheck">
|
|
CONFIRM
|
|
</button>
|
|
<% else %>
|
|
<button
|
|
class="btn btn-success btn-sm"
|
|
type="button"
|
|
data-reactable="non-user"
|
|
data-status="confirmed"
|
|
data-reaction-target="confirmed"
|
|
data-action="reaction#reactableUserCheck">
|
|
CONFIRM
|
|
</button>
|
|
<% end %>
|
|
<button
|
|
class="btn btn-danger btn-sm"
|
|
type="button"
|
|
data-altstatus="invalid"
|
|
data-reaction-target="invalid"
|
|
data-action="reaction#updateReactionInvalid">
|
|
INVALID
|
|
</button>
|
|
<% end %>
|
|
<% if params[:status] == "Resolved" %>
|
|
<button
|
|
class="btn btn-warning text-white btn-sm"
|
|
type="button"
|
|
data-altstatus="invalid"
|
|
data-reaction-target="invalid"
|
|
data-action="reaction#updateReactionInvalid">
|
|
INVALIDATE
|
|
</button>
|
|
<% elsif params[:status] == "Invalid" %>
|
|
<button
|
|
class="btn btn-success btn-sm"
|
|
type="button"
|
|
data-status="confirmed"
|
|
data-reaction-target="confirmed"
|
|
data-action="reaction#updateReactionConfirmed">
|
|
MARK AS VALID
|
|
</button>
|
|
<% end %>
|
|
</span>
|
|
</div>
|
|
<hr id="js__reaction__div__hr__<%= reaction.id %>">
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|