From 41d69fd6c693f1aaa356b100a7b6f6a8852b3886 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 8 Aug 2018 16:31:42 -0500 Subject: [PATCH] Support for threadsafe mode --- .../billing_subscriptions_controller.rb | 2 +- .../campaign_gift_options_controller.rb | 2 +- .../campaign_gift_options_controller.rb | 2 +- .../campaigns/donations_controller.rb | 2 +- .../campaigns/supporters_controller.rb | 2 +- app/controllers/campaigns_controller.rb | 2 +- app/controllers/email_settings_controller.rb | 2 +- app/controllers/event_discounts_controller.rb | 2 +- app/controllers/events_controller.rb | 2 +- app/controllers/maps_controller.rb | 2 +- .../nonprofits/activities_controller.rb | 2 +- .../nonprofits/bank_accounts_controller.rb | 2 +- app/controllers/nonprofits/button_controller.rb | 2 +- app/controllers/nonprofits/cards_controller.rb | 2 +- app/controllers/nonprofits/charges_controller.rb | 2 +- .../nonprofits/custom_field_joins_controller.rb | 2 +- .../custom_field_masters_controller.rb | 2 +- .../nonprofits/donations_controller.rb | 2 +- .../nonprofits/email_lists_controller.rb | 2 +- app/controllers/nonprofits/imports_controller.rb | 2 +- .../miscellaneous_np_infos_controller.rb | 2 +- .../nonprofits/nonprofit_keys_controller.rb | 2 +- .../nonprofits/payments_controller.rb | 2 +- app/controllers/nonprofits/payouts_controller.rb | 2 +- .../nonprofits/recurring_donations_controller.rb | 2 +- app/controllers/nonprofits/refunds_controller.rb | 2 +- app/controllers/nonprofits/reports_controller.rb | 2 +- .../nonprofits/supporter_emails_controller.rb | 2 +- .../nonprofits/supporter_notes_controller.rb | 2 +- .../nonprofits/supporters_controller.rb | 2 +- .../nonprofits/tag_joins_controller.rb | 2 +- .../nonprofits/tag_masters_controller.rb | 2 +- app/controllers/nonprofits_controller.rb | 2 +- app/controllers/roles_controller.rb | 2 +- app/controllers/settings_controller.rb | 2 +- app/controllers/ticket_levels_controller.rb | 2 +- app/controllers/tickets_controller.rb | 2 +- config/application.rb | 4 ++-- config/environments/development.rb | 1 + config/environments/test.rb | 1 + lib/construct/construct_custom_field.rb | 15 --------------- lib/construct/construct_tag.rb | 16 ---------------- lib/controllers/campaign_helper.rb | 4 ++-- lib/controllers/event_helper.rb | 4 ++-- lib/controllers/nonprofit_helper.rb | 2 +- lib/generators/api/entity/entity_generator.rb | 1 + .../api/resource/resource_generator.rb | 2 ++ .../api/validator/validator_generator.rb | 1 + 48 files changed, 50 insertions(+), 75 deletions(-) delete mode 100644 lib/construct/construct_custom_field.rb delete mode 100644 lib/construct/construct_tag.rb diff --git a/app/controllers/billing_subscriptions_controller.rb b/app/controllers/billing_subscriptions_controller.rb index 96f06355..1f63fb4b 100644 --- a/app/controllers/billing_subscriptions_controller.rb +++ b/app/controllers/billing_subscriptions_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class BillingSubscriptionsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_admin! diff --git a/app/controllers/campaign_gift_options_controller.rb b/app/controllers/campaign_gift_options_controller.rb index e6b84249..47b21367 100644 --- a/app/controllers/campaign_gift_options_controller.rb +++ b/app/controllers/campaign_gift_options_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class CampaignGiftOptionsController < ApplicationController - include CampaignHelper + include Controllers::CampaignHelper before_filter :authenticate_campaign_editor!, only: [:create, :destroy, :update, :update_order] diff --git a/app/controllers/campaigns/campaign_gift_options_controller.rb b/app/controllers/campaigns/campaign_gift_options_controller.rb index 1f7d8b21..e413855f 100644 --- a/app/controllers/campaigns/campaign_gift_options_controller.rb +++ b/app/controllers/campaigns/campaign_gift_options_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Campaigns; class CampaignGiftOptionsController < ApplicationController - include CampaignHelper + include Controllers::CampaignHelper before_filter :authenticate_campaign_editor!, only: [:index] diff --git a/app/controllers/campaigns/donations_controller.rb b/app/controllers/campaigns/donations_controller.rb index b02e9600..44cb27a1 100644 --- a/app/controllers/campaigns/donations_controller.rb +++ b/app/controllers/campaigns/donations_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Campaigns class DonationsController < ApplicationController - include CampaignHelper + include Controllers::CampaignHelper before_filter :authenticate_campaign_editor!, only: [:index] diff --git a/app/controllers/campaigns/supporters_controller.rb b/app/controllers/campaigns/supporters_controller.rb index 93ac9b18..9796e687 100644 --- a/app/controllers/campaigns/supporters_controller.rb +++ b/app/controllers/campaigns/supporters_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Campaigns class SupportersController < ApplicationController - include CampaignHelper + include Controllers::CampaignHelper before_filter :authenticate_campaign_editor!, only: [:index] diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index a78b4f0d..21c57919 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class CampaignsController < ApplicationController - include CampaignHelper + include Controllers::CampaignHelper helper_method :current_campaign_editor? before_filter :authenticate_confirmed_user!, only: [:create, :name_and_id, :duplicate] diff --git a/app/controllers/email_settings_controller.rb b/app/controllers/email_settings_controller.rb index 26f930c4..5eaf43fa 100644 --- a/app/controllers/email_settings_controller.rb +++ b/app/controllers/email_settings_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class EmailSettingsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def index diff --git a/app/controllers/event_discounts_controller.rb b/app/controllers/event_discounts_controller.rb index 949518a8..21a4bbf5 100644 --- a/app/controllers/event_discounts_controller.rb +++ b/app/controllers/event_discounts_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class EventDiscountsController < ApplicationController - include EventHelper + include Controllers::EventHelper before_filter :authenticate_event_editor!, :except => [:index] def create diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 2fe1744e..6710adca 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class EventsController < ApplicationController - include EventHelper + include Controllers::EventHelper helper_method :current_event_editor? before_filter :authenticate_nonprofit_user!, only: :name_and_id diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 53456d4f..8fe38819 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class MapsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_super_associate!, only: :all_supporters before_filter :authenticate_nonprofit_user!, only: [:all_npo_supporters, :specific_npo_supporters] diff --git a/app/controllers/nonprofits/activities_controller.rb b/app/controllers/nonprofits/activities_controller.rb index 97673d4e..6824e8a7 100644 --- a/app/controllers/nonprofits/activities_controller.rb +++ b/app/controllers/nonprofits/activities_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class ActivitiesController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! # get /nonprofits/:nonprofit_id/supporters/:supporter_id/activities diff --git a/app/controllers/nonprofits/bank_accounts_controller.rb b/app/controllers/nonprofits/bank_accounts_controller.rb index 57ae8791..c68ef006 100644 --- a/app/controllers/nonprofits/bank_accounts_controller.rb +++ b/app/controllers/nonprofits/bank_accounts_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class BankAccountsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_admin! diff --git a/app/controllers/nonprofits/button_controller.rb b/app/controllers/nonprofits/button_controller.rb index c2e60580..83a6765e 100644 --- a/app/controllers/nonprofits/button_controller.rb +++ b/app/controllers/nonprofits/button_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class ButtonController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_user! diff --git a/app/controllers/nonprofits/cards_controller.rb b/app/controllers/nonprofits/cards_controller.rb index f20b5a0f..fc0e377b 100644 --- a/app/controllers/nonprofits/cards_controller.rb +++ b/app/controllers/nonprofits/cards_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class CardsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! diff --git a/app/controllers/nonprofits/charges_controller.rb b/app/controllers/nonprofits/charges_controller.rb index a8fe1ee8..e3d87a6c 100644 --- a/app/controllers/nonprofits/charges_controller.rb +++ b/app/controllers/nonprofits/charges_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class ChargesController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user!, only: :index diff --git a/app/controllers/nonprofits/custom_field_joins_controller.rb b/app/controllers/nonprofits/custom_field_joins_controller.rb index 8ce29fa4..9c1a7fe2 100644 --- a/app/controllers/nonprofits/custom_field_joins_controller.rb +++ b/app/controllers/nonprofits/custom_field_joins_controller.rb @@ -2,7 +2,7 @@ module Nonprofits class CustomFieldJoinsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def index diff --git a/app/controllers/nonprofits/custom_field_masters_controller.rb b/app/controllers/nonprofits/custom_field_masters_controller.rb index 0c9c74be..f4e75a14 100644 --- a/app/controllers/nonprofits/custom_field_masters_controller.rb +++ b/app/controllers/nonprofits/custom_field_masters_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class CustomFieldMastersController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def index diff --git a/app/controllers/nonprofits/donations_controller.rb b/app/controllers/nonprofits/donations_controller.rb index 53d37be8..4599788b 100644 --- a/app/controllers/nonprofits/donations_controller.rb +++ b/app/controllers/nonprofits/donations_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class DonationsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user!, only: [:index, :update] before_filter :authenticate_campaign_editor!, only: [:create_offsite] diff --git a/app/controllers/nonprofits/email_lists_controller.rb b/app/controllers/nonprofits/email_lists_controller.rb index 7522c92f..1f3a5af0 100644 --- a/app/controllers/nonprofits/email_lists_controller.rb +++ b/app/controllers/nonprofits/email_lists_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class EmailListsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! diff --git a/app/controllers/nonprofits/imports_controller.rb b/app/controllers/nonprofits/imports_controller.rb index 0bc6e585..b942bfc0 100644 --- a/app/controllers/nonprofits/imports_controller.rb +++ b/app/controllers/nonprofits/imports_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class ImportsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! # post /nonprofits/:nonprofit_id/imports diff --git a/app/controllers/nonprofits/miscellaneous_np_infos_controller.rb b/app/controllers/nonprofits/miscellaneous_np_infos_controller.rb index ad53b73b..e0e7df41 100644 --- a/app/controllers/nonprofits/miscellaneous_np_infos_controller.rb +++ b/app/controllers/nonprofits/miscellaneous_np_infos_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class MiscellaneousNpInfosController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper helper_method :current_nonprofit_user? before_filter :authenticate_nonprofit_user! diff --git a/app/controllers/nonprofits/nonprofit_keys_controller.rb b/app/controllers/nonprofits/nonprofit_keys_controller.rb index 8d5700cd..efde5950 100644 --- a/app/controllers/nonprofits/nonprofit_keys_controller.rb +++ b/app/controllers/nonprofits/nonprofit_keys_controller.rb @@ -2,7 +2,7 @@ module Nonprofits class NonprofitKeysController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! # get /nonprofits/:nonprofit_id/nonprofit_keys diff --git a/app/controllers/nonprofits/payments_controller.rb b/app/controllers/nonprofits/payments_controller.rb index 40e429d5..62a96bc5 100644 --- a/app/controllers/nonprofits/payments_controller.rb +++ b/app/controllers/nonprofits/payments_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class PaymentsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! diff --git a/app/controllers/nonprofits/payouts_controller.rb b/app/controllers/nonprofits/payouts_controller.rb index 96b65e7c..5b0e0b55 100644 --- a/app/controllers/nonprofits/payouts_controller.rb +++ b/app/controllers/nonprofits/payouts_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class PayoutsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_admin!, only: :create before_filter :authenticate_nonprofit_user!, only: [:index, :show] diff --git a/app/controllers/nonprofits/recurring_donations_controller.rb b/app/controllers/nonprofits/recurring_donations_controller.rb index 79e73e7c..9aa4260e 100644 --- a/app/controllers/nonprofits/recurring_donations_controller.rb +++ b/app/controllers/nonprofits/recurring_donations_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class RecurringDonationsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user!, except: [:create] diff --git a/app/controllers/nonprofits/refunds_controller.rb b/app/controllers/nonprofits/refunds_controller.rb index 3f760031..aecd77a5 100644 --- a/app/controllers/nonprofits/refunds_controller.rb +++ b/app/controllers/nonprofits/refunds_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class RefundsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! diff --git a/app/controllers/nonprofits/reports_controller.rb b/app/controllers/nonprofits/reports_controller.rb index eaf9bc4f..c9f63bc6 100644 --- a/app/controllers/nonprofits/reports_controller.rb +++ b/app/controllers/nonprofits/reports_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class ReportsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def end_of_year diff --git a/app/controllers/nonprofits/supporter_emails_controller.rb b/app/controllers/nonprofits/supporter_emails_controller.rb index 51fdb946..724e53be 100644 --- a/app/controllers/nonprofits/supporter_emails_controller.rb +++ b/app/controllers/nonprofits/supporter_emails_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class SupporterEmailsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def create diff --git a/app/controllers/nonprofits/supporter_notes_controller.rb b/app/controllers/nonprofits/supporter_notes_controller.rb index c0d027af..554e4827 100644 --- a/app/controllers/nonprofits/supporter_notes_controller.rb +++ b/app/controllers/nonprofits/supporter_notes_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class SupporterNotesController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user!, except: [:create] diff --git a/app/controllers/nonprofits/supporters_controller.rb b/app/controllers/nonprofits/supporters_controller.rb index 970e7a27..380564cc 100644 --- a/app/controllers/nonprofits/supporters_controller.rb +++ b/app/controllers/nonprofits/supporters_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class SupportersController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user!, except: [:new, :create] #before_filter(except: [:create, :mailchimp_landing]){authenticate_min_nonprofit_plan(2)} diff --git a/app/controllers/nonprofits/tag_joins_controller.rb b/app/controllers/nonprofits/tag_joins_controller.rb index 5a8c108c..2552120c 100644 --- a/app/controllers/nonprofits/tag_joins_controller.rb +++ b/app/controllers/nonprofits/tag_joins_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class TagJoinsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def index diff --git a/app/controllers/nonprofits/tag_masters_controller.rb b/app/controllers/nonprofits/tag_masters_controller.rb index 80f7d1d8..cd0132da 100644 --- a/app/controllers/nonprofits/tag_masters_controller.rb +++ b/app/controllers/nonprofits/tag_masters_controller.rb @@ -1,7 +1,7 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later module Nonprofits class TagMastersController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_user! def index diff --git a/app/controllers/nonprofits_controller.rb b/app/controllers/nonprofits_controller.rb index 63fbcf07..9a78baf9 100755 --- a/app/controllers/nonprofits_controller.rb +++ b/app/controllers/nonprofits_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class NonprofitsController < ApplicationController - include NonprofitHelper + 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] diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 49bc16c9..5dbe31ea 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class RolesController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper before_filter :authenticate_nonprofit_admin! diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index ec85d0a0..da64cf2b 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class SettingsController < ApplicationController - include NonprofitHelper + include Controllers::NonprofitHelper helper_method :current_nonprofit_user? before_filter :authenticate_user! diff --git a/app/controllers/ticket_levels_controller.rb b/app/controllers/ticket_levels_controller.rb index b44903da..e0082a0e 100644 --- a/app/controllers/ticket_levels_controller.rb +++ b/app/controllers/ticket_levels_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class TicketLevelsController < ApplicationController - include EventHelper + include Controllers::EventHelper before_filter :authenticate_event_editor!, :except => [:index, :show] diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index b79504e4..1a8b1569 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class TicketsController < ApplicationController - include EventHelper + include Controllers::EventHelper helper_method :current_event_admin?, :current_event_editor? before_filter :authenticate_event_editor!, :except => [:create, :add_note] diff --git a/config/application.rb b/config/application.rb index c90ba07b..d34386dc 100755 --- a/config/application.rb +++ b/config/application.rb @@ -15,10 +15,10 @@ module Commitchange # Custom directories with classes and modules you want to be autoloadable. # config.autoload_paths += %W(#{config.root}/extras) - config.autoload_paths += Dir["#{config.root}/lib/**/"] + config.eager_load_paths += Dir["#{config.root}/lib/**/"] config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') - config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')] + config.eager_load_paths += Dir[Rails.root.join('app', 'api', '*')] # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. diff --git a/config/environments/development.rb b/config/environments/development.rb index 4d273e23..1f737037 100755 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -52,6 +52,7 @@ Commitchange::Application.configure do config.log_level = :debug + config.threadsafe! # Turn this on if you want to mess with code inside /node_modules # config.browserify_rails.evaluate_node_modules = true diff --git a/config/environments/test.rb b/config/environments/test.rb index 8685af99..78284d32 100755 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -41,4 +41,5 @@ Commitchange::Application.configure do config.log_level = :debug config.action_controller.allow_forgery_protection = false + config.threadsafe! end diff --git a/lib/construct/construct_custom_field.rb b/lib/construct/construct_custom_field.rb deleted file mode 100644 index 0099617d..00000000 --- a/lib/construct/construct_custom_field.rb +++ /dev/null @@ -1,15 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -require 'import_data' - -module ConstructCustomField - - # Given a row of import data (accessible like a hash)... - # - filter out all the custom field keys (prefixed with 'custom:x') - # - create an array of hashes for every custom field - # - used in Supporter.import - def self.from_import_data(supp_id, h) - return h.select{|key,_| key =~ /^custom:/}.map{|key,val| {'supporter_id'=>supp_id, 'value'=>val, 'name'=>key.gsub(/^custom:/,'')}} - end - -end - diff --git a/lib/construct/construct_tag.rb b/lib/construct/construct_tag.rb deleted file mode 100644 index 66aaaee8..00000000 --- a/lib/construct/construct_tag.rb +++ /dev/null @@ -1,16 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -require 'import_data' - -module ConstructTag - - # Given a row of import data (accessible like a hash)... - # - use only the 'tags' column from the import row - # - split the tags by commas and trim whitespace from the ends - # - return an array of hash data for every tag_join to be created - # - called from Supporter.import - def self.from_import_data(supp_id, h) - return [] if h['tags'].blank? - return h['tags'].split(';').map(&:strip).map{|name| {'supporter_id' => supp_id, 'name' => name}} - end - -end diff --git a/lib/controllers/campaign_helper.rb b/lib/controllers/campaign_helper.rb index c1055bde..d7a568a0 100644 --- a/lib/controllers/campaign_helper.rb +++ b/lib/controllers/campaign_helper.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -module CampaignHelper - include NonprofitHelper +module Controllers::CampaignHelper + include Controllers::NonprofitHelper private diff --git a/lib/controllers/event_helper.rb b/lib/controllers/event_helper.rb index 8f93ce89..a58c778f 100644 --- a/lib/controllers/event_helper.rb +++ b/lib/controllers/event_helper.rb @@ -1,6 +1,6 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -module EventHelper - include NonprofitHelper +module Controllers::EventHelper + include Controllers::NonprofitHelper private diff --git a/lib/controllers/nonprofit_helper.rb b/lib/controllers/nonprofit_helper.rb index 1fd4087e..a62cf078 100644 --- a/lib/controllers/nonprofit_helper.rb +++ b/lib/controllers/nonprofit_helper.rb @@ -1,5 +1,5 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -module NonprofitHelper +module Controllers::NonprofitHelper private diff --git a/lib/generators/api/entity/entity_generator.rb b/lib/generators/api/entity/entity_generator.rb index cff04bfc..8e781872 100644 --- a/lib/generators/api/entity/entity_generator.rb +++ b/lib/generators/api/entity/entity_generator.rb @@ -1,4 +1,5 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later +require 'rails/generators' class Api::EntityGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def copy_to_entity diff --git a/lib/generators/api/resource/resource_generator.rb b/lib/generators/api/resource/resource_generator.rb index 2e737da8..99aef6b1 100644 --- a/lib/generators/api/resource/resource_generator.rb +++ b/lib/generators/api/resource/resource_generator.rb @@ -1,3 +1,5 @@ +# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later +require 'rails/generators' class Api::ResourceGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def copy_to_resource diff --git a/lib/generators/api/validator/validator_generator.rb b/lib/generators/api/validator/validator_generator.rb index 4c5d7906..7c57d094 100644 --- a/lib/generators/api/validator/validator_generator.rb +++ b/lib/generators/api/validator/validator_generator.rb @@ -1,4 +1,5 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later +require 'rails/generators' class Api::ValidatorGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__)