diff --git a/app/controllers/store_controller.rb b/app/controllers/store_controller.rb index 6715732f..eab57115 100644 --- a/app/controllers/store_controller.rb +++ b/app/controllers/store_controller.rb @@ -1,14 +1,6 @@ class StoreController < ApplicationController include StoreHelper -<<<<<<< HEAD - skip_before_filter :verify_authenticity_token, :only => %w(show_changed showdate_changed) - - before_filter :set_customer, :except => %w[process_donation] - before_filter :is_logged_in, :only => %w[checkout place_order] - before_filter :order_is_not_empty, :only => %w[shipping_address checkout place_order] - -======= skip_before_action :verify_authenticity_token, :only => %w(show_changed showdate_changed) @@ -16,7 +8,6 @@ class StoreController < ApplicationController before_action :is_logged_in, :only => %w[checkout place_order] before_action :order_is_not_empty, :only => %w[shipping_address checkout place_order] ->>>>>>> rails5 # ACTION INVARIANT BEFORE ACTION # ------ ----------------------- # index, subscribe, donate_to_fund valid @customer @@ -50,13 +41,8 @@ def set_customer redirect_customer = resolve_customer_in_url(logged_in_user, specified_customer) if redirect_customer == specified_customer # ok to proceed as is @customer = specified_customer -<<<<<<< HEAD - else - redirect_to url_for(params.merge(:customer_id => redirect_customer.id, :only_path => true)) -======= else redirect_to url_for(params.to_unsafe_h.merge(:customer_id => redirect_customer.id, :only_path => true)) ->>>>>>> rails5 end end @@ -117,19 +103,11 @@ def subscribe redirect_to(store_path(@customer), :alert => "There are no subscriptions on sale at this time.") if @subs_to_offer.empty? end -<<<<<<< HEAD def donate_to_fund_redirect # redirect donate_to_fund route to quickdonate for potential printed material with donate_to_fund url fund_code = params[:id] fund_code = Donation.default_code.code if fund_code.blank? redirect_to quick_donate_url(account_code_string: fund_code) -======= - def donate_to_fund - return_after_login params.to_unsafe_hash.except(:customer_id) - @account_code = AccountCode.find_by_code(params[:id]) || - AccountCode.find_by_id(params[:id]) || - AccountCode.default_account_code ->>>>>>> rails5 end # Serve quick_donate page; POST calls #process_donation @@ -161,20 +139,11 @@ def process_donation if params[:customer_id].blank? customer_params = params.require(:customer).permit(Customer.user_modifiable_attributes) @customer = Customer.for_donation(customer_params) -<<<<<<< HEAD - @customer.errors.empty? or return redirect_to( - quick_donate_path( - :customer => params[:customer], - :account_code_string => @account_code.code, - :donation => @amount), - :alert => "Incomplete or invalid donor information: #{@customer.errors.as_html}") -======= unless @customer.errors.empty? flash[:alert] = "Incomplete or invalid donor information: #{@customer.errors.as_html}" render 'donate' return end ->>>>>>> rails5 else # we got here via a logged-in customer @customer = Customer.find params[:customer_id] end diff --git a/app/controllers/ticket_sales_imports_controller.rb b/app/controllers/ticket_sales_imports_controller.rb index 9e4aec63..f4585fc5 100644 --- a/app/controllers/ticket_sales_imports_controller.rb +++ b/app/controllers/ticket_sales_imports_controller.rb @@ -62,9 +62,9 @@ def destroy begin i = TicketSalesImport.find params[:id] i.destroy - request.xhr? ? head :ok : redirect_to(ticket_sales_imports_path, :notice => t('import.import_cancelled', :filename => i.filename)) + request.xhr? ? head(:ok) : redirect_to(ticket_sales_imports_path, :notice => t('import.import_cancelled', :filename => i.filename)) rescue ActiveRecord::RecordNotFound - request.xhr? ? head :ok : redirect_to(ticket_sales_imports_path, :notice => t('import.was_cancelled')) + request.xhr? ? head(:ok) : redirect_to(ticket_sales_imports_path, :notice => t('import.was_cancelled')) end end diff --git a/db/schema.rb b/db/schema.rb index eac295f4..bc033899 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,12 +11,9 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20240618113729) do -<<<<<<< HEAD # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -======= ->>>>>>> rails5 create_table "account_codes", force: :cascade do |t| t.string "name", limit: 255, default: "", null: false @@ -68,13 +65,13 @@ t.string "token" t.datetime "token_created_at" t.integer "ticket_sales_import_id" - t.index ["ticket_sales_import_id"], name: "index_customers_on_ticket_sales_import_id" + t.index ["ticket_sales_import_id"], name: "index_customers_on_ticket_sales_import_id", using: :btree end create_table "customers_labels", id: false, force: :cascade do |t| t.integer "customer_id" t.integer "label_id" - t.index ["customer_id", "label_id"], name: "index_customers_labels_on_customer_id_and_label_id", unique: true + t.index ["customer_id", "label_id"], name: "index_customers_labels_on_customer_id_and_label_id", unique: true, using: :btree end create_table "items", force: :cascade do |t| @@ -99,18 +96,15 @@ t.datetime "sold_on" t.integer "recurring_donation_id" t.string "state" -<<<<<<< HEAD -======= - t.index ["account_code_id"], name: "index_items_on_account_code_id" - t.index ["bundle_id"], name: "index_items_on_bundle_id" - t.index ["customer_id"], name: "index_items_on_customer_id" - t.index ["finalized"], name: "index_items_on_finalized" - t.index ["order_id"], name: "index_items_on_order_id" - t.index ["processed_by_id"], name: "index_items_on_processed_by_id" - t.index ["seat"], name: "index_items_on_seat" - t.index ["showdate_id"], name: "index_items_on_showdate_id" - t.index ["vouchertype_id"], name: "index_items_on_vouchertype_id" ->>>>>>> rails5 + t.index ["account_code_id"], name: "index_items_on_account_code_id", using: :btree + t.index ["bundle_id"], name: "index_items_on_bundle_id", using: :btree + t.index ["customer_id"], name: "index_items_on_customer_id", using: :btree + t.index ["finalized"], name: "index_items_on_finalized", using: :btree + t.index ["order_id"], name: "index_items_on_order_id", using: :btree + t.index ["processed_by_id"], name: "index_items_on_processed_by_id", using: :btree + t.index ["seat"], name: "index_items_on_seat", using: :btree + t.index ["showdate_id"], name: "index_items_on_showdate_id", using: :btree + t.index ["vouchertype_id"], name: "index_items_on_vouchertype_id", using: :btree end create_table "labels", force: :cascade do |t| @@ -228,22 +222,11 @@ t.integer "ticket_sales_import_id" t.string "type", default: "Order", null: false t.text "from_import" - t.index ["customer_id"], name: "index_orders_on_customer_id" - t.index ["external_key"], name: "index_orders_on_external_key" - t.index ["processed_by_id"], name: "index_orders_on_processed_by_id" - t.index ["purchaser_id"], name: "index_orders_on_purchaser_id" - t.index ["ticket_sales_import_id"], name: "index_orders_on_ticket_sales_import_id" - end - - create_table "recurring_donations", force: :cascade do |t| - t.integer "customer_id" - t.integer "account_code_id" - t.integer "processed_by_id" - t.string "stripe_price_oid" - t.string "state" - t.integer "amount" - t.datetime "created_at" - t.datetime "updated_at" + t.index ["customer_id"], name: "index_orders_on_customer_id", using: :btree + t.index ["external_key"], name: "index_orders_on_external_key", using: :btree + t.index ["processed_by_id"], name: "index_orders_on_processed_by_id", using: :btree + t.index ["purchaser_id"], name: "index_orders_on_purchaser_id", using: :btree + t.index ["ticket_sales_import_id"], name: "index_orders_on_ticket_sales_import_id", using: :btree end create_table "recurring_donations", force: :cascade do |t| @@ -288,8 +271,8 @@ t.text "access_instructions" t.text "long_description" t.string "house_seats", limit: 8192 - t.index ["seatmap_id"], name: "index_showdates_on_seatmap_id" - t.index ["show_id"], name: "index_showdates_on_show_id" + t.index ["seatmap_id"], name: "index_showdates_on_seatmap_id", using: :btree + t.index ["show_id"], name: "index_showdates_on_show_id", using: :btree end create_table "shows", force: :cascade do |t| @@ -318,7 +301,7 @@ t.string "filename" t.boolean "completed", default: false t.datetime "created_at" - t.index ["processed_by_id"], name: "index_ticket_sales_imports_on_processed_by_id" + t.index ["processed_by_id"], name: "index_ticket_sales_imports_on_processed_by_id", using: :btree end create_table "txns", force: :cascade do |t| @@ -333,12 +316,12 @@ t.string "comments", limit: 255 t.integer "order_id" t.string "txn_type", limit: 255 - t.index ["customer_id"], name: "index_txns_on_customer_id" - t.index ["entered_by_id"], name: "index_txns_on_entered_by_id" - t.index ["order_id"], name: "index_txns_on_order_id" - t.index ["show_id"], name: "index_txns_on_show_id" - t.index ["showdate_id"], name: "index_txns_on_showdate_id" - t.index ["voucher_id"], name: "index_txns_on_voucher_id" + t.index ["customer_id"], name: "index_txns_on_customer_id", using: :btree + t.index ["entered_by_id"], name: "index_txns_on_entered_by_id", using: :btree + t.index ["order_id"], name: "index_txns_on_order_id", using: :btree + t.index ["show_id"], name: "index_txns_on_show_id", using: :btree + t.index ["showdate_id"], name: "index_txns_on_showdate_id", using: :btree + t.index ["voucher_id"], name: "index_txns_on_voucher_id", using: :btree end create_table "valid_vouchers", force: :cascade do |t| @@ -352,8 +335,8 @@ t.datetime "updated_at", null: false t.integer "min_sales_per_txn", default: 1 t.integer "max_sales_per_txn", default: 100000 - t.index ["showdate_id"], name: "index_valid_vouchers_on_showdate_id" - t.index ["vouchertype_id"], name: "index_valid_vouchers_on_vouchertype_id" + t.index ["showdate_id"], name: "index_valid_vouchers_on_showdate_id", using: :btree + t.index ["vouchertype_id"], name: "index_valid_vouchers_on_vouchertype_id", using: :btree end create_table "vouchertypes", force: :cascade do |t| @@ -372,7 +355,7 @@ t.integer "account_code_id", default: 1, null: false t.integer "display_order", default: 0, null: false t.integer "seating_zone_id" - t.index ["account_code_id"], name: "index_vouchertypes_on_account_code_id" + t.index ["account_code_id"], name: "index_vouchertypes_on_account_code_id", using: :btree end end diff --git a/features/support/env.rb b/features/support/env.rb index 7ccf5ce5..a7558f24 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -28,18 +28,6 @@ # steps to use the XPath syntax. Capybara.default_selector = :css Capybara.server = :webrick -<<<<<<< HEAD -Capybara.register_driver :selenium do |app| - # Webdrivers::Chromedriver.required_version = '123.0.6312.58' - # Webdrivers::Chromedriver.required_version = '126.0.6478.126' - webdriver_args = %w[--headless --no-sandbox --disable-gpu --window-size=1024,1024] - options = Selenium::WebDriver::Chrome::Options.new( - args: webdriver_args - ) - # When an "unexpected" alert/confirm is displayed, accept it (ie user clicks OK). - # Expected ones can be handled with accept_alert do...end or accept_confirm do...end - options.unhandled_prompt_behavior = :accept -======= # must have compatible versions of chromedriver and chrome-for-testing (headless) installed: # Download a specific Chrome for Testing version: # npx @puppeteer/browsers install chrome@124.0.6367.91 @@ -47,25 +35,28 @@ # npx @puppeteer/browsers install chromedriver@124.0.6367.91 # (Note: these 'installs' just put stuff in the $cwd. brew install may be better) +path_to_chromedriver = `find ~+/tmp -type f -name 'chromedriver'`.chomp +#path_to_chrome_for_testing = `find ~+/tmp -type f -name 'chrome'`.chomp +path_to_chrome_for_testing = `find ~+/tmp -type f -name 'Google Chrome for Testing'`.chomp + Capybara.register_driver :selenium_chrome_headless do |app| options = Selenium::WebDriver::Chrome::Options.new.tap do |opts| opts.add_argument '--headless' opts.add_argument '--no-sandbox' opts.add_argument '--disable-gpu' opts.add_argument '--window-size=1024,1024' - # opts.binary = File.join(Rails.root, 'tmp', 'Google Chrome for Testing.app') # When an "unexpected" alert/confirm is displayed, accept it (ie user clicks OK). # Expected ones can be handled with accept_alert do...end or accept_confirm do...end opts.unhandled_prompt_behavior = :accept + opts.binary = path_to_chrome_for_testing end - #service = Selenium::WebDriver::Service.chrome(path: File.join(Rails.root, 'tmp', 'chromedriver')) - - ->>>>>>> rails5 + # expects headless Chrome-for-testing and its driver to be in $RAILS_ROOT/tmp somewhere, + # but puppeteer installs them in arch-specific subdirs :-( Capybara::Selenium::Driver.new( app, browser: :chrome, + service: Selenium::WebDriver::Service.chrome(path: path_to_chromedriver), options: options, clear_session_storage: true, clear_local_storage: true) diff --git a/features/support/webmock.rb b/features/support/webmock.rb index d5120111..9a42d8ef 100644 --- a/features/support/webmock.rb +++ b/features/support/webmock.rb @@ -5,10 +5,6 @@ allow_localhost: true, # 186585553: When upgrade to Ruby3.0, stop requiring webdrivers gem, upgrade to Selenium 4.11+, # and hopefully remove the whitelist URIs below -<<<<<<< HEAD - allow: ["googlechromelabs.github.io", 'edgedl.me.gvt1.com', 'storage.googleapis.com'] -======= allow: ['https://storage.googleapis.com/chrome-for-testing-public', "googlechromelabs.github.io", 'edgedl.me.gvt1.com'] ->>>>>>> rails5 )