diff --git a/app/models/role.rb b/app/models/role.rb index c86a0c5bd..d77fcf542 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -32,4 +32,13 @@ class Role < ApplicationRecord inclusion: { in: ROLES } scopify + + # Returns a somewhat friendly name for the resource related to a given role. + # In the case of Tag Moderators, a resource_type is not present, so we use the + # resource_id to grab the specific Tag related to that moderator's role. + def resource_name + return resource_type unless resource_id + + Tag.find(resource_id).name + end end diff --git a/app/views/admin/users/_activity.html.erb b/app/views/admin/users/_activity.html.erb index a3ce5b75f..92f44cfff 100644 --- a/app/views/admin/users/_activity.html.erb +++ b/app/views/admin/users/_activity.html.erb @@ -15,7 +15,7 @@

(view full history in notes below)