docbrown/spec/workers
Jeremy Friesen a40efc6bbd
Refactoring questions asked of user (#15762)
* Refactoring questions asked of user

In this pull request, I'm extracting and normalizing role-based
questions asked of the user.

Prior to this commit, our codebase has asked two very similar questions
of our user model:

- `user.has_role?(:admin)`
- `user.admin?`

In asking `has_role?(:admin)` we are relying on implementation details
of the rolify gem.  In addition, the `has_role?` question asked
throughout controllers or views means that it's harder to create
hieararchies of permissions.

In favoring `user.admin?` as our question, we can use that indirection
as an opportunity to discuss and decide "Should someone with the
`:super_admin` role be `user.admin? == true`?"

The details of this commit is to do three primary things:

1. Ask the `has_role?` questions in "one place" in the code (e.g. the
   `Authorizer` module)
2. Extract the role based questions that are on the `User` model and
   provde backwards compatable delegation.
3. Structure the code so that it's harder to accidentally call
   `user.has_role?` (e.g., make `User#has_role?` and `User#has_any_role?`
   private).

This is related to #15624 and the updates are informed by discussion in
PR #15691.  This commit supplants #15691.

* Refactoring the liquid tag policy tests

* Fixing typo

* Bump for travis
2021-12-21 12:45:12 -05:00
..
articles Asynchronously detect image aspect ratios and apply proper attributes (#15170) 2021-10-26 13:39:25 -07:00
badge_achievements Split BadgeRewarder into multiple services (#11902) 2020-12-23 09:55:06 -05:00
broadcasts Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
comments Refactor EdgeCache (#11684) 2020-12-02 14:20:22 -05:00
credits Refactor:Move Credit Counter Cache Sync to Sidekiq (#9972) 2020-08-24 14:20:11 -05:00
discover Add Forem Discover registration worker and service (#14865) 2021-10-01 10:27:31 -04:00
emails Delete old retained emails after certain period (#14949) 2021-10-12 16:27:13 -04:00
feeds Change signature of Feeds::ImportArticlesWorker (#13971) 2021-06-17 14:28:23 -04:00
follows Save article (to cache tags) before updating follow points (#15637) 2021-12-02 14:41:27 -06:00
github_repos ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
html_variants [deploy] Refactor:Move Remove Old HTML Variant Data task to Sidekiq (#9925) 2020-08-22 18:36:22 -05:00
listings Update bust_listings to service (#12050) 2020-12-29 09:52:34 +01:00
mentions [15-min-fix] Ensure mention worker delivers email (#14038) 2021-06-22 14:29:56 -04:00
metrics Boost priority of queue stats worker (#14173) 2021-07-09 09:28:43 -05:00
moderator Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
notification_subscriptions Add Article post_commit when user_id changes with specs (#15132) 2021-10-25 10:53:21 +07:00
notifications Rubocop fixes (#14868) 2021-09-30 13:22:09 -04:00
organizations Create Settings::SMTP (#13943) 2021-06-14 10:29:43 -04:00
pages Update .bust_page to EdgeCache::BustPage (#11952) 2020-12-18 11:21:54 -05:00
podcast_episodes Update bust_podcast_episode to EdgeCache::BustPodcastEpisode (#12049) 2020-12-29 09:49:13 +01:00
podcasts Update bust_podcast to EdgeCache::BustPodcast (#12047) 2020-12-29 09:49:59 +01:00
rating_votes Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606) 2021-05-03 11:09:45 -04:00
reactions Add conditional autovomits to user name and improve user score recalc (#14858) 2021-10-05 10:11:41 -04:00
shared_examples Add field test gem to establish a/b testing (#6283) [deploy] 2020-03-03 10:21:29 -05:00
slack/messengers Finalize Slack messengers refactoring (#7484) 2020-04-24 21:15:10 +02:00
tags Update bust_tag to EdgeCache::BustTag (#11953) 2020-12-21 14:43:42 -05:00
users Guarding against missing experiments (#15440) 2021-11-22 16:06:32 -05:00
webhook Remove Doorkeeper gem (#15749) 2021-12-21 12:29:58 +07:00
bust_cache_path_worker_spec.rb Refactor cache purging (#12811) 2021-03-02 10:09:05 -05:00
data_update_worker_spec.rb Spelling (#15702) 2021-12-07 06:59:10 -07:00
export_content_worker_spec.rb Update data exporter to handle admin send (#10274) 2020-10-26 18:00:56 -04:00