Skip to content
Snippets Groups Projects
Commit ee183731 authored by Monica Cellio's avatar Monica Cellio
Browse files

for mods, add number of warnings/suspensions sent (if any) to user profile page

parent 7996b4b3
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,10 @@ class CommunityUser < ApplicationRecord
false
end
def latest_warning
mod_warnings&.order(created_at: 'desc').first.created_at
end
# Calculation functions for privilege scores
# These are quite expensive, so we'll cache them for a while
def post_score
......
......@@ -20,6 +20,14 @@
</div>
<% end %>
<% if moderator? && @user.community_user.mod_warnings&.size.positive? %>
<div class="notice is-info h-m-b-4">
<p><%= pluralize(@user.community_user.mod_warnings.count, 'message') %> sent,
most recent: <%= time_ago_in_words(@user.community_user.latest_warning) %> ago
</p>
</div>
<% end %>
<div class="grid <%= deleted_user?(@user) ? 'deleted-content' : '' %>">
<div class="grid--cell is-9-lg is-12">
<div class="h-p-0 h-p-t-0">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment