Commit Graph

15918 Commits

Author SHA1 Message Date
Daniel Lockyer
51a6bc969a Updated Admin to v4.41.1 2022-03-23 08:24:59 +00:00
Sam Lord
de3a45a805
Fixed theme error handler (#14363)
no issue

Prevents errors from being uploaded to Sentry when a 404 happens in Ghost Admin. At the moment, 404s in Ghost Admin create an ENOENT error in express' static library. Our generic 404 handler at the end will only intercept requests that don't have any errors in the context, so a simple middleware can strip out 404 errors just before we add in our own.

The Ghost-specific error that we attach to requests does not get uploaded to Sentry :)
2022-03-22 15:32:55 +00:00
Hannah Wolfe
3bd4d0989a Added default serializer + handling
refs: https://github.com/TryGhost/Toolbox/issues/245

- Added a serializer called default to the canary API
  - Ideally, this would be part of the shared framework, but this would change v2/v3 and we're about to get rid of them
  - Therefore, we change just canary for now, and we can refactor again later.
- Added wiring to handler that uses the default serializer, if there is a default, and isn't an explicit serializer for the endpoint
- Removed the invites serializer, so that one endpoint now uses the default

Note: previous commits have added explicit serializers to every endpoint, this is the first step towards paring
that back so that we have less serializers overall, not more!
2022-03-22 13:52:32 +00:00
Hannah Wolfe
e6b92aed9b Added serializer for offers
refs: https://github.com/TryGhost/Toolbox/issues/245

- Offers didn't have a serializer because it's deliberately set at the API level
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Tests were added to cover this endpoint in ...
2022-03-22 13:52:32 +00:00
Hannah Wolfe
3919d31838 Added serializer for missing settings endpoints
refs: https://github.com/TryGhost/Toolbox/issues/245

- Upload, updateMembersEmail, validateMembersEmailUpdate & disconnectStripeConnectIntegration were all missing serializers
- Upload is an as-is response, same as download
- updateMembersEmail, validateMembersEmailUpdate & disconnectStripeConnectIntegration are all passthroughs with no response
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Updated the file based tests to prove the body doesn't change
- Tests were added to cover updateMembersEmail, validateMembersEmailUpdate & disconnectStripeConnectIntegration in 68c1bc0285
2022-03-22 13:52:32 +00:00
Hannah Wolfe
a188cfe677 Added serializer for session.all
refs: https://github.com/TryGhost/Toolbox/issues/245

- Session didn't have a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Tests were added to cover this endpoint in 2cf7e00493
2022-03-22 13:52:32 +00:00
Hannah Wolfe
7e6a7cb98c Added serializer for email_preview.sendTestEmail
refs: https://github.com/TryGhost/Toolbox/issues/245

- sendTestEmail was missing a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Updated the tests to prove the body doesn't change
2022-03-22 13:52:32 +00:00
Hannah Wolfe
2d7117bddd Added serializer for slack.all
refs: https://github.com/TryGhost/Toolbox/issues/245

- Slack didn't have a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Tests already cover this endpoint
2022-03-22 13:52:32 +00:00
Hannah Wolfe
3a1185f2a1 Added serializer for authentication.resetAllPasswords
refs: https://github.com/TryGhost/Toolbox/issues/245

- resetAllPasswords was missing a serializer
- added a new passthrough serializer for now
- the tests already cover this endpoint
2022-03-22 13:52:32 +00:00
Hannah Wolfe
84500be0e2 Added serializer for themes.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- The destroy endpoint was missing a serializer
- Instead of adding one, I've refactored to use an all method that's a passthrough
- Updated the tests to use the same pattern as others to make it clearer this is tested
2022-03-22 13:52:32 +00:00
Hannah Wolfe
ac3f18b251 Added serializer for snippets.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- The destroy endpoint was missing a serializer
- As this serializer uses the same createSerializer pattern as members, I've copied the passthrough from members into here
- This ensures the behaviour will stay the same when the default behaviour changes
- Updated the tests to prove the body doesn't change
2022-03-22 13:52:32 +00:00
Hannah Wolfe
a29ee2834d Added serializer for members.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- This was the only endpoint in the members API that didn't have a serializer
- It just needs to be a simple passthrough, but we define it so we can change the default
2022-03-22 13:52:32 +00:00
Hannah Wolfe
c89a01b031 Added serializer for integrations.destroy
refs: https://github.com/TryGhost/Toolbox/issues/245

