docbrown/app
Daniel Uber 4b4d8a7234
Ensure arguments to perform_async are json safe (#16285)
* Convert symbol hash keys to strings when calling .perform_async

Fixes a warning from Sidekiq 6.4.0+ about perform_async arguments
which are not equal when passed to perform (`JSON.parse(JSON.dump(arg))`
should equal arg).

This is a safety measure to prevent passing objects (like classes, or
model instances) rather than their representations (like a class name,
or a model's attributes hash).

This warning will be an error in sidekiq 7

* Turn warning into an error in non-production environments

* Use string keys for reaction notification and article fetched

Missed these two on the first pass

* Update example argument hashes for #enqueues_on_correct_queue

Since this calls perform_async under the hood we need to pass json
safe hashes in the test cases as well.

https://github.com/forem/forem/blob/main/spec/workers/shared_examples/enqueues_on_correct_queue.rb

* Convert keys from FollowData#to_h to string before perform_async

I'm not sure enough where else (outside of notification) to_h is being
called, so I'm converting here when building args, rather than in
FollowData#to_h, which might be my next step.

* Let FollowData#to_h return a hash with string keys

Update spec to use string keys as well.

* Make to_h return string keys for ReactionData

Like FollowData, the #to_h method is only used to call
notifications (this is used to enqueue sidekiq jobs).

* Remove a key that was in the hash

Since reaction_data calls to_h, it gets string and not symbol,
keys. Call Hash#except with a key that was actually there.
2022-01-25 18:07:40 -06:00
..
assets Implement Unified Embeds for Speakerdeck URLs (#16276) 2022-01-25 07:21:39 -05:00
components/admin/users Small change to make the tools section of member details mobile friendly. (#15159) 2021-10-22 18:47:20 +02:00
controllers Ensure arguments to perform_async are json safe (#16285) 2022-01-25 18:07:40 -06:00
decorators Refactoring cached_followed_tags (#16175) 2022-01-24 19:53:48 -05:00
errors small non-views ruby i18n (#16004) 2022-01-11 10:05:18 +07:00
forms Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
helpers Remove the "Getting Started" Section from the Config (#16033) 2022-01-20 07:31:35 -07:00
javascript Android Runtime Banner - Chrome Intent support (#15181) 2022-01-25 09:01:59 -06:00
lib Move BlackBox to app/lib (#16183) 2022-01-20 09:37:53 +07:00
liquid_tags Implement Unified Embeds for Speakerdeck URLs (#16276) 2022-01-25 07:21:39 -05:00
mailers app/mailers i18n (#16191) 2022-01-20 07:33:29 -07:00
models Ensure arguments to perform_async are json safe (#16285) 2022-01-25 18:07:40 -06:00
policies Allow for skipping navigation link creation (#16112) 2022-01-17 17:22:24 -05:00
queries small non-views ruby i18n (#16004) 2022-01-11 10:05:18 +07:00
refinements Drop profile columns from user (#10707) 2020-12-03 08:14:38 +07:00
sanitizers Extracting container for allowed tags & attrs (#15338) 2021-12-16 12:24:45 -05:00
serializers Refactoring to add helper method (#16064) 2022-01-12 11:21:44 -05:00
services Ensure arguments to perform_async are json safe (#16285) 2022-01-25 18:07:40 -06:00
uploaders small non-views ruby i18n (#16004) 2022-01-11 10:05:18 +07:00
validators Remove the "Getting Started" Section from the Config (#16033) 2022-01-20 07:31:35 -07:00
view_objects Patching ERB rendering of the data-info JSON (#16067) 2022-01-14 08:30:49 -05:00
views Added title to be displayed for stackexchange question (#16289) 2022-01-25 13:24:03 -06:00
workers Ensure arguments to perform_async are json safe (#16285) 2022-01-25 18:07:40 -06:00