diff options
author | Lukas Matt <lukas@zauberstuhl.de> | 2015-09-03 18:43:20 +0300 |
---|---|---|
committer | Lukas Matt <lukas@zauberstuhl.de> | 2015-10-03 11:58:01 +0300 |
commit | d1e3e568b9400f9569f2c5b40e550045a5c99080 (patch) | |
tree | 12e42f12900078c436f421c29556642fa32e441c /app/helpers | |
parent | cc631372a171dc35e54100e935bf092519fe7110 (diff) |
Report tab; bootstrap3 compatible, add user detail btn
The reported_user_details button will redirect you
to admin user_search. This can be useful if the podmin
wants to lock, unlock or delete the account which is
responsible for the reported post
Signed-off-by: Lukas Matt <lukas@zauberstuhl.de>
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/report_helper.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/app/helpers/report_helper.rb b/app/helpers/report_helper.rb index 2170e3665..99533489e 100644 --- a/app/helpers/report_helper.rb +++ b/app/helpers/report_helper.rb @@ -3,15 +3,24 @@ # the COPYRIGHT file. module ReportHelper + def get_reported_guid(id, type) + if type == "post" + Post.where(id: id).first.author.guid + elsif type == "comment" + Comment.where(id: id).first.author.guid + end + end + def report_content(id, type) - if type == 'post' && !(post = Post.find_by_id(id)).nil? - raw t('report.post_label', title: link_to(post_page_title(post), post_path(id))) - elsif type == 'comment' && !(comment = Comment.find_by_id(id)).nil? + if type == "post" && !(post = Post.find_by_id(id)).nil? + raw t("report.post_label", title: link_to(post_page_title(post), post_path(id))) + elsif type == "comment" && !(comment = Comment.find_by_id(id)).nil? # comment_message is not html_safe. To prevent # cross-site-scripting we have to escape html - raw t('report.comment_label', data: link_to(h(comment_message(comment)), post_path(comment.post.id, anchor: comment.guid))) + raw t("report.comment_label", data: link_to( + h(comment_message(comment)), post_path(comment.post.id, anchor: comment.guid))) else - raw t('report.not_found') + raw t("report.not_found") end end end |