[Bans] Enable API for index & show (#659)

This commit is contained in:
Donovan Daniels 2024-06-30 11:14:37 -05:00 committed by GitHub
parent 6d1b15eab4
commit 6011b9f7bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true
class BansController < ApplicationController
before_action :moderator_only, :except => [:show, :index]
before_action :moderator_only, except: %i[index show]
respond_to :html
respond_to :json, only: %i[index show]
helper_method :search_params
def new
@ -15,8 +16,8 @@ class BansController < ApplicationController
def index
@bans = Ban.search(search_params).paginate(params[:page], :limit => params[:limit])
respond_with(@bans) do |fmt|
fmt.html { @bans = @bans.includes(:user, :banner) }
respond_with(@bans) do |format|
format.html { @bans = @bans.includes(:user, :banner) }
end
end