Commit graph

67 commits

Author SHA1 Message Date
Ben Halpern
a229cfa174
Preserve internal navigation indicator on redirect (#11476)
* Preserve internal navigation indicator on redirect

* Fix test

* Refactor for cleaner reusability

* Add docs
2020-11-25 11:04:19 -05:00
Ben Halpern
badefcabeb
Developer experience/security: Make dev/test blow up if current_user is used erroneously (#11237)
* Let dev/test blow up if current_user is used erroneously

* Fix logic

* Fix click-to-edit permissions

* Change test to check for new behavior

* linting

* Edit tests

* Change test

* Clean up implementation

* Update comment

* Fix instance vars

* Update app/controllers/concerns/caching_headers.rb

* Merge origin and add request_store gem
2020-11-12 11:54:23 -05:00
Ben Halpern
e83f194a01
[deploy] Redirect to SiteConfig.app_domain (#10942)
* Redirect to SiteConfig.app_domain

* Redirect to full path with helper
2020-10-19 20:07:15 -04:00
Julianna Tetreault
292b4143ce
Part One: Fix Users Stuck in a "Created" but "Unregistered" State (#10882)
* Alters the Invitations::Controller to work with registered users and onboarding
  - Adds #after_accept_path_for to Application::Controller for onboarding
  - Adds update! on the users registered status to the Invitations::Controller
  - Adds a respond_with in place of a redirt to Invitations::Controller
  - Adds a request spec testing invitation acceptance and registered status

* specs: Cleans up invitations_spec.rb comments a little bit

* fix: Adds comments back to the Invitations::Controller that previously existed prior to refactor

* Adds back accidentally removed code from InvitationsController

* Temporarily comments out invitations_spec with reference to issue in the code

* Removes invitations_spec file in favor of spec file in another open PR
2020-10-19 16:51:31 -04:00
Ben Halpern
f62f5514f7
Add invitations controller to Allow List (#10934) 2020-10-19 16:31:26 -04:00
Molly Struve
ea969748e9
Feature:Notify Devs when Sidekiq is Not Running in Development (#10541) 2020-10-13 12:13:47 -05:00
Molly Struve
3303186125
Bug Fix:Count the Health Checks Controller as Public (#10435) 2020-09-25 10:35:10 +07:00
Ben Halpern
3a469a99e2
[deploy] Enable admin-configured app_domain (#10206)
* Move app_domain from env var to siteconfig *within app area*

* Fix SiteConfig

* Don't change URL.domain yet

* Not use in fastly cache purge yet

* Session store magoo

* Revert domain issue

* Add SetCookie middleware

* Temporarily remove cookie middleware and release tasks

* Re-enable SetCookieDomain

* Add some more comments, get it ready for testing

* Remove host from url options and temporarily show errors

* Allow forwarded host to be cookie

* Fix typo

* Change invalidAuthenticityToken

* Properly set app domain

* Proper Fastly cache

* Remove config.app_domain

* Remove config.app_domain

* Explicitely set remember_user_token

* More play with cookies

* Fiddle with remember_user_token

* Add remember_user_token changes

* Monkeypatch devise

* Sessions controller

* Include rememberable

* Include rememberable

* Proper cookie monkeypatch

* Proper cookie monkeypatch

* Proper cookie monkeypatch

* Remove extra cookie code

* User sign in tweak

* Close the loop

* Experiment with carrierwave public_url

* Finalize carrierwave monkeypatch

* Remove async controller specs

* Change some tests

* Update domain test

* Remove temporary production.rb change

* modify cookie logic

* Remove unneeded changes

* Remove unneeded changes

* Explicitely pass host

* Fix linting

* Fix social image test

* Add some cookie tests

* Modify article url

* Fix canonical urls

* Fix typo

* Remove sessions controller

* Remove devise monkeypatch

* Add monkeypatch

* Remove elsif

* Update spec/helpers/application_helper_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Adjust remember_cookie_sync

* Remember user token experimentation

* Fiddle with devise

* Properly configure devise

* Fix typo

* Fix formatting issue

* Add comment about middleware

* Fix typo

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Remove commented-out code

Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-09-11 09:38:34 -04:00
Ben Halpern
7e9a6b848d
Add multiple entry options (#10117) 2020-09-01 08:59:52 -04:00
Lisa Sy
54c071856e
[deploy] Update top-header for logged-out user (#9874)
* Create first start at desktop top header updates

* Update mobile styling of top header

* Stylize sign in widget card

* Update nav menu and top bar

* Changes based on user being logged-in or not

* Uses user_signed_in? on top nav bar

* Fix lingering old cloudinary helper method

* Trigger CI

* Fixes specs

* Adds redirect_using_referer_spec, fixes other specs & cleanup

* Adds nav-menu.scss to layouts/_styles.html.erb for inline & small edit in referer check

* Remove logged-out styles to make it more uniform with logged in

* Remove nav-menu.scss file

* cleanup markup and JS a little

* Fixes FB auth specs to new login links

* Makes sure unauthenticated /new redirects back to editor

* CI fix Sing in with -> Continue with

* Update db/schema.rb

* Update db/schema.rb

* Update db/schema.rb

Co-authored-by: Fernando Valverde <fdov88@gmail.com>
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-08-31 18:12:22 -04:00
Ben Halpern
7ba7d9fc46
Add logic for asking for FOREM_OWNER_SECRET to be present on first user sign up if set by system (#10108)
* Add logic for requiring FOREM_OWNER_SECRET to be present

* Fix test logic
2020-08-31 16:41:30 -04:00
Ben Halpern
dba151915b
[deploy] Allow initial user to sign up and configure app (#10073)
* Allow initial user to sign up and configure app

* Fix added value unneeded

* Make siteconfig public in tests

* Remove deprecated method and adjust seed default

* Add new controllers not to redirect for public

* Modify tests

* Edit test defaults

* Fix linting

* Add starter mode to seed file
2020-08-31 12:54:22 -04:00
Ben Halpern
0dd04ea45a
Create initial "register by email and password" beta/MVP in prep for "setup mode" (#10039)
* Modify registrations controller

* A bit of progress

* More work

* a bit pf progress on confirmation emails

* Get basic functionality in place

* Remove comments

* First basic test

* Add tests

* Fix code styles

* Remove sessions spec

* Remove sessions spec

* Remove extra markup
2020-08-28 09:46:56 -04:00
rhymes
ec4d373ea0
Move Stripe dev logger in the controller (#9887) 2020-08-20 09:38:54 -04:00
Ben Halpern
e76f6cbbba
Set Stripe dynamically instead of at boot (#9862)
* Set Stripe dynamically instead of at boot

* Add stripe SiteConfig

* Fix capitalization
2020-08-19 21:24:19 -04:00
Michael Kohl
1c1ab8b709
Add PUBLIC_CONTROLLERS constant (#9825) 2020-08-17 14:05:25 -04:00
Vaidehi Joshi
df990afadc
Conditionally remove no-cache from Fastly headers (#9631) [deploy]
* Rename FastlyHeaders to CachingHeaders, conditionally experiment with removing no-cache

We suspect that it is safe to remove `no-cache` entirely from the Cache-Control headers that are sent
along to Fastly, but there is no great way to confirm this hypothesis. We're testing this by experimenting
on one single article. We will conditionally default to the same headers that we send to Nginx, and send
those headers to Fastly (by removing `no-cache` and adding in `max-age`, which should be ignored since Fastly
also has Surrogate-Control headers added to it, which include a `max-age`, which Fastly should prioritize
over any other `max-age`.

Once we've confirmed that this doesn't cause issues on the Fastly side, we can remove this check and use
the same Cache-Control headers for both Fastly and Nginx.

* Add check for request.env[REQUEST_PATH].present?
2020-08-05 12:34:12 -07:00
benhalpern
b611a9847a Enable public or private forem config 2020-07-16 09:58:00 -04:00
benhalpern
98242dc68b Initial work 2020-07-16 06:59:20 -04:00
Michael Kohl
fb27f52ed0
[deploy] Display banner if site hasn't been configured (PRE DEPLOYMENT TASKS) (#8435) 2020-07-07 07:37:04 -05:00
Ben Halpern
cfa5e882ce
[deploy] Add SiteConfig for feed style (#8721)
* Add SiteConfig for feed style

* Merge master

* Merge master

* Fix typo
2020-06-24 12:14:33 -04:00
Vaidehi Joshi
ded5e245fd
Turn off ahoy visit tracking (#8782) [deploy] 2020-06-18 15:31:31 -07:00
Molly Struve
16495791d3
Remove Unnecessary User Touch From Strip Controller (#7924) 2020-05-19 12:45:56 +02:00
Molly Struve
6d6f7086e5
[deploy] Track current_user ID in Honeycomb (#7915) 2020-05-18 09:36:18 -05:00
Molly Struve
d1e39a7dba
[deploy] Rate Limit Feedback Message Creation (#7832) 2020-05-14 12:00:22 -05:00
Molly Struve
371a71a3be
[deploy] Expose Article Update Rate Limit on Config Page (#7826) 2020-05-13 15:29:32 -05:00
Molly Struve
ba0ebbafa8
[deploy] RateLimit Refactor: Consolidate Logic for Checking a Limit and Raising an Error (#7636) 2020-05-01 13:31:44 -05:00
Alex
b6664456c0
[deploy] Validate filenames server-side (#7405) 2020-04-23 14:30:59 -05:00
rhymes
6d9ecb45e6
[deploy] Authentication refactoring: improve testing on OmniauthCallbacksController (#7439)
* Improve testing on OmniauthCallbacksController

* Remove removal of legacy cookie and added validation comments
2020-04-23 17:27:04 +02:00
Alex
83e92cbfd3
Rescue error and add specs (#7292) 2020-04-15 10:34:00 -04:00
Alex
10c1882548
[deploy] Log image data to Datadog for file name too long error (#7200)
* Log image data to Datadog for file name too long error

* Add guard for when no images are found
2020-04-09 18:25:26 -04:00
Alex
932f81afe6
Copy set_cache_control_headers from fastly-rails (#7070) [deploy]
* Copy controller actions from fastly-rails

* Move logic to FastlyHeaders controller concern

- Only add cache-control headers
2020-04-06 13:06:27 -04:00
Matej Minárik
e9a0efbbf2
Fix broken StoriesController#show article with bad chars (#6248) [deploy] 2020-02-24 13:41:06 -05:00
rhymes
1df24046d8
Small API controllers refactoring (#6021) [deploy]
* TagsController inherits from ApiController
* Let ApiController inherit from ActionController::Base to have its own lifecycle
* Remove unused method
* Use only one respond_to :json for the entire API
* ApiController inherits from ActionController::Base
* Use Pundit only where needed
2020-02-12 11:51:42 -05:00
rhymes
c41d66e900
Replace ban/banned with suspend/suspended in user facing text (#5816) [deploy] 2020-02-10 10:12:53 -05:00
rhymes
42b33f29ae
Add signin=true as a param correctly if the URL already has params (#5866) [deploy] 2020-02-04 09:41:10 -05:00
Molly Struve
1a76fa03d7 Return ActionController::RoutingError error when Invalid Format is Requested (#5140) [deploy]
* Return ActiveRecord::RecordNotFound error when an invalid format is requested

* raise ActionController::RoutingError when template is not found
2019-12-17 10:00:12 -05:00
Ben Halpern
630c1b7425
Migrate to streaming app shell via serviceworkers (#5020) [deploy]
* Initial work for streaming app shell way of using serviceworkers

* Close in on serviceworker adjustment finalization

* Add docs and loading indicator

* Remove useless code

* Don't run on API

* Update app/javascript/contentDisplayPolicy/hideBlockedContent.js

* Fix small details

* Don't run serviceworker.js code in test env

* Fix JS in serviceworker

* Move private keyword to proper place in async controller

* Change shell_version to HEROKU_SLUG_COMMIT

* Update caching config

* Add test for async_info/shell_version
2019-12-16 12:21:33 -05:00
Ben Halpern
b938dab91b
Add ApplicationMetalController to relevant controllers (#4937)
* Add ApplicationMetalController to relevant controllers

* Add request forgery protection to metal

* Remove logger call

* Add logger keyword and skip protect_from_forgery in test

* Uncomment main_image in test
2019-11-26 16:29:07 -05:00
rhymes
0ffa127481 Refactor session_current_user_id in a shared concern (#4936) 2019-11-26 13:21:56 -05:00
Ben Halpern
36479f09c3
Replace current_user.id with session_current_user_id (#4880) [deploy]
* Replace current_user.id with efficient_current_user_id in high-leverage areas

* Update name of efficient_current_user_id

* Replace user_signed_in? in pageviews

* Remove unneeded ?
2019-11-22 14:27:43 -05:00
Andy Zhao
8a4030c25d Revert changes as a hotfix (#3964) 2019-09-06 11:54:35 -04:00
rhymes
69c8b24c34 Send JSON 404 response to API error routes (#3959)
* Fix an issue where API 404 calls got the HTML 404 page in response

* Use keyword for consistency
2019-09-06 10:18:50 -04:00
Ali Spittel
52c60ce37e Feature/refactored onboarding (#3333)
* set up refactored onboarding

* create onboarding page

* add in first slide and change slide functionality

* fix test suite

* profile refactor

* profile refactor

* refactor to api

* add checkbox fields

* add checkbox fields

* remove puts

* add basic css

* add styling

* add redirect

* hide back and next at first and last slides

* test refactored onboarding

* test refactored onboarding

* remove article edits

* Fix schema

* Add deleted file back in

* Add default value for checked_t&c column

* Adjust HTML structure to keep nav buttons in place

* Fix ESLint issues on Onboarding.jsx file

* Handling for undefined or empty followedTags on getUserTags

* Fix codeclimate issues

* Fix codeclimate issues

* Fix more codeclimate issues

* Fix more codeclimate issues

* Update Onboarding snapshots

* Uncheck the CoC and T&C checkboxes on render

* Update snapshots

* Return false instead of raising error

* Update spec to use new onboarding

* Redirect to onboarding if haven't seen it yet

* Prevent redirect to onboarding from /signout_confirm

* Use assign_attributes instead of saving twice

* Move COC and T&C checkbox page to second slide

* Add 'go back to original page' functionality

* Reuse ready prototype logic

* Keep track of the last visited onboarding page

* Fix email subscription bug

* Fix overflow issue for tags page

* Remove height to prevent page container scrolling

* Check for CoC and T&C for displaying onboarding

* Add InstantClick redirect and preserve referrer in client

* Fix async update + check by using localStorage

* Turn off onboarding for tests

* Finalize design for onboarding

* Finalize design for onboarding

* Make bulk follows during onboarding

* Fix bulk follow test
2019-07-26 15:53:32 -04:00
Anna Buianova
0ecb937875 Added rubocop-rails (#3059)
* Added rubocop-rails

* Update rubocop version in the CodeClimate config
2019-06-06 09:47:57 -04:00
Ben Halpern
4319d86c06
Remove extra param and add message for prefill (#2487)
* Remove extra param and add message for prefill

* Fix test for /new non-logged-in

* Fix /new test
2019-04-18 15:34:50 -04:00
Andy Zhao
8ef611f879 Remove Honeycomb from the app (#2366)
* Remove Honeycomb related gems

* Remove Honeycomb related code from controllers

* Remove Honeycomb from RSS Reader

* Remove Honeycomb related files

* Remove Honeycomb related tests

* Remove leftover Honeycomb methods
2019-04-11 10:49:35 -04:00
rhymes
3b4bda89df Upgrade Honeycomb gem, fix and improve RssReader tests (#2319)
* Switch from deprecated honeycomb-rails to honeycomb-beeline

* Improve error handling, tests and add refactoring

* Fix multiple fetching test and add one more

The test wasn't actually testing the correct behavior, because the class
by default force fetches. It worked because it wasn't reloading the user
from the database.

* Test that Honeycomb's client is doing its thing

* Use some defensive programming to avoid any possible problem during shutdown

* Fix typo

* Use the new API to add fields to the current measured event

* Use default instrumentation and add user info to event

* Replace user.email with user.username, less personal data around

* Use mocking instead of calling Honeycomb.init

* Freeze time before traveling

* Remove a flaky test dependent on rand
2019-04-07 15:27:53 -04:00
Andy Zhao
3e89796d9d Add API Analytics Endpoints (#2293)
* Add API endpoints for analytics

* Remove comment and spacing

* Use proper time formatting

* Refactor and clean up some logic

* Add pro and org member traits

* Use shared examples for analytics API spec

* Add analytics authorization specs

* Remove accidental include Pundit

* Raise not_authorized for invalid requests

* Make attributes and time methods private

* Add custom UnauthorizedError

* Raise and use rescue_from to handle 4xx requests

* Enforce date parameters to follow a specific format

* Use current user to allow same origin requests

* Use custom headers and not params for token auth

* Default to current user for same origin requests

* Use correct boolean for choosing user

* Update tests to use request headers and add stricter tests
2019-04-04 10:52:45 -04:00
rhymes
27213bf6da Use ActiveRecord::RecordNotFound instead of ActionController::RoutingError for 404s (#2118) 2019-03-19 20:54:25 -04:00