Commit graph

1174 commits

Author SHA1 Message Date
Joshua Wehner
8be41307cf
Unpin article should behave more like Pin article (#17798)
* Unpin article should behave more like Pin article
* Don't repeat pinned article on index
2022-06-07 14:18:43 +02:00
Viviane Dias
938a726381
[listing-dashboard] Refactor class components to be functional component (#17764)
* refactor(listings-dashboard): migrates comp to pure comp

* refactor(listing-dashboard): organizes data setup for tests

* refactor(listing-dashboard): uses func to setup tests and starts using screen

* test(listing-dashboard): refactors tests using role query and expects

* test(listing-dashboard): separate first listing tests into another description block

* test(listing-dashboard): separate second listing tests into another description block

* test(listing-dashboard): separate third listing tests into another description block
2022-06-07 11:50:47 +01:00
Ridhwana
fe447694ed
BETA version of the Storybook Multi Input (#17828)
* feat: create a crayons component called MultiInput that appears under App Components/MultiInput

* feat: add the doc describing the components to storybook

* feat: create the component ina  different file and reference its usage from the stories

* feat: add a random class to hook up a stylesheet to the component

* lets just copy soem HTML

* chore: remove arias that will not be used for the multiinput

* feat: update the classnames and remove unneeded html

* feat: multi input css updates

* feat: add the ability to set the list of emails using state

* feat: add the ability to clear the input selection

* feat: remove item

* feat: handle key events like space, comma and enter in the input

* refactor: clean up code a bit

* refactor: rename email to item

* fix: remove space keydown as its causing weird behaviour

* refactor: remove unused css now that we using pills

* feat: ensure that we do not add blank pills

* feat: add the component to BETA

* feat: rename addToList to addItemToList to be more verbose

* feat: add the first component prop i.e. placeholder

* feat: add a more descriptive text

* feat: add a padding to the field

* remove unused arial labels, and erword soem descriptions

* feat: add imports to scss

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

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

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

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

* Update app/javascript/crayons/MultiInput/__stories__/MultiInput.mdx

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-06-07 12:22:33 +02:00
Arit Amana
1679fbf47d
Allow Moderator Role to Unpublish Single Post (#17795)
* relocate btn; build functionality for admin only

* remove commented code

* add explanatory comment

* refactor

* build unpublish and feature-post policies

* mod role in policies fails specs 😓

* fix failing specs

* add end-to-end tests

* fix hardcoded name in modal  😓
2022-06-03 12:48:20 -04:00
Andy Zhao
103394d5ad
Add tooltip to cover image button describing optimal image ratio (#17779)
* Add tooltip for cover image button

* Add cover img tooltip to v1 editor

* Use a slightly different message

* Fix tests

* Use proper comment syntax for front matter

* Fix Cypress test

* Use regex to find matching label
2022-06-02 17:44:34 -04:00
Suzanne Aitchison
c119b64b74
Reusable user admin modals (#17763)
* target modal content by a classname to avoid duplicate IDs

* woops - fix missed selector

* use showWindowModal in editUser

* move add org to a partial

* move add role into a partial

* move adjust credits to a partial

* move profile modals to be re-used

* generalise approach to add organisation modal

* generalise add role modal form

* generalise adjust credits modal

* rework unpublish modal

* refactor banish user modal

* refactors

* prevent issues with duplicate ids

* fix banish form action

* make sure role management specs covered in cypress

* let hidden modal content use IDs

* rename file for clarity

* add some JSDoc notes

* cleanup some redundant changes

* one more

* woops - fixed id that contained a classname
2022-06-02 09:52:26 -06:00
Ikko Ashimine
127fe37e19
Fix typo in runtime.js (#17783)
succesful -> successful
2022-05-31 14:30:04 -04:00
Suzanne Aitchison
02cdaed8e6
layout tweaks for mobile (#17771) 2022-05-31 10:55:19 +02:00
Viviane Dias
94c431afb0
[single-article] Refactor class components to be functional component (#17681)
* refactor(single-article): migrates class to use pure components

* test(single-article): removes repeated test from file
2022-05-26 12:59:06 +01:00
Viviane Dias
0960b36d92
[categories] Refactor class components to be functional component (#17682)
* feat(categories): migrate Categories to pure component

* test(categories): adds tests to Categories comp
2022-05-26 12:53:25 +01:00
Suzanne Aitchison
f545b4b73f
localize display of US and non-US date format (#17758) 2022-05-25 17:08:00 +01:00
Suzanne Aitchison
c93794f987
Initial BETA storybook version of DateRangePicker (#17742)
* WIP initial component/story

* examples of customisation

* populate the month year pickers

* change the calendar view when the month or year is chosen

* fix which dates should be disabled

* style left right nav buttons

* add calendar icon, fix some date range styles

* extract some color variables

* some minor changes to styles and comments

* add phrases, allow all dates to be toggled in story

* consolidate styles

* conditional navigation given max and min dates

* labels on selects, tweaks to story

* undo unrelated changes from merge

* undo unrelated changes from merge

* undo unrelated changes from merge

* undo unrelated changes from merge

* retry adding dependencies, not feeling hopeful XD

* is this a preact issue?

* Revert "is this a preact issue?"

This reverts commit 5f3f720f8e739cc3dcca7fd54f8d97e08d8bb88c.

* without css import

* import styles via sass file, not component

* Apply suggestions from code review

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

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-05-24 17:43:58 +01:00
Suzanne Aitchison
e62684342f
Member index view - collapse other filter sections when one is clicked (#17740)
* collapse any filter sections when a new one is clicked

* add a cypress test
2022-05-24 14:51:18 +01:00
Viviane Dias
655bfb59c4
refactor(article-cover-image): migrates class comp to pure comp (#17697) 2022-05-24 06:50:36 -06:00
Viviane Dias
34a78440cf
refactor(single-listing): migrates class comp to pure comp (#17698) 2022-05-23 16:52:52 +01:00
Viviane Dias
b2e6ca67a2
refactor(save-btn): migrates class comp to pure comp (#17699) 2022-05-23 16:15:27 +01:00
Viviane Dias
ab26216de9
[github-repos] Refactor class components to be functional component (#17700)
* refactor(github-repos): migrates class comp to pure comp

* refactor(github-repos): shifts functions to keep same pattern
2022-05-23 16:12:13 +01:00
Dwight Scott
dbeb4a5aca
make feed image consistent with cover image (#17512)
* make feed image consistent with cover image

* small tweaks for the logged out view of the feed cover image`

* update feed cover image for logged in users

* update to reflect new cover image

* reverting to see if the build, builds?

* snapshot tests

* update spec to look for the right class

* too long by ONE character 121/120 🙄

* Update app/javascript/articles/components/ArticleCoverImage.jsx

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

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

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

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

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

* no need for the anchor tag to have a bg color

* update snapshot test expectations

* remove unnecessary span with hidden class

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-05-19 13:40:00 -04:00
Takuya N
c3c33aa9cd
Show friendly error message on API fetch failure on stats (#17570)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-05-18 16:12:42 +02:00
Suzanne Aitchison
c37bbd77e5
Member index phase 2 - mock filters modal (#17578)
* mock filters popover

* fix for safari

* add missing label
2022-05-17 15:25:21 +01:00
Jeremy Friesen
bcfbd523d4
Moving from user.trusted tests to policy tests (#17619)
The [`ArticlePolicy#moderate?`][1] method answers the questions around article
moderation.

At present this change does not introduce any significant changes (aside
from the JS logic loop).  The next "step" is to adjust the
`ArticlePolicy#moderate?` method to test if the user has a moderator
role.

Further, we'd need to see what is available on the action panel.

Related to forem/forem#17606

[1]:5ac3216a5a/app/policies/article_policy.rb (L160-L174)
2022-05-11 08:18:13 -04:00
Viviane Dias
27373c6cf8
Improves UI unit tests by correcting wrong use of queries (#17599)
* test(cover-image): uses correct queries for ui unit tests

* test(form): replaces queries to getByRole and adds expect where necessary

* feat(help): adds expect assert and uses within to test inside specific block

* feat(image-uploader): uses correct queries to validate behaviour

* test: corrects queries and adds expect assertions to some unit tests
2022-05-09 14:23:56 +01:00
Suzanne Aitchison
26af4d951a
Update crayons Modal to add sheet variant (#17576)
* update Modal to add sheet variant

* dont use prompt title for modal sheet stories, to better reflect intended purpose

* Apply suggestions from code review

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-05-05 14:32:35 +01:00
Suzanne Aitchison
50d2359049
add crayons modal to gdpr confirm delete flow (#17568) 2022-05-05 08:19:34 +01:00
Takuya N
275cdadb60
Pass options correctly to chart.js on articles#stats (#17435)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-05-04 09:42:55 +01:00
Suzanne Aitchison
648c86c612
Add prop for user-defined selections in MultiSelectAutocomplete (#17402)
* add new prop and update specs

* update storybook
2022-04-29 09:39:25 +01:00
Arit Amana
0d023163ba
Hide 'Save' button on posts that belong to the current user (#17293)
* implement change

* struggling with tests

* extend implementation to relevant views

* update Article.test.jsx snapshot

* fix failing specs

* query userData more robustly

* default saveable value in SaveButton component

* fix spec

* fetch currentUser async
2022-04-28 12:33:01 -04:00
Mac Siri
4b37f2384c
Refactor OnboardingsController (#17329)
* Refactor OnboardingsController

* Fix broken spec

* Update policy

* Fix spec

* Update config/routes.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Touchup

* Update routes

* Screw it, let's move notification_settings too

* Revert "Screw it, let's move notification_settings too"

This reverts commit aead8c05f4dda62cbc46cdd033afd0acdef2ad73.

* Temp .travis.yml changes

* Revert "Temp .travis.yml changes"

This reverts commit c26109843ba027f9a524e66282a9b01f0341f836.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-04-27 16:17:02 -04:00
dependabot[bot]
2bc63d6650
Bump focus-trap from 6.7.3 to 6.8.1 (#17425)
* Bump focus-trap from 6.7.3 to 6.8.1

Bumps [focus-trap](https://github.com/focus-trap/focus-trap) from 6.7.3 to 6.8.1.
- [Release notes](https://github.com/focus-trap/focus-trap/releases)
- [Changelog](https://github.com/focus-trap/focus-trap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/focus-trap/focus-trap/compare/v6.7.3...v6.8.1)

---
updated-dependencies:
- dependency-name: focus-trap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* mock tabbable in jest

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-27 08:09:21 -06:00
Suzanne Aitchison
e6c4e3ba2e
ignore fetched suggestions if input already cleared (#17419) 2022-04-25 16:03:36 +01:00
Takuya N
aed1b9f8c8
Remove @storybook/addon-notes 5 (#17399)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-22 07:35:00 -04:00
Suzanne Aitchison
9d9bf8763a
fix bug in search and filter indicators (#17341) 2022-04-20 17:57:57 +01:00
Takuya N
3eee116104
Enable error tracking on sendFollowUser (#17328)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-18 22:13:31 -04:00
Takuya N
63c3229e36
Remove use of jQuery on admin config JS (#17206)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-15 07:13:00 -06:00
Ridhwana
2746e77fd5
Adding a modal for the CSV export (#17259) 2022-04-14 18:19:28 +02:00
ludwiczakpawel
3a753cd7f6
one checkbox (#17212) 2022-04-14 10:51:40 +02:00
dependabot[bot]
3f3b13f382
Bump @testing-library/user-event from 13.5.0 to 14.1.0 (#17253)
* Bump @testing-library/user-event from 13.5.0 to 14.1.0

Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.5.0 to 14.1.0.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.5.0...v14.1)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* refactor to account for breaking changes

* remove redundant cleanup

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-13 10:41:08 -06:00
Suzanne Aitchison
64ed2c6dec
move showModal helper into its own pack file (#17266) 2022-04-13 14:15:07 +01:00
Miguel Nieto A
13c433cd56
fix: 🐛 Fix Color displaying over button in settings (#17172) 2022-04-11 10:59:57 +02:00
ludwiczakpawel
d6f204afc1
Toggle component (#17126)
* toggle

* box-sizing

* fixes

* whoopsy

* add specs for toggle component

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-11 09:44:43 +02:00
Suzanne Aitchison
bd097bca25
Member index: add copy email to clipboard functionality (#17146)
* functioning on large screen view

* layout tweak

* tidy up

* remove redundant change

* refocus dropdown button when clipboard copy executes and closes dropdown

* add cypress test

* add missed attr

* implement in responsive layouts

* use runtime copy utility
2022-04-08 14:08:15 +01:00
Suzanne Aitchison
be64f43c1a
Refactor runtime to webpacker JS (#17142)
* add runtime utilities in webpack land, refactor webpack JS using old class

* access Runtime in legacy JS code via window.Forem namespace

* refactor

* make sure data-runtime added only after page does initial load
2022-04-07 15:39:38 +01:00
Suzanne Aitchison
eae8557cf1
Admin member index: update responsive layouts (#17124)
* add an xl breakpoint and use in member index view

* expand search controls at medium breakpoint

* tweak small screen layout options per breakpoint, add overflow button

* small fix

* switch where role appears depending on breakpoint

* adjust for smallest layout

* tweaks for medium layout

* tweaks for large layout

* tweaks for XL table
2022-04-07 14:36:43 +01:00
Jeremy Friesen
c3c884f4d0
Conditional rendering of "Create Post" link (#17076)
* WIP - Conditional rendering of "Create Post" link

This PR builds on the conversation from forem/forem#17056 and moves in a
slightly different direction.

Important in all of this is that the ability to create a post is
enforced on the server.  If the "Create Post" button were to be visible
but the user couldn't create a post when they clicked the button, they
would get an authorization error (or some such response).

This PR posits a different and perhaps competing approach to
forem/forem#16606.  This PR provides a general approach in which we add
class attributes in our HTML erb files.

Note: I have not included Cypress tests as I don't want to yet commit
that time.  I'm also wondering if this is the "right" thing to do.  I
definitely think we want to add some JS tests.  But could we do JS and
unit tests?  (How do we reach consensus regarding our test approach?)

Again, thank you for the conversation and expect an even more "complete"
PR after we have our discussion.

* Extracting AsyncInfo model to ease testing

* Renaming forbidden to visible

* Adding cypress test to assert no 'Create Post'

These are always treacherous.  What happens when we rename the button?
The test will continue to work.

* Apply suggestions from code review

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

* Switching to pack file for policy

Follows on [Suzanne's comment](https://github.com/forem/forem/pull/17076#issuecomment-1088567286)

* Update app/javascript/packs/applyApplicationPolicyToggles.js

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-05 12:47:12 -04:00
Jeremy Friesen
2fda726409
Revert "Added a way to sort comments on an article (#16686)" (#17093)
This reverts commit 1345334b33.
2022-04-04 08:36:34 -04:00
VISHAL DEEPAK
1345334b33
Added a way to sort comments on an article (#16686)
* Added a way to sort comments on an article

* Sorting of comments now uses crayons-dropwn. Some minor fixes as per comments on PR

* Add and fix test cases for sorting comments functionality

* Changes in code for sort comments.  Code  is more aligned with forem's conventions

* Added cyperss tests for sort comments on an article. Cleaned up code to better follow forem conventions

* Get fresh handle of triggerButton everytime clickOustideListener is clicked. Fix Cypress test cases to reflect the earlier.
2022-04-01 09:26:18 -05:00
Michael Kohl
33195929aa
Bump to Rails 7.0.2.2 MVP (#15908)
* Update gems

* Update more gems

* Update @rails/ujs package

* Explicitly add sprockets-rails

* Gemfile update

* Run bin/rails app:setup

* Update redis-actionpack

* Update stats initializer autoloading

* Update acts-as-taggable-on

* Disable signed: true option in session store

* Switch back to released version of redis-actionpack

* Update Gemfile.lock

* WIP

* Update Rails and gems

* Move hair_trigger back to released gem

* Add explicit requires to initializers

* Update Rails version

* Add more explicit require_relative calls

* Re-enable ForemStatsDriver

* Update schema

* Temp spec changes

* Bullet started raising errors?

* Fix broken spec

* Temporarily disable hair_trigger_spec

* Refactor

* Fix spec

* Enable use_rfc4122_namespaced_uuids

* Revert "Enable use_rfc4122_namespaced_uuids"

This reverts commit 5dac3722284bb08049586bfa943405f8a01289df.

* Temporarily deploy to canary

* Revert "Temporarily deploy to canary"

This reverts commit 04f8469501fab2a3177450baf051ff6259c41827.

* Update Containerfile

* Add comments to specs

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-03-30 15:00:33 -04:00
Miguel Nieto A
148f242892
Replace listings tag component (#16855)
* wip

* feat:  Use MultiSelectAutocomplete for Tags

* feat:  Add additional tags for listings

* refactor: ♻️ Use preact/hooks and refactor propTypes

* fix: 🐛 Fix addiional tags support depending on the selected category

- Add slug to returned array in select_options_for_categories helper
- Differentiate the fields categoryId and categorySlug

* fix: 🐛 Adjust propTypes

* test: 🚨 Change test for select_options_for_categories helper

* refactor: ♻️ Apply requested changes

* refactor: ♻️ Remove border prop - default is true

* test: 🚨 Add test suite for ListingTagsField component

* refactor: ♻️ Apply requested changes

* refactor: ♻️ Remove unnecessary forEach + Improve code legibility

* docs: 📚 Remove topTags from hook documentation

* refactor: ♻️ Use the alias for crayons folder + Use loclaCompare in sort

* test: 🚨 Clean up mock response

* fix: 🐛 Reorder styles

* style: 🎨 Add comment to TagAutocompleteOption/Selection components
2022-03-30 16:51:40 +01:00
Suzanne Aitchison
70a5e9437f
Admin member index: show/hide search and filter controls (#17009)
* initial work to show the expand/collapse search and filter on member index

* replace icon with actual button

* simplify logic in pack

* add cypress tests

* make sure both fields part of same form

* add an indicator in mobile view when field has a value

* make sure empty params treated same as missing params

* make sure indicators stay in step with current user input

* partials for inputs

* rename pack file
2022-03-29 15:37:37 +01:00
MrFuku
847cd594ba
Add toggle button to 'New Forem Secret' form (#17016)
* Add toggle button to 'New Forem Secret' form

* Display messages using i18n

* Fix from snake case to kebab case

* Fix a bug when the specified class did not exist
2022-03-29 08:29:29 -06:00