diff --git a/Gemfile b/Gemfile index c01f075b9..89a2abc5e 100644 --- a/Gemfile +++ b/Gemfile @@ -97,7 +97,7 @@ group :test do gem 'factory_bot_rails' gem 'rails-controller-testing' gem 'rspec-rails' - gem 'selenium-webdriver' + gem 'selenium-webdriver', "4.8.6" gem 'simplecov', require: false gem 'webdrivers', '>= 5.1.0' end diff --git a/Gemfile.lock b/Gemfile.lock index f476b685e..e3ee7e627 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,10 +96,10 @@ GEM aes_key_wrap (1.1.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.749.0) + aws-partitions (1.762.0) aws-record (2.10.1) aws-sdk-dynamodb (~> 1.18) - aws-sdk-core (3.171.0) + aws-sdk-core (3.172.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -220,12 +220,12 @@ GEM activesupport (>= 5.0) hashie (5.0.0) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.13.0) concurrent-ruby (~> 1.0) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - importmap-rails (1.1.5) + importmap-rails (1.1.6) actionpack (>= 6.0.0) railties (>= 6.0.0) jbuilder (2.11.5) @@ -262,7 +262,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logstop (0.3.0) - loofah (2.20.0) + loofah (2.21.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.8.1) @@ -278,7 +278,7 @@ GEM mime-types-data (3.2023.0218.1) mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.8.1) + mini_portile2 (2.8.2) minitest (5.18.0) msgpack (1.7.0) multi_json (1.15.0) @@ -293,7 +293,7 @@ GEM timeout net-smtp (0.3.3) net-protocol - newrelic_rpm (9.2.0) + newrelic_rpm (9.2.2) nio4r (2.5.9) nokogiri (1.14.3) mini_portile2 (~> 2.8.0) @@ -322,9 +322,9 @@ GEM activerecord (>= 5.2) request_store (~> 1.1) parallel (1.23.0) - parser (3.2.2.0) + parser (3.2.2.1) ast (~> 2.4.1) - pg (1.4.6) + pg (1.5.3) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -332,10 +332,10 @@ GEM puma (5.6.5) nio4r (~> 2.0) racc (1.6.2) - rack (2.2.6.4) + rack (2.2.7) rack-cors (1.1.1) rack (>= 2.0.0) - rack-protection (3.0.5) + rack-protection (3.0.6) rack rack-test (2.1.0) rack (>= 1.3) @@ -390,22 +390,22 @@ GEM railties (>= 5.2) rexml (3.2.5) rolify (6.0.1) - rspec-core (3.12.1) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.0.1) + rspec-rails (6.0.2) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.11) - rspec-expectations (~> 3.11) - rspec-mocks (~> 3.11) - rspec-support (~> 3.11) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) @@ -419,7 +419,7 @@ GEM rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.0) + rubocop-ast (1.28.1) parser (>= 3.2.1.0) rubocop-capybara (2.17.1) rubocop (~> 1.41) @@ -504,7 +504,7 @@ GEM chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.7) + zeitwerk (2.6.8) PLATFORMS ruby @@ -560,7 +560,7 @@ DEPENDENCIES rubocop-rails rubocop-rspec sass-rails (>= 6.0.0) - selenium-webdriver + selenium-webdriver (= 4.8.6) sidekiq simplecov sprockets-rails diff --git a/app/controllers/admin/digital_products_controller.rb b/app/controllers/admin/digital_products_controller.rb index 1fee91d97..ab58ad8a4 100644 --- a/app/controllers/admin/digital_products_controller.rb +++ b/app/controllers/admin/digital_products_controller.rb @@ -61,7 +61,9 @@ def edit def create @digital_product = DigitalProduct.new(digital_product_params) - @digital_product.organization_list.add(current_user.organization_id) + organization = current_user.organization + @digital_product.organization_list.add(organization.id) + @digital_product.organization_list.add(organization.parent.id) if organization.parent if @digital_product.save Event.log_event(Event.names[:digital_product_created], 'Digital Product', @digital_product.id, "Digital Product #{@digital_product.name} created at #{DateTime.now}", current_user.id) @@ -111,7 +113,9 @@ def remove_tag def add_organization ensure_digital_product_permissions(digital_product: @digital_product) - @digital_product.organization_list.add(params[:organization_id]) + organization = Organization.find(params[:organization_id]) + @digital_product.organization_list.add(organization.id) + @digital_product.organization_list.add(organization.parent.id) if organization.parent @digital_product.save set_sponsoring_agency_options end diff --git a/app/controllers/admin/digital_service_accounts_controller.rb b/app/controllers/admin/digital_service_accounts_controller.rb index 6cd049f32..7666bc10a 100644 --- a/app/controllers/admin/digital_service_accounts_controller.rb +++ b/app/controllers/admin/digital_service_accounts_controller.rb @@ -69,7 +69,9 @@ def edit def create @digital_service_account = DigitalServiceAccount.new(digital_service_account_params) - @digital_service_account.organization_list.add(current_user.organization_id) + organization = Organization.find(current_user.organization_id) + @digital_service_account.organization_list.add(organization.id) + @digital_service_account.organization_list.add(organization.parent.id) if organization.parent if @digital_service_account.save current_user.add_role(:contact, @digital_service_account) @@ -131,7 +133,9 @@ def remove_tag def add_organization ensure_digital_service_account_permissions(digital_service_account: @digital_service_account) - @digital_service_account.organization_list.add(params[:organization_id]) + organization = Organization.find(params[:organization_id]) + @digital_service_account.organization_list.add(organization.id) + @digital_service_account.organization_list.add(organization.parent.id) if organization.parent @digital_service_account.save set_sponsoring_agency_options end diff --git a/app/models/digital_service_account.rb b/app/models/digital_service_account.rb index 49aa929d0..3d352b88c 100644 --- a/app/models/digital_service_account.rb +++ b/app/models/digital_service_account.rb @@ -65,6 +65,7 @@ def self.list 'Ideascale', 'Instagram', 'Linkedin', + 'Linktree', 'Livestream', 'Mastodon', 'Medium', diff --git a/app/models/organization.rb b/app/models/organization.rb index 9e5c2cdc9..0e585f29f 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -25,6 +25,10 @@ class Organization < ApplicationRecord def parent parent_id ? Organization.find(parent_id) : nil end + + def children + Organization.where(parent_id: self.id) + end def slug abbreviation.downcase diff --git a/app/views/admin/digital_product_versions/index.html.erb b/app/views/admin/digital_product_versions/index.html.erb index 2c11a9f82..3dc0ff345 100644 --- a/app/views/admin/digital_product_versions/index.html.erb +++ b/app/views/admin/digital_product_versions/index.html.erb @@ -12,7 +12,7 @@ <% if digital_product_permissions?(digital_product: @digital_product, user: current_user) %> - <%= link_to "New digital product version", new_admin_digital_product_digital_product_version_path(@digital_product), class: "usa-button" %> + <%= link_to "New digital product version", new_admin_digital_product_digital_product_version_path(@digital_product), class: "usa-button full-width" %> <% end %>