From adc3efb539b407bde6afc21aaeda63c8596fa44a Mon Sep 17 00:00:00 2001 From: Toks Date: Wed, 21 Aug 2013 13:36:20 -0400 Subject: [PATCH] Update flag/appeal searches and profile --- app/models/post_flag.rb | 4 ++-- app/views/users/_statistics.html.erb | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 646906ad2..6ca25ebcd 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -35,11 +35,11 @@ class PostFlag < ActiveRecord::Base q = scoped return q if params.blank? - if params[:creator_id].present? + if params[:creator_id].present? && (CurrentUser.user.is_janitor? || params[:creator_id].to_i == CurrentUser.user.id) q = q.where("creator_id = ?", params[:creator_id].to_i) end - if params[:creator_name].present? + if params[:creator_name].present? && CurrentUser.user.is_janitor? q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_")) end diff --git a/app/views/users/_statistics.html.erb b/app/views/users/_statistics.html.erb index db451d11e..7a40a069f 100644 --- a/app/views/users/_statistics.html.erb +++ b/app/views/users/_statistics.html.erb @@ -92,17 +92,17 @@ - - Appeals - <%= presenter.appeal_count(self) %> - - + <% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %> + + Appeals + <%= presenter.appeal_count(self) %> + + <% end %> <% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %> Flags - <%= presenter.flag_count(self) %> - + <%= presenter.flag_count(self) %> <% end %>