summaryrefslogtreecommitdiff
path: root/app/controllers/posts/reportings_controller.rb
blob: e4f48a0544d1e90e91fa4852c6893ef477adfd6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class Posts::ReportingsController < ApplicationController
  before_action :load_post
  before_action :check_auth

  def show
    @dupe_reports = DuplicateReport.includes(:post, :duplicate_of_post).where('post_id = ? OR duplicate_of_post_id = ?', @post.id, @post.id)
    render partial: 'images/image_reporting', locals: { post: @post }
  end

  private

  def load_post
    @post = Post.find(params[:post_id])
  end

  def check_auth
    authorize! :read, @post
  end
end