docbrown/app/views
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
..
admin Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
api/v0 I18nize views misc & non-HTML templates (#15136) 2021-12-08 11:28:16 -05:00
articles Update a11y of ButtonGroup component (#15765) 2021-12-15 12:52:33 +00:00
badges views/badges etc i18n (#15021) 2021-10-20 09:36:30 -06:00
collections Page headers unified (#15158) 2021-10-25 21:41:29 +02:00
comments fix missing i18n strings & keys in views/comments (#15657) 2021-12-02 14:24:57 -06:00
credits quote localized strings in credits/purchase embedded script (#15623) 2021-12-01 10:07:55 -06:00
dashboards Spelling fixes to live code (#15670) 2021-12-06 12:11:25 +02:00
deep_links various small article elements i18n (#15023) 2021-10-15 11:06:44 +07:00
devise Update the User Invitation email copy (#15501) 2021-11-29 09:29:36 -05:00
email_subscriptions I18nize views misc & non-HTML templates (#15136) 2021-12-08 11:28:16 -05:00
feedback_messages views/feedback_messages i18n (#15038) 2021-10-27 12:34:56 +01:00
fields views/tags etc i18n (#15039) 2021-10-20 08:13:51 -06:00
followings Move HexComparer to Hex::Comparer service (#12202) 2021-01-12 11:34:30 -05:00
github_repos
homepage
kaminari/internal
layouts Remove Doorkeeper gem (#15749) 2021-12-21 12:29:58 +07:00
liquid_embeds Refactor deployed_at and latest_commit_id code (#12224) 2021-01-13 16:53:59 +02:00
liquids Implement embed tag and specs (#15801) 2021-12-16 12:58:43 -05:00
listings Spelling fixes to live code (#15670) 2021-12-06 12:11:25 +02:00
mailers ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
moderations Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
notifications Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
onboardings views/onboardings i18n (#15018) 2021-10-13 12:26:07 +02:00
open_search I18nize views misc & non-HTML templates (#15136) 2021-12-08 11:28:16 -05:00
organizations Remove unused assets (#15367) 2021-11-16 19:57:37 +01:00
pages Conditionally Renders Links Within the COC During Creator Onboarding (#15692) 2021-12-09 08:17:53 -07:00
podcast_episodes Extracting container for allowed tags & attrs (#15338) 2021-12-16 12:24:45 -05:00
podcasts views/podcasts, views/podcast_episodes i18n (#15020) 2021-10-25 14:32:51 +01:00
profile_field_groups Add ProfileFieldGroupsController to API (#10124) 2020-09-03 10:12:53 +07:00
profile_preview_cards Make header fields in profile preview card dynamic (#14454) 2021-08-11 09:34:30 +07:00
reading_list_items views/reading_list_items i18n (#15041) 2021-10-18 11:32:57 -07:00
response_templates
service_worker Revert "Revert "Removed service worker (#12974)" (#13014)" (#13015) 2021-03-17 10:57:56 -04:00
shared Update left sidebar links with new Crayons components (#15757) 2021-12-20 08:46:30 +01:00
sidebars views/stories, views/layouts and other homepage i18n (#15083) 2021-11-10 07:38:43 -06:00
sitemaps Fix legacy sitemap logic (#14926) 2021-10-07 08:59:16 -04:00
social_previews I18nize articles & social_previews (#15097) 2021-10-27 16:21:47 -04:00
stories Refactoring instance variable usage in tagged articles controller (#15687) 2021-12-15 10:49:50 -05:00
tags Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
users Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
videos Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00