Support for threadsafe mode

This commit is contained in:
Eric Schultz 2018-08-08 16:31:42 -05:00
parent 0c19b7300e
commit 41d69fd6c6
48 changed files with 50 additions and 75 deletions

View file

@ -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!

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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!

View file

@ -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!

View file

@ -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!

View file

@ -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

View file

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

View file

@ -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

View file

@ -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]

View file

@ -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!

View file

@ -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

View file

@ -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!

View file

@ -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

View file

@ -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!

View file

@ -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]

View file

@ -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]

View file

@ -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!

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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)}

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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!

View file

@ -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!

View file

@ -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]

View file

@ -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]

View file

@ -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.

View file

@ -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

View file

@ -41,4 +41,5 @@ Commitchange::Application.configure do
config.log_level = :debug
config.action_controller.allow_forgery_protection = false
config.threadsafe!
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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__)