Update flag/appeal searches and profile
This commit is contained in:
@@ -35,11 +35,11 @@ class PostFlag < ActiveRecord::Base
|
|||||||
q = scoped
|
q = scoped
|
||||||
return q if params.blank?
|
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)
|
q = q.where("creator_id = ?", params[:creator_id].to_i)
|
||||||
end
|
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(" ", "_"))
|
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -92,17 +92,17 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %>
|
||||||
<th>Appeals</th>
|
<tr>
|
||||||
<td><%= presenter.appeal_count(self) %>
|
<th>Appeals</th>
|
||||||
</td>
|
<td><%= presenter.appeal_count(self) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %>
|
<% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Flags</th>
|
<th>Flags</th>
|
||||||
<td><%= presenter.flag_count(self) %>
|
<td><%= presenter.flag_count(self) %></td>
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user