Update flag/appeal searches and profile

This commit is contained in:
Toks
2013-08-21 13:36:20 -04:00
parent 6b18c46c03
commit adc3efb539
2 changed files with 9 additions and 9 deletions

View File

@@ -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

View File

@@ -92,17 +92,17 @@
</td>
</tr>
<tr>
<th>Appeals</th>
<td><%= presenter.appeal_count(self) %>
</td>
</tr>
<% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %>
<tr>
<th>Appeals</th>
<td><%= presenter.appeal_count(self) %></td>
</tr>
<% end %>
<% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %>
<tr>
<th>Flags</th>
<td><%= presenter.flag_count(self) %>
</td>
<td><%= presenter.flag_count(self) %></td>
</tr>
<% end %>