Since this is already a component, we can use the `header` method without much refactoring.
23 lines
450 B
Ruby
23 lines
450 B
Ruby
class Moderation::Users::IndexComponent < ApplicationComponent
|
|
include Header
|
|
attr_reader :users
|
|
|
|
def initialize(users)
|
|
@users = users
|
|
end
|
|
|
|
private
|
|
|
|
def title
|
|
t("moderation.users.index.title")
|
|
end
|
|
|
|
def status(user)
|
|
t("admin.activity.show.actions.#{activity_action(user)}")
|
|
end
|
|
|
|
def activity_action(user)
|
|
Activity.where(actionable: user, action: [:hide, :block]).last&.action || "block"
|
|
end
|
|
end
|