docbrown/app
Jeremy Friesen 76933284b7
Authorize Web Monetization If User Can Create Article (#16824)
* Authorize Web Monetization If User Can Create Article

There are three things I'm introducing in this PR:

1. Extracting a partial
2. Reworking the i18n keys
3. Adding a policy check regarding Web Monetization

In *extracting a partial*, I'm following the existing pattern where
other extensions have their own partial.

In *reworking the i18n keys*, I'm ensuring that the keys are part of the
same namespace.  This will make finding their usage easier.  Further, if
we decide to remove (or convert to a plugin) the web_monetization, then
we're just a bit closer to that possibility.

Last, and the reason for the work, is *Adding a policy check regarding
Web Monetization*.  This follows on the work in forem/forem#16790.

Closes forem/forem#16820
Related to forem/forem#15098

There are two things to test:

1. Does the feature flag work or not.
2. Are the i18n keys properly applied.

For the feature flag:

- checkout this branch
- in rails console `FeatureFlag.enable(:limit_post_creation_to_admins)`
- start the rails server
- login as a non-admin user
- go to /settings/extensions and scroll to the bottom, you **shouldn't** see
  the partial
- login as an admin user
- go to /settings/extensions and scroll to the bottom, you **should** see
  the partial

Or visually verify the relatively simple change (and accept that it
conforms to #16790's existing pattern).

For the i18n keys, I have a before screenshot (from DEV.to) and the
after (from the changes on this branch).

* Adjustments based on contributor feedback
2022-03-08 09:39:34 -05:00
..
assets Implement new color picker in listings category form, cleanup old code (#16770) 2022-03-08 12:43:18 +00:00
controllers Removing before_action in favor of explicity call (#16777) 2022-03-04 11:08:53 -05:00
decorators [Small win] Add display name to campaign settings (#16653) 2022-02-22 10:01:52 -05:00
errors A suspended user returns 403 instead of 500 (#16408) 2022-02-04 09:42:23 -05:00
forms Using a Form Object that will persist for the Creator Settings Form (#15684) 2021-12-10 17:07:40 +02:00
helpers add new color picker to user experience config (#16769) 2022-03-08 12:43:01 +00:00
javascript Use the Preact ColorPicker in creator onboarding (#16731) 2022-03-03 08:22:10 +00:00
lib Renaming method for clarity (#16791) 2022-03-07 12:55:56 -05:00
liquid_tags Implement Loom Embed (not merging now) (#16633) 2022-02-22 09:05:55 -05:00
mailers "Reply to" and "From" Email addresses for SMTP Configurations (#16499) 2022-02-16 16:14:54 +02:00
models Renaming method for clarity (#16791) 2022-03-07 12:55:56 -05:00
policies Adding ArticlePolicy#moderate? (#16786) 2022-03-07 15:27:43 -05:00
queries small non-views ruby i18n (#16004) 2022-01-11 10:05:18 +07:00
refinements Drop profile columns from user (#10707) 2020-12-03 08:14:38 +07:00
sanitizers Don't sanitize anchor elements with no href (#16667) 2022-02-22 11:27:38 -06:00
serializers Remove unused methods from User (#16616) 2022-02-18 09:02:17 +07:00
services Only fetch RSS of users who can create articles (#16766) 2022-03-04 14:06:38 -05:00
uploaders small non-views ruby i18n (#16004) 2022-01-11 10:05:18 +07:00
validators Remove the "Getting Started" Section from the Config (#16033) 2022-01-20 07:31:35 -07:00
view_objects Patching ERB rendering of the data-info JSON (#16067) 2022-01-14 08:30:49 -05:00
views Authorize Web Monetization If User Can Create Article (#16824) 2022-03-08 09:39:34 -05:00
workers Favoring User scope as parameter for feed fetching (#16763) 2022-03-02 16:45:06 -05:00