Commit graph

903 commits

Author SHA1 Message Date
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
Suzanne Aitchison
8358571b29
Get a11y lint script paths from rails helper (#13912)
* retrieve paths from rails helper

* move assets to vendor folder, precompile in assets config

* drop coverage on lines

* remove unneeded line
2021-06-10 09:25:29 +01:00
Suzanne Aitchison
be15f31122
Optimise dropdowns for accessibility: Dashboard and Manage pages (#13909)
* use dropdownutils in dashboard and manage pages

* add tests for the toggle menu on dashboard

* add test for archiving from manage post view

* small tweak to avoid unhandled errors

* small tweaks to form methods
2021-06-04 10:19:56 +01:00
rhymes
99ddd31058
Pin posts to feed (#13807)
* Add SiteConfig.feed_pinned_article and validation

* Display pinned article at the top of feed

* Add (basic) functionality to pin/unpin post

* Admins can pin other users posts as well

* Hide the button if looking at the non pinned post

* Add pinned/unpinned snackbar message

* Rename SiteConfig usage to Settings::General

* Add pinned article to the Admin articles index

* Show the pin post button when there's no pinned article

* Move pinning to a separate controller

* Fix SiteConfig reference

* Hide PinController actions to unauthorized users

* PinnedArticlesController#show action and refactor some of the code

* Add Modal interaction

* Fix modal-pinned checkbox interaction

* Fixed pin/unpin post

* Add ArticleDecorator#pinned? specs

* Add PinnedArticlePolicy and PinnedArticlesController specs

* Add ability to actually pin an article from the admin after submit

* Add partial Cypress pin/unpin spec

* Fix pinned article and add basic Cypress interaction tests

* Add Crayons styling to modal

* Only render the pinned article on the default Feed page

* Use persisted?

* Add some comments

* Update app/javascript/articles/Article.jsx

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

* Update app/javascript/packs/homePageFeed.jsx

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

* Fix Cypress tests

* Update app/javascript/admin/controllers/article_controller.js

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

* Fix pinning in article show page

* Used PinnedArticle domain model

* Fix spec

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/articleFlows/pinArticle.spec.js

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

* Update cypress/integration/articleFlows/pinArticle.spec.js

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

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

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

* Fix merge woes

* Add missing article pin post flows

* Add missing admin article flows

* Add Unpin to Admin as well

* Add Audit::Log entries for pin/unpin actions

* Update app/controllers/stories/feeds_controller.rb

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

* Do not rate limit in E2E tests

* Use .find instead of .filter

* Rename ArticleIdValidator to ExistingArticleIdValidator

* Treat draft and deleted articles the same

* Make sure posts can be pinned after the pinned article is unpublished or deleted

* Use .get directly

* Fix spec and fix PinnedArticlesController#show

* Strengthen pinArticle Cypress tests

* Add Cypress test heading guard

* Add another Cypress test heading guard

* Remove duplicate validator

* Try using the Tools: header instead of the article title

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-06-04 10:54:53 +02:00
Suzanne Aitchison
573c78d032
Advise users about potential accessibility failings in their posts - RFC #58 (#13745)
* initial rough version

* link to relevant rules, extract image text, only show if more than 0 errors

* jsdoc and tweaks

* refactors

* add tests

* open info links in new tab

* add new window link icon
2021-06-03 10:27:12 +01:00
Suzanne Aitchison
7e322e4f7b
Optimise dropdowns for accessibility - Post comments and share (#13868)
* WIP - basic init of comment dropdowns with open and close on click

* WIP - initialize the share dropdown

* initialize all post dropdowns within packs, init copy to clipboard announcer

* refactor and add JSDocs to helper

* undo changes to base jsx

* update accessible name of post actions button in cypress test

* make sure dropdowns pack loaded on comment index page

* undo prettier changes in base jsx

* undo prettier changes in base jsx

* initialize comment dropdowns in podcasts

* add test for the post actions

* add article comment tests

* add cypress tests for comment dropdowns
2021-06-03 09:13:17 +01:00
rhymes
3be26dae97
Remove duplicate jquery import, remove jquery-rails and use @rails/ujs (#13891)
* Remove unused jQuery include in Listings

* Use @rails/ujs in the admin

* Remove jquery-rails

* Content is mandatory for listings

* form_with defaults to local: true

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

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

* Update cypress/integration/listingFlows/deleteListing.spec.js

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

* Update cypress/integration/listingFlows/deleteListing.spec.js

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

* Update cypress/integration/listingFlows/deleteListing.spec.js

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

* Apply feedback on e2e and fix a bullet warning

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-01 15:28:09 +02:00
Suzanne Aitchison
9b326e3638
show the sidebar on all logged in feed views (#13877) 2021-06-01 09:55:13 +01:00
Dan Wallis
521bb09394
Add loading=lazy to image tags (#10888)
* Add loading=lazy to image tags

* Fix test

* Lazy-load some obvious templates

* Lazy-load more verified templates
2021-05-27 19:01:21 +02:00
Lisa Sy
e925d95f71
Rename WRITE A POST to CREATE POST (#13855)
* Rename WRITE A POST to CREATE POST

* Revert schema line removal
2021-05-25 10:30:30 -07:00
Andrew Bone
61cd4b3e14
🚑 Quick fix prevent grammarly from running on chromium based browsers (#13820) 2021-05-25 06:54:32 -04: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
5832d146de
Add error handling to clipboard promise - post editor (#13798)
* Adds error handling to clipboard promise - post editor

* Adds a reload when rendering the Editor to get missing navigator.clipboard

* Remove reload logic from Post Editor

* Adds Honeybadger notify on error handling
2021-05-20 09:46:37 -06:00
Alex
795cf7b10a
Don't show articles from blocked users in the feed (#13752)
* Update element identifier for blocked articles

* Update confirmation wording

* Add specs
2021-05-14 09:41:50 +02:00
Andrew Bone
f6e222f12e
Fix layout shift on active crayons-tabs change. (#13300) 2021-05-12 11:45:36 -04:00
Suzanne Aitchison
2829c7f848
stop adding a false class (#13710) 2021-05-10 13:54:23 +01:00
Suzanne Aitchison
783fb6fa24
Accessibility enhancements to navigation tabs (#13559)
* update storybook example and docs

* update desktop home feed tabs with a11y enhancements

* update storybook to reflect buttons usage, update post editor buttons

* update admin html variants tabs

* update admin sponsorships tabs

* re-add flex to the crayons-tab class to prevent regression in tab components not updated

* Revert "update admin sponsorships tabs"

This reverts commit d9e4a5e4b0d362e38a11c795b35ceb4442bc4d90.

* Revert "update admin html variants tabs"

This reverts commit 3d9f119e88dc2f2f102d664c57a1f56413490a36.

* update search tabs

* update v2 form erb html

* update tag index tabs

* update notifications tabs

* label the notifications nav

* update mod sidebar tabs

* update main analytics page tabs

* add cypress tests for home feed tabs

* add tab tests for the post editor

* add cypress tests for tags index navigation

* fix UI issue with search tabs, add search cypress tests

* add tests for the analytics dashboard tabs

* add mod nav tests

* add notifications navigation tests

* get new handles after view switch

* replace hardcoded mod paths

* apply review suggestions
2021-05-07 15:24:34 +01:00
Andrew Bone
38214380dd
Fix a bug with moderator dropdowns and add aria tags (#13623) 2021-05-06 07:56:28 -04:00
Rafi
41cc771839
Refactoring help component (and fragmenting it too) (#10895)
* Refactoring Help component

* Fixing typo

* Adding missing prop types

* Removing setCommonProps

* Moving show to parent component

* Renaming Format component

* Converting help component to functional component

* Removing html from state

* Fixing modal toggle and eslint errors

* Adding arria hidden

* Using optional chaining

* Fixing variable names

* Renaming state variable

* Adding jsdoc

Co-authored-by: Nick Taylor <nick@dev.to>
2021-05-05 12:58:40 +07:00
Suzanne Aitchison
ad43dbe0b3
Add prefer object destructuring lint rule (#13183)
* add prefer object destructuring lint rule

* fix typo

* sweep up lint errors missed in config controller

* Revert "fix typo"

This reverts commit 44f9d57e3f0dc4007ab9020c8c659c2f770230c2.

* Revert "sweep up lint errors missed in config controller"

This reverts commit 3f8d5d782fe110607c2172b713c74c08c883eda3.

* make this a warning rather than error for now

* undo auto change
2021-05-04 12:10:32 +01:00
Rafi
ca50e5750e
Fixing dom structure of Tags to follow (#13184)
* Using buttons instead of checkbox

* Adding svg icon

* Update app/javascript/onboarding/components/FollowTags.jsx

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

* Adding condition for crayons-btn-icon-left

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-05-03 17:20:26 +01:00
Suzanne Aitchison
4aebfb62f2
Improve keyboard accessibility of comment rate limit and error modals (#13536)
* add modal code to Forem namespace, use showModal in the rate limit modal generator

* add cypress tests for both modals

* styling tweaks

* tidy up

* make sure modal trap selector is unique to page, update Modal JSDoc

* add additional jest test for focusTrapSelector
2021-05-03 07:14:23 +01:00
Suzanne Aitchison
1868537294
fix some landmark issues in listings (#13602) 2021-04-30 18:34:27 +02:00
Suzanne Aitchison
2e9ba2334a
15 min fix for chart js errors (#13598) 2021-04-30 13:28:20 +01:00
Ridhwana
320eb86dc2
RFC 50: Interaction tweaks (take two) (#13576)
* feat: add the collapse style css + a script for the intercepting the bootstrap event

* chore: remove old code

* Add some guards for missing elements and simplify show/hide collapse interaction

* Update app/assets/stylesheets/admin.scss

Co-authored-by: rhymes <rhymes@hey.com>

Co-authored-by: rhymes <rhymes@hey.com>
2021-04-30 13:01:55 +02:00
Andrew Bone
59c7e25e22
Remove input scroll from position (#13569)
* Remove input scroll from position

* Rerun travis
2021-04-29 11:00:37 +02:00
Ridhwana
b027a0c342
fix: change aria-page to aria-current (#13558) 2021-04-28 21:33:29 +02:00
Ridhwana
3a4da2dd5a
RFC 50: Remove hardcoded paths and use path_helpers instead (in the specs) (#13549)
* feat: update the paths in the spec files

* feat: update hardcoded paths with path helpers

* chore: update hardcoded paths to path helpers

* chore: hardcode describe blocks

* chore: oops

* feat: update some more hardcoded to use link_to's

* fix broken tests

* chore: admin_articles path

* chore: oops remove rails helper

* feat: add starting /

* chore: more pre slashes

* chore: add pre slashes

* chore: some small typos

* fix: oops
2021-04-28 21:32:51 +02:00
dependabot[bot]
1a48b3151a
Bump cypress from 6.9.1 to 7.2.0 (#13528)
* Bump cypress from 6.9.1 to 7.2.0

Bumps [cypress](https://github.com/cypress-io/cypress) from 6.9.1 to 7.2.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/commits/v7.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

* fix intercept and exception issues causing commentOnArticle specs to fail

* fix a typo while we're here

* stub the minimum search text

* update intercepts on post mention user

* Bump cypress from 6.9.1 to 7.2.0

Bumps [cypress](https://github.com/cypress-io/cypress) from 6.9.1 to 7.2.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/commits/v7.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

* fix unhandled exceptions in initScrolling causing tests to abort

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-28 10:09:43 +01:00
dependabot[bot]
62e150f5af
Bump eslint-config-preact from 1.1.3 to 1.1.4 (#13516)
* Bump eslint-config-preact from 1.1.3 to 1.1.4

Bumps [eslint-config-preact](https://github.com/preactjs/eslint-config-preact) from 1.1.3 to 1.1.4.
- [Release notes](https://github.com/preactjs/eslint-config-preact/releases)
- [Commits](https://github.com/preactjs/eslint-config-preact/compare/v1.1.3...v1.1.4)

Signed-off-by: dependabot[bot] <support@github.com>

* Add missing key prop for elements in iterators where necessary

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2021-04-27 18:54:43 +02:00
Suzanne Aitchison
7c7a0992b7
Reintroduce autocomplete Cypress test, refactor tests in same suite (#13506)
* reintroduce test, refactor tests

* make sure we always wait for comment box substitution before continuing
2021-04-27 12:01:51 +01:00
Ridhwana
c5bcb4c021
RFC 50: fix some more hardcoded paths (#13473)
* fix: remove hardcoded paths

* fix: use path helpers

* swap href for link_to

* feat: use path helpers

* feat: use a data path to send through the path that we will be calling

* feat: pass route through to js

* dus index path

* chore: change to use path_helpers

* feat: update DUS controller

* chore: oops remove these paths
2021-04-26 17:49:54 +02:00
Jacob Herrington
2f703e97f3
Fix bug when responding to listings (#13366)
* Fix bug when responding to listings

Sending a message to a listing author works about half the time. I
can't determine exactly what user behavior causes it to fail or succeed,
but after making this change it doesn't fail anymore. Looking at the
code, I'm not sure how it ever works...

* Notify Honeybadger when listing responses fail

* Add E2E test for contacting through listings

* Update e2e test
2021-04-23 13:55:33 -05:00
Nick Taylor
90da6355dd
[15 minute fix] Fixed issue with member navigation button only working after full page loads but not InstantClick page transitions (#13402) 2021-04-23 08:06:56 -04:00
Fernando Valverde
8b4e6ba91b
[Small fix] Makes stats page responsive (#13345)
* Small UI refactor that makes the stats page resonsive (to some degree)

* Add import to scss file

* Whoops

* Implement feedback from review

* Extract flex value into variable

* Update app/javascript/analytics/dashboard.js

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-14 14:57:35 -06:00
Suzanne Aitchison
2998cb4555
remove extra key handler on archive button (#13392) 2021-04-14 13:34:47 +01:00
Suzanne Aitchison
94bca23f07
Switch from combobox to plaintextArea on click outside (#13333)
* switch back to plaintextArea on click outside

* add a test for click outside

* restore plainTextArea on blur, add cypress test
2021-04-14 09:15:26 +01:00
Hariharan Sampath
208d788672
Fix feed navigation shortcuts when first article is not 100% visible (#11874)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Hariharan <hariharan.s@samsung.com>
2021-04-13 22:35:50 -04:00
Nick Taylor
2b13b9a593
[15 minute fix] Cleanup of post preview E2E tests (#13376) 2021-04-13 10:56:24 -04:00
Andy Zhao
7b119057b3
[15-min-fix] Fix removing cover img from v2 editor and dashboard link (#13227)
* Navigate back to dashboard instead of article.path

* Set mainImage to null to remove image properly

* Use dashboard_path over string path

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

* Handle apostrophe edge cases

* Allow main image to be set

* Add new test for removing article cover img

* Use potentially less flaky find

* Use findByAltText instead of get

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-04-12 09:34:30 -04:00
Suzanne Aitchison
458e3fbc7a
make sure all text area heights stay in step (#13341) 2021-04-12 10:34:21 +01:00
Michael Kohl
5406b0576e
Split Settings::Authentication from SiteConfig (#13095)
* Split Settings::Authentication from SiteConfig

* Move specs

* Sort fields

* Update settings usages

* Update recaptcha usages

* Add data update script

* Update spec

* Rename SiteConfigParams concern

* Fixes, new route, new controller

* Controller and service refactoring

* More controller and service updates

* Spec updates

* More spec fixes

* Move file

* Fix FeedbackMessagesController

* Update admin/configs_spec

* Fix remaining specs in admin/configs_spec

* Fix configs API

* Formatting

* Clean up old service object

* Various fixes

* Update DUS

* Add model argument to admin_config_label

* Fix key name

* Fix specs

* Add distinct request caches for settings classes

* Fix e2e tests

* Fix remaining system spec

* Make DUS idempotent

* Move routes block

* Cleanup

* Switch to ActiveSupport::CurrentAttributes

* Pinned rails-settings-cached

* Update e2e test

* Update lib/data_update_scripts/20210316091354_move_authentication_settings.rb

Co-authored-by: rhymes <rhymes@hey.com>

* Add guard to DUS

* Temporarily re-add two SiteConfig fields

* Fix config show view

Co-authored-by: rhymes <rhymes@hey.com>
2021-04-12 09:41:09 +02:00
Nick Taylor
37d7cdbef7
Now the load more button only appears (if necessary) when the reading list is finished loading. (#13327) 2021-04-09 10:17:52 +02:00
Nick Taylor
86deddbb75
Fixed Reading List on Mobile + Small Improvements (#12755)
* Some div soup to semantic markup.

* Small refactor to inline mapping of available tags.

* Renamed <ItemListTags /> component to <TagList />.

* Now a select is used for picking a tag to filter on.

* Added custom Cypress command to create an article.

* Added documentation for the create article custom command.

* Removed unnecesary properties from payload to create an article.

* reading list mobile view wip.

* Reworked styles in <TagList />.

* Reworked reading list to use <MediaQuery /> component.

* Removed bottom padding from reading list header.

* styling tweaks if there are no available tags.

* Added some E2E tests.

* Removed reading list component test in favour of e2e test.

* Made breakpoint values numbers.

* Added some padding and more grid gap to filter on small screens.

* Adjusted jest coverage thresholds as we're moving some tests to e2e tests.

* Reverting a VS Code setting change caused by one of my extensions.

* First pass for E2E tests for the reading list.

* Added some more grid gap.

* Fixed load next page to send tags properly.

* Added some more tests.

* Improved label and placeholder for text filter in reading list.

* Added more tests

* Fixed media queries so it works in Chrome as well.

* Removed aside as tag filters are not complimentary information.

* Update app/javascript/readingList/components/TagList.jsx

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

* Update docs/tests/e2e-tests.md

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

* Turned off deprecated rule in jsx-a11y eslint plugin.

* Reverted to links instead of radio buttons.

* Added an all tags link and select option.

* Fixed relayout issue.

* Fixed View Archive button size.

* Fixed styling of the load more button.

* Fixed empty list issue toggling between archive and reading list.

* Fixed request changes from PR review.

* Removed CSS change that is no longer required.

* Trigger Build

* Fixed centering of items in top fieldset.

* Fixed issue with search text field resetting reading list.

* Fixed component tests for the reading list.

* Fixed empty state popping up between search queries.

* Fixed casing of fixture filenames.

* Update app/javascript/readingList/readingList.jsx

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

* Reverted change in reading list component test.

* Added missing JSDoc comment.

* Now links are in an unordered list.

* Promoted some CSS classes from the <nav /> to the <ul /> for spacing.

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-08 12:53:43 +01:00
dependabot[bot]
1522b6d41e
Bump chart.js from 2.9.4 to 3.0.2 (#13244)
* Bump chart.js from 2.9.4 to 3.0.2

Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.9.4 to 3.0.2.
- [Release notes](https://github.com/chartjs/Chart.js/releases)
- [Commits](https://github.com/chartjs/Chart.js/compare/v2.9.4...v3.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

* fix issues in migration to 3x of chart.js

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-08 10:46:32 +02:00
Daniel Uber
68867e7c68
Ensure we have current user information before deciding how to handle the "flag user" button (#13279)
* Make test fail again

Minimal reproduction via `rspec
spec/system/user/trusted_user_flags_user_spec.rb --order=random
--seed=9374` which runs in this order:

- when signed in as a trusted user
- when not logged in
- when signed in as the non-trusted user
- when signed in as the user

Because "not logged in" immediately precedes "non-trusted user" in this
order, the browser store cache is cleared and there is no user. Since
there's no user, the flag is not removed.

* Wait for current user promise before processing current user

* Extract button callback registration to function

This addresses a code climate concern (function exceeded 50 lines) by
extracting the button behavior to a function of (button, id, name),
and calls that within the exported initFlag function.

* Prefer request to fetch

Addresses feedback to use @utilities/http's request method in  place
of fetch (which automatically adds the needed csrf headers)

* Reorder imports

Satisfies code climate report that imports are out of order

* Add honeybadger notify to error handling

Do more than just notify that something went wrong. Notify honeybadger
on failure to flag/unflag a user.

* Remove temp variable

This makes the notify code look more like the suggestion

* Reduce function arglist

Since the user id and name are properties of the flagButton's dataset,
we can efficiently extract them from the flagButton.

Only pull user id from dataset to check if current user = profile
user, and extract id and name from dataset after passing the
flagButton.

* reorder imports

Not sure how I managed to reverse this in 18aeb675b but here we go again

* Test button behavior

The original tests only asserted that the link to reactions was
present and labeled correctly. Add additional check that we can use
the button and that the label toggling occurs (this adds a request to
the test case, but adds a test for user facing behavior).

* Tame eslint check

I was getting conflicting feedback on import ordering from code
climate and eslint. Since telling eslint to ignore its rules was
immediately clear to me (there's an example on the line before this)
that's the direction I headed, but I can revisit if it matters

https://github.com/forem/forem/pull/13279#issuecomment-814411401
captures the conflict (code climate wants @utilities/http first,
eslint wants ../chat/util first, one or the other fails regardless of
the ordering.

* Use multiple rules in one ignore comment

https://eslint.org/docs/user-guide/configuring/rules#disabling-rules
supports multiple warnings separated by commas

* Remove stray comment

* Move documentation comment to the code it describes

* Replace invalid name

I had copied from the suggested code snippet the
userData.profileUserID name, but userData in this context is a global
function, and `profileUserId` (capitalization) is the bound variable
in this context.

Fix it before we throw an error trying to report an error (ironically,
before the window alert telling the user an error occurred, I think
this would have been visible only in console).

* Actually call the remove button function
2021-04-07 16:28:21 -05:00
Jamie Gaskins
c2b7f0b096
Use 2-digit month and day for JS Date class (#13257)
Single-digit months and days are not compliant with the ECMAScript
standard for date strings.

See: https://262.ecma-international.org/11.0/#sec-date-time-string-format
2021-04-07 14:25:39 -04:00
Andrew Bone
6aae404c54
Update Analytics Dashboard time navigation to tabs (#13270)
* Move to crayons-tabs

* Update js logic to use crayon-tabs

* Remove toggle and add tab

The added code moved the tabs to the right hand side of the container (until mobile styles kick in then it will fill the container).
2021-04-07 14:11:15 +01:00
Nick Taylor
b34db2360e
Fixed bug with iOS devices that crashed the post editor (#13281) 2021-04-07 05:52:17 -04:00
Alex
3891c7d468
✂️ Remove search from Connect (#13235)
* Remove search from connect

* Remove alternate approach

* Alphabetize CHAT_CHANNEL_PARAMS

* Remove default value for user_ids

* Add spec for result ordering
2021-04-06 13:03:31 -04:00