Skip to content

Commit 0f86903

Browse files
committed
switched posts/_expanded to flag-related methods & scopes
1 parent bc50b0b commit 0f86903

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

app/views/posts/_expanded.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
<% end %>
318318
<% end %>
319319
<% end %>
320-
<% if check_your_privilege('flag_curate') %>
320+
<% if current_user&.can_handle_flags? %>
321321
<a href="javascript:void(0)"
322322
data-modal="#mod-tools-<%= post.id %>"
323323
class="tools--item"
@@ -326,12 +326,12 @@
326326
<i class="fa fa-wrench"></i>
327327
Tools
328328
</a>
329-
<% flags_count = Flag.accessible_to(current_user, post).where(handled_by_id: nil).count %>
329+
<% flags_count = Flag.accessible_to(current_user, post).unhandled.count %>
330330

331331
<% own_flags_count = if current_user&.at_least_moderator?
332332
0
333333
else
334-
post.flags.not_confidential.where(user: current_user, handled_by_id: nil).count
334+
post.flags.not_confidential.where(user: current_user).unhandled.count
335335
end %>
336336

337337
<% if flags_count > 0 %>
@@ -350,11 +350,11 @@
350350
<%= render 'posts/close_modal', post: post %>
351351
<% end %>
352352

353-
<% if current_user&.privilege?('flag_curate') %>
353+
<% if current_user&.can_handle_flags? %>
354354
<div class="post--action-dialog js-flags">
355355
<div class="widget">
356356
<div class="widget--header">Flags on this post</div>
357-
<% post.flags.where(handled_by_id: nil).each do |flag| %>
357+
<% post.flags.unhandled.each do |flag| %>
358358
<% next if !current_user.at_least_moderator? && (flag.post_flag_type.nil? || flag.post_flag_type.confidential) %>
359359
<% next if !current_user.at_least_moderator? && (current_user.id == flag.user.id) %>
360360
<div class="widget--body">

0 commit comments

Comments
 (0)