Ghost/ghost/core/test/utils
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
..
agents Sped up comments and feedback tests by reusing Ghost app instance 2022-11-18 14:58:35 +01:00
fixtures 🐛 Fixed unexpected conversion of single-quoted attributes in HTML cards (#19727) 2024-03-06 09:11:49 +00:00
mocks Fixed Playwright tests for new email flow 2023-01-20 19:00:13 +01:00
admin-utils.js 🎨 Reduced requests and 403 responses for comments auth check (#19840) 2024-03-12 12:27:18 +00:00
api.js Cleaned up lexicalEditor labs flag, switched Post model to lexical-by-default (#18607) 2023-10-23 17:51:34 +01:00
assertions.js Removed custom assertions 2023-03-10 14:29:55 +01:00
batch-email-utils.js Added email address alignment protections (#19094) 2023-11-23 10:25:30 +01:00
configUtils.js Fixed configUtils and adapter cache issues in E2E tests (#16167) 2023-01-30 14:06:20 +01:00
db-utils.js Removed Bluebird Promise.each from db.utils (#17032) 2023-06-23 09:46:41 +02:00
e2e-framework-mock-manager.js Added email address alignment protections (#19094) 2023-11-23 10:25:30 +01:00
e2e-framework.js Added Source as the new default theme 2023-10-03 14:02:08 +02:00
e2e-utils.js Added Source as the new default theme 2023-10-03 14:02:08 +02:00
fixture-utils.js Added page html reset and re-render to handle dynamic collection card content (#18265) 2023-09-21 14:51:08 +00:00
index.js 🔒 Fixed filtering on private Author fields in Content API 2023-05-03 08:43:20 -04:00
mocha-retry-reporter.js Enabled and tracked retries in CI tests (#16909) 2023-06-02 09:36:28 +02:00
overrides.js Disabled network retries for webmentions in tests (#18269) 2023-09-21 16:17:05 +02:00
redirects.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
stripe-mocker.js 🐛 Fixed handling multiple Stripe subscriptions for same member (#17773) 2023-08-22 13:27:21 +02:00
url-service-utils.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
urlUtils.js Removed all unused variables from test files 2023-03-10 14:29:55 +01:00