retrospring/app/helpers/moderation_helper.rb

21 lines
483 B
Ruby
Raw Permalink Normal View History

2022-07-23 12:19:47 +02:00
# frozen_string_literal: true
2014-12-25 23:00:33 +01:00
module ModerationHelper
2014-12-28 20:05:30 +01:00
# @param report [Report]
def content_url(report)
target = report.target
case report.type
2022-07-23 12:19:47 +02:00
when "Reports::Answer"
answer_path target.user.screen_name, target.id
when "Reports::Comment"
answer_path target.answer.user.screen_name, target.answer.id
when "Reports::Question"
question_path "user", target.id
when "Reports::User"
user_path target
else
"#"
2014-12-28 20:05:30 +01:00
end
end
2014-12-25 23:00:33 +01:00
end