From 0aae8e79beb1bb7e9bbbd4339b5f8351ff2d3fbb Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 15:17:40 -0800 Subject: [PATCH 01/22] Restore omniauth providers to keep conistency with master --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 1e148579..8328aa2f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,7 +50,7 @@ class User < ApplicationRecord else [:database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, - :omniauthable, omniauth_providers: [:google, :discourse]] + :omniauthable, omniauth_providers: [:suse, :google, :facebook, :github, :discourse]] end devise(*devise_modules) From 7ea5ff9160f5c12b99682f61e738dcc58b3975cb Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 15:20:37 -0800 Subject: [PATCH 02/22] Restore gemfile to have the standard gems --- Gemfile | 8 ++++---- Gemfile.lock | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 1a43ca93..04a12d43 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'puma', '~> 3.0' gem 'responders', '~> 2.0' # as supported databases -# gem 'mysql2' +gem 'mysql2' gem 'pg' # for tracking data changes @@ -41,9 +41,9 @@ gem 'devise_ichain_authenticatable' gem 'omniauth' gem 'omniauth-google-oauth2' gem 'omniauth-discourse' -# gem 'omniauth-openid' -# gem 'omniauth-facebook' -# gem 'omniauth-github' +gem 'omniauth-openid' +gem 'omniauth-facebook' +gem 'omniauth-github' # Bot-filtering gem 'recaptcha', require: 'recaptcha/rails' diff --git a/Gemfile.lock b/Gemfile.lock index 788c1861..7125136f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -304,6 +304,7 @@ GEM multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.1.1) + mysql2 (0.5.3) nenv (0.3.0) net-http-persistent (3.0.1) connection_pool (~> 2.2) @@ -325,6 +326,11 @@ GEM rack (>= 1.6.2, < 3) omniauth-discourse (1.0.0) omniauth (~> 1.0) + omniauth-facebook (6.0.0) + omniauth-oauth2 (~> 1.2) + omniauth-github (1.3.0) + omniauth (~> 1.5) + omniauth-oauth2 (>= 1.4.0, < 2.0) omniauth-google-oauth2 (0.6.1) jwt (>= 2.0) omniauth (>= 1.1.1) @@ -332,6 +338,9 @@ GEM omniauth-oauth2 (1.6.0) oauth2 (~> 1.1) omniauth (~> 1.9) + omniauth-openid (1.0.1) + omniauth (~> 1.0) + rack-openid (~> 1.3.1) open4 (1.3.4) orm_adapter (0.5.0) paper_trail (10.3.1) @@ -373,6 +382,9 @@ GEM public_suffix (3.1.1) puma (3.12.2) rack (2.0.8) + rack-openid (1.3.1) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.2.3) @@ -489,6 +501,7 @@ GEM rubocop-rspec (1.36.0) rubocop (>= 0.68.1) ruby-oembed (0.12.0) + ruby-openid (2.9.2) ruby-progressbar (1.10.1) ruby-rc4 (0.1.5) ruby_dep (1.5.0) @@ -654,10 +667,14 @@ DEPENDENCIES mina mini_magick money-rails + mysql2 nokogiri (>= 1.8.1) omniauth omniauth-discourse + omniauth-facebook + omniauth-github omniauth-google-oauth2 + omniauth-openid paper_trail pdf-inspector pg From 506f0c946ff0e5246586a6d7d5fc3fc614f8dc77 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 15:23:54 -0800 Subject: [PATCH 03/22] Update user model spec --- spec/models/user_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 29aadfe6..e7d55add 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -468,7 +468,8 @@ describe User do describe '.omniauth_providers' do it 'contains providers' do - expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github] + # expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github] + expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github, :discourse] end end end From 6dd501663ce13f526eb417f7dba745ab6273acf3 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 22:31:57 -0800 Subject: [PATCH 04/22] Lint: Sort gems --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 04a12d43..ee256912 100644 --- a/Gemfile +++ b/Gemfile @@ -39,11 +39,11 @@ gem 'devise' gem 'devise_ichain_authenticatable' gem 'omniauth' -gem 'omniauth-google-oauth2' gem 'omniauth-discourse' -gem 'omniauth-openid' gem 'omniauth-facebook' gem 'omniauth-github' +gem 'omniauth-google-oauth2' +gem 'omniauth-openid' # Bot-filtering gem 'recaptcha', require: 'recaptcha/rails' From 1ec99a50186e6d0c7a3c2687806d5eab86ee8a7d Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 22:42:37 -0800 Subject: [PATCH 05/22] Delint helpers --- app/helpers/application_helper.rb | 14 ++++++++------ app/helpers/format_helper.rb | 24 ++++++++---------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4091792d..a9a07726 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -178,20 +178,22 @@ module ApplicationHelper 'hidden' if Date.today > conference.end_date end + # TODO:Snap!Con: Replace this with a search for a conference logo. def nav_root_link_for(conference) - link_text = ( - conference.try(:organization).try(:name) || - ENV['OSEM_NAME'] || - 'OSEM' - ) link_to( image_tag('snapcon_logo.png'), root_path, class: 'navbar-brand', - title: 'Open Source Event Manager' + title: ENV['OSEM_NAME'] ) end + def nav_link_text(conference) + conference.try(:organization).try(:name) || + ENV['OSEM_NAME'] || + 'OSEM' + end + # returns the url to be used for logo on basis of sponsorship level position def get_logo(object) if object.try(:sponsorship_level) diff --git a/app/helpers/format_helper.rb b/app/helpers/format_helper.rb index 9dc7abc5..6aa198d6 100644 --- a/app/helpers/format_helper.rb +++ b/app/helpers/format_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'redcarpet/render_strip' module FormatHelper @@ -43,12 +44,11 @@ module FormatHelper def target_progress_color(progress) progress = progress.to_i - result = - case - when progress >= 90 then 'green' - when progress < 90 && progress >= 80 then 'orange' - else 'red' - end + result = case + when progress >= 90 then 'green' + when progress < 90 && progress >= 80 then 'orange' + else 'red' + end result end @@ -100,19 +100,11 @@ module FormatHelper end def icon_for_todo(bool) - if bool - 'fa fa-check' - else - 'fa fa-times' - end + bool ? 'fa fa-check' : 'fa fa-times' end def class_for_todo(bool) - if bool - 'todolist-ok' - else - 'todolist-missing' - end + bool ? 'todolist-ok' : 'todolist-missing' end def word_pluralize(count, singular, plural = nil) From 35a532ceab88e269b6d7616d22a6de8245a64d68 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 22:53:47 -0800 Subject: [PATCH 06/22] Delint --- app/helpers/application_helper.rb | 2 +- config/initializers/devise.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a9a07726..78dbc652 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -184,7 +184,7 @@ module ApplicationHelper image_tag('snapcon_logo.png'), root_path, class: 'navbar-brand', - title: ENV['OSEM_NAME'] + title: nav_link_text(conference) ) end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 0afd8ae3..92d933ff 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -13,7 +13,7 @@ Devise.setup do |config| scope: 'email' config.omniauth :discourse, - sso_url: "https://forum.snap.berkeley.edu/session/sso_provider", + sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider', sso_secret: ENV['OSEM_DISCOURSE_SECRET'] # config.omniauth :facebook, (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret) From d8ce3c298233dc372cc42a9e63de99c86cd78cdb Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 22:54:03 -0800 Subject: [PATCH 07/22] Try to update spec file with image in navbar --- spec/helpers/application_helper_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index cc0caeb9..edadc869 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -65,16 +65,19 @@ describe ApplicationHelper, type: :helper do describe 'navigation title link' do it 'should default to OSEM' do ENV.delete('OSEM_NAME') - expect(nav_root_link_for(nil)).to match 'OSEM' + # TODO:Snap!Con: expect(nav_root_link_for(nil)).to match 'OSEM' + expect(nav_root_link_for(nil)).to match image_tag('snapcon_logo.png') end it 'should use the environment variable' do ENV['OSEM_NAME'] = Faker::Company.name + "'" - expect(nav_root_link_for(nil)).to match h(ENV['OSEM_NAME']) + # expect(nav_root_link_for(nil)).to match h(ENV['OSEM_NAME']) + expect(nav_root_link_for(nil)).to match image_tag('snapcon_logo.png') end it 'should use the conference organization name' do - expect(nav_root_link_for(conference)).to match h(conference.organization.name) + # expect(nav_root_link_for(conference)).to match h(conference.organization.name) + expect(nav_root_link_for(nil)).to match image_tag('snapcon_logo.png') end end end From e269e45a455252831861ecb7711c0d73b5fbafd2 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 22:56:12 -0800 Subject: [PATCH 08/22] Fix format spec with new markdown options --- spec/helpers/format_helper_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/helpers/format_helper_spec.rb b/spec/helpers/format_helper_spec.rb index 0eb4d055..9d611ccb 100644 --- a/spec/helpers/format_helper_spec.rb +++ b/spec/helpers/format_helper_spec.rb @@ -11,7 +11,15 @@ describe FormatHelper, type: :helper do it 'should return HTML for header markdown' do expect(Redcarpet::Markdown).to receive(:new) - .with(Redcarpet::Render::HTML, autolink: true, space_after_headers: true, no_intra_emphasis: true) + .with( + Redcarpet::Render::HTML, + autolink: true, + space_after_headers: true, + tables: true, + strikethrough: true, + footnotes: true, + superscript: true + ) .and_call_original expect(markdown('# this is my header')).to eq "

