Commit graph

6450 commits

Author SHA1 Message Date
Jeremy Friesen
e6b26c7ed4
Favoring re-use of authorization error (#16992)
We only have one reference to the UnauthorizedError, which is shadows
the ApplicationPolicy::NotAuthorizedError.  This commit removes the
exception.

Related to forem/forem#16985 but only barely
2022-03-24 08:16:28 -04:00
Anna Buianova
b08c1a2285
Fix redundant slack notifications when article was published (#16977)
* Don't send redundant slack messages when article was published

* Move Article callbacks

* Moved callbacks for rubocop
2022-03-24 09:59:01 +03:00
Jeremy Friesen
ea3bc697e2
Removing a JS message about connect (#16982)
* Removing a JS message about connect

Related to forem/forem#14734

* Remvoing another reference

I ran `rg Connect[^i]` to see about any remaining references to
Connect.  This one seems to be the last.
2022-03-23 12:30:59 -04:00
Jeremy Friesen
38ef49a2f2
Adjusting article copy to be more general (#16973)
* Adjusting article copy to be more general

Our language regarding articles needs minor revisions to speak a bit
more generally about content.  This follows on the features of
AuthN/AuthZ work to allow forem admins to configure their forems such
that a subset of their forem members may not have the ability to create
articles.

Closes forem/forem#16890
Closes forem/forem#16891

* Update app/views/users/_notifications.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-23 11:34:33 -04:00
Jeremy Friesen
aa3d6c8104
Refactoring methods to remove duplication (#16974)
As I'm looking at the dashboard, there's lots of small duplication.
This refactor is a way to help me collect my thoughts regarding how to
approach the larger issue at hand.
2022-03-23 09:07:47 -04:00
Jeremy Friesen
b9b52c91a2
Adding Admin > Content Manager > Spaces menu item (#16951)
This menu item will show up once you have added the
`:limit_post_creation_to_admins` feature flag (regardless of whether
it is enabled or not).

If you wish to add the menu item:

```console
rails console runner "FeatureFlag.add(:limit_post_creation_to_admins)"
```

In "adding" the item, it will default to disabled.  However, as an
administrator you should now be able to toggle on and off the
authorization enforcement.

If you wish to remove the menu item:

```console
rails console runner "FeatureFlag.remove(:limit_post_creation_to_admins)"
```

Future plans for this will be to remove the `FeatureFlag.exist?`
conditional so that the menu item shows up.  A major consideration is
that we'll assume that all Forem's have a "default space" in which
folks (by default) can post.

Builds on forem/forem#16897
Closes forem/forem#16842
2022-03-23 08:55:50 -04:00
Julianna Tetreault
e132279048
Update Member Index View Layout (#16975)
* Adds Member Index View cbare-bones columns

* Adds conditional search/filter styling to _controls partial
2022-03-23 06:39:46 -06:00
Jeremy Friesen
4cdfc4cc13
Adding ArticlePolicy#has_existing_articles_or_can_create_new_ones? (#16944)
* Adding ArticlePolicy#has_existing_articles_or_can_create_new_ones?

As part of our aspirations to only show users what is relevant to them
and "hiding" what is not, this method will help us with the edge case of
"should we show the user a dashboard listing of posts?"

Related to forem/forem#16837

* Adding further documentation

* Adding clarifying comment
2022-03-22 16:01:44 -04:00
Jamie Gaskins
2058c57274
Optimize URL.database_available? (#16968)
This method was making a DB query every time. Chances are that if the
table is there the first time, it'll continue to exist. This is an
assumption generally baked into ActiveRecord - it caches the schema for
every table when its corresponding model is used and never checks it
again for the life of the process.
2022-03-22 13:04:12 -04:00
Jeremy Friesen
73ff4169e8
Removing instance variable and before action (#16954)
There is no reason to create an instance variable as we don't pass this
to the view.  Further, by adding this as a before_action there's a
disconnect in logic.

This commit attempts to address those issues.

What follows is a three-fold change:

1. Removing the before action (let's just call the method)
2. Reworking the method to reduce, just a bit, the method cost
3. Removing an unused instance variable

Here are the benchmarks.  Note the "follows_limit" as written below is
the "Proposed" route.

```ruby
require 'benchmark'

def follows_limit_original(params:, default: 80, max: 1000)
  per_page = (params[:per_page] || default).to_i
  @follows_limit = [per_page, max].min
end

def follows_limit(params:, default: 80, max: 1000)
  return default unless params.key?(:per_page)
  per_page = params[:per_page].to_i
  return max

  per_page
end

def follows_limit_alt(params:, default: 80, max: 1000)
  per_page = params.fetch(:per_page, default).to_i
  return max if per_page > max
  per_page
end

TIMES = 10_000
Benchmark.bmbm do |b|
  b.report("Original no params") { 1000.times { follows_limit_original(params: {}) } }
  b.report("Original less than max") { 1000.times { follows_limit_original(params: {per_page: 90 }) } }
  b.report("Original greater than max") { 1000.times { follows_limit_original(params: {per_page: 9000 }) } }
  b.report("Proposed no params") { 1000.times { follows_limit(params: {}) } }
  b.report("Proposed less than max") { 1000.times { follows_limit(params: {per_page: 90 }) } }
  b.report("Proposed greater than max") { 1000.times { follows_limit(params: {per_page: 9000 }) } }
  b.report("Alt no params") { 1000.times { follows_limit_alt(params: {}) } }
  b.report("Alt less than max") { 1000.times { follows_limit_alt(params: {per_page: 90 }) } }
  b.report("Alt greater than max") { 1000.times { follows_limit_alt(params: {per_page: 9000 }) } }
end
```

```shell
$ ruby /Users/jfriesen/git/forem/bench.rb
Rehearsal -------------------------------------------------------------
Original no params          0.000403   0.000002   0.000405 (  0.000405)
Original less than max      0.000109   0.000005   0.000114 (  0.000114)
Original greater than max   0.000161   0.000006   0.000167 (  0.000166)
Proposed no params          0.000076   0.000001   0.000077 (  0.000076)
Proposed less than max      0.000114   0.000009   0.000123 (  0.000126)
Proposed greater than max   0.000112   0.000011   0.000123 (  0.000123)
Alt no params               0.000104   0.000007   0.000111 (  0.000114)
Alt less than max           0.000113   0.000009   0.000122 (  0.000122)
Alt greater than max        0.000111   0.000001   0.000112 (  0.000115)
---------------------------------------------------- total: 0.001354sec

                                user     system      total        real
Original no params          0.000108   0.000000   0.000108 (  0.000110)
Original less than max      0.000109   0.000001   0.000110 (  0.000111)
Original greater than max   0.000109   0.000000   0.000109 (  0.000109)
Proposed no params          0.000071   0.000000   0.000071 (  0.000071)
Proposed less than max      0.000103   0.000001   0.000104 (  0.000103)
Proposed greater than max   0.000102   0.000000   0.000102 (  0.000103)
Alt no params               0.000093   0.000000   0.000093 (  0.000093)
Alt less than max           0.000103   0.000000   0.000103 (  0.000104)
Alt greater than max        0.000102   0.000000   0.000102 (  0.000103)
```
2022-03-22 12:57:57 -04:00
Andy Zhao
5fab2f86b0
Always show the browse section of podcasts regardless of featured (#16329)
* Always show the browse section regardless of featured

* Add tests for /pod

* Use safe operator if there are no episodes to show

* Fix test for new podcast page

* Fix test again for podcast page
2022-03-22 12:56:54 -04:00
yheuhtozr
8b8d14479b
youtube tag timestamp format fix (#16873)
* youtube tag timestamp format fix

* spec update
2022-03-22 08:55:45 -06:00
Takuya N
26e10fc71e
Use the canonical URLs to link from sorted pages (#16928)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-03-22 14:51:36 +00:00
Suzanne Aitchison
198cc7d1ac
Style member index header & tabs behind feature flag (#16964)
* tweak tab and heading layout inc small screens

* role heading and tabs out to invited and GDPR views
2022-03-22 14:29:44 +00:00
ludwiczakpawel
2cec22e146
Removing bootstrap from Config's collapsable sections (#16620)
* .

* updates

* update specs

* expand profile field before deleting

* expand auth section in rspec test

* expand smtp settings summary in rspec

* update user experience section specs

* more spec tweaks

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-22 14:57:07 +01:00
Ridhwana
28b1c09b83
Updated Member Index View Layout foundation behind a feature flag. (#16958) 2022-03-22 14:53:39 +02:00
Daniel Uber
6869917904
validate will send forem feeds importer user agent, just like import (#16925)
follow on to #15942 which enabled downloading existing DEV feeds, this
allows setting a feed url to DEV.

It's possible this user agent should be brought inline with the
tags choice of community name and url, but in the short term I'm
making this consistent with the existing feed importer.
2022-03-21 16:43:24 -05:00
Jeremy Friesen
d12d3b3ef1
Removing before actions in favor of explicit method (#16942)
There is an incredible amount of conditionals in play within this
controller.  I'm working to disentangle the logic so we can introduce
unified authorization policies.

The first step is removing the quasi-opaque "before_action" behavior
related to authorization.  My strong preference is to make that explicit
and in doing so begin to see how to adjust the policy enforcement/creation.

This relates to forem/forem#16913
2022-03-21 17:24:15 -04:00
Jeremy Friesen
26149ddf31
Adding inline documentation (#16955)
While exploring the DashboardsController, I came across method calls to
`not_found`.  Idiomatically, I assumed that these methods were returning
a value.  However, in looking at the code, it raises an exception.

_Note: I excpect methods that raise exceptions, especially as the only
thing they do, to end in a `!`._

By adding the documentation my "IntelliSense" provides insight into the
expected behavior of this function (e.g. "Raises an exception").
Without the documentation, I don't see any useful information.
2022-03-21 17:18:06 -04:00
Daniel Uber
7e099db0f4
Match error class using case instead of if/elsif/else (#16952)
* prefer case to multiple if branches

case klass works fine on inheritance chains (we don't need to match on
inheritance explicitly).

* Verify case on error class behaves as before

* Fix tests

I don't know how I committed tests that were failing, but don't do that
2022-03-21 15:34:49 -05:00
Arit Amana
161e18e5df
Better error upon Tweet embed when Twitter keys missing (#16916)
* complete implementation; specs remain

* complete specs

* better implementation

* more appropriate error msg

* ALSO change error msg in spec
2022-03-21 16:21:37 -04:00
Jeremy Friesen
71e9f2bfb4
Refactoring AdminMenu and Menu towards classes (#16847)
As I was looking to implement the new Spaces feature (see
forem/forem#16842), I began looking at how to adjust the admin menu.  I
found the Menu and AdminMenu.  I wanted to add the "spaces" item under
the `:content_manager` scope.  Looking at the implementation, I saw I
would need some additional branching logic.

To get an understanding of the implementation, I chose factor towards
classes.

This refactor does a few things:

1) Clarifies a method name (e.g. "children?" becomes
   "has_multiple_children?")
2) Adds some tests of the menu implementation.
3) Removes deeply nested hashs in favor of first class objects.
4) Removes a complex method for determining menu visibility, instead
   favoring a method that either takes a boolean OR a lambda.

There are further refactors to consider, especially in regards to the
helper methods and some of the coercion of strings into different
formats.  But this refactor gets me the part I most am interested in:

Making it easier to specify a menu item as visible or not.
2022-03-21 13:31:20 -04:00
Jeremy Friesen
88f4daf952
Penciling in a Default Spaces section (#16897)
* Penciling in a Default Spaces section

This delivers two primary things:

1.  Extracting shared policy examples
2.  Providing a functioning skeleton for toggling on the
    "limit_post_creation_to_admins" feature.

Important is that once merged, it would be possible for this code to
"leak" out.  But how that leaks out is also how you can test that the
feature works.

First, to orient, there is a constraint for a new route.  That
constraint checks if the feature flag exists (e.g. has been explicitly
enabled or explicitly disabled).  In other words, at this point, you
can't accidentally enable the feature via the UI.  But once you have
enabled the feature, you can then toggle the feature on and off.

So, to test this in the browser:

1. Pull down this branch
2. Run `rails runner "FeatureFlag.disable(:limit_post_creation_to_admins)"`
3. Startup your the web server.
4. Login as an administrator
5. Goto /admin/content_manager/spaces
   a. Bask in the glory of a plain HTML form
6. With another browser, login as another non-admin user
7. Go to /settings/extensions, you should see a section Publishing from RSS.
8. Now with the admin's session, update the form to turn on
  "limit_post_creation_to_admins"
9. Back to the non-admin browser, refresh /settings/extensions, you
   should no longer see the section Publishing from RSS.

Note: I have not included an admin menu item as that is related to and
dependent on some refactors I'm working on (see forem/forem#16888 and
forem/forem#16847).  So a bit of "security through obsurity"

Note: In the future, once we resolve forem/forem#16490, we'll start
toggling the "Create a Post" button.

Note: I am not including Cypress tests nor request tests for this
feature because the implementation details related to the testing via
that approach are a little too volitale.

Related to forem/forem#16842

* Updating copy based on forem/forem#16893

* styles

* styles

* dark styles

Co-authored-by: Paweł Ludwiczak <ludwiczakpawel@gmail.com>
2022-03-21 09:56:12 -04:00
Arit Amana
2731c37cd6
Fix embed link validation failures (#16920)
* complete fix and update specs

* issue head req not get

* fix broken specs
2022-03-18 14:45:43 -04:00
Julianna Tetreault
2560032c0c
Remove duplicate banish confirmation modal (#16912) 2022-03-18 09:22:15 -06:00
Daniel Uber
c6c30d58ab
Remove fastly http purge feature flag and conditional behavior (#16903)
* Always use purge, never post, to fastly

* Remove unneeded feature flag
2022-03-18 09:10:43 -05:00
Arit Amana
c4073ab217
Allow embedding of Instagram profile URLs (#16904)
* complete IG implementation of profile embed, refactors, update specs

* Follow redirects and check them for validity via recursion

* working out redirects

* add IG test links with params

Co-authored-by: Dwight Scott <dwight@forem.com>
2022-03-18 09:03:14 -04:00
Jeremy Friesen
e1f7a6548c
Adding docs and specs to AdminMenu.nested_menu_items (#16888)
* Adding docs and specs to AdminMenu.nested_menu_items

This relates to PR forem/forem#16847 which addresses issue
forem/forem#16842.

The goal of this PR is to help me develop an understanding of the
AdminMenu so I can further extend it and better understand it.

There's also a bit of knowledge sharing that I'm looking for, and the
comments and tests are there to help "confirm" that knowledge.  There
might be more that I'd consider regarding a refactor, but I want to make
sure I'm on the right path before I go further.

tl;dr - this is the smallest commit I can make to begin to tease out an
understanding of the method I put under test.

* Update app/models/admin_menu.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Adding more documentation

* Update app/models/admin_menu.rb

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-03-18 08:30:41 -04:00
Ridhwana
74a16beacb
Introduce "extensions" (#16840)
* feat: add the feature flag route and controller

* feat: add a ff page

* feat: update to a post with a success banner

* feat: test the feature

* feat: update the styling

* feat: change feature flag to extension witha  few more improvements like adding a model not backed by a table

* feat: update the text

* refactor: if you enable a FF, it gets added under the hood as well

* feat: accessibility name for label

* use keyword args

* use locales

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update config/locales/controllers/admin/fr.yml

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/controllers/admin/extensions_controller.rb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* fix: rubucop

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-18 11:22:17 +02:00
Julianna Tetreault
bf2973bdc4
Refactor the "Banish" Modal in the Member Detail View (#16757)
* Refactors _banish.html.erb by removing duplicate code

* Refactors _banish.html.erb to account for new and old users

* Moves conditional into Admin::UsersController#set_user_to_be_banished

* Reverts last commit, as it didnt work as expected

* Fixes last commit, which reverted to the incorrect code

* Pulls banishable user into instance var and fixes button txt
2022-03-17 10:36:10 -06:00
Arit Amana
c06be3f447
Allow option for "no readme" with GitHub embeds (#16895)
* Implementation and specs

* update docs

* refactor

* remove unneeded commented code

* remove real auth string

* complete stubbing with vcr cassette

* clearer error messaging

* activate VCR conventional way

* added naming clarity

* more robust options checks

* update docs

* nudge Travis

* clearer docs

* fix failing specs

* fix boolean method

* damn code
2022-03-17 12:06:26 -04:00
Suzanne Aitchison
b498dd9867
Revert "Refactor editor tags selector to fetch all tag info in one network call (#16841)" (#16900)
This reverts commit 7c1993604c.
2022-03-17 10:49:35 +00:00
Suzanne Aitchison
7c1993604c
Refactor editor tags selector to fetch all tag info in one network call (#16841)
* use bulk get of tags in editor

* prefer tag_ids if both tag_ids and tag_names are present

* undo changes to public api tags

* use new endpoint
2022-03-17 09:30:09 +00:00
Mac Siri
8379232bb3
Fix missing dc:creator on RSS feed (#16898)
* Fix missing dc:creator on RSS feed

* Update spec

* Remove aggregate_failures
2022-03-16 17:15:15 -04:00
Mac Siri
b81d8c9479
Add Errno::EHOSTUNREACH to Podcasts's rescue list (#16884)
* Add Errno::EHOSTUNREACH to Podcasts's rescue list

* Add spec
2022-03-15 14:05:04 -04:00
Julianna Tetreault
c91bdeaeb2
Removes views that have been replaced with the Admin Member Detailed view (#16852) 2022-03-15 06:53:21 -06:00
Juan Esteban Nieto Cifuentes
efcab9d7db
Fix pause button (#16846)
* Fix pause button

* Fix gif button bug

* Add comment
2022-03-11 16:30:22 +00:00
Fernando Valverde
445b5ba584
Re-enable imageUpload native integration (#15487)
* Re-enable imageUpload native integration

* remove temporary inline comments

* move addEventListener to useEffect hook

* console.log on native messages from image upload integration

* Debug suggestions

* store text area in ref rather than state

* call error callback from native message handler

* Remove debug logs

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-11 08:45:25 -06:00
Arit Amana
34bfc491b0
Check validity of embed URLs (#16704)
* start link validation check

* keep PRs small

* rearrange check flow

* need a change to switch accounts

* Rescue from SocketError to surface a better error message

* some updates

* handle 301s

* address Travis failures

* implement request stub

* add needed unified-embed tag spec

* add needed unified-embed tag spec

* nudge Travis

* Address PR review comments

* special-case displaying "base"

* undo change to errors.add

* nudge Travis

* more succinct code

Co-authored-by: aritmock <aritmock@example.com>
Co-authored-by: Dwight Scott <dwight@forem.com>
2022-03-10 13:18:59 -05:00
Julianna Tetreault
aa44786ebd
Remove admin_member_view Feature Flag-Related Conditionals (#16764)
* Removes admin_member_view feature flags and refactors  conditionals

* Removes unused admin/users/_email_tools partial and user_email_tools_spec

* Actually remove the admin/user_email_tools_spec this time

* Removes the edit route from admin.rb users

* Adds a DUS (and spec) to disable and remove admin_member_view flag

* Fixes admin/users_spec.rb failures by updating spec with Member Detail changes

* Fixes spec failures within admin_bans_or_warns_user_spec.rb

* Refactors Admin::UsersController#credit_params due to failing specs

* Removes last traces of edit_admin_user_path and fixes buttons, specs, etc.
2022-03-10 08:29:05 -07:00
Arit Amana
39bc67ec15
Test Solution for Forem-link Embed issues on Canary2 (#16843)
* solution

* fixing specs

* complete specs

* nudge Travis

* resolve database issues

* nudge Travis

* Check that the settings table exists before loading the class

This maybe fixes an issue in test-console-check accessing a missing
table `users` (because we're requiring
settings during the initializer, and we're initializing the app during
a schema load on a newly created db).

* refactor check

* privatize and rename

* add self

* reposition private class method

* Prevent accidentally deploying to DEV

* Skip tests to try deploying to benhalpern

* Allow PR to deploy to benhalpern

* Allow other branches to deploy

* Oops

* Revert changes to travis.yml

Co-authored-by: Dan Uber <dan@forem.com>
Co-authored-by: Andy Z <17884966+Zhao-Andy@users.noreply.github.com>
2022-03-09 18:26:02 -05:00
Mac Siri
63b5c9102d
Remove ForemStatsDriver abstraction (#16835)
* Remove ForemStatsDriver abstraction

* Remove stats.rb
2022-03-09 14:18:29 -05:00
Fernando Valverde
06cec96324
Rebranding from passport to forem account (#16754) 2022-03-09 10:03:16 -06:00
Jamie Gaskins
987c0a07a2
Allowlist character classes for post titles (#16787)
* Normalize article titles

* Change method name to match what it does

* Expand on allowed emoji ranges

This required a few changes to be in compliance with Rubocop because
that regex is a beast.
2022-03-09 10:36:33 -05:00
Daniel Uber
cc7c342bb5
Limit per-user feed import fanout to users with feed urls set (#16831)
* Limit feeds import fanout to users with feeds

This filtering for feed settings occurs in
Feeds::Import#filter_users_from already, so the enqueued ForUser
jobs were mostly no-op, but the queue latency spiked as hundreds of
thousands of jobs were added to default.

Prescreen users to avoid enqueuing a noop job every hour for every single
user without a feed.

* Update tests to check only jobs for users with feeds are enqueued

* spec cleanup

Only include alice when we check no job is enqueued for her.

Assert no job is enqueued for alice.

Rename bob to user when alice isnt there to contrast.

* Update spec

Use update_columns to bypass setting validation (checking feed is
valid/reachable)

Remove unneeded timecop block when passing a set time

Remove sidekiq: fake and allow Import.call to be received

* Empty commit to trigger CI rebuild
2022-03-09 08:51:00 -06:00
Jamie Gaskins
9423060299
Fan out Feeds::ImportArticlesWorker (#16818)
* Fan out Feeds::ImportArticlesWorker

Doing all that work within a single Sidekiq job has begun taking over an
hour on DEV. Regardless of the reasons we did it that way originally, we
should be able to handle this concurrently. If we cannot, we need to
investigate why and handle it properly rather than consigning it to
sequential work.

* Fix specs

The specs make assumptions about how the code under test is implemented.
This commit does not change that, as much as I would like to. Instead,
it just aligns the assumptions with the new implementation.

The previous tests didn't actually represent reality though, since we
can't get a Time or ActiveSupport::TimeWithZone instance inside of the
`perform` method while running it through Sidekiq. Instead, the specs
seem to be relying on the fact that the time instance gets serialized to
ISO-8601/RFC3339 format and that that format is understood by Postgres.
Otherwise, I'm not sure how it would work in production as written.

The new specs reflect reality more closely. The `earlier_than` value
will be converted into an ISO8601/RFC3339 string when passed through
Sidekiq.

* Add parens to perform_bulk call

Turns out, we actually do this pretty consistently. I could've sworn I
saw a bunch of these calls without parens. ¯\_(ツ)_/¯

* Improve variable naming

This is not a list of ids, it's a list of lists of arguments for Sidekiq
jobs, the inner of which contains an id, but that's not the only thing
it contains.
2022-03-08 15:39:16 -05:00
Jeremy Friesen
4db3e38174
Removing unused instance variable (#16826)
```shell
❯ rg "@notifications_index"
```

The above shell command exits status code 1, which means there are no
results found.

This relates to exploratory work for forem/forem#16821
2022-03-08 13:59:08 -05:00
Daniel Uber
ffc65bed81
Don't suggest author follows for anonymous visitors (#16825)
* Don't suggest users for an anonymous visitor to follow

The sidebar raises an error when rendering suggested users for a tag
when the user is signed out.

https://app.honeybadger.io/projects/66984/faults/79342962/

* Assert empty response returned for anonymous requests
2022-03-08 11:15:06 -06:00
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
Suzanne Aitchison
5ae9eb4257
Implement new color picker in listings category form, cleanup old code (#16770)
* remove old color picker initializer

* update listing category picker

* remove old color picker styles
2022-03-08 12:43:18 +00:00