- The destroy endpoint was missing a serializer
- Instead of adding one, we've refactored to use the standard structure for this serializer
- Updated the tests to prove the body doesn't change
2022-03-22 13:52:32 +00:00
Hannah Wolfe
7433378e6a Added serializer for redirects.upload
refs:  https://github.com/TryGhost/Toolbox/issues/245

- There was only a serializer in place for redirects.download.
- Upload was falling through, which means nothing happens by default atm
- We want to change this default, so I'm making sure all our routes have serializers declared and tests
- Updated the tests and checked the behaviour was the same before and after:
  - We can't use our new framework here yet because it doesn't support uploads or downloads
  - Instead, just add simple matching for the body of the responses
2022-03-22 13:52:32 +00:00
Daniel Lockyer
28a30835a1
Added minified ghost.min.css to gitignore
- this is a minified version of `core/frontend/public/ghost.css`, but it
  is a release asset and shouldn't be committed to git
- without this change, the file will show up in git and people might
  accidentally commit it
2022-03-22 10:44:39 +00:00
Naz
f3f4501552 Added aliases to update test snapshots
closes https://github.com/TryGhost/Toolbox/issues/248

- When using the framework it was laways confusing to remember which variable would trigger the snapshot updates. Having aliases to most common "typos" makes the DX way better.
- List of updated variables triggering all snapshot updates:

SNAPSHOT_UPDATE
UPDATE_SNAPSHOT
SNAPSHOTS_UPDATE
UPDATE_SNAPSHOTS

- Additionally this bump automatically fixes missing trailing slashes in URLs used in tests
2022-03-22 17:47:14 +08:00
Naz
3c9531452c Reverted "Added detection of "ghost-api" use in theme config"
This reverts commit 4c19f38c74.
2022-03-22 16:18:17 +08:00
Renovate Bot
a10c89ff94 Update dependency cssnano to v5.1.5 2022-03-22 07:41:14 +00:00
Naz
4c19f38c74 Added detection of "ghost-api" use in theme config
refs https://github.com/TryGhost/Toolbox/issues/241

- The `engines.ghost-api` property has been deprecated and the support for it will be dropped in Ghost v5 due to versionless nature of the Content API.
- When uploading a new theme or activating existing one that uses ghost-api in it's config a warning will be shown to the user
2022-03-22 14:05:34 +08:00
Naz
fd14b7eaf6 Refactored the gscan version check to use single variable
no issue

- Just a small refactor as it was becoming painful to change the version in three places while experimenting with gscan
- Also follows the "rule of 3"
2022-03-22 09:53:22 +08:00
Renovate Bot
955f1e8a2e
Update dependency @sentry/node to v6.19.1 2022-03-21 21:04:26 +00:00
Simon Backx
028cf7becc Added dashboardV5 feature flag 2022-03-21 16:56:34 +01:00
Daniel Lockyer
cc4ab58e36
Updated .npmignore
- these files are only for development and don't need to be shipped with
  Ghost
- also removes `.travis.yml` - yuck
2022-03-21 15:54:37 +00:00
Thibaut Patel
6e9bc81d6d Fixed the tests from the previous commit
refs 2324b29b2a

- Updated the settings snapshot
2022-03-21 16:28:26 +01:00
Peter Zimon
2324b29b2a Added multiple newsletters flag 2022-03-21 16:11:36 +01:00
Daniel Lockyer
abfc6a17b8 v4.41.0 2022-03-21 11:38:12 +00:00
Daniel Lockyer
7de80473b1 Updated Admin to v4.41.0 2022-03-21 11:38:12 +00:00
Hannah Wolfe
3784d79682
Added fixture path utility to e2e-framework
- Always want to be able to safely get a fixture path without needing the path util
- Means tests can be moved around more easily
2022-03-21 11:14:54 +00:00
Naz
25e5cb46de 🐛 Fixed /canary/ API endpoints 404s
refs https://github.com/TryGhost/Toolbox/issues/169
refs 7becf0a2b2

- The referenced commit has dropped existance of Content and Admin APIs under `/canary/` prefix, which made a breaking change and clients that are still relying on "canary" started to break.
- The `/canary/` prefix should be used up untill the introduction of Ghost v5, otherwise we run the risk of accidentally breaking API clients.
2022-03-21 19:11:13 +08:00
Renovate Bot
30f73b73fe Update dependency papaparse to v5.3.2 2022-03-21 09:51:56 +00:00
Renovate Bot
d34c8f77df Update dependency @playwright/test to v1.20.0 2022-03-21 09:16:50 +00:00
Daniel Lockyer
ac5f42b7ad
Added missing message string
- we use this property in the code but it was missing from the messages
  object
