Retrospring/app/helpers/moderation_helper.rb

19 lines
472 B
Ruby
Raw Normal View History

2014-12-25 14:00:33 -08:00
module ModerationHelper
2014-12-28 11:05:30 -08:00
# @param report [Report]
def content_url(report)
target = report.target
case report.type
when 'Reports::Answer'
answer_path target.user.screen_name, target.id
2014-12-28 11:05:30 -08:00
when 'Reports::Comment'
answer_path target.answer.user.screen_name, target.answer.id
2014-12-28 11:05:30 -08:00
when 'Reports::Question'
question_path 'user', target.id
2014-12-28 11:05:30 -08:00
when 'Reports::User'
user_path target
2014-12-28 11:05:30 -08:00
else
'#'
end
end
2014-12-25 14:00:33 -08:00
end