summaryrefslogtreecommitdiff
path: root/app/controllers/ip_profiles/source_changes_controller.rb
blob: 6f6c01175df5473cd5728289fdf0c2c5f8813a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

class IpProfiles::SourceChangesController < ApplicationController
  before_action :load_source_changes
  before_action :check_auth

  respond_to :html, :json

  def index
    @ip = params[:ip_profile_id]
    @title = "Source Changes: #{@ip}"
    respond_with @source_changes
  end

  private

  def load_source_changes
    @source_changes = SourceChange.where(ip: params[:ip_profile_id]).includes(:post)
    @source_changes = @source_changes.page(params[:page]).per(20)
  end

  def check_auth
    authorize! :mod_read, User
  end
end