docbrown/app/views/notifications
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
..
shared Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
_aggregated_reactions.html.erb actions and reactions i18n (#15058) 2021-10-25 12:35:05 -06:00
_article.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_badgeachievement.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_broadcast.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_comment.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_follow.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_mention.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_milestone.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_nav_menu.html.erb Page headers unified (#15158) 2021-10-25 21:41:29 +02:00
_notifications_list.html.erb views/notifications i18n (#15056) 2021-10-25 15:46:46 +07:00
_reaction.html.erb Notifications redesign (#11084) 2020-10-29 20:38:17 +01:00
_single_reaction.html.erb Cleanup single reaction template (#15207) 2021-10-26 16:35:12 -05:00
_tagadjustment.html.erb Remove surplus closing parenthesis (#15216) 2021-10-27 15:13:56 -07:00
index.html.erb Add comment notification test to Cypress, including a11y improvements to notification page (#15842) 2021-12-21 15:42:13 +00:00