this is my header

\n" From 3a2198d1fae0da5846d87ab15b17b4733548d7ea Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 27 Jan 2020 22:58:19 -0800 Subject: [PATCH 09/22] Cleanup config file, ensure providers are set if present --- config/initializers/devise.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 92d933ff..101f0c3d 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -8,7 +8,9 @@ Devise.setup do |config| # config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user' - config.omniauth :google_oauth2, (ENV['OSEM_GOOGLE_KEY'] || Rails.application.secrets.google_key), (ENV['OSEM_GOOGLE_SECRET'] || Rails.application.secrets.google_secret), + config.omniauth :google_oauth2, + (ENV['OSEM_GOOGLE_KEY'] || Rails.application.secrets.google_key), + (ENV['OSEM_GOOGLE_SECRET'] || Rails.application.secrets.google_secret), name: 'google', scope: 'email' @@ -16,8 +18,13 @@ Devise.setup do |config| sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider', sso_secret: ENV['OSEM_DISCOURSE_SECRET'] - # config.omniauth :facebook, (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret) - # config.omniauth :github, (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_secret) + config.omniauth :facebook, + (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), + (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret) + + config.omniauth :github, + (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), + (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_secret) # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, From 7bf57b05f30d78dae8c7239acb2cf4be81fc4a80 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 29 Jan 2020 16:51:27 -0800 Subject: [PATCH 10/22] Cleanup specs --- app/views/payments/_payment.html.haml | 17 ++++++++++++----- spec/features/conference_spec.rb | 3 ++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/payments/_payment.html.haml b/app/views/payments/_payment.html.haml index 56af80f7..ff27e2ba 100644 --- a/app/views/payments/_payment.html.haml +++ b/app/views/payments/_payment.html.haml @@ -1,6 +1,6 @@ .div .col-md-12.table-responsive - %table.table.table-hover + %table.table.table-hover.table-striped %thead %tr %th Ticket @@ -21,7 +21,14 @@ = form_tag conference_payments_path do %script.stripe-button{ src: "https://checkout.stripe.com/checkout.js", - data: { amount: @total_amount_to_pay.cents, label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}", - email: current_user.email, currency: @total_amount_to_pay.currency, name: ENV['OSEM_NAME'] || 'OSEM', - description: "book your tickets", key: Rails.application.secrets.stripe_publishable_key, locale: "auto"}} - = link_to 'Edit Purchase', conference_tickets_path(@conference.short_title), class: 'btn btn-default' + data: { + amount: @total_amount_to_pay.cents, + label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}", + email: current_user.email, + currency: @total_amount_to_pay.currency, + name: ENV['OSEM_NAME'] || 'OSEM', + description: "#{OSEM_NAME} tickets", + key: ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.secrets.stripe_publishable_key, locale: "auto" + }} + = link_to('Edit Purchase', conference_tickets_path(@conference.short_title), + class: 'btn btn-default') diff --git a/spec/features/conference_spec.rb b/spec/features/conference_spec.rb index 95f422bc..f995540e 100644 --- a/spec/features/conference_spec.rb +++ b/spec/features/conference_spec.rb @@ -98,7 +98,8 @@ feature Conference do sign_in user visit admin_conference_path(conference.short_title) - expect(find('.navbar-brand').text).to eq(conference.organization.name) + # expect(find('.navbar-brand')).to eq(conference.organization.name) + expect(find('.navbar-brand')).to eq(image_tag('snapcon_logo.png')) end it_behaves_like 'add and update conference' From 00c8903968f31abd1c7ddd0af775f5ddda068e7d Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 18:44:32 -0800 Subject: [PATCH 11/22] Fix the docker init script --- bin/osem-init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/osem-init.sh b/bin/osem-init.sh index b7d05dca..4a43081d 100755 --- a/bin/osem-init.sh +++ b/bin/osem-init.sh @@ -1,4 +1,5 @@ #!/bin/bash +bundle install # Setup the app if it isn't already setup bundle exec rake db:bootstrap # Start the app From 93551149601ad6c8ecdc7344fa68acdd6060fa07 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 20:49:22 -0800 Subject: [PATCH 12/22] Cleanup stripe stuff --- app/views/payments/_payment.html.haml | 18 ++++++++---------- config/initializers/stripe.rb | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/views/payments/_payment.html.haml b/app/views/payments/_payment.html.haml index ff27e2ba..440f9985 100644 --- a/app/views/payments/_payment.html.haml +++ b/app/views/payments/_payment.html.haml @@ -20,15 +20,13 @@ = humanized_money_with_symbol ticket.quantity * ticket.price = form_tag conference_payments_path do - %script.stripe-button{ src: "https://checkout.stripe.com/checkout.js", - data: { - amount: @total_amount_to_pay.cents, - label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}", - email: current_user.email, - currency: @total_amount_to_pay.currency, - name: ENV['OSEM_NAME'] || 'OSEM', - description: "#{OSEM_NAME} tickets", - key: ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.secrets.stripe_publishable_key, locale: "auto" - }} + %script.stripe-button{'src': "https://checkout.stripe.com/checkout.js", + 'data': {amount: @total_amount_to_pay.cents, + label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}", + email: current_user.email, + currency: @total_amount_to_pay.currency, + name: ENV['OSEM_NAME'] || 'OSEM', + description: "#{ENV['OSEM_NAME']} tickets", + key: ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.secrets.stripe_publishable_key, locale: "auto"}} = link_to('Edit Purchase', conference_tickets_path(@conference.short_title), class: 'btn btn-default') diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb index 555cc16f..b89159b4 100644 --- a/config/initializers/stripe.rb +++ b/config/initializers/stripe.rb @@ -1 +1 @@ -Stripe.api_key = Rails.application.secrets.stripe_secret_key +Stripe.api_key = ENV['STRIPE_SECRET_KEY'] || Rails.application.secrets.stripe_secret_key From 165fe2b9ca2cef023c434cfe486f415b980a06ec Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 20:50:41 -0800 Subject: [PATCH 13/22] Update stripe gem --- Gemfile.lock | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7125136f..519ea1ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -130,7 +130,6 @@ GEM url coderay (1.1.1) concurrent-ruby (1.1.5) - connection_pool (2.2.2) countable-rails (0.0.1) railties (>= 3.1) countries (3.0.0) @@ -306,8 +305,6 @@ GEM multipart-post (2.1.1) mysql2 (0.5.3) nenv (0.3.0) - net-http-persistent (3.0.1) - connection_pool (~> 2.2) netrc (0.11.0) nio4r (2.5.2) nokogiri (1.10.5) @@ -555,9 +552,7 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.1) - stripe (4.21.3) - faraday (~> 0.13) - net-http-persistent (~> 3.0) + stripe (5.14.0) stripe-ruby-mock (2.5.8) dante (>= 0.2.0) multi_json (~> 1.0) From b50972213a28bf900c80c06ecc5ed8ee2d1d62dd Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 22:48:58 -0800 Subject: [PATCH 14/22] Add sentry logging --- Gemfile | 4 +--- Gemfile.lock | 10 ++-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index ee256912..5c281642 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,6 @@ gem 'puma', '~> 3.0' gem 'responders', '~> 2.0' # as supported databases -gem 'mysql2' gem 'pg' # for tracking data changes @@ -143,8 +142,7 @@ gem 'rqrcode' gem 'axlsx', git: 'https://github.com/randym/axlsx.git' gem 'axlsx_rails' -# as error catcher -gem 'airbrake' +gem 'sentry' # to make links faster gem 'turbolinks' diff --git a/Gemfile.lock b/Gemfile.lock index 519ea1ab..be766571 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,10 +68,6 @@ GEM addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) afm (0.2.2) - airbrake (9.2.2) - airbrake-ruby (~> 4.4) - airbrake-ruby (4.4.0) - rbtree3 (~> 0.5) ajax-datatables-rails (0.4.3) railties (>= 4.0) archive-zip (0.12.0) @@ -303,7 +299,6 @@ GEM multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.1.1) - mysql2 (0.5.3) nenv (0.3.0) netrc (0.11.0) nio4r (2.5.2) @@ -440,7 +435,6 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) - rbtree3 (0.5.0) rdoc (6.0.4) rdoc-generator-fivefish (0.4.0) inversion (~> 1.1) @@ -524,6 +518,7 @@ GEM selenium-webdriver (3.142.6) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) + sentry (0.5.3) sexp_processor (4.11.0) shellany (0.0.1) shoulda-matchers (4.1.2) @@ -613,7 +608,6 @@ DEPENDENCIES active_model_serializers acts_as_commentable_with_threading acts_as_list - airbrake ajax-datatables-rails autoprefixer-rails awesome_nested_set @@ -662,7 +656,6 @@ DEPENDENCIES mina mini_magick money-rails - mysql2 nokogiri (>= 1.8.1) omniauth omniauth-discourse @@ -705,6 +698,7 @@ DEPENDENCIES ruby-oembed sass-rails (>= 4.0.2) selectize-rails + sentry shoulda-matchers skylight spring-commands-rspec From 71659ae65f9088d7339161a0d754d44e0724f855 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 22:51:20 -0800 Subject: [PATCH 15/22] remove airbrake --- config/initializers/airbrake.rb | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 config/initializers/airbrake.rb diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb deleted file mode 100644 index e3c96dfc..00000000 --- a/config/initializers/airbrake.rb +++ /dev/null @@ -1,22 +0,0 @@ -Airbrake.configure do |config| - # Change this to some sensible data for your errbit instance - config.project_id = ENV['OSEM_ERRBIT_ID'] || Rails.application.secrets.errbit_id || '' - config.project_key = ENV['OSEM_ERRBIT_KEY'] || Rails.application.secrets.errbit_key || '' - config.host = ENV['OSEM_ERRBIT_HOST'] - config.environment = Rails.env - if config.project_key.blank? || config.host.blank? - config.ignore_environments = [:production, :development, :test] - else - config.ignore_environments = [:development, :test] - end -end - -Airbrake.add_filter do |notice| - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActiveRecord::RecordNotFound' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::InvalidAuthenticityToken' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::UnknownAction' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'AbstractController::ActionNotFound' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionView::MissingTemplate' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::UnknownFormat' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::RoutingError' && error[:message] =~ %r{\[GET\]} } -end From bc6b76fcc3f571af47d00228554806fc5f1744d4 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 23:42:26 -0800 Subject: [PATCH 16/22] Update stripe mock gem --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index be766571..9e204e77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -296,7 +296,7 @@ GEM monetize (~> 1.9.0) money (~> 6.13.2) railties (>= 3.0) - multi_json (1.13.1) + multi_json (1.14.1) multi_xml (0.6.0) multipart-post (2.1.1) nenv (0.3.0) @@ -548,10 +548,10 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.1) stripe (5.14.0) - stripe-ruby-mock (2.5.8) + stripe-ruby-mock (3.0.1) dante (>= 0.2.0) multi_json (~> 1.0) - stripe (>= 2.0.3) + stripe (> 5, < 6) sysexits (1.2.0) temple (0.8.0) thor (0.20.3) From 37ffc1765dd9fc1939da21733417dede1c9cae72 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 4 Feb 2020 23:50:28 -0800 Subject: [PATCH 17/22] Fix specs for omniauth providers? --- app/models/user.rb | 4 +++- spec/features/conference_spec.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8328aa2f..e0ee192e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,7 +50,9 @@ class User < ApplicationRecord else [:database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, - :omniauthable, omniauth_providers: [:suse, :google, :facebook, :github, :discourse]] + :omniauthable, + # omniauth_providers: [:suse, :google, :facebook, :github, :discourse] + omniauth_providers: [:google, :discourse] end devise(*devise_modules) diff --git a/spec/features/conference_spec.rb b/spec/features/conference_spec.rb index f995540e..45f59e78 100644 --- a/spec/features/conference_spec.rb +++ b/spec/features/conference_spec.rb @@ -99,7 +99,7 @@ feature Conference do visit admin_conference_path(conference.short_title) # expect(find('.navbar-brand')).to eq(conference.organization.name) - expect(find('.navbar-brand')).to eq(image_tag('snapcon_logo.png')) + expect(find('.navbar-brand img')['alt']).to have_content conference.organization.name end it_behaves_like 'add and update conference' From 9904ee67aac8ba695ed84bf926828a67a5e10488 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 5 Feb 2020 10:57:02 -0800 Subject: [PATCH 18/22] fix missing ] --- app/models/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user.rb b/app/models/user.rb index e0ee192e..f6d62de3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -53,6 +53,7 @@ class User < ApplicationRecord :omniauthable, # omniauth_providers: [:suse, :google, :facebook, :github, :discourse] omniauth_providers: [:google, :discourse] + ] end devise(*devise_modules) From a6bac93788322ec86def898cc011c494f9d522d1 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 5 Feb 2020 23:20:31 -0800 Subject: [PATCH 19/22] Tweak Tickets Text --- app/views/conferences/_tickets.haml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/conferences/_tickets.haml b/app/views/conferences/_tickets.haml index 1250266e..8b37582a 100644 --- a/app/views/conferences/_tickets.haml +++ b/app/views/conferences/_tickets.haml @@ -7,7 +7,7 @@ .container .row .col-md-12.text-center - %h2 Sign Up for Campus Housing + %h2 Sign Up for Snap!Con %br -# %h2 -# Support @@ -15,8 +15,7 @@ .row.row-centered - tickets.each do |ticket| .col-lg-4.col-md-3.col-sm-3.col-centered.col-top - = link_to(conference_tickets_path(conference.short_title), - class: 'thumbnail') do + = link_to(conference_tickets_path(conference.short_title), class: 'thumbnail') do .caption %h3.text-center.word_break = ticket.title From 142e93bebc4b26b241e22d827c4bc0322fd94f7c Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 5 Feb 2020 23:25:00 -0800 Subject: [PATCH 20/22] fix user model spec --- config/puma.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/puma.rb b/config/puma.rb index 9886e1e5..1d43c487 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -43,5 +43,16 @@ on_worker_boot do ActiveRecord::Base.establish_connection if defined?(ActiveRecord) end +lowlevel_error_handler do |ex, env| + Raven.capture_exception( + ex, + :message => ex.message, + :extra => { :puma => env }, + :transaction => "Puma" + ) + # note the below is just a Rack response + [500, {}, ["An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact conference@snap.berkeley.edu\n"]] +end + # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart From cc9a7599609bbd11fb865ee23916688afa57884b Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 5 Feb 2020 23:25:08 -0800 Subject: [PATCH 21/22] add sentry puma hooks --- spec/models/user_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e7d55add..9d7c8153 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -469,7 +469,7 @@ describe User do describe '.omniauth_providers' do it 'contains providers' do # expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github] - expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github, :discourse] + expect(User.omniauth_providers).to eq [:google, :discourse] end end end From a72633e2d94d07e0b0dd9dcb6b4d8ece69bc2d40 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Thu, 6 Feb 2020 00:47:40 -0800 Subject: [PATCH 22/22] Cleanup some Auth specs and weird haml syntax --- app/views/devise/shared/_openid_links.html.haml | 8 +++++--- spec/support/omniauth_macros.rb | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/views/devise/shared/_openid_links.html.haml b/app/views/devise/shared/_openid_links.html.haml index fc6086c9..2e7916b3 100644 --- a/app/views/devise/shared/_openid_links.html.haml +++ b/app/views/devise/shared/_openid_links.html.haml @@ -7,8 +7,10 @@ title: "Your #{provider} login" do %i{class: "fa fa-#{provider}"} - else - = link_to("Snap!", - "user_#{provider}_omniauth_authorize".to_sym, + = link_to("user_#{provider}_omniauth_authorize".to_sym, class: "btn btn-success btn-lg", id: "omniauth-#{provider}", - title: "Your #{provider} login") + title: "Your #{provider} login") do + %span + Snap + %em> ! diff --git a/spec/support/omniauth_macros.rb b/spec/support/omniauth_macros.rb index 12bacc17..a7ec88bb 100644 --- a/spec/support/omniauth_macros.rb +++ b/spec/support/omniauth_macros.rb @@ -6,12 +6,12 @@ module OmniauthMacros ENV['OSEM_GOOGLE_KEY'] = 'test key google' ENV['OSEM_GOOGLE_SECRET'] = 'test secret google' - ENV['OSEM_FACEBOOK_KEY'] = 'test key facebook' - ENV['OSEM_FACEBOOK_SECRET'] = 'test secret facebook' - ENV['OSEM_SUSE_KEY'] = 'test key suse' - ENV['OSEM_SUSE_SECRET'] = 'test secret suse' - ENV['OSEM_GITHUB_KEY'] = 'test key github' - ENV['OSEM_GITHUB_SECRET'] = 'test secret github' + # ENV['OSEM_FACEBOOK_KEY'] = 'test key facebook' + # ENV['OSEM_FACEBOOK_SECRET'] = 'test secret facebook' + # ENV['OSEM_SUSE_KEY'] = 'test key suse' + # ENV['OSEM_SUSE_SECRET'] = 'test secret suse' + # ENV['OSEM_GITHUB_KEY'] = 'test key github' + # ENV['OSEM_GITHUB_SECRET'] = 'test secret github' def mock_auth_new_user OmniAuth.config.mock_auth[:google] =