diff --git a/Gemfile.lock b/Gemfile.lock index 068733cf..f70cd7ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,64 +41,64 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.0.2.1) - actionpack (= 6.0.2.1) + actioncable (6.0.2.2) + actionpack (= 6.0.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.2.1) - actionpack (= 6.0.2.1) - activejob (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) + actionmailbox (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) mail (>= 2.7.1) - actionmailer (6.0.2.1) - actionpack (= 6.0.2.1) - actionview (= 6.0.2.1) - activejob (= 6.0.2.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.2.1) - actionview (= 6.0.2.1) - activesupport (= 6.0.2.1) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.2.1) - actionpack (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) + actiontext (6.0.2.2) + actionpack (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) nokogiri (>= 1.8.5) - actionview (6.0.2.1) - activesupport (= 6.0.2.1) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) active_record_union (1.3.0) activerecord (>= 4.0) - active_storage_validations (0.8.7) + active_storage_validations (0.8.8) rails (>= 5.2.0) - activejob (6.0.2.1) - activesupport (= 6.0.2.1) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) globalid (>= 0.3.6) - activemodel (6.0.2.1) - activesupport (= 6.0.2.1) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.0.2.1) - activemodel (= 6.0.2.1) - activesupport (= 6.0.2.1) - activestorage (6.0.2.1) - actionpack (= 6.0.2.1) - activejob (= 6.0.2.1) - activerecord (= 6.0.2.1) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activestorage (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) marcel (~> 0.3.1) - activesupport (6.0.2.1) + activesupport (6.0.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -116,7 +116,7 @@ GEM autoprefixer-rails (9.7.4) execjs aws-eventstream (1.0.3) - aws-partitions (1.283.0) + aws-partitions (1.294.0) aws-sdk (3.0.1) aws-sdk-resources (~> 3) aws-sdk-accessanalyzer (1.1.0) @@ -275,7 +275,7 @@ GEM aws-sdk-connectparticipant (1.0.0) aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-core (3.91.1) + aws-sdk-core (3.92.0) aws-eventstream (~> 1.0, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) @@ -875,7 +875,7 @@ GEM aws-sdk-route53resolver (1.11.0) aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.61.1) + aws-sdk-s3 (1.61.2) aws-sdk-core (~> 3, >= 3.83.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) @@ -1028,7 +1028,7 @@ GEM bundler-audit (0.6.1) bundler (>= 1.2.0, < 3) thor (~> 0.18) - capybara (3.31.0) + capybara (3.32.1) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -1080,7 +1080,7 @@ GEM cucumber-wire (0.0.1) d3-rails (5.9.2) railties (>= 3.1) - database_cleaner (1.8.3) + database_cleaner (1.8.4) dateslices (0.0.4) rails (> 4) db_text_search (0.3.1) @@ -1127,7 +1127,7 @@ GEM gherkin (5.1.0) globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.16.1) + guard (2.16.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -1158,7 +1158,7 @@ GEM http_parser.rb (~> 0.6.0) http-cookie (1.0.3) domain_name (~> 0.5) - http-form_data (2.2.0) + http-form_data (2.3.0) http_parser.rb (0.6.0) i18n (1.8.2) concurrent-ruby (~> 1.0) @@ -1166,7 +1166,7 @@ GEM concurrent-ruby (~> 1.0) http (~> 4.1.0) jwt (~> 2.2.1) - ibm_watson (1.3.0) + ibm_watson (1.3.1) concurrent-ruby (~> 1.0) eventmachine (~> 1.2) faye-websocket (~> 0.10) @@ -1208,10 +1208,10 @@ GEM listen (3.2.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.4.0) + loofah (2.5.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.0.13) + lumberjack (1.2.4) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) @@ -1267,7 +1267,7 @@ GEM parallel (1.19.1) paranoia (2.4.2) activerecord (>= 4.0, < 6.1) - parser (2.7.0.3) + parser (2.7.0.5) ast (~> 2.4.0) paypal-checkout-sdk (1.0.3) paypalhttp (~> 1.0.0) @@ -1276,11 +1276,11 @@ GEM faraday (~> 0.15) faraday_middleware (~> 0.12) paypalhttp (1.0.0) - pg (1.2.2) + pg (1.2.3) pry (0.13.0) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.3) + public_suffix (4.0.4) puma (4.3.3) nio4r (~> 2.0) puma-heroku (1.1.0) @@ -1299,20 +1299,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.2.1) - actioncable (= 6.0.2.1) - actionmailbox (= 6.0.2.1) - actionmailer (= 6.0.2.1) - actionpack (= 6.0.2.1) - actiontext (= 6.0.2.1) - actionview (= 6.0.2.1) - activejob (= 6.0.2.1) - activemodel (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) + rails (6.0.2.2) + actioncable (= 6.0.2.2) + actionmailbox (= 6.0.2.2) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actiontext (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) bundler (>= 1.3.0) - railties (= 6.0.2.1) + railties (= 6.0.2.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@ -1345,9 +1345,9 @@ GEM sassc-rails (>= 1.3, < 3) rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (6.0.2.1) - actionpack (= 6.0.2.1) - activesupport (= 6.0.2.1) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -1355,7 +1355,7 @@ GEM rake (13.0.1) rb-fsevent (0.10.3) rb-gravatar (1.0.5) - rb-inotify (0.10.0) + rb-inotify (0.10.1) ffi (~> 1.0) react-rails (2.6.1) babel-transpiler (>= 0.7.0) @@ -1365,14 +1365,14 @@ GEM tilt redcarpet (3.5.0) redis (4.1.3) - regexp_parser (1.6.0) + regexp_parser (1.7.0) remotipart (1.4.4) responders (3.0.0) actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.4) rinku (2.0.6) - rmagick (4.0.0) + rmagick (4.1.1) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -1397,14 +1397,14 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.9.2) - rubocop (0.80.1) + rubocop (0.81.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) rexml ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) + unicode-display_width (>= 1.4.0, < 2.0) ruby-prof (1.3.1) ruby-progressbar (1.10.1) ruby-vips (2.0.17) @@ -1431,7 +1431,7 @@ GEM shellany (0.0.1) shoulda-matchers (4.3.0) activesupport (>= 4.2.0) - sidekiq (6.0.5) + sidekiq (6.0.6) connection_pool (>= 2.2.2) rack (~> 2.0) rack-protection (>= 2.0.0) @@ -1468,7 +1468,7 @@ GEM tilt (2.0.10) timeago_js (3.0.2.2) tribute (3.6.0.0) - tzinfo (1.2.6) + tzinfo (1.2.7) thread_safe (~> 0.1) tzinfo-data (1.2019.3) tzinfo (>= 1.0.0) @@ -1477,7 +1477,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.6) - unicode-display_width (1.6.1) + unicode-display_width (1.7.0) uniform_notifier (1.13.0) warden (1.2.8) rack (>= 2.0.6) diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 4227bd38..b511f704 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -501,7 +501,7 @@ class ContentController < ApplicationController .downcase .to_sym - params.require(content_class).permit(content_param_list + [:deleted_at, :document_entity_id]) + params.require(content_class).except(:page_tags, :_destroy).permit(content_param_list + [:deleted_at, :document_entity_id]) end def page_tag_params diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index baa9e0ef..264de990 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -12,8 +12,8 @@ class UsersController < ApplicationController @content = @user.public_content.select { |type, list| list.any? } @tabs = @content.keys - @accent_color = @user.favorite_page_type_color - @accent_icon = @user.favorite_page_type_icon + @accent_color = @user.favorite_page_type_color + @accent_icon = @user.favorite_page_type_icon @favorite_content = @user.favorite_page_type? ? @user.send(@user.favorite_page_type.downcase.pluralize).is_public : [] # todo this is really bad and needs redone/improved diff --git a/app/models/concerns/has_content.rb b/app/models/concerns/has_content.rb index 8e8c65c7..92a58489 100644 --- a/app/models/concerns/has_content.rb +++ b/app/models/concerns/has_content.rb @@ -123,7 +123,7 @@ module HasContent .first(limit) @user_recent_content_list = recently_changed_attributes.map do |entity_type, entity_id| - entity_type.constantize.find_by(id: entity_id) + entity_type.constantize.find_by(id: entity_id) rescue nil end.compact end diff --git a/app/models/page_groupers/group_allyship.rb b/app/models/page_groupers/group_allyship.rb index a63382e1..4e3e00c8 100644 --- a/app/models/page_groupers/group_allyship.rb +++ b/app/models/page_groupers/group_allyship.rb @@ -15,6 +15,6 @@ class GroupAllyship < ApplicationRecord this_object = Group.find_by(id: self.group_id) other_object = Group.find_by(id: self.ally_id) - other_object.allies.delete this_object + other_object.allies.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/group_enemyship.rb b/app/models/page_groupers/group_enemyship.rb index d3f2972e..d0cb01d4 100644 --- a/app/models/page_groupers/group_enemyship.rb +++ b/app/models/page_groupers/group_enemyship.rb @@ -15,6 +15,6 @@ class GroupEnemyship < ApplicationRecord this_object = Group.find_by(id: self.group_id) other_object = Group.find_by(id: self.enemy_id) - other_object.enemies.delete this_object + other_object.enemies.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/sistergroupship.rb b/app/models/page_groupers/sistergroupship.rb index 464e3825..01a7543f 100644 --- a/app/models/page_groupers/sistergroupship.rb +++ b/app/models/page_groupers/sistergroupship.rb @@ -15,6 +15,6 @@ class Sistergroupship < ApplicationRecord this_object = Group.find_by(id: self.group_id) other_object = Group.find_by(id: self.sistergroup_id) - other_object.sistergroups.delete this_object + other_object.sistergroups.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/subgroupship.rb b/app/models/page_groupers/subgroupship.rb index 22bb06c7..e1aa651e 100644 --- a/app/models/page_groupers/subgroupship.rb +++ b/app/models/page_groupers/subgroupship.rb @@ -18,6 +18,6 @@ class Subgroupship < ApplicationRecord this_object = Group.find_by(id: self.group_id) other_object = Group.find_by(id: self.subgroup_id) - other_object.supergroups.delete(this_object) + other_object.supergroups.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/supergroupship.rb b/app/models/page_groupers/supergroupship.rb index 5a730cf3..ce058fe9 100644 --- a/app/models/page_groupers/supergroupship.rb +++ b/app/models/page_groupers/supergroupship.rb @@ -18,6 +18,6 @@ class Supergroupship < ApplicationRecord this_object = Group.find_by(id: self.group_id) other_object = Group.find_by(id: self.supergroup_id) - other_object.subgroups.delete this_object + other_object.subgroups.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/technology_child_technology.rb b/app/models/page_groupers/technology_child_technology.rb index 3816ef0d..decf5dc6 100644 --- a/app/models/page_groupers/technology_child_technology.rb +++ b/app/models/page_groupers/technology_child_technology.rb @@ -20,6 +20,6 @@ class TechnologyChildTechnology < ApplicationRecord this_object = Technology.find_by(id: self.technology_id) other_object = Technology.find_by(id: self.child_technology_id) - other_object.parent_technologies.delete(this_object) + other_object.parent_technologies.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/technology_parent_technology.rb b/app/models/page_groupers/technology_parent_technology.rb index ec51bb46..1147ed6f 100644 --- a/app/models/page_groupers/technology_parent_technology.rb +++ b/app/models/page_groupers/technology_parent_technology.rb @@ -20,6 +20,6 @@ class TechnologyParentTechnology < ApplicationRecord this_object = Technology.find_by(id: self.technology_id) other_object = Technology.find_by(id: self.parent_technology_id) - other_object.child_technologies.delete(this_object) + other_object.child_technologies.delete(this_object) if other_object.present? end end diff --git a/app/models/page_groupers/technology_related_technology.rb b/app/models/page_groupers/technology_related_technology.rb index e8c18772..5a4f73ee 100644 --- a/app/models/page_groupers/technology_related_technology.rb +++ b/app/models/page_groupers/technology_related_technology.rb @@ -14,6 +14,6 @@ class TechnologyRelatedTechnology < ApplicationRecord this_object = Technology.find_by(id: self.technology_id) other_object = Technology.find_by(id: self.related_technology_id) - other_object.related_technologies.delete(this_object) + other_object.related_technologies.delete(this_object) if other_object.present? end end diff --git a/app/models/users/user.rb b/app/models/users/user.rb index b61caa18..adec01e4 100644 --- a/app/models/users/user.rb +++ b/app/models/users/user.rb @@ -152,12 +152,18 @@ class User < ApplicationRecord Rails.application.routes.url_helpers.rails_representation_url(avatar.variant(resize_to_limit: [size, size]).processed, only_path: true) else # otherwise, grab the default from Gravatar for this email address - require 'digest/md5' # todo do we actually need to require this all the time? - email_md5 = Digest::MD5.hexdigest(email.downcase) - "https://www.gravatar.com/avatar/#{email_md5}?d=identicon&s=#{size}".html_safe + gravatar_fallback_url(size) end rescue ActiveStorage::FileNotFoundError + gravatar_fallback_url(size) + + rescue ImageProcessing::Error + gravatar_fallback_url(size) + end + + def gravatar_fallback_url(size=80) + require 'digest/md5' # todo do we actually need to require this all the time? email_md5 = Digest::MD5.hexdigest(email.downcase) "https://www.gravatar.com/avatar/#{email_md5}?d=identicon&s=#{size}".html_safe end diff --git a/app/services/temporary_field_migration_service.rb b/app/services/temporary_field_migration_service.rb index a86e6bf2..e7b0e969 100644 --- a/app/services/temporary_field_migration_service.rb +++ b/app/services/temporary_field_migration_service.rb @@ -2,16 +2,17 @@ # to the new-style of having values in an associated Attribute model. # Once all data has been moved over, we can remove these old columns and delete this service. class TemporaryFieldMigrationService < Service - def self.migrate_all_content_for_user(user) + def self.migrate_all_content_for_user(user, force: false) user.content_list.each do |content| - self.migrate_fields_for_content(content, user) + self.migrate_fields_for_content(content, user, force: force) end end - def self.migrate_fields_for_content(content_model, user) + def self.migrate_fields_for_content(content_model, user, force: false) return unless content_model.present? && user.present? return unless content_model.user == user - return if content_model.persisted? && content_model.updated_at > 'May 1, 2018'.to_datetime + return if !force && content_model.persisted? && content_model.created_at > 'May 1, 2018'.to_datetime + return if !!content_model.columns_migrated_from_old_style? # todo we might be able to do this in a single left outer join attribute_categories = content_model.class.attribute_categories(content_model.user) @@ -44,6 +45,9 @@ class TemporaryFieldMigrationService < Service if existing_value && existing_value.created_at != existing_value.updated_at next end + if existing_value.try(:value).present? + next + end if content_model.respond_to?(attribute_field.old_column_source) value_from_model = content_model.send(attribute_field.old_column_source) @@ -68,5 +72,7 @@ class TemporaryFieldMigrationService < Service end end end + + content_model.update_column(:columns_migrated_from_old_style, true) end end diff --git a/app/views/content/panels/_associations.html.erb b/app/views/content/panels/_associations.html.erb index aa23938b..372c9380 100644 --- a/app/views/content/panels/_associations.html.erb +++ b/app/views/content/panels/_associations.html.erb @@ -12,11 +12,19 @@