* Add "Welcome" type to Broadcasts, allow dynamic "authoring" of Broadcasts
This adds a new `type_of` to the Broadcast model: "Welcome". As we begin to create a new "welcome notification" workflow, we'll categorize them by making them all of the same type.
This also adds a concept of a "welcoming user", which can be set via an ENV var. The WELCOMING_USER_ID will allow us to explicitly set (and change) which user in the database is the one that "sends" welcoming notification. In production, we plan for this to be dev.to/sloan.
* Allow WelcomeNotificationWorker to accept + send any kind of broadcast
This abstracts out the logic of deciding which broadcast to send from the woker into the calling method. This will help us send many different kinds of welcome notifications using one, resuable worker class.
* Raise if a Notification can't be created
* Add STAFF_USER_ID as an ENV var
This is in preparation for moving away from SiteConfig.staff_user_id, and replacing it with an ENV var. We will need to set this in production first, and then make a separate PR to replace all instances of staff_user_id with the newly-set ENV var.
* Consolidate `.decorate` calls
* Move Activerecord finders out of main stories feed partial
* Add back in decorates to sticky_articles partial
* Combine top and new articles returned from StoriesController
* Extract feed construction logic to a service
* Some PR tweaks (naming)
* Quick test fix
* SASS formatting in action.
* Unnested .sidebar-nav-element in SASS
* Created the <TagsFollowed /> component.
* Mini refactor.
* Left side bar uses <TagsFollowed /> component now.
* Accomodating InstantClick
* Small refactor and added some comments.
* The homepage webpacker pack only needs to be loaded once.
* Added tests for the <TagsFollowed /> component.
* Modified the receive InstantClick callback as per their docs.
* Reverted the data-no-instant on he homepage bundle. It seems to cause issues in certain scenarios.
* Just some tweaks to <TagsFollowed /> component.
* Removed CSS for general img tag in context of sidebar as it does not appear to be used.
* Fixed copy paste error from JSX to HTML.
* Fixed <img /> styles for arbitrary sponsorship widget.
* Fixed a regression that a Capybara test caught.
* Fixed user followed tags on home page tests.
* Fixed logic for loading user data on homepage.
* Index tags to Elasticsearch after they are created
* add rules_html to Tag index since we show it in search drop down
* change get method to find_document to make it more explicit
Allowing ids to be mutated by admins from the /internal/config pages is dangerous.
This could cause issues if an admin tries to update the SiteConfig.staff_user_id to an id that is another user's id, or to an id that isn't valid.
* Add check for article param being a Hash & spec
* Remove unnecessary blank line
* Move logic to private method and before_action call
* Change check_if to validate
* Use is_a? to type check
* Fix type check for specs
* Add specs
* Check the object, not the ID
* Use permitted params and delete cache only after create
* Inherit from ApiController, bail if the reaction user does not exist, fix naming
* Remove superflous test
* Fix logging for dev and test environments
We had some unused code for Timber in our config files for development and test.
However, this was completely clobbering Rails' default behavior of logging out to log/development.log and log/test.log. We should allow for logging in these environments in particular, and since we're not using Timber there, we can just revert to using the Rails default debugging log levels.
* Add Timber logger to specs that explicitly require it
* Restore default Rails.logger in specs using Timber logger
* Explicitly use Rails.logger in OmniauthCallbacksController
We seem to have different logger classes leaking into this controller in tests.
I'm not entirely sure why this is/haven't been able to investigate yet, but I do think we should be using the Rails.logger explicitly until we can figure that out.
* Add new UpdateMainImageBackgroundHexWorker worker class
This is a port of app/jobs/update_main_image_background_job.rb
that works with Sidekiq instead of DelayedJob.
* Update all references to UpdateMainImageBackgroundHexJob
This updates all references to UpdateMainImageBackgroundHexJob
so they now call UpdateMainImageBackgroundHexWorker, which works
with Sidekiq instead of DelayedJob.
* Move method call to after_commit callback
* Fix article specs with sidekiq helpers
Co-authored-by: Alex <alexandersmith223@gmail.com>
* Create Articles::ScoreCalcWorker
* Create Articles::ScoreCalcWorker spec
* Update references to the new ScoreCalcWorker
* Refactoring conditional callbacks and biz logic
- Move update_columns to a model method
- Move conditions on callback to guard clause in callback method
- Make article_destroy_spec more explicit