Commit graph

1182 commits

Author SHA1 Message Date
Josh Puetz
bb4f8fa2b5
Track clicks and views in comments on article page (#17886)
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-21 09:19:55 -05:00
Suzanne Aitchison
1eefc3d3cd
remove storybook addon-links (#17935) 2022-06-16 15:03:47 -04:00
Suzanne Aitchison
b94c5deea6
Admin member index: filter by member roles (#17884)
* prevent ID conflicts in filters modal by caching content

* show roles with expandable section

* minor tweak

* don't use the hidden field

* send array of role

* role -> roles. small refactor

* set initial checked status

* show an indicator when a filter is applied

* add JS to toggle filter clear buttons and indicators

* update some comments, make sure users only appear once in list

* add some cypress specs, fix some bugs
2022-06-16 15:06:35 +01:00
Joshua Wehner
07e1364f54
Trusted users can view & use moderator response templates (#17867)
* Trusted users can use moderator response templates

* Iron out container reveal logic

* Explanatory comment on controller endpoint confusion
2022-06-16 14:05:49 +02:00
Fernando Valverde
6b073d078b
Enable clickOutsideDeactivates on Onboarding FocusTrap (#17885) 2022-06-13 08:23:46 -06:00
Julianna Tetreault
8e4b6581e2
Member Index View Actions: "Assign Role" (#17866)
* Adds the Assign Role modal to the Member Index View

* Adds e2e tests for the Assign role modal

* WIP: Conditionally redirects to the correct view upon assigning a role

* Conditionally renders the redirect in the correct method :|

* Adjusts the conditional redirect to account for ID

* Adds an even more explicit check for the correct refferer
2022-06-10 07:22:03 -06:00
Rajat Talesra
27c6f07686
Feature/add embed icon to editor toolbar (#17781)
* Finished task 1 and task 3

* Task 2:  If the user already has text selected inside syntax

* Added comments

* Tests added

* Nit fixes

* Code optimisation

* Nit fixes

* Fix typo

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

* Removed console log statements

* Minor fix

* Simplified code

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-10 17:33:23 +05:30
Suzanne Aitchison
6c9a09c344
Add quick select ranges to date range picker (#17850)
* Add utils for preset date ranges

* show the preset options in the calendar

* allow ranges to be selected in storybook

* add some more docs

* add missing prop type

* add tests

* move story out of beta

* fix last time periods

* small refactors
2022-06-08 15:48:06 +01:00
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