Commit Graph

19 Commits

Author SHA1 Message Date
Kevin Ansfield
dd3bc06761
🐛 Fixed comments block disappearing when performing certain actions (#19846)
closes https://linear.app/tryghost/issue/ENG-739

- `props.innerRef` in `<IFrame>` was inadvertently assumed to always exist, sometimes throwing an error on render when certain popups like the profile settings modal were opened resulting in the app crashing and the whole comments block disappearing
- added a guard to ensure the ref exists before trying to set it
- updated tests so the profile modal route is tested
2024-03-12 17:39:36 +00:00
Kevin Ansfield
ef143978e7
🎨 Reduced requests and 403 responses for comments auth check (#19840)
closes https://linear.app/tryghost/issue/ENG-721
ref https://linear.app/tryghost/issue/ENG-708

Comments-UI loads `/ghost/admin-frame/` in an iframe to check if a Staff User is authenticated in order to  show moderation options. That iframe request loads a HTML page which in turn contains a script that fires off an API request that attempts to fetch the logged-in user details, resulting in a 403 "error" showing up when not authenticated. In the vast majority of cases there will be no staff user authenticated so lots of extra requests and "errors" are seen unnecessarily.

- adjusted the `/ghost/auth-frame/` endpoint to check if the request contains an Admin session cookie
  - if it does, continue as before with rendering the HTML page so the script is loaded
  - if it doesn't, return an empty 204 response avoiding the script request and subsequent 403-generating API request
- eliminates the 403 error being generated for all typical visitor traffic, the error should only be seen when an Admin was previously logged in but their cookie is no longer valid (either from logging out, or going past the 6month validity period)
2024-03-12 12:27:18 +00:00
Kevin Ansfield
92a8a53a95
Added lazy-loading of admin auth in Comments UI (#19799)
closes ENG-711

When an Admin is authenticated in Comments-UI we only add moderation options to the displayed comments so we don't need to pre-emptively load the `admin-auth` iframe and make the `/ghost/api/admin/users/me/` request until some comments are actually visible.

- used `state.comments.length` property to defer rendering of the admin auth frame until comments have been fetched (after box is scrolled into view) and the count is > 0
2024-03-05 15:57:20 +00:00
Fabien O'Carroll
a291914fc4 Updated Comments UI to use new endpoint
refs https://linear.app/tryghost/issue/ENG-676/

Now we have the case that there is no filter param, the simple string
approach fails. Instead we build up a URLSearchParams object which
makes it easier to handle conditional params & stringify it at the end.
2024-02-28 22:40:56 +07:00
Kevin Ansfield
5b6d8fb7a8
Added lazy-loading to comments (#19769)
closes ENG-678

The comments block is typically shown at the bottom of a post so it doesn't make sense to eagerly fetch comments from the API when we don't know if the comments block will even be viewed. By lazy-loading the data only when the comments block comes into view we can reduce both data usage for visitors and load on the site.

- uses IntersectionObserver API to delay comments app initialisation until the comments block has scrolled into view
- updated all iframe-related components to forward a `ref` so we can use the `<iframe>` element reference inside the `App` component
2024-02-28 12:52:24 +00:00
Fabien O'Carroll
359c1049c6 Fixed comments MockedApi and tests
The Comments API should be serving comments in reverse chronological order
2024-02-28 07:38:22 +07:00
Ronald Langeveld
0c95111f8e
🎨 Admin X - Offers (#19520)
no issue

- Offers rebuilt in React and now located in Settings.
2024-01-25 12:41:54 +00:00
Daniel Lockyer
57c5f92770 Reverted "🎨 Added Offers to the new Settings (#19493)"
This reverts commit c7d7b883cc.
2024-01-18 15:04:59 +01:00
Ronald Langeveld
c7d7b883cc
🎨 Added Offers to the new Settings (#19493)
no issue

- Removes flags for the new Offers in Admin X (Settings)
- Removes old Offers from the sidebar.
- See a new version of Offers in Settings. 🎨
2024-01-18 12:56:08 +00:00
Simon Backx
f1b51729fc
Converted Comments-UI App to TypeScript and React hooks (#17760)
refs https://github.com/TryGhost/Product/issues/3504

- App component now uses React hooks intead of React class component
- App is now written in TypeScript
- All JavaScript is now removed from the Comments-UI project
- Removed `PopupNotification` because these were never displayed
- Removed `action` from AppContext (never used)
- Moved options parsing out of `index.ts` into a separate utility file,
similar to the signup-form
- Improved reliability of some editor tests by always waiting for the
editor to be focused (was not always the case) + added an utility method
for this
2023-08-18 13:30:59 +00:00
Simon Backx
850cc7a9a1
Moved old comment tests to Playwright (#17750)
refs https://github.com/TryGhost/Product/issues/3504
2023-08-17 12:47:08 +02:00
Simon Backx
c8daf2e514
🐛 Fixed comments admin menu not visible when not logged in as member (#17749)
refs https://github.com/TryGhost/Product/issues/3504

- When you are logged in as an admin, but not as a member, no buttons
showed (discovered in new e2e tests)
- Added E2E tests for admin actions
2023-08-17 09:20:40 +00:00
Simon Backx
5c843545d8 Added comments-ui editor E2E tests
refs https://github.com/TryGhost/Team/issues/3504
2023-06-28 13:08:35 +02:00
Simon Backx
e6fe60ed37 Added E2E test for colorScheme in comments-ui
refs https://github.com/TryGhost/Team/issues/3504
2023-06-27 16:28:53 +02:00
Simon Backx
23fc00ae60 Added E2E tests for comments-ui accent color option
refs https://github.com/TryGhost/Team/issues/3504

This also fixes an issue where the signup button would become transparent when the accent color option was not set
2023-06-27 16:28:53 +02:00
Simon Backx
81970fbe01 Added E2E test for avatarSaturation on comments-ui
refs https://github.com/TryGhost/Team/issues/3504
2023-06-27 16:28:53 +02:00
Simon Backx
331533d724
Migrated Comments-UI to TypeScript (#17129)
refs https://github.com/TryGhost/Team/issues/3504

This migrates comments-ui to TypeScript. Only `App.js` is left to
migrate, but since this isn't using hooks yet, it will need a bigger
rewrite so this will need to happen in a separate PR.
2023-06-27 14:51:37 +02:00
Simon Backx
9135ca92e0 Added Playwright test for comment reply pagination
refs https://github.com/TryGhost/Team/issues/3504
2023-06-22 19:09:21 +02:00
Simon Backx
8d6fb51908 Added Playwright tests to comments-ui
refs https://github.com/TryGhost/Team/issues/3504

Not complete yet, but contains the basic structure and a few tests that work and should run in CI.
2023-06-22 15:06:13 +02:00