* Moved logging and deleting comments to Moderator::UnpublishAllArticlesWorker
* Added logging for admin action (unpublish_all_articles)
* Extracted code from UnpublishAllArticlesWorker to the service
* Make it possible to add a note while unpublishing all via admin action
* Added ability to add notes for unpublishing all from moderator action panel
* Fixed setting slug for the AuditLog on unpublishing + spec
* Remove context_notifications when unpublishing all posts
* Fixed typo
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Fixed typo
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Update worker calculation and disable early return
* Enable service tests
This updates the test to look at the individual article scores
changing, rather than the sum of the articles scores changing
The scores lambda was added as a way to observe this eagerly
* Correctly handle raising the score when vomit is cleared
The initial implementation loaded the articles reactions and the
user's reactions in order to rescore. This restores that activity.
It occurs to me that article.reactions.sum(:points) +
user.reactions.sum(:points) feels like something articles should know
how to do, in which case we can move this into article (#rescore!)?
and call that instead of knowing how to handle moderation specially here.
* Move logic to Article#update_score
Having realized "sum of reaction scores" was an Article concern, I
found that we have a worker to score articles that does _exactly_ what
we're doing here.
Let's use that and allow the vomit reaction presence or absence on a
user to automatically affect the article calculations.
This is at least n + 1 and maybe worse.
* This change abstracts the DatadogStatsClient into a ForemStatsClient.
The purpose of this abstraction is to set the foundation for a subsequent PR that will allow one to use New Relic for recording Forem stats, instead of Datadog, if there is a New Relic configuration found.
This specific change creates an abstraction layer that can be built upon, without changing any actual default behavior. All specs still pass.
* Use delegate instead of explicit methods.
* Delegate instead of explicit methods.
* Fix the error.
* Refactor according to the suggestions in the comments.
* Ooops. Stats work better when all of the code is committed.
* Removing the alias of count to increment since that was done in error.
* Add sink user service and specs for mass vomits
* Use new score calculation
* Lower articles' scores instead and make async
* Add lower score functionality to controllers
* Remove unused variable
* Use correct var and add missing arg
* Remove unused status
* Add composite index for reactable_type and ID
* Use alias instead of additional boolean
* Use medium priority for sink worker
* Log to honeybadger and not logs
* Log the error and not a string