From 38b648655060d06109734821095cf32e7a82efb6 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sat, 14 Mar 2020 16:24:49 -0700 Subject: [PATCH 01/24] Use database password in Docker Compose environment Addresses docker-library/postgres#681. --- INSTALL.md | 2 +- docker-compose.yml | 1 + docker-compose.yml.production-example | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 39f9ce4c..27037af2 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -37,7 +37,7 @@ There is a rudimentary docker-compose configuration for production usage (`docke 1. Configure OSEM - You have at least to set `SECRET_KEY_BASE` + You have at least to set `OSEM_DB_PASSWORD` and `SECRET_KEY_BASE` ``` cp dotenv.example .env.production vim .env.production diff --git a/docker-compose.yml b/docker-compose.yml index 8f31749c..62f0d55f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,7 @@ services: image: postgres environment: PGDATA: /var/lib/postgresql/data/pgdata + POSTGRES_PASSWORD: $OSEM_DB_PASSWORD osem: build: context: . diff --git a/docker-compose.yml.production-example b/docker-compose.yml.production-example index 73fa1ad1..f35c950c 100644 --- a/docker-compose.yml.production-example +++ b/docker-compose.yml.production-example @@ -5,6 +5,7 @@ services: image: postgres environment: PGDATA: /var/lib/postgresql/data/pgdata + POSTGRES_PASSWORD: $OSEM_DB_PASSWORD volumes: - osem_production_database:/var/lib/postgresql/data/pgdata production_web: From 8eb696bb4a0057c102a7aece70d329b7a81e6f44 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 16 Mar 2020 16:05:00 -0700 Subject: [PATCH 02/24] Use version range instead of OSEM_RUBY_VERSION --- Gemfile | 2 +- dotenv.example | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index b281e1aa..f71b1215 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby ENV['OSEM_RUBY_VERSION'] || '2.5.0' +ruby '~> 2.5.0' # rails-assets requires >= 1.8.4 if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4') diff --git a/dotenv.example b/dotenv.example index ca6bbfa8..89cd16e9 100644 --- a/dotenv.example +++ b/dotenv.example @@ -32,9 +32,6 @@ # OSEM_MEMCACHED_USERNAME='root' # OSEM_MEMCACHED_PASSWORD='1234' -# The ruby version to use -# OSEM_RUBY_VERSION=2.5.0 - # What time is it? # OSEM_TIME_ZONE="UTC" From d088a4ae173e247c0ed56e157eac26027e2f3071 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 16 Mar 2020 18:55:45 -0700 Subject: [PATCH 03/24] Add missing Chromium dependencies in base image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: $ docker run --rm osem/base chromium --no-sandbox --headless … Check failed: InitDefaultFont(). Could not find the default font --- Dockerfile.base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.base b/Dockerfile.base index 9e274751..1865285a 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -17,7 +17,7 @@ RUN zypper -n install --no-recommends \ # as ruby ruby2.5-devel \ # as browser for feature tests - chromium + chromium xorg-x11-fonts # Setup sudo RUN echo 'osem ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers From f37eab88c79fd04dd604b79cd8c7d655d0db5910 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 16 Mar 2020 18:57:51 -0700 Subject: [PATCH 04/24] Use Chrome::Options instead of Capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: $ docker-compose run --rm osem bundle exec rspec --tag js … Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally. --- spec/spec_helper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fe6bab9b..a5e7d5f2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -78,12 +78,10 @@ RSpec.configure do |config| end Capybara.register_driver :chrome_headless do |app| - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( - chromeOptions: { args: %w(headless disable-gpu window-size=1920x1080 no-sandbox) } - ) - Capybara::Selenium::Driver.new( - app, browser: :chrome, desired_capabilities: capabilities + options = Selenium::WebDriver::Chrome::Options.new( + args: %w(headless disable-gpu window-size=1920x1080 no-sandbox) ) + Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end Capybara.default_max_wait_time = 10 # seconds From aa61ec96929104ce5efb7a5a915e888ed9d0e13c Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Tue, 31 Mar 2020 17:40:13 -0700 Subject: [PATCH 05/24] Remove unused code --- spec/features/versions_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index ec443fd0..beaeafa5 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -319,12 +319,6 @@ feature 'Version' do context 'organization role', feature: true, versioning: true, js: true do let!(:user) { create(:user) } - let!(:role) do - Role.find_by( - resource_id: conference.organization.id, - resource_type: 'Organization' - ) - end setup do user.add_role :organization_admin, conference.organization From 71d9860124abaa4882d95e2fc8f064e610aeadfc Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Thu, 2 Apr 2020 21:29:33 -0700 Subject: [PATCH 06/24] Test access to organization_admin version as organization_admin This corrects the specification for the behavior of the Revision History screen; changes to the organization administrator role should be accessible to organization administrators, not conference organizers. --- spec/factories/users.rb | 11 +++++++++++ spec/features/versions_spec.rb | 3 +++ 2 files changed, 14 insertions(+) diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 24affba4..38fd26d6 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -59,6 +59,17 @@ FactoryBot.define do biography { '
' } end + factory :organization_admin, parent: :user do + transient do + organization { create(:organization) } + end + + after(:create) do |user, evaluator| + user.roles << Role.find_or_create_by(name: 'organization_admin', resource: evaluator.organization) + user.save! + end + end + factory :organizer, parent: :user do transient do resource { create(:resource) } diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index beaeafa5..e60d7cdc 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -318,11 +318,14 @@ feature 'Version' do end context 'organization role', feature: true, versioning: true, js: true do + let!(:organization_admin) { create(:organization_admin, organization: conference.organization) } let!(:user) { create(:user) } setup do user.add_role :organization_admin, conference.organization user.remove_role :organization_admin, conference.organization + + sign_in organization_admin visit admin_revision_history_path end From 79cd1c9fcd3e07888f19d47d9f51c11dc660c4b9 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Fri, 3 Apr 2020 09:47:31 -0700 Subject: [PATCH 07/24] Grant permission to read, revert organization_admin version Without this permission, organization administrators can't see the history of changes to the organization administrator role on the Revision History screen. --- app/models/admin_ability.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/admin_ability.rb b/app/models/admin_ability.rb index 19d6c4d3..455246d2 100644 --- a/app/models/admin_ability.rb +++ b/app/models/admin_ability.rb @@ -99,6 +99,8 @@ class AdminAbility can :manage, Conference, organization_id: org_ids_for_organization_admin can [:index, :show], Role + can [:index, :revert_object, :revert_attribute], PaperTrail::Version, organization_id: org_ids_for_organization_admin + signed_in_with_organizer_role(user, conf_ids_for_organization_admin) end From fe2e5febe3c6f7bc8597a08554849710259e9124 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Fri, 3 Apr 2020 09:51:35 -0700 Subject: [PATCH 08/24] Deconflate organization/conference IDs in role versions Resolves failing test spec/features/versions_spec.rb:320. --- app/models/role.rb | 12 +++++- app/models/users_role.rb | 9 ++-- .../versions/_object_desc_and_link.html.haml | 42 +++++++------------ ...0331214534_add_organization_to_versions.rb | 35 ++++++++++++++++ db/schema.rb | 4 +- 5 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 db/migrate/20200331214534_add_organization_to_versions.rb diff --git a/app/models/role.rb b/app/models/role.rb index 2be87d7b..7b67a158 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -5,7 +5,9 @@ class Role < ApplicationRecord has_many :users_roles has_many :users, through: :users_roles - has_paper_trail on: [:create, :update], only: [:name, :description], meta: { conference_id: :resource_id } + has_paper_trail on: [:create, :update], + only: [:name, :description], + meta: { conference_id: :conference_id, organization_id: :organization_id } before_destroy :cancel scopify @@ -14,6 +16,14 @@ class Role < ApplicationRecord validates :name, uniqueness: { scope: :resource } + def conference_id + resource_type == 'Conference' ? resource_id : nil + end + + def organization_id + resource_type == 'Organization' ? resource_id : nil + end + private # Needed to ensure that removing all user from role doesn't remove role. diff --git a/app/models/users_role.rb b/app/models/users_role.rb index b5dbe9fb..eb046f3d 100644 --- a/app/models/users_role.rb +++ b/app/models/users_role.rb @@ -4,11 +4,8 @@ class UsersRole < ApplicationRecord belongs_to :role belongs_to :user - has_paper_trail on: [:create, :destroy], meta: { conference_id: :conference_id } + delegate :conference_id, :organization_id, to: :role - private - - def conference_id - role.resource_id - end + has_paper_trail on: [:create, :destroy], + meta: { conference_id: :conference_id, organization_id: :organization_id } end diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index 1728b999..be9f4741 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -15,18 +15,14 @@ - role = current_or_last_object_state('Role', object.role_id) - role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: object.role_id).last.changeset[:name].second role - - if role_name == 'organization_admin' - - if Organization.find_by(id: version.conference_id) - -# organization_admin belongs to organization and not conferences - - organization = Organization.find_by(id: version.conference_id) - = link_if_alive version, role_name, - admins_admin_organization_path(organization), organization - - else - (Deleted Organization) - - else + - if version.conference_id - conference = Conference.find_by(id: version.conference_id) - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' = link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference + - elsif version.organization_id + - organization = Organization.find(version.organization_id) + = link_if_alive version, role_name, + admins_admin_organization_path(organization), organization = version.event == 'create' ? 'to' : 'from' user @@ -133,19 +129,15 @@ - when 'Role' role - role_name = object.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second - - if role_name == 'organization_admin' - - if Organization.find_by(id: version.conference_id) - -# organization_admin belongs to organization and not conferences - - organization = Organization.find_by(id: version.conference_id) - = link_if_alive version, role_name, - admins_admin_organization_path(organization), organization - - else - (Role Deleted) - - else + - if version.conference_id - conference = Conference.find_by(id: version.conference_id) - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' = link_if_alive version, role_name, admin_conference_role_path(conference_short_title, role_name), conference + - elsif version.organization_id + - organization = Organization.find(version.organization_id) + = link_if_alive version, role_name, + admins_admin_organization_path(organization), organization - when 'Venue' venue @@ -203,20 +195,16 @@ = link_to_user(version.item_id) - unless %w(Conference Subscription Registration User Organization).include?(version.item_type) - - if (version.item_type == 'Role' && role_name == 'organization_admin') || (version.item_type == 'UsersRole' && role_name == 'organization_admin') - in organization - - if Organization.find_by(id: version.conference_id) - -# organization_admin belongs to organization and not conferences - - organization = Organization.find_by(id: version.conference_id) - = link_to_organization(version.conference_id) - - else - (Organization Deleted) - - elsif version.item_type == 'Commercial' + - if version.item_type == 'Commercial' - commercial = current_or_last_object_state(version.item_type, version.item_id) - commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id) - unless commercial.commercialable_type == 'Conference' in conference = link_to_conference(version.conference_id) + - elsif version.organization_id + - organization = Organization.find(version.organization_id) + in organization + = link_to_organization(version.organization_id) - else in conference = link_to_conference(version.conference_id) diff --git a/db/migrate/20200331214534_add_organization_to_versions.rb b/db/migrate/20200331214534_add_organization_to_versions.rb new file mode 100644 index 00000000..dc3e06f7 --- /dev/null +++ b/db/migrate/20200331214534_add_organization_to_versions.rb @@ -0,0 +1,35 @@ +class AddOrganizationToVersions < ActiveRecord::Migration[5.2] + def up + add_reference :versions, :organization + deconflate + end + + def down + conflate + remove_reference :versions, :organization + end + + private + + def conflate + say 'conflate' + + PaperTrail::Version.where.not(organization_id: nil).each do |version| + version.update_attributes conference_id: version.organization_id + end + end + + def deconflate + say 'deconflate' + + PaperTrail::Version.where.not(conference_id: nil).where(item_type: %[Role UsersRole]).each do |version| + id = version.conference_id + + if Organization.exists?(id) + raise "version #{version.id} conflates organization #{id} with conference #{id}" if Conference.exists?(id) + + version.update_attributes conference_id: nil, organization_id: id + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 2cb9ac88..4602a3b5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20181113195810) do +ActiveRecord::Schema.define(version: 2020_03_31_214534) do create_table "answers", force: :cascade do |t| t.string "title" @@ -639,7 +639,9 @@ ActiveRecord::Schema.define(version: 20181113195810) do t.text "object_changes" t.datetime "created_at" t.integer "conference_id" + t.integer "organization_id" t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + t.index ["organization_id"], name: "index_versions_on_organization_id" end create_table "votes", force: :cascade do |t| From faffc49020140a63fb00cc0defb1c25a86086b73 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Fri, 3 Apr 2020 16:32:03 -0700 Subject: [PATCH 09/24] Exclude Rails database schema from linting The schema is automatically generated, so RuboCop's recommendations are non-actionable; ignore it as in rubocop-hq/rubocop#752. --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 23ceccc8..e56339ca 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,8 @@ AllCops: UseCache: true CacheRootDirectory: tmp/rubocop_cache_rails_dir MaxFilesInCache: 4000 + Exclude: + - db/schema.rb #################### Style ########################### diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a7514f19..9037d43f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1155,7 +1155,6 @@ Style/StringLiterals: - 'config/deploy.rb' - 'config/environments/production.rb' - 'config/puma.rb' - - 'db/schema.rb' - 'lib/tasks/dump_db.rake' - 'lib/tasks/events_registrations.rake' - 'lib/tasks/factory_bot.rake' From 17c0abb2dee5d406595af8b4b19f70450a6c6540 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Fri, 3 Apr 2020 17:06:36 -0700 Subject: [PATCH 10/24] Don't clobber RuboCop's default excludes By default, adding an exclude (faffc49) has the effect of removing the default excludes. Merge them as described in rubocop-hq/rubocop#6567. --- .rubocop.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index e56339ca..bdb72694 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,10 @@ require: rubocop-rspec inherit_from: .rubocop_todo.yml +inherit_mode: + merge: + - Exclude + AllCops: UseCache: true CacheRootDirectory: tmp/rubocop_cache_rails_dir From 5b3520801f5ecd5b21ab3b19d8ad760425dd432b Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sat, 4 Apr 2020 21:48:31 -0700 Subject: [PATCH 11/24] Use correct loading mode of Bootstrap-Markdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit data-provide="markdown-editable" is intended for inline editing of page content à la contenteditable. When this is applied to a textarea, the editor is loaded only after the user clicks on the field. This behavior breaks focus and is incompatible with keyboard navigation. --- app/views/admin/cfps/_form.html.haml | 2 +- app/views/admin/conferences/edit.html.haml | 2 +- app/views/admin/lodgings/_form.html.haml | 2 +- app/views/admin/organizations/_form.html.haml | 4 ++-- app/views/admin/resources/_form.html.haml | 2 +- app/views/admin/sponsors/_form.html.haml | 2 +- app/views/admin/tickets/_form.html.haml | 2 +- app/views/admin/tracks/_form.html.haml | 2 +- app/views/admin/users/_form.html.haml | 2 +- app/views/admin/venues/_form.html.haml | 2 +- app/views/booths/_form.html.haml | 6 +++--- app/views/proposals/_proposal_form.html.haml | 2 +- app/views/proposals/new.html.haml | 2 +- app/views/tracks/_form.html.haml | 4 ++-- app/views/users/edit.html.haml | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/views/admin/cfps/_form.html.haml b/app/views/admin/cfps/_form.html.haml index 1cff0645..8e3c7f35 100644 --- a/app/views/admin/cfps/_form.html.haml +++ b/app/views/admin/cfps/_form.html.haml @@ -17,7 +17,7 @@ input_html: { class: 'form-control', id: 'registration-period-end-datepicker' } = f.input :description, hint: markdown_hint, - input_html: { rows: 2, data: { provide: 'markdown-editable' } } + input_html: { rows: 2, data: { provide: 'markdown' } } - if cfp.cfp_type == 'events' = f.input :enable_registrations, as: :boolean, hint: 'Allow submitters to request registration?' diff --git a/app/views/admin/conferences/edit.html.haml b/app/views/admin/conferences/edit.html.haml index edb8f12b..456c5f12 100644 --- a/app/views/admin/conferences/edit.html.haml +++ b/app/views/admin/conferences/edit.html.haml @@ -9,7 +9,7 @@ = semantic_form_for(@conference, url: admin_conference_path(@conference.short_title), html: {multipart: true}) do |f| = f.input :title, hint: "The full title of the conference, e.g. 'openSUSE Conference 2014'" = f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs" - = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } } + = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown' } } = f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'} = f.label 'Conference Logo' %br diff --git a/app/views/admin/lodgings/_form.html.haml b/app/views/admin/lodgings/_form.html.haml index 11d829aa..8d5ba82e 100644 --- a/app/views/admin/lodgings/_form.html.haml +++ b/app/views/admin/lodgings/_form.html.haml @@ -11,7 +11,7 @@ = semantic_form_for(@lodging, url: (@lodging.new_record? ? admin_conference_lodgings_path : admin_conference_lodging_path(@conference.short_title, @lodging))) do |f| = f.input :name, input_html: { autofocus: true} = f.input :website_link, input_html: { type: :url } - = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint + = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown' } }, hint: markdown_hint - if @lodging.picture? = image_tag @lodging.picture.thumb.url = f.input :picture diff --git a/app/views/admin/organizations/_form.html.haml b/app/views/admin/organizations/_form.html.haml index fa326431..9e8db2a1 100644 --- a/app/views/admin/organizations/_form.html.haml +++ b/app/views/admin/organizations/_form.html.haml @@ -2,11 +2,11 @@ = f.inputs name: 'Organization details' do = f.input :name, as: :string, required: true = f.input :description, as: :text, - input_html: { rows: 10, data: { provide: 'markdown-editable' } }, + input_html: { rows: 10, data: { provide: 'markdown' } }, hint: markdown_hint, placeholder: 'Decribe about your organization...' = f.input :code_of_conduct, as: :text, - input_html: { rows: 10, data: { provide: 'markdown-editable' } }, + input_html: { rows: 10, data: { provide: 'markdown' } }, hint: markdown_hint, placeholder: 'Rules governing behavior and dispute resolution...' = image_tag f.object.picture.thumb.url if f.object.picture? diff --git a/app/views/admin/resources/_form.html.haml b/app/views/admin/resources/_form.html.haml index ce5f25b0..a7a1b328 100644 --- a/app/views/admin/resources/_form.html.haml +++ b/app/views/admin/resources/_form.html.haml @@ -9,7 +9,7 @@ .col-md-8 = semantic_form_for(@resource, :url => (@resource.new_record? ? admin_conference_resources_path : admin_conference_resource_path(@conference.short_title, @resource))) do |f| = f.input :name, input_html: { autofocus: true } - = f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } } + = f.input :description, input_html: { rows: 5, data: { provide: 'markdown' } } = f.input :used = f.input :quantity %p.text-right diff --git a/app/views/admin/sponsors/_form.html.haml b/app/views/admin/sponsors/_form.html.haml index 5e475714..19bc2ae6 100644 --- a/app/views/admin/sponsors/_form.html.haml +++ b/app/views/admin/sponsors/_form.html.haml @@ -10,7 +10,7 @@ .col-md-8 = semantic_form_for(@sponsor, url: (@sponsor.new_record? ? admin_conference_sponsors_path : admin_conference_sponsor_path(@conference.short_title, @sponsor))) do |f| = f.input :name, input_html: { autofocus: true } - = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint + = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown' } }, hint: markdown_hint = image_tag f.object.picture.thumb.url if f.object.picture? = f.input :picture = f.input :website_url diff --git a/app/views/admin/tickets/_form.html.haml b/app/views/admin/tickets/_form.html.haml index f66cea51..8e07116f 100644 --- a/app/views/admin/tickets/_form.html.haml +++ b/app/views/admin/tickets/_form.html.haml @@ -10,7 +10,7 @@ .col-md-8 = semantic_form_for(@ticket, url: (@ticket.new_record? ? admin_conference_tickets_path : admin_conference_ticket_path(@conference.short_title, @ticket))) do |f| = f.input :title, input_html: { autofocus: true } - = f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } } + = f.input :description, input_html: { rows: 5, data: { provide: 'markdown' } } = f.input :price = f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY', 'CHF'], include_blank: false = f.input :registration_ticket, hint: 'A registration ticket is with which user register for the conference.' diff --git a/app/views/admin/tracks/_form.html.haml b/app/views/admin/tracks/_form.html.haml index cfdd9bf3..7c9fda4e 100644 --- a/app/views/admin/tracks/_form.html.haml +++ b/app/views/admin/tracks/_form.html.haml @@ -23,6 +23,6 @@ with = link_to 'rooms', admin_conference_venue_rooms_path(@conference.short_title) , if you want to select a room for the track. - = f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, hint: markdown_hint + = f.input :description, input_html: {rows: 2, data: { provide: 'markdown' } }, hint: markdown_hint = f.input :cfp_active, label: 'Allow event submitters to select this track for their proposal' = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index 40ec8a7a..7604f0d3 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -20,7 +20,7 @@ = f.input :email = f.input :password if @user.new_record? = f.input :affiliation, as: :string - = f.input :biography, input_html: { rows: 10, data: { provide: 'markdown-editable' } }, + = f.input :biography, input_html: { rows: 10, data: { provide: 'markdown' } }, hint: markdown_hint = f.actions do = f.action :submit, button_html: {class: 'btn btn-primary'} diff --git a/app/views/admin/venues/_form.html.haml b/app/views/admin/venues/_form.html.haml index 6674305b..1c68282f 100644 --- a/app/views/admin/venues/_form.html.haml +++ b/app/views/admin/venues/_form.html.haml @@ -14,7 +14,7 @@ .col-md-8 = semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f| = f.inputs :name, :website - = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint + = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown' } }, hint: markdown_hint = f.label 'Venue Logo' %br - if @venue.picture? diff --git a/app/views/booths/_form.html.haml b/app/views/booths/_form.html.haml index 583db3d9..8135de50 100644 --- a/app/views/booths/_form.html.haml +++ b/app/views/booths/_form.html.haml @@ -3,11 +3,11 @@ .col-md-8 = semantic_form_for(@booth, url: @url, html: { multipart: true }) do |f| = f.input :title, as: :string, input_html: { autofocus: true }, required: true - = f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true, + = f.input :description, input_html: { rows: 5, data: { provide: 'markdown' } }, required: true, hint: 'This field becomes public upon request acceptance' - = f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true, + = f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown' } }, required: true, label: 'How it fits the conference' - = f.input :submitter_relationship, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true, + = f.input :submitter_relationship, input_html: { rows: 5, data: { provide: 'markdown' } }, required: true, label: 'Submitter\'s relation', hint: 'e.g. employee, comunity manager, etc' = f.input :website_url diff --git a/app/views/proposals/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml index e4d72ae3..65f8fe22 100644 --- a/app/views/proposals/_proposal_form.html.haml +++ b/app/views/proposals/_proposal_form.html.haml @@ -29,7 +29,7 @@ %span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" } = difficulty_level.description - = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, + = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown' } }, hint: markdown_hint('[Tips to improve your presentations.](http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx)') %p diff --git a/app/views/proposals/new.html.haml b/app/views/proposals/new.html.haml index 7885f990..63916751 100644 --- a/app/views/proposals/new.html.haml +++ b/app/views/proposals/new.html.haml @@ -45,7 +45,7 @@ %span{ class: 'help-block event_event_type_id collapse', id: "#{event_type.id}-help" } = event_type.description - = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, + = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown' } }, hint: markdown_hint('[Tips to improve your presentations.](http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx)') %p diff --git a/app/views/tracks/_form.html.haml b/app/views/tracks/_form.html.haml index 42832e80..1fc8bc5a 100644 --- a/app/views/tracks/_form.html.haml +++ b/app/views/tracks/_form.html.haml @@ -15,6 +15,6 @@ = f.input :color, input_html: {size: 6, type: 'color'}, required: true = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' } = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' } - = f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, required: true, hint: "This will be public #{markdown_hint}".html_safe - = f.input :relevance, input_html: {rows: 5, data: { provide: 'markdown-editable' } }, required: true, hint: "Please explain here how this track relates to the conference, how you are related to its content and why we should accept it. #{markdown_hint}".html_safe + = f.input :description, input_html: {rows: 2, data: { provide: 'markdown' } }, required: true, hint: "This will be public #{markdown_hint}".html_safe + = f.input :relevance, input_html: {rows: 5, data: { provide: 'markdown' } }, required: true, hint: "Please explain here how this track relates to the conference, how you are related to its content and why we should accept it. #{markdown_hint}".html_safe = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 6f70b651..52c0d57f 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -14,7 +14,7 @@ = link_to 'Change your avatar here', 'https://gravatar.com' = f.input :affiliation, as: :string, hint: 'This could be a company, a user group, or nothing at all.' - = f.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, + = f.input :biography, input_html: { rows: 5, data: { provide: 'markdown' } }, hint: markdown_hint You have used %span#bio_length From 3142c0f164c8559a62b170551598f9fba587cda3 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Apr 2020 10:16:40 -0700 Subject: [PATCH 12/24] Fix bug in logging of screenshots of failed tests Presumably this was a typo. --- spec/support/save_feature_failures.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb index 8b1fb104..7cb73bc7 100644 --- a/spec/support/save_feature_failures.rb +++ b/spec/support/save_feature_failures.rb @@ -9,7 +9,7 @@ RSpec.configure do |config| example_filename += '.html' if RSpec.current_example.exception.present? save_page(example_filename) - save_page(example_screenshotname) + save_screenshot(example_screenshotname) # remove the file if the test starts working again else File.unlink(example_filename) if File.exist?(example_filename) From 75f64508dec6954ea859b78411b99378e4b84f71 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Apr 2020 10:20:46 -0700 Subject: [PATCH 13/24] Work around RuboCop false positive Details: rubocop-hq/rubocop#7853 --- spec/support/save_feature_failures.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb index 7cb73bc7..3f7129c4 100644 --- a/spec/support/save_feature_failures.rb +++ b/spec/support/save_feature_failures.rb @@ -9,7 +9,7 @@ RSpec.configure do |config| example_filename += '.html' if RSpec.current_example.exception.present? save_page(example_filename) - save_screenshot(example_screenshotname) + save_screenshot(example_screenshotname) # rubocop:disable Lint/Debugger # remove the file if the test starts working again else File.unlink(example_filename) if File.exist?(example_filename) From 3aa32aebe8166bbbb771abef99c620de4582f010 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Apr 2020 07:59:29 -0700 Subject: [PATCH 14/24] Remove redundant code This functionality is provided by transactional_capybara. --- spec/support/kneet_connections.rb | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 spec/support/kneet_connections.rb diff --git a/spec/support/kneet_connections.rb b/spec/support/kneet_connections.rb deleted file mode 100644 index 87f0bcd5..00000000 --- a/spec/support/kneet_connections.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module ActiveRecord - class Base - mattr_accessor :shared_connection - @@shared_connection = nil - - def self.connection - @@shared_connection || retrieve_connection - end - end -end - -ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection From 11a7e056bff958fcc6e2f4a19003e9da269564ae Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Apr 2020 11:16:15 -0700 Subject: [PATCH 15/24] Fix bug in test database preparation Presumably the intent of this was to clear the database and repopulate it with seed data. `transaction` isn't the right strategy for this; it just rolls back any existing transactions. --- spec/support/database_cleaner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index c9d3073b..651e1474 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -2,7 +2,7 @@ RSpec.configure do |config| config.before(:suite) do - DatabaseCleaner.clean_with(:transaction) + DatabaseCleaner.clean_with(:truncation) Rails.application.load_seed end From ae00a7f05595d8c2f922c531d4e362b152e84ea2 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Apr 2020 12:51:30 -0700 Subject: [PATCH 16/24] Use Rails transactional tests As of Rails 5.1: - Rails has built-in support for running tests within database transactions, so Database Cleaner is no longer needed for this. - Rails automatically shares the database connection across threads, so transactional_capybara is no longer needed. Changes: - Enable `use_transactional_tests`. - Remove transactional_capybara. - Remove the Database Cleaner test wrapper. This resolves: - transactional_capybara mismanages the shared database connection, causing the connection to falsely report as idle after the first test. At 6 minutes (idle_timeout + reaping_frequency) into testing, the connection is closed, causing e.g. `PG::ConnectionBad` errors. --- Gemfile | 1 - Gemfile.lock | 3 --- spec/features/commercials_spec.rb | 2 -- spec/features/proposals_spec.rb | 1 - spec/features/versions_spec.rb | 2 +- spec/spec_helper.rb | 9 ++------- spec/support/database_cleaner.rb | 9 --------- 7 files changed, 3 insertions(+), 24 deletions(-) diff --git a/Gemfile b/Gemfile index b281e1aa..61d3a87f 100644 --- a/Gemfile +++ b/Gemfile @@ -247,7 +247,6 @@ group :test do gem 'database_cleaner' gem 'geckodriver-helper' gem 'rspec-rails' - gem 'transactional_capybara' gem 'webdrivers' # for measuring test coverage gem 'codecov', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 604ba14f..2e86ffdc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -566,8 +566,6 @@ GEM thread_safe (0.3.6) tilt (2.0.9) timecop (0.9.1) - transactional_capybara (0.2.0) - capybara transitions (1.2.1) ttfunk (1.5.1) turbolinks (5.2.1) @@ -715,7 +713,6 @@ DEPENDENCIES stripe stripe-ruby-mock timecop - transactional_capybara transitions turbolinks uglifier (>= 1.3.0) diff --git a/spec/features/commercials_spec.rb b/spec/features/commercials_spec.rb index a0710f86..eaf0db72 100644 --- a/spec/features/commercials_spec.rb +++ b/spec/features/commercials_spec.rb @@ -85,7 +85,6 @@ feature Commercial do click_button 'Update' page.find('#flash') expect(flash).to eq('Commercial was successfully updated.') - TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) expect(event.commercials.count).to eq(1) commercial.reload expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw') @@ -118,7 +117,6 @@ feature Commercial do end page.find('#flash') expect(flash).to eq('Commercial was successfully destroyed.') - TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) expect(event.commercials.count).to eq(0) end end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 9bd0e1c3..fbb6b9b1 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -127,7 +127,6 @@ feature Event do page.find('#flash') expect(page).to have_content 'Proposal was successfully submitted.' - TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) expect(current_path).to eq(conference_program_proposals_path(conference.short_title)) expect(Event.count).to eq(expected_count) end diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index ec443fd0..3f4c18e0 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -392,7 +392,7 @@ feature 'Version' do click_link 'Comments (0)' fill_in 'comment_body', with: 'Sample comment' click_button 'Add Comment' - TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) + expect(page).to have_text('Comments (1)') Comment.last.destroy PaperTrail::Version.last.reify.save diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fe6bab9b..7d21f8e4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,9 +20,6 @@ require 'webdrivers' # all migrations applied ActiveRecord::Migration.maintain_test_schema! -# Keep capybara and the database on the same page -require 'transactional_capybara/rspec' - # Adds rspec helper provided by paper_trail # makes it easier to control when PaperTrail is enabled during testing. require 'paper_trail/frameworks/rspec' @@ -49,10 +46,8 @@ RSpec.configure do |config| # config.mock_with :flexmock # config.mock_with :rr - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = false + # Test within database transactions + config.use_transactional_examples = true # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index 651e1474..722e270d 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -5,13 +5,4 @@ RSpec.configure do |config| DatabaseCleaner.clean_with(:truncation) Rails.application.load_seed end - - config.before(:each) do - DatabaseCleaner.start - end - - config.after(:each) do |example| - TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) if example.metadata[:js] - DatabaseCleaner.clean - end end From e077fe9671addc22b66d7ab7be6ef89add0d48eb Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 12 Apr 2020 10:04:20 -0700 Subject: [PATCH 17/24] Fix bug in test of animated form The help text for the event type field is animated using a technique unaffected by `Capybara.disable_animation`. Wait for the animation. Resolves: #2356 Works around: #2661 --- spec/features/proposals_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 9bd0e1c3..8afbf46c 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -114,9 +114,12 @@ feature Event do visit conference_program_proposals_path(conference.short_title) click_link 'New Proposal' + expect(page).to have_selector(".in[id='#{find_field('event[event_type_id]').value}-help']") # End of animation fill_in 'event_title', with: 'Example Proposal' select('Example Event Type', from: 'event[event_type_id]') + expect(page).to have_selector(".in[id='#{find_field('event[event_type_id]').value}-help']") # End of animation + fill_in 'event_abstract', with: 'Lorem ipsum abstract' expect(page).to have_text('You have used 3 words') From e657d37c8d7dbdaa9edcde6b598614d510643ebf Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 16 Mar 2020 19:03:56 -0700 Subject: [PATCH 18/24] Whitelist Webdrivers update URLs in WebMock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #2557: $ docker-compose run --rm osem bundle exec rspec --tag js … WebMock::NetConnectNotAllowedError See titusfortner/webdrivers#109 for details. --- spec/support/external_request.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/support/external_request.rb b/spec/support/external_request.rb index fb69975f..a3ebf939 100644 --- a/spec/support/external_request.rb +++ b/spec/support/external_request.rb @@ -2,7 +2,10 @@ # Mock external requests to youtube require 'webmock/rspec' -WebMock.disable_net_connect!(allow_localhost: true, allow: /stripe.com/) +driver_urls = Webdrivers::Common.subclasses.map do |driver| + Addressable::URI.parse(driver.base_url).host +end +WebMock.disable_net_connect!(allow_localhost: true, allow: [*driver_urls, /stripe.com/]) RSpec.configure do |config| config.before(:each) do From c34b55c1b81a4e10cf5116611678ca61798c1a26 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 13 Apr 2020 08:13:07 -0700 Subject: [PATCH 19/24] =?UTF-8?q?Update=20Docker=20Compose=20file=20format?= =?UTF-8?q?:=202.0=20=E2=86=92=202.4=20(minor)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows the use of additional parameters such as `cpus` and `healthcheck`. --- docker-compose.override.yml.example | 3 ++- docker-compose.yml | 2 +- docker-compose.yml.production-example | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.override.yml.example b/docker-compose.override.yml.example index f5dca21d..2d816375 100644 --- a/docker-compose.override.yml.example +++ b/docker-compose.override.yml.example @@ -1,4 +1,5 @@ -version: '2' +version: "2.4" + services: osem: build: diff --git a/docker-compose.yml b/docker-compose.yml index 8f31749c..f611991e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "2" +version: "2.4" services: database: diff --git a/docker-compose.yml.production-example b/docker-compose.yml.production-example index 73fa1ad1..933f1d24 100644 --- a/docker-compose.yml.production-example +++ b/docker-compose.yml.production-example @@ -1,4 +1,4 @@ -version: "2" +version: "2.4" services: production_database: From 4a0961e88e4de98e5fbd31a1a1ef861171349c4f Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 11 May 2020 12:38:36 -0700 Subject: [PATCH 20/24] Annotate past migrations with Rails version Many migrations currently fail to run with: > Directly inheriting from ActiveRecord::Migration is not supported. > Please specify the Rails release the migration was written for: > > class Example < ActiveRecord::Migration[4.2] I've annotated those that I need to run with the Rails version at the time each was committed: rake db:migrate:status \ | grep --perl-regexp --only-matching '(?<=^ down )\d{14}' \ | while read -r id; do path="$(ls -1 db/migrate/${id}_*.rb)" version="$(git show "$(git log --diff-filter=A --pretty=format:%H -- "$path")":Gemfile.lock \ | grep --perl-regexp --only-matching '(?<=^ rails \()\d+\.\d+(?=(\.\d+)+\))')" sed --in-place -e "s/\(< ActiveRecord::Migration\)$/\\1[$version]/" "$path" done --- db/migrate/20160627122446_create_surveys.rb | 2 +- db/migrate/20160628093634_create_survey_questions.rb | 2 +- db/migrate/20160629145954_add_target_to_surveys.rb | 2 +- db/migrate/20160630094850_create_survey_replies.rb | 2 +- db/migrate/20160630130731_create_survey_submissions.rb | 2 +- db/migrate/20161229080315_add_comments_count_to_events.rb | 2 +- .../20170108053041_add_default_to_revision_in_conference.rb | 2 +- db/migrate/20170212145523_add_enabled_to_event_schedules.rb | 2 +- db/migrate/20170516190048_create_booths.rb | 2 +- db/migrate/20170530072155_add_type_to_cfps.rb | 2 +- db/migrate/20170530112510_create_booth_requests.rb | 2 +- db/migrate/20170603095900_create_physical_tickets.rb | 2 +- db/migrate/20170629162450_add_short_name_to_tracks.rb | 2 +- db/migrate/20170629232817_add_ticket_layout_to_conferences.rb | 2 +- ...39_add_state_cfp_active_and_submitter_reference_to_tracks.rb | 2 +- db/migrate/20170711102511_create_ticket_scannings.rb | 2 +- db/migrate/20170712120556_add_room_and_dates_to_tracks.rb | 2 +- ...715131706_make_track_state_not_null_and_add_default_value.rb | 2 +- db/migrate/20170720134353_make_track_cfp_active_not_null.rb | 2 +- db/migrate/20170721001700_add_index_to_physical_tickets.rb | 2 +- db/migrate/20170721184810_add_custom_domain_to_conferences.rb | 2 +- db/migrate/20170726065629_add_relevance_to_tracks.rb | 2 +- db/migrate/20170727081731_add_include_booths_to_splashpages.rb | 2 +- db/migrate/20170728182033_add_booth_limit_to_conferences.rb | 2 +- db/migrate/20170731161207_add_booths_to_email_settings.rb | 2 +- db/migrate/20170807092805_add_registration_ticket_to_tickets.rb | 2 +- db/migrate/20170809120927_add_track_reference_to_schedule.rb | 2 +- db/migrate/20170814174637_add_selected_schedule_to_tracks.rb | 2 +- db/migrate/20170905110034_add_description_to_cfps.rb | 2 +- .../20170924190528_add_amount_paid_to_ticket_purchases.rb | 2 +- db/migrate/20171130172334_rebuild_conference_pictures.rb | 2 +- db/migrate/20171201163628_add_mastodon_to_contact.rb | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/db/migrate/20160627122446_create_surveys.rb b/db/migrate/20160627122446_create_surveys.rb index ca7f52ea..9fdfd30d 100644 --- a/db/migrate/20160627122446_create_surveys.rb +++ b/db/migrate/20160627122446_create_surveys.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateSurveys < ActiveRecord::Migration +class CreateSurveys < ActiveRecord::Migration[5.0] def change create_table :surveys do |t| t.datetime :start_date diff --git a/db/migrate/20160628093634_create_survey_questions.rb b/db/migrate/20160628093634_create_survey_questions.rb index 63020a7d..b89dd3b2 100644 --- a/db/migrate/20160628093634_create_survey_questions.rb +++ b/db/migrate/20160628093634_create_survey_questions.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateSurveyQuestions < ActiveRecord::Migration +class CreateSurveyQuestions < ActiveRecord::Migration[5.0] def change create_table :survey_questions do |t| t.references :survey diff --git a/db/migrate/20160629145954_add_target_to_surveys.rb b/db/migrate/20160629145954_add_target_to_surveys.rb index 385ea38a..e0efc45d 100644 --- a/db/migrate/20160629145954_add_target_to_surveys.rb +++ b/db/migrate/20160629145954_add_target_to_surveys.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddTargetToSurveys < ActiveRecord::Migration +class AddTargetToSurveys < ActiveRecord::Migration[5.0] def change add_column :surveys, :target, :integer, default: 0 end diff --git a/db/migrate/20160630094850_create_survey_replies.rb b/db/migrate/20160630094850_create_survey_replies.rb index 8e8d43a2..fb8f3b83 100644 --- a/db/migrate/20160630094850_create_survey_replies.rb +++ b/db/migrate/20160630094850_create_survey_replies.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateSurveyReplies < ActiveRecord::Migration +class CreateSurveyReplies < ActiveRecord::Migration[5.0] def change create_table :survey_replies do |t| t.integer :survey_question_id diff --git a/db/migrate/20160630130731_create_survey_submissions.rb b/db/migrate/20160630130731_create_survey_submissions.rb index a64c4e5d..35a89fc8 100644 --- a/db/migrate/20160630130731_create_survey_submissions.rb +++ b/db/migrate/20160630130731_create_survey_submissions.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateSurveySubmissions < ActiveRecord::Migration +class CreateSurveySubmissions < ActiveRecord::Migration[5.0] def change create_table :survey_submissions do |t| t.integer :user_id diff --git a/db/migrate/20161229080315_add_comments_count_to_events.rb b/db/migrate/20161229080315_add_comments_count_to_events.rb index 25e9ed58..b886b079 100644 --- a/db/migrate/20161229080315_add_comments_count_to_events.rb +++ b/db/migrate/20161229080315_add_comments_count_to_events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddCommentsCountToEvents < ActiveRecord::Migration +class AddCommentsCountToEvents < ActiveRecord::Migration[4.2] def change add_column :events, :comments_count, :integer, default: 0, null: false diff --git a/db/migrate/20170108053041_add_default_to_revision_in_conference.rb b/db/migrate/20170108053041_add_default_to_revision_in_conference.rb index 1e06838c..66517402 100644 --- a/db/migrate/20170108053041_add_default_to_revision_in_conference.rb +++ b/db/migrate/20170108053041_add_default_to_revision_in_conference.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddDefaultToRevisionInConference < ActiveRecord::Migration +class AddDefaultToRevisionInConference < ActiveRecord::Migration[4.2] def change change_column :conferences, :revision, :integer, default: 0, null: false end diff --git a/db/migrate/20170212145523_add_enabled_to_event_schedules.rb b/db/migrate/20170212145523_add_enabled_to_event_schedules.rb index 9d9cb819..e4255dfd 100644 --- a/db/migrate/20170212145523_add_enabled_to_event_schedules.rb +++ b/db/migrate/20170212145523_add_enabled_to_event_schedules.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddEnabledToEventSchedules < ActiveRecord::Migration +class AddEnabledToEventSchedules < ActiveRecord::Migration[5.0] def change add_column :event_schedules, :enabled, :boolean, default: true end diff --git a/db/migrate/20170516190048_create_booths.rb b/db/migrate/20170516190048_create_booths.rb index 4c315511..944fd30a 100644 --- a/db/migrate/20170516190048_create_booths.rb +++ b/db/migrate/20170516190048_create_booths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateBooths < ActiveRecord::Migration +class CreateBooths < ActiveRecord::Migration[4.2] def change create_table :booths do |t| t.string :title diff --git a/db/migrate/20170530072155_add_type_to_cfps.rb b/db/migrate/20170530072155_add_type_to_cfps.rb index 603a6de0..9cfae8bf 100644 --- a/db/migrate/20170530072155_add_type_to_cfps.rb +++ b/db/migrate/20170530072155_add_type_to_cfps.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddTypeToCfps < ActiveRecord::Migration +class AddTypeToCfps < ActiveRecord::Migration[4.2] class TmpCfp < ActiveRecord::Base self.table_name = 'cfps' end diff --git a/db/migrate/20170530112510_create_booth_requests.rb b/db/migrate/20170530112510_create_booth_requests.rb index a6358a68..a244c309 100644 --- a/db/migrate/20170530112510_create_booth_requests.rb +++ b/db/migrate/20170530112510_create_booth_requests.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateBoothRequests < ActiveRecord::Migration +class CreateBoothRequests < ActiveRecord::Migration[4.2] def change create_table :booth_requests do |t| t.references :booth, index: true, foreign_key: true diff --git a/db/migrate/20170603095900_create_physical_tickets.rb b/db/migrate/20170603095900_create_physical_tickets.rb index ef8abb65..20d3c838 100644 --- a/db/migrate/20170603095900_create_physical_tickets.rb +++ b/db/migrate/20170603095900_create_physical_tickets.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreatePhysicalTickets < ActiveRecord::Migration +class CreatePhysicalTickets < ActiveRecord::Migration[4.2] def change create_table :physical_tickets do |t| t.integer :ticket_purchase_id, null: false diff --git a/db/migrate/20170629162450_add_short_name_to_tracks.rb b/db/migrate/20170629162450_add_short_name_to_tracks.rb index a334885f..9cb2054b 100644 --- a/db/migrate/20170629162450_add_short_name_to_tracks.rb +++ b/db/migrate/20170629162450_add_short_name_to_tracks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddShortNameToTracks < ActiveRecord::Migration +class AddShortNameToTracks < ActiveRecord::Migration[4.2] class TmpProgram < ActiveRecord::Base self.table_name = 'programs' end diff --git a/db/migrate/20170629232817_add_ticket_layout_to_conferences.rb b/db/migrate/20170629232817_add_ticket_layout_to_conferences.rb index faf67332..36a1028c 100644 --- a/db/migrate/20170629232817_add_ticket_layout_to_conferences.rb +++ b/db/migrate/20170629232817_add_ticket_layout_to_conferences.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddTicketLayoutToConferences < ActiveRecord::Migration +class AddTicketLayoutToConferences < ActiveRecord::Migration[4.2] def change add_column :conferences, :ticket_layout, :integer, default: 0 end diff --git a/db/migrate/20170705075039_add_state_cfp_active_and_submitter_reference_to_tracks.rb b/db/migrate/20170705075039_add_state_cfp_active_and_submitter_reference_to_tracks.rb index b42cf9c2..4094812b 100644 --- a/db/migrate/20170705075039_add_state_cfp_active_and_submitter_reference_to_tracks.rb +++ b/db/migrate/20170705075039_add_state_cfp_active_and_submitter_reference_to_tracks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddStateCfpActiveAndSubmitterReferenceToTracks < ActiveRecord::Migration +class AddStateCfpActiveAndSubmitterReferenceToTracks < ActiveRecord::Migration[4.2] def change add_column :tracks, :state, :string add_column :tracks, :cfp_active, :boolean diff --git a/db/migrate/20170711102511_create_ticket_scannings.rb b/db/migrate/20170711102511_create_ticket_scannings.rb index 12c20eb1..bbf35e3c 100644 --- a/db/migrate/20170711102511_create_ticket_scannings.rb +++ b/db/migrate/20170711102511_create_ticket_scannings.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateTicketScannings < ActiveRecord::Migration +class CreateTicketScannings < ActiveRecord::Migration[4.2] def change create_table :ticket_scannings do |t| t.integer :physical_ticket_id, null: false diff --git a/db/migrate/20170712120556_add_room_and_dates_to_tracks.rb b/db/migrate/20170712120556_add_room_and_dates_to_tracks.rb index 6c2d92b9..6cd0228c 100644 --- a/db/migrate/20170712120556_add_room_and_dates_to_tracks.rb +++ b/db/migrate/20170712120556_add_room_and_dates_to_tracks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddRoomAndDatesToTracks < ActiveRecord::Migration +class AddRoomAndDatesToTracks < ActiveRecord::Migration[4.2] def change add_reference :tracks, :room, index: true, foreign_key: true add_column :tracks, :start_date, :date diff --git a/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb b/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb index 2d8d9b2d..54c6979f 100644 --- a/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb +++ b/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration +class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration[4.2] class TmpTrack < ActiveRecord::Base self.table_name = 'tracks' end diff --git a/db/migrate/20170720134353_make_track_cfp_active_not_null.rb b/db/migrate/20170720134353_make_track_cfp_active_not_null.rb index b96d84fe..c0097532 100644 --- a/db/migrate/20170720134353_make_track_cfp_active_not_null.rb +++ b/db/migrate/20170720134353_make_track_cfp_active_not_null.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MakeTrackCfpActiveNotNull < ActiveRecord::Migration +class MakeTrackCfpActiveNotNull < ActiveRecord::Migration[4.2] class TmpTrack < ActiveRecord::Base self.table_name = 'tracks' end diff --git a/db/migrate/20170721001700_add_index_to_physical_tickets.rb b/db/migrate/20170721001700_add_index_to_physical_tickets.rb index 042430fe..08a436e6 100644 --- a/db/migrate/20170721001700_add_index_to_physical_tickets.rb +++ b/db/migrate/20170721001700_add_index_to_physical_tickets.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddIndexToPhysicalTickets < ActiveRecord::Migration +class AddIndexToPhysicalTickets < ActiveRecord::Migration[4.2] def change add_column :physical_tickets, :token, :string add_index :physical_tickets, :token, unique: true diff --git a/db/migrate/20170721184810_add_custom_domain_to_conferences.rb b/db/migrate/20170721184810_add_custom_domain_to_conferences.rb index a3e2897b..664bfbbe 100644 --- a/db/migrate/20170721184810_add_custom_domain_to_conferences.rb +++ b/db/migrate/20170721184810_add_custom_domain_to_conferences.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddCustomDomainToConferences < ActiveRecord::Migration +class AddCustomDomainToConferences < ActiveRecord::Migration[4.2] def change add_column :conferences, :custom_domain, :string end diff --git a/db/migrate/20170726065629_add_relevance_to_tracks.rb b/db/migrate/20170726065629_add_relevance_to_tracks.rb index 7db35227..21f2d17c 100644 --- a/db/migrate/20170726065629_add_relevance_to_tracks.rb +++ b/db/migrate/20170726065629_add_relevance_to_tracks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddRelevanceToTracks < ActiveRecord::Migration +class AddRelevanceToTracks < ActiveRecord::Migration[4.2] def change add_column :tracks, :relevance, :text end diff --git a/db/migrate/20170727081731_add_include_booths_to_splashpages.rb b/db/migrate/20170727081731_add_include_booths_to_splashpages.rb index ea5882c1..350e1851 100644 --- a/db/migrate/20170727081731_add_include_booths_to_splashpages.rb +++ b/db/migrate/20170727081731_add_include_booths_to_splashpages.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddIncludeBoothsToSplashpages < ActiveRecord::Migration +class AddIncludeBoothsToSplashpages < ActiveRecord::Migration[4.2] def change add_column :splashpages, :include_booths, :boolean end diff --git a/db/migrate/20170728182033_add_booth_limit_to_conferences.rb b/db/migrate/20170728182033_add_booth_limit_to_conferences.rb index ae0f1410..1176375e 100644 --- a/db/migrate/20170728182033_add_booth_limit_to_conferences.rb +++ b/db/migrate/20170728182033_add_booth_limit_to_conferences.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddBoothLimitToConferences < ActiveRecord::Migration +class AddBoothLimitToConferences < ActiveRecord::Migration[4.2] def change add_column :conferences, :booth_limit, :integer, default: 0 end diff --git a/db/migrate/20170731161207_add_booths_to_email_settings.rb b/db/migrate/20170731161207_add_booths_to_email_settings.rb index 5df76759..422006ca 100644 --- a/db/migrate/20170731161207_add_booths_to_email_settings.rb +++ b/db/migrate/20170731161207_add_booths_to_email_settings.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddBoothsToEmailSettings < ActiveRecord::Migration +class AddBoothsToEmailSettings < ActiveRecord::Migration[4.2] def change add_column :email_settings, :send_on_booths_acceptance, :boolean, default: false add_column :email_settings, :booths_acceptance_subject, :string diff --git a/db/migrate/20170807092805_add_registration_ticket_to_tickets.rb b/db/migrate/20170807092805_add_registration_ticket_to_tickets.rb index c2e4fd8e..d3ce8184 100644 --- a/db/migrate/20170807092805_add_registration_ticket_to_tickets.rb +++ b/db/migrate/20170807092805_add_registration_ticket_to_tickets.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddRegistrationTicketToTickets < ActiveRecord::Migration +class AddRegistrationTicketToTickets < ActiveRecord::Migration[4.2] def change add_column :tickets, :registration_ticket, :boolean, default: false end diff --git a/db/migrate/20170809120927_add_track_reference_to_schedule.rb b/db/migrate/20170809120927_add_track_reference_to_schedule.rb index b98fca24..9a6a0ecc 100644 --- a/db/migrate/20170809120927_add_track_reference_to_schedule.rb +++ b/db/migrate/20170809120927_add_track_reference_to_schedule.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddTrackReferenceToSchedule < ActiveRecord::Migration +class AddTrackReferenceToSchedule < ActiveRecord::Migration[4.2] def change add_reference :schedules, :track, index: true, foreign_key: true end diff --git a/db/migrate/20170814174637_add_selected_schedule_to_tracks.rb b/db/migrate/20170814174637_add_selected_schedule_to_tracks.rb index bedc96c3..55ad57b3 100644 --- a/db/migrate/20170814174637_add_selected_schedule_to_tracks.rb +++ b/db/migrate/20170814174637_add_selected_schedule_to_tracks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddSelectedScheduleToTracks < ActiveRecord::Migration +class AddSelectedScheduleToTracks < ActiveRecord::Migration[4.2] def change add_column :tracks, :selected_schedule_id, :integer add_index :tracks, :selected_schedule_id diff --git a/db/migrate/20170905110034_add_description_to_cfps.rb b/db/migrate/20170905110034_add_description_to_cfps.rb index 968a907c..a058a1e1 100644 --- a/db/migrate/20170905110034_add_description_to_cfps.rb +++ b/db/migrate/20170905110034_add_description_to_cfps.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddDescriptionToCfps < ActiveRecord::Migration +class AddDescriptionToCfps < ActiveRecord::Migration[4.2] def change add_column :cfps, :description, :text end diff --git a/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb b/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb index f3357ee3..7ada30a4 100644 --- a/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb +++ b/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddAmountPaidToTicketPurchases < ActiveRecord::Migration +class AddAmountPaidToTicketPurchases < ActiveRecord::Migration[4.2] def change add_column :ticket_purchases, :amount_paid, :float, default: 0 end diff --git a/db/migrate/20171130172334_rebuild_conference_pictures.rb b/db/migrate/20171130172334_rebuild_conference_pictures.rb index c19ae041..66973433 100644 --- a/db/migrate/20171130172334_rebuild_conference_pictures.rb +++ b/db/migrate/20171130172334_rebuild_conference_pictures.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class RebuildConferencePictures < ActiveRecord::Migration +class RebuildConferencePictures < ActiveRecord::Migration[5.0] def up Conference.all.each do |conference| conference.picture.recreate_versions! diff --git a/db/migrate/20171201163628_add_mastodon_to_contact.rb b/db/migrate/20171201163628_add_mastodon_to_contact.rb index a3cc50b6..4ed4d8ff 100644 --- a/db/migrate/20171201163628_add_mastodon_to_contact.rb +++ b/db/migrate/20171201163628_add_mastodon_to_contact.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AddMastodonToContact < ActiveRecord::Migration +class AddMastodonToContact < ActiveRecord::Migration[5.0] def change add_column :contacts, :mastodon, :string end From 63aa240e65d6f94fb311cc30e27b74c0948dbc08 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 11 May 2020 12:50:34 -0700 Subject: [PATCH 21/24] Fix migration that fails on conferences without pictures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CarrierWave documentation: > Note: `recreate_versions!` will throw an exception on records without > an image. To avoid this, scope the records to those with images or > check if an image exists within the block. Resolves #1976: NoMethodError: undefined method `read' for nil:NilClass …/carrierwave-1.3.1/lib/carrierwave/uploader/cache.rb:81:in `sanitized_file' …/carrierwave-1.3.1/lib/carrierwave/uploader/cache.rb:118:in `cache!' …/carrierwave-1.3.1/lib/carrierwave/uploader/versions.rb:234:in `recreate_versions!' db/migrate/20171130172334_rebuild_conference_pictures.rb:4:in `block in up' --- db/migrate/20171130172334_rebuild_conference_pictures.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20171130172334_rebuild_conference_pictures.rb b/db/migrate/20171130172334_rebuild_conference_pictures.rb index c19ae041..36b398ac 100644 --- a/db/migrate/20171130172334_rebuild_conference_pictures.rb +++ b/db/migrate/20171130172334_rebuild_conference_pictures.rb @@ -2,7 +2,7 @@ class RebuildConferencePictures < ActiveRecord::Migration def up - Conference.all.each do |conference| + Conference.where.not(picture: nil).each do |conference| conference.picture.recreate_versions! end end From 16b7d6f69d7c37f30dc9a6f01e6e88be452c1e8c Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 11 May 2020 21:55:36 -0700 Subject: [PATCH 22/24] Work around bug in migrations to non-null columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running migration 20170705075039 followed by 20170715131706, the latter fails due to lingering null values in a newly non-null column— Mysql2::Error: Invalid use of NULL value: ALTER TABLE `tracks` CHANGE `state` `state` varchar(255) DEFAULT 'new' NOT NULL db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb:17:in `change' —despite having apparently converted any existing null values prior to changing the column type. Investigation reveals that actually the attempted conversion has had no effect, and that this can be resolved by clearing ActiveRecord internal caches between migrations: connection.schema_cache.clear_data_source_cache! 'tracks' The same problem also affects running 20170705075039 followed by 20170720134353, but in that case it leads to silent data corruption as `change_column_null` automatically converts any lingering null values. This commit 1) clears ActiveRecord internal caches at the beginning of each affected migration, and 2) replaces `change_column_null` with `change_column` to reflect that no automatic conversion is intended. --- ...5131706_make_track_state_not_null_and_add_default_value.rb | 2 ++ db/migrate/20170720134353_make_track_cfp_active_not_null.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb b/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb index 2d8d9b2d..6382df7b 100644 --- a/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb +++ b/db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb @@ -6,6 +6,8 @@ class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration end def change + TmpTrack.reset_column_information + TmpTrack.where(state: nil).each do |track| track.state = 'confirmed' track.save! diff --git a/db/migrate/20170720134353_make_track_cfp_active_not_null.rb b/db/migrate/20170720134353_make_track_cfp_active_not_null.rb index b96d84fe..916ede43 100644 --- a/db/migrate/20170720134353_make_track_cfp_active_not_null.rb +++ b/db/migrate/20170720134353_make_track_cfp_active_not_null.rb @@ -6,11 +6,13 @@ class MakeTrackCfpActiveNotNull < ActiveRecord::Migration end def change + TmpTrack.reset_column_information + TmpTrack.where(cfp_active: nil).each do |track| track.cfp_active = true track.save! end - change_column_null :tracks, :cfp_active, false + change_column :tracks, :cfp_active, :boolean, null: false, default: false end end From b7187323a7206fbe08a487687cf7044401099692 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sat, 30 May 2020 09:36:26 -0700 Subject: [PATCH 23/24] Serve precompiled assets in example Docker Compose configuration Continues 959d5af. --- docker-compose.yml.production-example | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml.production-example b/docker-compose.yml.production-example index 73fa1ad1..f4f0c173 100644 --- a/docker-compose.yml.production-example +++ b/docker-compose.yml.production-example @@ -18,6 +18,7 @@ services: env_file: .env.production # see dotenv.example file environment: OSEM_DB_HOST: production_database + RAILS_SERVE_STATIC_FILES: 'true' command: /osem/bin/osem-init.sh volumes: - osem_production_web_data:/osem/public/system From 7baf1099ab0a139fca4e36aa12544261aabce430 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Sat, 20 Jun 2020 02:40:59 +0000 Subject: [PATCH 24/24] Update all of rails to version 5.2.4.3 --- Gemfile.lock | 98 ++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 27ec514a..6171434a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,25 +13,25 @@ GEM remote: https://rails-assets.org/ specs: Ascii85 (1.0.3) - actioncable (5.2.3) - actionpack (= 5.2.3) + actioncable (5.2.4.3) + actionpack (= 5.2.4.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) + actionmailer (5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) - rack (~> 2.0) + actionpack (5.2.4.3) + actionview (= 5.2.4.3) + activesupport (= 5.2.4.3) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + actionview (5.2.4.3) + activesupport (= 5.2.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -41,20 +41,20 @@ GEM activemodel (>= 4.1, < 6.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (5.2.3) - activesupport (= 5.2.3) + activejob (5.2.4.3) + activesupport (= 5.2.4.3) globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) + activemodel (5.2.4.3) + activesupport (= 5.2.4.3) + activerecord (5.2.4.3) + activemodel (= 5.2.4.3) + activesupport (= 5.2.4.3) arel (>= 9.0) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) + activestorage (5.2.4.3) + actionpack (= 5.2.4.3) + activerecord (= 5.2.4.3) marcel (~> 0.3.1) - activesupport (5.2.3) + activesupport (5.2.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -94,7 +94,7 @@ GEM bootstrap-switch-rails (3.0.2) bootstrap3-datetimepicker-rails (4.17.47) momentjs-rails (>= 2.8.1) - builder (3.2.3) + builder (3.2.4) byebug (11.0.1) cancancan (2.3.0) capybara (3.26.0) @@ -129,7 +129,7 @@ GEM simplecov url coderay (1.1.1) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) connection_pool (2.2.2) countable-rails (0.0.1) railties (>= 3.1) @@ -142,7 +142,7 @@ GEM sort_alphabetical (~> 1.0) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.5) + crass (1.0.6) daemons (1.3.1) dalli (2.7.10) dante (0.2.0) @@ -235,7 +235,7 @@ GEM htmlentities (4.3.4) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (1.7.0) + i18n (1.8.3) concurrent-ruby (~> 1.0) i18n_data (0.8.0) inversion (1.1.1) @@ -270,7 +270,7 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loggability (0.14.0) - loofah (2.4.0) + loofah (2.6.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.0.12) @@ -282,14 +282,14 @@ GEM mime-types (3.2.2) mime-types-data (~> 3.2015) mime-types-data (3.2018.0812) - mimemagic (0.3.3) + mimemagic (0.3.5) mina (1.2.3) open4 (~> 1.3.4) rake mini_magick (4.9.5) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) + minitest (5.14.1) momentjs-rails (2.20.1) railties (>= 3.1) monetize (1.9.2) @@ -310,7 +310,7 @@ GEM connection_pool (~> 2.2) netrc (0.11.0) nio4r (2.5.2) - nokogiri (1.10.8) + nokogiri (1.10.9) mini_portile2 (~> 2.4.0) notiffany (0.1.1) nenv (~> 0.1) @@ -379,24 +379,24 @@ GEM slop (~> 3.4) public_suffix (3.1.1) puma (3.12.6) - rack (2.1.4) + rack (2.2.3) 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) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) + rails (5.2.4.3) + actioncable (= 5.2.4.3) + actionmailer (= 5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) + activemodel (= 5.2.4.3) + activerecord (= 5.2.4.3) + activestorage (= 5.2.4.3) + activesupport (= 5.2.4.3) bundler (>= 1.3.0) - railties (= 5.2.3) + railties (= 5.2.4.3) sprockets-rails (>= 2.0.0) rails-assets-bootstrap (3.3.6) rails-assets-jquery (>= 1.9.1, < 3) @@ -430,9 +430,9 @@ GEM rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + railties (5.2.4.3) + actionpack (= 5.2.4.3) + activesupport (= 5.2.4.3) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -562,7 +562,7 @@ GEM stripe (>= 2.0.3) sysexits (1.2.0) temple (0.8.0) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) tilt (2.0.9) timecop (0.9.1) @@ -573,7 +573,7 @@ GEM turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.5) + tzinfo (1.2.7) thread_safe (~> 0.1) uglifier (4.1.20) execjs (>= 0.3.0, < 3) @@ -600,7 +600,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - websocket-driver (0.7.1) + websocket-driver (0.7.2) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) whenever (0.10.0)