- this was causing an error in the `tpl` library so this commit adds the
  correct message
2022-03-21 09:07:54 +00:00
Daniel Lockyer
ce81d907b6
Deduped dependencies via yarn-deduplicate
refs 8b5b0b12e8

- we've added some Renovate config to run this automatically but we
  should run this manually first so the first dependency bump won't
  contain extraneous cleanups
2022-03-21 08:47:59 +00:00
Renovate Bot
47741e5b58 Update CSS preprocessors 2022-03-21 08:36:33 +00:00
Hannah Wolfe
5f378ca3f6
Removed unused snapshot files
- the tests that used these files have been moved to test/e2e-api
2022-03-19 16:48:59 +00:00
Hannah Wolfe
68c1bc0285 Added missing settings endpoint tests
- Added a test for each of the 3 missing endpoints
- This is so that we can be sure future refactors won't break these endpoints
2022-03-19 16:06:07 +00:00
Hannah Wolfe
c66eeb5879 Updated settings to use new test framework
- split out the two tests that use files, as the new framework doesn't support this yet
- convert the 3 existing tests for the settings endpoint to use the new framework
- introduced a new pattern of using a function to generate a matching array, so that we can do extra stuff
- in this case, just one of the items needed a matcher for the value, which results in slightly weird code
- wrapping in a function gives us somewhere to do this and leave a comment
2022-03-19 16:06:07 +00:00
Hannah Wolfe
c11187d770 Updated members tests to use defined matcher
- some tests were inconsistently using copy-pasted matchers
- instead, we should define them once and use them everywere
- this keeps the tests easy to read and maintain
2022-03-19 16:06:07 +00:00
Kevin Ansfield
8a28923421 Added members activity feed screen to admin area
no issue

- adds a separate activity feed screen with all member events
  - can be filtered to show specific event types
  - can be filtered by a specific member to show their full event feed
- updated member details screen to show all events instead of just email events
2022-03-18 16:29:12 +00:00
Kevin Ansfield
95c919852b
Fixed missing product name in API response when editing creating/editing subscriptions (#14339)
refs https://github.com/TryGhost/Team/issues/1141

- switched to the same member fetch method as used in `GET /member/:id/` so there's consistent data available when rendering the API responses
2022-03-18 16:06:38 +00:00
Daniel Lockyer
70788b86a0 v4.40.0 2022-03-18 16:00:40 +00:00
Daniel Lockyer
76fb1f56eb Updated Admin to v4.40.0 2022-03-18 16:00:40 +00:00
Simon Backx
d9f103ddac
Updated @tryghost/members-api to 5.4.0 (#14338) 2022-03-18 16:52:56 +01:00
Djordje Vlaisavljevic
808143e005 Fixed horizontal scrolling issue in code blocks in emails 2022-03-18 15:26:08 +01:00
Rishabh
f44c86c937 Refined scrollbar and preview style in Portal
- bumps portal with several design refinements and tiny UX fixes
2022-03-18 19:35:58 +05:30
Thibaut Patel
b4ea309893
Added the MemberCancelEvent model to MembersApi (#14313)
refs https://github.com/TryGhost/Team/issues/1302

- Added the `MemberCancelEvent` model to MembersApi
- Triggered when a subscription is canceled by an admin or by the member
- Updated shared dependencies

Co-authored-by: Simon Backx <simon@ghost.org>
2022-03-18 14:25:35 +01:00
Hannah Wolfe
2cf7e00493 Added tests for session API
- this API has never had proper tests!
- using the new framework this was pretty easy :)
2022-03-18 13:13:16 +00:00
Renovate Bot
f20b31dbe9
Update dependency knex-migrator to v4.2.3 2022-03-17 22:52:36 +00:00
Hannah Wolfe
911ce5f92d Cleaned up db-utils and added jsdocs
- Attempted to make it clearer what the db utils do and what each one is for
- Clearly marked the old clearData & initData as deprecated, we don't want to mix db and url service resets
2022-03-17 17:33:11 +00:00
Hannah Wolfe
11a792f7df Wrapped test teardown in a fallback
- The fast truncateAll method can fail
- If it does, use knex-migrate to do a safe reset of the DB instead
- This is being done to try to make test runs more reliable in the face of database errors
2022-03-17 17:33:11 +00:00