users: let mods see users' last login time.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user