Files
nairobi/app/components/shared/moderation_actions_component.rb
Javi Martín 021fef07b6 Make action names to block and hide more clear
The `hide` action was calling the `block` method while the `soft_block`
action was calling the `hide` method.

Combined with the fact that we also have a `block` permission which is
used in `ModerateActions` the logic was hard to follow.
2021-12-30 15:50:03 +01:00

35 lines
763 B
Ruby

class Shared::ModerationActionsComponent < ApplicationComponent
attr_reader :record
delegate :can?, to: :helpers
def initialize(record)
@record = record
end
def render?
can?(:hide, record) || can?(:hide, record.author)
end
private
def hide_path
polymorphic_path([:moderation, record], action: :hide)
end
def confirm_hide_text
t("admin.actions.confirm_action", action: t("admin.actions.hide"), name: record.human_name)
end
def confirm_block_author_text
t("admin.actions.confirm_action", action: t("admin.actions.block_author"), name: record.author.name)
end
def separator
if record.is_a?(Comment)
"&nbsp;&bull;&nbsp;"
else
"&nbsp;|&nbsp;"
end
end
end