users: let mods see users' last login time.

This commit is contained in:
evazion
2020-12-21 22:40:48 -06:00
parent 3c4781f6d8
commit fbb4cfb807
3 changed files with 16 additions and 0 deletions

View File

@@ -23,6 +23,10 @@ class UserPolicy < ApplicationPolicy
user.is_member?
end
def can_see_last_logged_in_at?
user.is_moderator?
end
def can_see_favorites?
user.is_admin? || record.id == user.id || !record.enable_private_favorites?
end

View File

@@ -11,6 +11,13 @@
<td><%= presenter.join_date %></td>
</tr>
<% if policy(User).can_see_last_logged_in_at? %>
<tr>
<th>Last Seen</th>
<td><%= time_ago_in_words_tagged(user.last_logged_in_at) %></td>
</tr>
<% end %>
<% if policy(IpAddress).show? %>
<tr>
<th>Last IP</th>

View File

@@ -32,6 +32,11 @@
<% t.column "Level" do |user| %>
<%= user.level_string %>
<% end %>
<% if policy(User).can_see_last_logged_in_at? %>
<% t.column "Last Seen" do |user| %>
<%= time_ago_in_words_tagged(user.last_logged_in_at) %>
<% end %>
<% end %>
<% t.column "Joined" do |user| %>
<%= compact_time user.created_at %>
<% end %>