* 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
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
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.
* 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>
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)
```
* 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
* 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
* 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
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)?
* 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>
* 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
* 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
* 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>
* 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'
* 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>
* 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
* 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
* 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
* 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>
* 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
* 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