Commit graph

108 commits

Author SHA1 Message Date
Lawrence
0c93bde6c2
Subscribe to Comment Functionality (#19555)
* Move save over and add button labels

* comment notification design and functionality

* controller error handling

* add ternery operator for background class

* minor cleanup

* add proper styling toggles

* tests and mobile spec

* add for all buttons

* add article as a param

* comment is not required on article preview

* update policy spec

* add test for coverage

* add proper button titles

* use the last user comment as comment id

* add better error handling and remove multiple fetch calls in js

* copy change to threads

* update copy, fix multiple fetch calls, add observer for loading more notifications

* update spec

* add rspecs

* more test specs

* fix test specs

* subscribe button text tests

* add export

* optimistically update ui function tests

* button initialize test

* check for comment ancestry

* add feature flag block

* some cleanup

* update logic and specs

* oops

* rubocop issues

* change config names

* change config names

* fix spec

* add one more conditional

* check for comments

* service-object the toggler

* separate routes

* continual refactoring

* refine spec tests

* clean up policy

* Adjust js and view files to match be params

* some service object refactoring

* separate endpoints on client-side

* broken spec

* service specs

* policy spec fixes

* remove action param

* remove action param from spec

* minor updates

* trigger build

* update to post

* Services don't need permitted params

* Notifications continue to be a mess, decorator specs to follow

* Not toggling now

* This doesn't really belong here

* Fix tests after moving

* Streamline front-end

* There could be errors?

* polymorphic_name is a class thing

* ☠️ json_data in notification views

* Use feature_flag helper to get current_user

* Cannot derive current subscription status from notification, only from subscription

* Default is subscribe to all article comments

* Sync up matching unsubscribe, make subscribe idempotent-ish

* Temporarily comment-out button jest tests to see if I can unstick CI

* Stop trying to detect potential subscribe-to-comment

* Stop trying to detect potential subscribe-to-comment

* Minor spec refactoring

* Add specs for article notification decoration

* NotificationDecorator specs are rather long

* Rubocop likes it?

* Minor spec refactoring

* Doesn't need to stay pending

* Add spec for subscription finder

* Expand Subscribe service specs

* YAGNI, but I don't like hard-coded config

* Refactor Unsubscribe service specs

* nobody expects the infinite scroll

* This *might* work, except for feature flag

* Ancestry can be quite deep actually

* Rubocop

* Update subscribe button for subscribe-to-thread

* Jest tests are just tests

* hasAttribute != getAttribute

* Test knows **nothing** about window size

* Tests have been lying about mobileLabel this whole time

* Make payload/endpoint testable

* Is Jest actually happy???

* Still cleaning up jest/eslint

* Temporarily comment-out cypress tests pending feature flag

* Thanks, Rubocop, what would we do without you

* Preserve round-trip for 'top-level' and 'only-author' subscriptions

* Update specs

* Move save button icon

* Update test with better config param

* Try feature flag specific to cypress env

* Tell cypress to wait for (un)subscribing to work

---------

Co-authored-by: Lawrence S <lawrence@forem.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-07-10 17:11:46 +02:00
Joshua Wehner
c2a131e43d
Add organizations to onboarding follow suggestions (#19564)
* Prepare: relocate user suggestions

* Prepare: relocate users suggestion service -> query

* Organization query for orgs with above-average scores

* Rubocop

* Limit to last 3 weeks

* Tweak recent scope, limit to 5 orgs

* Onboarding routes are also always JSON

* Divide by zero makes NaN means

* Add Orgs suggester into suggestions

* Rubocop

* select distinct orgs

* Fix for weird edge-case with bad local data

* Include type_identifier in JSON payload

* Update follows API to allow org_ids as input

* Update onboarding front-end to distinguish users/orgs

* Fix: i18n issues

* Fix: type_identifier in json output

* Fix: distinct is weird

* Fix: JS linter

* Continue tweaking front-end

* Audit import order

* Cleanup @todo note

* Try renaming controller action

* Move Article average calculation to postgres and fix math

* Refactor decorated type_identifier

* Refactor SuggestProminent, return more orgs, fix spec math

* Use FeatureFlag for organization suggestions

* This might fix the jest
2023-06-09 10:32:03 +02:00
Joshua Wehner
862cd54dc7
Refactoring onboarding (#19525)
* Quick refactor onboardings controller(s)

* Quick refactor onboardings controller(s), pt2

* Quick refactor onboardings controller(s), pt3

* Quick refactor onboardings controller(s), pt4

* Quick refactor onboardings controller(s), pt5

* Add test for checkboxes
2023-05-25 10:03:12 +02:00
Mac Siri
0813a0a322
Resolves false-positive UnsafeRedirectError (#19297) 2023-04-07 09:17:56 -04:00
Mac Siri
cb2477a991
Prefer remote_ip in GaEventsController (#19074) 2023-02-06 18:38:00 -05:00
Joshua Wehner
e63423573c
Misc/minor article fixes (#18846)
* Don't assume all requests are JSON

* Prevent nil error from optimized_image_tag (possible local data issue)

* Slug miss should 404, instead of Podcast not found

* Plain html rescue satisfies spec(s)
2022-12-13 15:15:09 +01:00
Fernando Valverde
3170c06077
Fix connect account bug from settings (#18824)
* Fix connect account bug from settings

* Adds a controller concern test for after_sign_in_path_for

* Styling tweaks

* Merge uri query_values and only ignore i=i param

* remove unused stored_location_for and rename path var

* Reintroduce stored_location_for :p

* Reorder path origin priority
2022-12-09 09:58:04 -06:00
Fernando Valverde
2ad02cf31c
API v1 without api key restriction (#18340)
* Remove :api_v1 feature flag

* Reworking the auth configs throughout V1 + specs

* Fix remaining v1 specs

* Enhanced inline docs

* deprecation warning update

* Use headers variable for most v1 specs

* Cherry pick spec changes

* Fix specs

* group let! statements - rubocop

* Bring back ||= on api v1 authentication methods

* Bump swagger/v1/api_v1.json
2022-08-19 14:04:41 -06:00
Suzanne Aitchison
25bf8a0711
Remove name from invitation flow (#17438)
* remove name from invite user flow

* remove name from invitation instructions

* update invitations spec

* update specs and invitation actions overflow menu name

* allow users to set name when accepting invite
2022-05-03 09:33:12 +01:00
Jeremy Friesen
faaf2ec028
Favoring explicit declaration over inferrence (#17089)
This commit does three things:

1. Documents a method
3. Implies the question: "Do we want to use class_attribute in Forem's codebase?"
2. Switches from an inferrence to an explicit (and configurable)

In my experience, I want to favor "explicit" declarations instead of
inferring what they should be.  In this case, the inferrence is perhaps
adequate.  But as I look to `ApplicationController::PUBLIC_CONTROLLERS`,
I think that is a prime case for a `class_attribute`.  (The `api_action`
happened to be the lowest hanging fruit to begin the conversation.)

We still need some clarity into the `verify_private_forem` method as it
looks like it's doing a few different things.

There is precedence for using `class_attribute` found in
[`UniqueCrossModelSlugValidator.model_and_attribute_name_for_uniqueness_test`][1] (also
introduced by me).

[1]:https://github.com/forem/forem/blob/main/app/validators/unique_cross_model_slug_validator.rb
2022-04-06 10:42:08 -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
Jeremy Friesen
d055613676
Adjusting ArticlePolicy for admin only posting (#16614)
* Adjusting ArticlePolicy for admin only posting

The goal of this commit is actually two fold:

1) To add documentation regarding my current emerging understanding of
   our caching implementation as it relates to our authorization and
   authentication.
2) Flippiing "on" the feature's core authorization check.

Buried within this is the desired normalization of the authorization
between the `ArticlePolicy`'s `#create?`, `#preview?`, `#new?`.

My testing plan for this is to ask for SRE to spin-up a canary, then
test.  What does that look like?  I'm uncertain because this is nudge
closer towards our edge-caching strategy.  Which makes robust testing
more difficult.

Closes forem/forem#16483
Related to #16529, #16571, #16536, #16529
Informs #16490, #16606

* Update spec/requests/editor_spec.rb

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2022-02-21 10:09:13 -05:00
Jeremy Friesen
955d9ee51a
Plumbing application for probable AuthN/Z changes (#16571)
* Plumbing application for probable AuthN/Z changes

For further details, core members can read:

- [Forem Article Authorization Discrepencies][1]
- [Forem Authentication and Authorization Principles][2]

(Note: there's nothing "private" about these articles, I happened to
post them on https://forem.team for internal discussion.)

Related to #16529

[1]:https://forem.team/jeremy/forem-article-authorization-discrepencies-45df
[2]:https://forem.team/jeremy/forem-authentication-and-authorization-principles-58l3

* Adding changes based on feedback
2022-02-16 09:10:18 -05:00
Jeremy Friesen
663a712a10
Removing deprecation warning (#16572)
Prior to this commit, I saw the following in the Rails test log:

```
DEPRECATION WARNING: 'include Pundit' is deprecated. Please use 'include Pundit::Authorization' instead.
 (called from include at ./app/controllers/application_controller.rb:12)
 ```
2022-02-15 05:02:47 -05:00
Julianna Tetreault
89706527b0
Remove "New Admin Member"-Related Code (#16475)
* Removes code behind new_admin_members feature flag

* Removes components/admin/users/tools/* and the tools components

* Removes unused /admin/users/tools/* controllers, comments, and routes

* Removes New Member View-related E2E and RSpec specs

* Remove admin_users_tools.rb frin spec/support/shared_examples/

* Removes remaining component-related specs

* Removes the view_component gem and test helper

* Resolve merge conflicts in Admin::UsersController

* Removes the view_component gem, as it is no longer used

* Removes view_component from Gemfile.lock
2022-02-10 06:42:56 -07:00
Jamie Gaskins
a9cdb2bae2
A suspended user returns 403 instead of 500 (#16408) 2022-02-04 09:42:23 -05:00
yheuhtozr
c4778d832e
app/controllers & decorators i18n (#16126)
* app/controllers (& decorators) i18n etc

* tidy key names

* update keys

* delete ja.yml

* delete an involved ja.yml

* fix for PR review

* fix for spec

* delete ja.yml
2022-02-03 13:35:56 -05:00
Julianna Tetreault
0dfad5b07f
Remove Setup Banner (VerifySetupCompleted) (#15969)
* Remove all references to VerifySetupCompleted to remove setup banner

* Removes setup banner-related specs

* Adjusts the title in activateMissingKeysModal

* Adds the show expand classes to getStartedBodyContainer in show.html.erb
2022-01-10 10:30:05 -07:00
Michael Kohl
5da625cadb
Rubocop fixes (#15892)
* Add missing spaces

* Use filter_map over map + reject/compact

* Simplify FactoryBot calls

* Use to_h with block instead of map + to_h

* Use guard clause
2021-12-28 09:11:41 -06:00
Daniel Uber
4d40ea18a2
When returning a json error, don't use a raw unescaped string (#15879)
The 400 and 403 error pages show json parsing errors in most browsers,
since "Error: Bad Request" is not a valid json body ('"Error: Bad
Request"' would be, or the object with key error and value of the
string which I've selected is _also_ valid).

Do we have frontend code that's looking for this body before it parses
for some reason, or was this just a mistaken copying from the api
controller in the initial PRs (#2293 for not_authorized, and #6248 for
the bad_request method, which may have just replicated the decision
for not_authorized)?
2021-12-27 11:39:15 -06:00
Andy Zhao
90b8fcecc3
Try env var from request for Nginx ip address (#15201) 2021-10-27 16:00:20 -04:00
Ben Halpern
e03f2435d9
Remove dead app shell code (#14915) 2021-10-05 10:09:54 +02:00
Ben Halpern
036d75aa6e
Admin-configurable display locale (#14620)
* Admin-configurable display locale

* Add i18n-js and namespacing

* Basic tests and clean up

* A few test adjustments

* Update vendor cache

* Fix a few tests

* Fix a few tests

* Update app/views/articles/_actions.html.erb

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

* Update app/views/articles/_comments_actions.html.erb

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

* Update app/views/articles/_single_story.html.erb

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

* Update app/views/articles/_single_story.html.erb

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

* Update app/views/comments/_comment_header.html.erb

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

* Update app/views/layouts/_sidebar_tags.html.erb

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

* Update app/views/listings/index.html.erb

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

* Update spec/system/homepage/user_visits_homepage_articles_spec.rb

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

* Update spec/system/user/view_user_index_spec.rb

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

* Alphabetical locale page

* Add activerecord custom validation error translations

* Add i18n to webpacker

* Fix a few tests

* Adjust error messages

* Add i18n-tasks

* Adjust JS to get working with jest

* Adjust the way translations are pulled in

* Adjust jest tests

* Remove time localization

* Remove superfluous public js

* Add basic tests for i18n application controller

* Remove unnecessary content

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-09-28 11:04:35 -04:00
rhymes
7ff882b8ce
Refactor Admin Member Detail view - Tools section (#14283)
* Test with Grid layout

* Use Flexbox

* Replace with utility classes

* Wire up Tools -> Emails

* Stash: will rebase with a better commit message

* Fix transition between Email and Tools component

* Refactor Verify Email Ownership button a bit

* Use respond_to for verify_email_ownership

* Wrap the Preact Snackbar controller in Stimulus and use it from users/tools/email_controller

* Add HTML5 validation to EmailComponent

* Validation and cleanup

* Add Email history list and fix styling

* Additional styling cleanups

* Add error handling

* Close panel after email operations

* Actually use <local-time> GitHub time element correctly

* Add specs for Tools component and controller

* Email to Emails

* Add tests for Admin::Users::Tools::EmailsComponent

* Fix bug with ToolsComponent instantiation in ToolsController

* Add notes to show page

* Add ToolsComponent css

* Use Rails UJS instead of manual Stimulus to connect remote helpers

* Make Notes section come alive by adding its code

* Make Credits section come alive by adding its code

* Go back to vertical flex

* Finalize small restructuring of credits code

* Simplify ToolsComponent instantiation

* Add basic Add user to org functionality

* Make update user permissions form work

* Make remove user from org work

* Use generic Stimulus AjaxController to cleanup code

* Use Stimulus AjaxController for NotesComponent

* Use Stimulus AjaxController for CreditsComponent

* Use Stimulus AjaxController for OrganizationsController

* Add Admin::Users::Tools::ReportsComponent

* Do not display snackbar message if there is no message

* Add Admin::Users::Tools::ReactionsComponent

* Fix EmailsComponent spec

* Add CreditsComponent tests

* Fix quotes

* Add OrganizationsComponent specs

* Add ReportsComponent spec

* Add ReactionsComponent spec

* Fix rubocop violation

* Fix ToolsComponent specs

* Remove unused variable

* More tests

* Use keyword argument for ToolsComponent

* Fill in Tools requests specs

* Use Rspec shared_examples for ToolsController and EmailsController

* Add tests for Admin::Users::Tools::CreditsController

* Add tests for Admin::Users::Tools::NotesController

* Add tests for Admin::Users::Tools::OrganizationsController

* Add tests for Admin::Users::Tools::ReactionsController and ReportsController

* Fix bugs and add tests to Admin::OrganizationMembershipsController

* Add comments to deprecated sections of the UsersController

* Fix bugs and add tests to Admin::UsersController #send_email and #verify_email_ownership

* Add User model tests

* Feature flag fixes

* Add Cypress Tools - Emails tests

* Add Cypress Tools - Notes tests

* Add Cypress Tools - Credits tests

* Add Cypress Tools - Organizations tests

* Add Cypress Tools - Reports and Reactions tests

* Mark the replace target as a polite region

* Update view_component gem

* Tiny fixes

* Fix spec

* Wrap component rendering in render_component

* Move user.related_negative_reactions to a Reaction scope

* Move user.reports to a FeedbackMessage scope

* Move user.last_verification_date as EmailAuthorization class method

* Revert encapsulation to private

* Fix boxes backlinks names

* Add keyboard focus styling to boxes

* Remove duplicate styling

* Remove duplicated header element

* Improve heading hiearchy

* Fix <legend> and labels

* Backlink should be Tools not Users

* Announce section change to screen reader and fix focus

* Fix specs

* Add focus style for backlinks

* Enable email sending in e2e mode

* Use Settings instead of env variable
2021-08-17 18:55:53 +02:00
Alex
7a48708156
API: Add instance endpoint and spec (#14301)
* Create /api/forem_directories endpoint and spec

* PR feedback

* Update regex in spec
2021-07-23 12:10:08 -04:00
rhymes
686965c9ff
[15 min fix] Refactor private landing pages model code (#13982)
* Add LandingPage domain model

* Rely on Rails data integrity and remove previous code

* Remove superfluous equality check

* Restore landing_page class method

* Add and fix specs

* Do not attach landing page modal controller unnecessarily
2021-06-15 18:17:15 +02:00
Julianna Tetreault
b12ebfa0e5
RFC #74, Pt. 2: Private Forem Landing Page (#13819)
* Adds landing_page checkbox for Landing Page

* Adds landing_page to page_params in Admin::Pages::Controller

* Adds landing_page to admin_manages_pages and admin_creates_pages specs

* Adjusts copy for Landing Page in pages/_form.html.erb

* Places #post_a_job before #privacy in Pages::Controller
  - Ensures that all page-related methods are properly
 alphabetized

* Alphabetizes remaining out-of-order page-related methods
  - Ensures that all page-related methods within the
 Pages::Controller are in alphabetical order, following
 the order of the other methods

* Adds landing_page check to ApplicationController#verify_private_forem

* Adds a single_landing_page validation to the Page model

* Adds a lock.svg to /images and uses it in the pages index

* Adjusts buttons and checkboxes to use crayons class in pages partial

* Ensures that pages/_form.html.erb destroy button uses crayons

* Adds a landing_page validation-related test to page_spec.rb

* Updates #single_landing_page validation and error message

* WIP: Adds JS modal upon landing_page error in pages/_form.html.erb

* Adds a working modal upon error in pages/_form.html.erb
- Removes redundant #single_landing_page validation from Page
- Adds #has_a_landing_page? in place of #single_landing_page
- Conditionally renders the landing_page checkbox in _form.html.erb
- Adds styles to locked screen/landing page modal
- Adds copy to locked screen/landing page modal
- Beings adding buttons to overwrite current landing_page

* Updates the data-modal-selectors and ids in pages/_form.html.erb

* Uses #landing_page_path within pages/_form.html.erb modal
- Adds a link_to to link to the current landing page in the modal
- Adds styles to buttons and link_to in modal

* Adds back single_landing_page validation to Page.rb

* Reverts changes and updates methods within Page.rb
 - Reverts changes to #single_landing_page
 - Refactors #has_a_landing_page? and #landing_page_path
 - Updates div id in pages/_form.html.erb

* Adjusts #single_landing_page error message slightly

* Adds a test for landing_pages in stories_index_spec.rb

* Adds an overwrite attribute to Pages for the modal in _form
  - Fixes anonymous spelling

* Refactors pages/_form.html.erb and cleans up spelling

* Adds a safe operator to landing_page.path in Page
  - Adjusts the placement of the hidden value in pages/_form.html.erb

* Updates styling for Current Locked Screen link

* Adds the ability to overwrite an active landing page on click
  - Adds Admin::PagesController#update_and_overwrite and refactors
AdminPages::Controller#udpate to work with new method
  - Adds a remote attribute, overwrite, to Admin::PagesController
via a hidden_field in pages/_form.html.erb and an attr_accessor in
the Page model
  - Adds a toggleOverwrite() function to pages/_form.html.erb to
toggle the (soon to be hidden) overwrite checkbox in the form --
the checkbox is toggled on button click

* Adds a guard clause to #landing_page_path in Page.rb

* Adds a safe naviagtor to Admin::PagesController#update_and_overwrite_landing_page

* Adds a type and return to Overwrite button to prevent submit

* Adds a hidden class to the overwrite checkbox field in _form.html.erb
  - Hides the overwrite checkbox since it is only used to overwrite
the landing_page boolean on click of the "Overwrite current locked
screen" button

* Adds Admin::PagesController#create_and_overwrite and removes hidden class

* Adds landing page-related tests to admin_manages_pages_spec.rb

* Remove messy commented out code and place it in GH comment instead

* PR Review Feedback: Renames remote attr, defines class methods, updates views
  - Renames remote attribute to overwrite_landing_page
  - Updates all necessary views, methods, etc. w/ new attr
  - Defines two class methods to make code more extensible
  - Updates all necessary views, methods, etc. w/ new methods

* Remove unnecessary comments and revert changes to ternary in _form.html.erb

* Adjustments for accessibility within _form and index
  - Adds a descriptive id to <p> in _form.html.erb
  - Adds an ariadescribedby field to _form.html.erb
  - Adjusts title within index.html.erb

* Refactors landing_page-related code per PR review requests
  - Adds a landing_page_modal_controller.js that handles
and further customizes the dismiss and overwrite button, and
handles opening the modal
  - Adds a _landing_page_modal partial to extract modal-specific
html outside of the _form.html.erb partial
  - Refactors _form.html.erb to account for the _landing_page_modal
partial and the landing_page_modal_controller.js
  - Refactors the overwrite checkbox to be a hidden_field rather than
a hidden checkbox and removes existing hidden_field to accomodate it
  - Loads the @landing_page within Admin::PagesController#edit for
use by the _landing_page_modal.html.erb partial
  - Refactors Page#single_landing_page to be more readable
  - Removes useless JS from _form.html.erb

* Removes #landing_page_exists? class method since it isnt used now

* Uses the #landing_page class method within ApplicationController

* Removes pending status from test in admin_manages_pages_spec.rb

* Adds an e2e test for landing pages and adds to seeds_e2e
  - Adds a landingPage.spec.js to test landing pages
  - Adds a Page to seeds_e2e.rb for landingPage.spec.js

* Removes references to articles from e2e test and adds clickable link

* Adds another Page to seeds_e2e.rb and updates link names in test

* Adds the Current Locked Screen title to modal and opens in new link

* Renames Dismiss to Cancel and updates all necessary code

* Adjusts landingPage.spec.js

* check for existing landing page before showing modal

* Update Cypress tests and fix bug in LandingPageModalController

* Apply suggestions from code review

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

* Orders Pages by created_at desc in /admin/pages/index.html.erb for consistency

* Targets specific edit button in landingPage.spec.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: rhymes <github@rhymes.dev>
2021-06-10 11:46:24 -06:00
Michael Kohl
6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00
Fernando Valverde
2463ac7194
Expose aasa for non-private Forems (#13729)
* Expose aasa non-private forems + small tweak to aasa

* Tests

* Update spec/requests/universal_links_spec.rb

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

* Check empty array with be_empty

* Include Universal Links context

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-05-12 10:13:46 -06:00
Mac Siri
cf538f83c8
Fix invalid form during Creator onboarding. (#13673) 2021-05-05 16:14:48 -04:00
Michael Kohl
1c7de11bef
Split Settings::UserExperience (#13495)
* Add Settings::UserExperience

* Add DUS

* Update usage

* Add controller

* Add e2e test

* Fix specs
2021-04-28 13:29:25 +07:00
Jacob Herrington
a5b2d109d5
Rename banned and comment_banned roles (#12270)
* Rename banned and comment_banned roles

* Add data update script to rename roles containing 'ban'

* Add named error for Suspended users

* Update unidiomatic method names

* Rename misc banned to suspended

* Apply suggestions from code review

Co-authored-by: Michael Kohl <me@citizen428.net>

* Add unit tests for suspended methods

This commit also adds TODO comments for removing banned and
comment_banned from the codebase after data update scripts have
successfully run on all of our Forems.

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-04-06 10:12:14 -05:00
Nick Taylor
7c1343be9e
Revert "Revert "Removed service worker (#12974)" (#13014)" (#13015)
This reverts commit 2416387fb4.
2021-03-17 10:57:56 -04:00
Molly Struve
2416387fb4
Revert "Removed service worker (#12974)" (#13014)
This reverts commit 4fb6230606.
2021-03-16 18:10:01 -05:00
Nick Taylor
4fb6230606
Removed service worker (#12974) 2021-03-16 15:55:31 -04:00
Alex
d109b6824e
Refactor cache purging (#12811)
* Refactor caching

* Bring back old bust class

* Refactor with PR feedback

* Remove useless return values
2021-03-02 10:09:05 -05:00
Ben Halpern
73125c0795
Reduce service worker functionality to minimal offline page (#12834)
* Reduce service worker functionality to minimal offline page

* Update docs for service workers

* Add comment to fix test

* Include incrementable static cache

* Add TODO comments about removal

* Fix trailing whitespace
2021-03-01 19:29:26 -05:00
rhymes
543b9bec7e
Improve ActionController::InvalidAuthenticityToken error handling (#12833) 2021-03-01 11:27:12 +01:00
Michael Kohl
d1d4c00114
Update OmniAuth to 2.0 (#12715)
* Update gems

* Remove Omniauth CVE from bundle-audit ignore list

* Add omniauth-rails_csrf_protection gem

This is recommended in the OmniAuth upgrade guide:
https://github.com/omniauth/omniauth/wiki/Upgrading-to-2.0#rails

* Temporarily bundle Devise from master

* Pin Devise commit in Gemfile

* Fix CSRF cookie workaround

As suggested by @fdoxyz

* Remove CSRF workaround

* Add DataDog counter

* Add request path tag

* Remove rendering of devise shared links

* Remove unused Devise partial
2021-02-25 12:46:13 -06:00
Alex
f70af66258
Update bust to EdgeCache::Bust (#12052)
* Update bust to EdgeCache::Bust

* Update specs

* Fix more specs

* Fix more specs :)
2020-12-29 09:53:15 +01:00
Ben Halpern
68867e9384
Add config post route for admin api (#11698)
* Add config post route for admin api

* Fix params

* Extract config_params to concern

* Remove print statement

* Some changes

* A couple changes

* Change controller method name and refactor upsert

* Fix tests and method names

* Fix routes and class stuff

* Fix styles

* Fix config params

* Fix styles

* Move regex to constant

* Remove single-use after action callbacks

* Expose success? method

* Fix syntax error

* Fix success? return

* Switch to guard clause

* Final clean ups?
2020-12-22 15:50:34 -05:00
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