5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 03:26:22 +00:00
panel/app/controllers/concerns/moderation_concern.rb

37 lines
1.1 KiB
Ruby
Raw Normal View History

2024-03-04 17:47:20 +00:00
# frozen_string_literal: true
module ModerationConcern
extend ActiveSupport::Concern
included do
private
def redirect_to_moderation_queue!
redirect_back fallback_location: site_moderation_queue_path(**(session[:moderation_queue_filters] || {}))
end
2024-03-05 17:18:06 +00:00
# @return [String]
def panel_actor_mention
@panel_actor_mention ||= ENV.fetch('PANEL_ACTOR_MENTION', '@sutty@sutty.nl')
end
def remote_flag_params(model)
2024-03-18 15:48:09 +00:00
remote_flag = ActivityPub::RemoteFlag.find_by(actor_id: model.actor_id)
{ remote_flag_attributes: { id: remote_flag&.id, message: ''.dup } }.tap do |p|
2024-03-05 17:18:06 +00:00
p[:remote_flag_attributes][:site_id] = model.site_id
p[:remote_flag_attributes][:actor_id] = model.actor_id
I18n.available_locales.each do |locale|
p[:remote_flag_attributes][:message].tap do |m|
m << I18n.t(locale)
m << ': '
m << I18n.t('remote_flags.report_message', locale: locale, panel_actor_mention: panel_actor_mention)
m << '\n\n'
end
end
end
end
2024-03-04 17:47:20 +00:00
end
end