From 5864907f300a96a0eb0db228cc5c194c787c457c Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 09:24:03 -0700 Subject: [PATCH 1/7] 229 - correct spelling of the propogate method --- .../hyrax/visibility_propagator_decorator.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/services/hyrax/visibility_propagator_decorator.rb diff --git a/app/services/hyrax/visibility_propagator_decorator.rb b/app/services/hyrax/visibility_propagator_decorator.rb new file mode 100644 index 00000000..d4a3dd9c --- /dev/null +++ b/app/services/hyrax/visibility_propagator_decorator.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. + +module Hyrax + ## + # @abstract Propagates visibility from a provided object (e.g. a Work) to some + # group of its members (e.g. file_sets). + module VisibilityPropagatorDecorator + ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. + # @return [void] + # @raise [RuntimeError] if we're in development mode + def propagate + message = "Tried to propagate visibility to members of #{source} " \ + "but didn't know what kind of object it is. Model " \ + "name #{source.try(:model_name)}. Called from #{caller[0]}." + + Hyrax.logger.warn(message) + Rails.env.development? ? raise(message) : :noop + end + end + end +end + +Hyrax::VisibilityPropagator.prepend(Hyrax::VisibilityPropagatorDecorator) \ No newline at end of file From 440424ca4b4b10be1efe9cc806a8acb484e05f67 Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 09:24:37 -0700 Subject: [PATCH 2/7] 229 - handle nil case and casue of sidekiq sentry error --- app/jobs/content_event_job_decorator.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/jobs/content_event_job_decorator.rb diff --git a/app/jobs/content_event_job_decorator.rb b/app/jobs/content_event_job_decorator.rb new file mode 100644 index 00000000..7eab9bed --- /dev/null +++ b/app/jobs/content_event_job_decorator.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# OVERRIDE HYRAX 3.4.1 to handle nil case and casue of sidekiq sentry error +# TODO: why is depositor coming across as nil? +module ContentEventJobDecorator + # OVERRIDE HYRAX 3.4.1 to handle nil case and casue of sidekiq sentry error + # log the event to the users profile stream + def log_user_event(depositor) + depositor&.log_profile_event(event) + end +end + +ContentEventJob.prepend(ContentEventJobDecorator) From b011efdc180576ac6cfd06034e3bac646ad890c0 Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 09:24:37 -0700 Subject: [PATCH 3/7] 229 - handle nil case and casue of sidekiq sentry error --- .../hyrax/visibility_propagator_decorator.rb | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/services/hyrax/visibility_propagator_decorator.rb b/app/services/hyrax/visibility_propagator_decorator.rb index d4a3dd9c..c606a5ed 100644 --- a/app/services/hyrax/visibility_propagator_decorator.rb +++ b/app/services/hyrax/visibility_propagator_decorator.rb @@ -6,17 +6,16 @@ module Hyrax # @abstract Propagates visibility from a provided object (e.g. a Work) to some # group of its members (e.g. file_sets). module VisibilityPropagatorDecorator - ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. - # @return [void] - # @raise [RuntimeError] if we're in development mode - def propagate - message = "Tried to propagate visibility to members of #{source} " \ - "but didn't know what kind of object it is. Model " \ - "name #{source.try(:model_name)}. Called from #{caller[0]}." + ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. + # @return [void] + # @raise [RuntimeError] if we're in development mode + def propagate + message = "Tried to propagate visibility to members of #{source} " \ + "but didn't know what kind of object it is. Model " \ + "name #{source.try(:model_name)}. Called from #{caller[0]}." - Hyrax.logger.warn(message) - Rails.env.development? ? raise(message) : :noop - end + Hyrax.logger.warn(message) + Rails.env.development? ? raise(message) : :noop end end end From 73aead5d671916020a40751d5c9e63773b69759e Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 11:21:07 -0700 Subject: [PATCH 4/7] rubocop updates --- app/jobs/content_event_job_decorator.rb | 2 +- app/services/hyrax/visibility_propagator_decorator.rb | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/jobs/content_event_job_decorator.rb b/app/jobs/content_event_job_decorator.rb index 7eab9bed..3d6a6f5a 100644 --- a/app/jobs/content_event_job_decorator.rb +++ b/app/jobs/content_event_job_decorator.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true - + # OVERRIDE HYRAX 3.4.1 to handle nil case and casue of sidekiq sentry error # TODO: why is depositor coming across as nil? module ContentEventJobDecorator diff --git a/app/services/hyrax/visibility_propagator_decorator.rb b/app/services/hyrax/visibility_propagator_decorator.rb index c606a5ed..5c42883a 100644 --- a/app/services/hyrax/visibility_propagator_decorator.rb +++ b/app/services/hyrax/visibility_propagator_decorator.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. module Hyrax @@ -10,9 +11,11 @@ module VisibilityPropagatorDecorator # @return [void] # @raise [RuntimeError] if we're in development mode def propagate - message = "Tried to propagate visibility to members of #{source} " \ + # rubocop:disable Performance/Caller + message = "Tried to propagate visibility to members of #{source} " \ "but didn't know what kind of object it is. Model " \ "name #{source.try(:model_name)}. Called from #{caller[0]}." + # rubocop:enable Performance/Caller Hyrax.logger.warn(message) Rails.env.development? ? raise(message) : :noop @@ -20,4 +23,4 @@ def propagate end end -Hyrax::VisibilityPropagator.prepend(Hyrax::VisibilityPropagatorDecorator) \ No newline at end of file +Hyrax::VisibilityPropagator.prepend(Hyrax::VisibilityPropagatorDecorator) From 781422bbbc73692e9028cd658cfb71de95ddafed Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 12:57:03 -0700 Subject: [PATCH 5/7] 299 - override Hyrax::VisibilityPropagator::NullVisibilityPropogator --- .../hyrax/visibility_propagator_decorator.rb | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/app/services/hyrax/visibility_propagator_decorator.rb b/app/services/hyrax/visibility_propagator_decorator.rb index 5c42883a..1e724f9a 100644 --- a/app/services/hyrax/visibility_propagator_decorator.rb +++ b/app/services/hyrax/visibility_propagator_decorator.rb @@ -2,25 +2,18 @@ ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. -module Hyrax - ## - # @abstract Propagates visibility from a provided object (e.g. a Work) to some - # group of its members (e.g. file_sets). - module VisibilityPropagatorDecorator - ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. - # @return [void] - # @raise [RuntimeError] if we're in development mode - def propagate - # rubocop:disable Performance/Caller - message = "Tried to propagate visibility to members of #{source} " \ - "but didn't know what kind of object it is. Model " \ - "name #{source.try(:model_name)}. Called from #{caller[0]}." - # rubocop:enable Performance/Caller +Hyrax::VisibilityPropagator::NullVisibilityPropogator.class_eval do + ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. + # @return [void] + # @raise [RuntimeError] if we're in development mode + def propagate + # rubocop:disable Performance/Caller + message = "Tried to propagate visibility to members of #{source} " \ + "but didn't know what kind of object it is. Model " \ + "name #{source.try(:model_name)}. Called from #{caller[0]}." + # rubocop:enable Performance/Caller - Hyrax.logger.warn(message) - Rails.env.development? ? raise(message) : :noop - end + Hyrax.logger.warn(message) + Rails.env.development? ? raise(message) : :noop end -end - -Hyrax::VisibilityPropagator.prepend(Hyrax::VisibilityPropagatorDecorator) +end \ No newline at end of file From 7986190fcdb9fa7d2977e32bdda4de7bb897651d Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 12:57:03 -0700 Subject: [PATCH 6/7] 299 - override Hyrax::VisibilityPropagator::NullVisibilityPropogator --- app/services/hyrax/visibility_propagator_decorator.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/hyrax/visibility_propagator_decorator.rb b/app/services/hyrax/visibility_propagator_decorator.rb index 1e724f9a..d16b927c 100644 --- a/app/services/hyrax/visibility_propagator_decorator.rb +++ b/app/services/hyrax/visibility_propagator_decorator.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. +require_dependency Hyrax::Engine.root.join('app', 'services', 'hyrax', 'visibility_propagator').to_s Hyrax::VisibilityPropagator::NullVisibilityPropogator.class_eval do ## OVERRIDE HYRAX 3.4.1 to correct method spelling that causes sidekiq errors. From 47a576b559f0e5e5fe6cffaf4cd0fff231dc94b1 Mon Sep 17 00:00:00 2001 From: Shana Date: Tue, 25 Oct 2022 12:57:03 -0700 Subject: [PATCH 7/7] 299 - override Hyrax::VisibilityPropagator::NullVisibilityPropogator --- app/services/hyrax/visibility_propagator_decorator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/hyrax/visibility_propagator_decorator.rb b/app/services/hyrax/visibility_propagator_decorator.rb index d16b927c..cc6146f6 100644 --- a/app/services/hyrax/visibility_propagator_decorator.rb +++ b/app/services/hyrax/visibility_propagator_decorator.rb @@ -17,4 +17,4 @@ def propagate Hyrax.logger.warn(message) Rails.env.development? ? raise(message) : :noop end -end \ No newline at end of file +end