feat: replace deprecated before_filter with before_action

This commit is contained in:
Luis Castro 2019-07-13 09:53:59 +02:00
parent 34b4604c7a
commit dd64ee5159
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639
45 changed files with 54 additions and 54 deletions

View file

@ -1,7 +1,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class ActivitiesController < ApplicationController
before_filter :authenticate_user!, only: [:create]
before_action :authenticate_user!, only: [:create]
def create
json_saved Activity.create(params[:activity])

View file

@ -1,6 +1,6 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class ApplicationController < ActionController::Base
before_filter :set_locale, :redirect_to_maintenance
before_action :set_locale, :redirect_to_maintenance
protect_from_forgery

View file

@ -1,6 +1,6 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AwsPresignedPostsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
# post /presigned_posts
# Create some keys using the AWS gem so the user can do direct-to-S3 uploads

View file

@ -2,7 +2,7 @@
class BillingSubscriptionsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_admin!
before_action :authenticate_nonprofit_admin!
def create_trial
render JsonResp.new(params){|params|

View file

@ -2,7 +2,7 @@
class CampaignGiftOptionsController < ApplicationController
include Controllers::CampaignHelper
before_filter :authenticate_campaign_editor!, only: [:create, :destroy, :update, :update_order]
before_action :authenticate_campaign_editor!, only: [:create, :destroy, :update, :update_order]
def index
@gift_options = current_campaign.campaign_gift_options.order('"order", amount_recurring, amount_one_time')

View file

@ -2,7 +2,7 @@
module Campaigns; class CampaignGiftOptionsController < ApplicationController
include Controllers::CampaignHelper
before_filter :authenticate_campaign_editor!, only: [:create, :destroy, :update, :update_order, :report]
before_action :authenticate_campaign_editor!, only: [:create, :destroy, :update, :update_order, :report]
def report
respond_to do |format|

View file

@ -3,7 +3,7 @@ module Campaigns
class DonationsController < ApplicationController
include Controllers::CampaignHelper
before_filter :authenticate_campaign_editor!, only: [:index]
before_action :authenticate_campaign_editor!, only: [:index]
def index
respond_to do |format|

View file

@ -3,7 +3,7 @@ module Campaigns
class SupportersController < ApplicationController
include Controllers::CampaignHelper
before_filter :authenticate_campaign_editor!, only: [:index]
before_action :authenticate_campaign_editor!, only: [:index]
def index
@panels_layout = true

View file

@ -3,9 +3,9 @@ class CampaignsController < ApplicationController
include Controllers::CampaignHelper
helper_method :current_campaign_editor?
before_filter :authenticate_confirmed_user!, only: [:create, :name_and_id, :duplicate]
before_filter :authenticate_campaign_editor!, only: [:update, :soft_delete]
before_filter :check_nonprofit_status, only: [:index, :show]
before_action :authenticate_confirmed_user!, only: [:create, :name_and_id, :duplicate]
before_action :authenticate_campaign_editor!, only: [:update, :soft_delete]
before_action :check_nonprofit_status, only: [:index, :show]
def index
@nonprofit = current_nonprofit

View file

@ -1,7 +1,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class CardsController < ApplicationController
before_filter :authenticate_user!, :except => [:create]
before_action :authenticate_user!, :except => [:create]
# post /cards
def create

View file

@ -1,7 +1,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class EmailSettingsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def index
user = current_role?(:super_admin) ? User.find(params[:user_id]) : current_user

View file

@ -1,6 +1,6 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class EmailsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
def create
email = params[:email]

View file

@ -1,7 +1,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class EventDiscountsController < ApplicationController
include Controllers::EventHelper
before_filter :authenticate_event_editor!, :except => [:index]
before_action :authenticate_event_editor!, :except => [:index]
def create
params[:event_discount][:event_id] = current_event.id

View file

@ -3,8 +3,8 @@ class EventsController < ApplicationController
include Controllers::EventHelper
helper_method :current_event_editor?
before_filter :authenticate_nonprofit_user!, only: :name_and_id
before_filter :authenticate_event_editor!, only: [:update, :soft_delete, :stats, :create, :duplicate]
before_action :authenticate_nonprofit_user!, only: :name_and_id
before_action :authenticate_event_editor!, only: [:update, :soft_delete, :stats, :create, :duplicate]
def index

View file

@ -1,6 +1,6 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class ImageAttachmentsController < ApplicationController
before_filter :authenticate_confirmed_user!
before_action :authenticate_confirmed_user!
def create
# must return json with a link attr
# http://editor.froala.com/server-integrations/php-image-upload

View file

@ -2,8 +2,8 @@
class MapsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_super_associate!, only: :all_supporters
before_filter :authenticate_nonprofit_user!, only: [:all_npo_supporters, :specific_npo_supporters]
before_action :authenticate_super_associate!, only: :all_supporters
before_action :authenticate_nonprofit_user!, only: [:all_npo_supporters, :specific_npo_supporters]
# used on admin/nonprofits_map and front page
def all_npos

View file

@ -2,7 +2,7 @@
module Nonprofits
class ActivitiesController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
# get /nonprofits/:nonprofit_id/supporters/:supporter_id/activities
def index

View file

@ -3,7 +3,7 @@ module Nonprofits
class BankAccountsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_admin!
before_action :authenticate_nonprofit_admin!
# post /nonprofits/:nonprofit_id/bank_account
# must pass in the user's password as params[:password]

View file

@ -4,7 +4,7 @@ class ButtonController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_user!
before_action :authenticate_user!
def send_code

View file

@ -3,7 +3,7 @@ module Nonprofits
class CardsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def edit
@nonprofit = current_nonprofit

View file

@ -3,7 +3,7 @@ module Nonprofits
class ChargesController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!, only: :index
before_action :authenticate_nonprofit_user!, only: :index
# get /nonprofit/:nonprofit_id/charges
def index

View file

@ -3,7 +3,7 @@ module Nonprofits
class CustomFieldJoinsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def index
@custom_field_joins = current_nonprofit

View file

@ -2,7 +2,7 @@
module Nonprofits
class CustomFieldMastersController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def index
@custom_field_masters = current_nonprofit

View file

@ -3,8 +3,8 @@ module Nonprofits
class DonationsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!, only: [:index, :update]
before_filter :authenticate_campaign_editor!, only: [:create_offsite]
before_action :authenticate_nonprofit_user!, only: [:index, :update]
before_action :authenticate_campaign_editor!, only: [:create_offsite]
# get /nonprofit/:nonprofit_id/donations
def index

View file

@ -3,7 +3,7 @@ module Nonprofits
class EmailListsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def index
render_json{ Qx.fetch(:email_lists, nonprofit_id: params[:nonprofit_id]) }

View file

@ -3,7 +3,7 @@ module Nonprofits
class ImportsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
# post /nonprofits/:nonprofit_id/imports
def create
render_json{

View file

@ -4,7 +4,7 @@ module Nonprofits
include Controllers::NonprofitHelper
helper_method :current_nonprofit_user?
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def show
respond_to do |format|

View file

@ -3,7 +3,7 @@
module Nonprofits
class NonprofitKeysController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
# get /nonprofits/:nonprofit_id/nonprofit_keys
# pass in the :select query param, which is the name of the column of the specific token you want

View file

@ -3,7 +3,7 @@ module Nonprofits
class PaymentsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
# get /nonprofit/:nonprofit_id/payments

View file

@ -3,8 +3,8 @@ module Nonprofits
class PayoutsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_admin!, only: :create
before_filter :authenticate_nonprofit_user!, only: [:index, :show]
before_action :authenticate_nonprofit_admin!, only: :create
before_action :authenticate_nonprofit_user!, only: [:index, :show]
def create
payout = InsertPayout.with_stripe(current_nonprofit.id, {

View file

@ -3,7 +3,7 @@ module Nonprofits
class RecurringDonationsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!, except: [:create]
before_action :authenticate_nonprofit_user!, except: [:create]
# get /nonprofits/:nonprofit_id/recurring_donations
def index

View file

@ -3,7 +3,7 @@ module Nonprofits
class RefundsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
# post /charges/:charge_id/refunds
def create

View file

@ -2,7 +2,7 @@
module Nonprofits
class ReportsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def end_of_year
respond_to do |format|

View file

@ -2,7 +2,7 @@
module Nonprofits
class SupporterEmailsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def create
if params[:selecting_all]

View file

@ -3,7 +3,7 @@ module Nonprofits
class SupporterNotesController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!, except: [:create]
before_action :authenticate_nonprofit_user!, except: [:create]
# post /nonprofits/:nonprofit_id/supporters/:supporter_id/supporter_notes
def create

View file

@ -3,8 +3,8 @@ module Nonprofits
class SupportersController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!, except: [:new, :create]
#before_filter(except: [:create, :mailchimp_landing]){authenticate_min_nonprofit_plan(2)}
before_action :authenticate_nonprofit_user!, except: [:new, :create]
#before_action(except: [:create, :mailchimp_landing]){authenticate_min_nonprofit_plan(2)}
# get /nonprofit/:nonprofit_id/supporters
def index

View file

@ -2,7 +2,7 @@
module Nonprofits
class TagJoinsController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def index
render_json do

View file

@ -2,7 +2,7 @@
module Nonprofits
class TagMastersController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_user!
before_action :authenticate_nonprofit_user!
def index
render json: {data:

View file

@ -3,8 +3,8 @@
include Controllers::NonprofitHelper
helper_method :current_nonprofit_user?
before_filter :authenticate_nonprofit_user!, only: [:dashboard, :dashboard_metrics, :dashboard_todos, :payment_history, :profile_todos, :recurring_donation_stats, :update, :verify_identity]
before_filter :authenticate_super_admin!, only: [:destroy]
before_action :authenticate_nonprofit_user!, only: [:dashboard, :dashboard_metrics, :dashboard_todos, :payment_history, :profile_todos, :recurring_donation_stats, :update, :verify_identity]
before_action :authenticate_super_admin!, only: [:destroy]
# get /nonprofits/:id
# get /:state_code/:city/:name

View file

@ -3,7 +3,7 @@ class ProfilesController < ApplicationController
helper_method :authenticate_profile_owner!
before_filter :authenticate_profile_owner!, only: [:update, :fundraisers, :donations_history]
before_action :authenticate_profile_owner!, only: [:update, :fundraisers, :donations_history]
# get /profiles/:id
# public profile

View file

@ -2,7 +2,7 @@
class RolesController < ApplicationController
include Controllers::NonprofitHelper
before_filter :authenticate_nonprofit_admin!
before_action :authenticate_nonprofit_admin!
def create
role = Role.create_for_nonprofit(params[:role][:name].to_sym, params[:role][:email], FetchNonprofit.with_params(params))

View file

@ -3,7 +3,7 @@ class SettingsController < ApplicationController
include Controllers::NonprofitHelper
helper_method :current_nonprofit_user?
before_filter :authenticate_user!
before_action :authenticate_user!
def index
if current_role?(:super_admin) && params[:nonprofit_id]

View file

@ -2,7 +2,7 @@
class SuperAdminsController < ApplicationController
layout "layouts/page"
before_filter :authenticate_super_associate!
before_action :authenticate_super_associate!
def index
end

View file

@ -2,7 +2,7 @@
class TicketLevelsController < ApplicationController
include Controllers::EventHelper
before_filter :authenticate_event_editor!, :except => [:index, :show]
before_action :authenticate_event_editor!, :except => [:index, :show]
def index
ev_id = current_event.id

View file

@ -3,8 +3,8 @@ class TicketsController < ApplicationController
include Controllers::EventHelper
helper_method :current_event_admin?, :current_event_editor?
before_filter :authenticate_event_editor!, :except => [:create, :add_note]
before_filter :authenticate_nonprofit_user!, only: [:delete_card_for_ticket]
before_action :authenticate_event_editor!, :except => [:create, :add_note]
before_action :authenticate_nonprofit_user!, only: [:delete_card_for_ticket]
# post /nonprofits/:nonprofit_id/events/:event_id/tickets
def create