docbrown/config
Jeremy Friesen 765df66084
Scoping the :listing routes to feature (#16406)
This commit builds on the conditional rendering of navigation links by
adding a routing constraint to all :listing routes.

The impact is, if we were to disable the listing feature (e.g.,
`FeatureFlag.disable(:listing_feature_enabled)`) all requests to `GET
/listings` (and those drawn in the [config/routes/listings.rb][1] file)
would return a 404 response.

Related to forem/rfcs#291, #16335, #16338, #16362.

Testing this change:

1. Start your local application (e.g. `$ bin/startup`)
2. Go to http://localhost:3000/listings
3. You should get a Successful response.
4. Now disable the feature (e.g. `$ bin/rails r \
   "FeatureFlag.disable(:listing_feature_enabled)"`)
5. Refresh http://localhost:3000/listings
6. You should get an `ActiveRecord::RecordNotFound` error; because the
   application is now looking for a user or org named "listings"; in other
   words we're not routing `GET "/listings"` to `listings#index` controller
   action.
7. Now enable the feature (e.g. `$ bin/rails r \
   "FeatureFlag.enable(:listing_feature_enabled)"`)
8. Refresh http://localhost:3000/listings
9. You should get a Successful response.
10. Goto 4

This commit is intended to be the penultimate change before we toggle
the listings section off by default.

[1]:c2ce2c32d5/config/routes/listing.rb (L1)
2022-02-04 10:13:56 -05:00
..
environments Ensuring that test's URL methods are similar (#16348) 2022-01-31 09:18:13 -05:00
fastly/snippets Disallow null user agent and obsolete browser (#15817) 2021-12-17 15:02:30 -05:00
initializers A suspended user returns 403 instead of 500 (#16408) 2022-02-04 09:42:23 -05:00
locales Copy organization secret code to clipboard (#16358) 2022-02-04 08:22:03 +00:00
routes Extracting listing routes (#16338) 2022-01-28 10:49:52 -05:00
webpack Reworked some webpack aliases as prework for #16174. (#16412) 2022-02-04 06:34:37 -05:00
application.rb Enable use_cookies_with_metadata option (#16087) 2022-01-13 10:27:19 -05:00
blazer.yml Increase Blazer's timeout (#15427) 2021-11-18 14:50:18 -05:00
boot.rb Upgrade to Rails 6.0 (#7658) 2020-06-04 11:54:25 +02:00
cable.yml Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
database.yml Update database config (#11308) 2021-02-23 17:41:34 -05:00
environment.rb Rails 6: enable zeitwerk autoloader (#8766) 2020-06-22 16:27:55 +02:00
field_test.yml Feed Experiment round 5: Factor in sum of tag points (#16272) 2022-01-25 17:08:31 -05:00
i18n-tasks.yml Remove Doorkeeper gem (#15749) 2021-12-21 12:29:58 +07:00
puma.rb Upgrade Rails to 6.1.3.1 (#11333) 2021-04-05 10:39:48 -04:00
routes.rb Scoping the :listing routes to feature (#16406) 2022-02-04 10:13:56 -05:00
schedule.yml Remove hardcoded /badge page that is DEV-only ✂️✂️✂️ (#16303) 2022-01-27 13:29:05 -05:00
secrets.yml Initial commit 2018-02-28 16:11:08 -05:00
sidekiq.yml setup sidekiq queues for different priority jobs (#5300) [deploy] 2019-12-30 10:16:52 -06:00
spring.rb Upgrade Rails to 6.1.3.1 (#11333) 2021-04-05 10:39:48 -04:00
storage.yml Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
webpacker.yml Moved from resolved_paths (deprecated) to additional_paths. (#9982) 2020-08-24 16:08:16 -04:00