- if @user
- sql = <<~SQL
- SELECT ignored_user_id
- FROM ignored_users as ig
- INNER JOIN users as u ON u.id = ig.ignored_user_id
- WHERE ig.user_id = :current_user_id
- AND ig.ignored_user_id <> :current_user_id
- AND NOT u.admin
- AND NOT u.moderator
- SQL
- ignored_user_ids = DB.query_single(sql, current_user_id: @user.id)
- if ignored_user_ids.present?
- @filtered_posts =
- @filtered_posts.where.not("user_id IN (?) AND posts.post_number != 1", ignored_user_ids)
- @contains_gaps = true
- end
- end