Commit Graph

16500 Commits

Author SHA1 Message Date
Matt Hanley
48f1dbc7a5 Added docs for writing new commands 2022-05-17 17:16:44 +01:00
Matt Hanley
99a4e1ea48 Added missing log alias to command 2022-05-17 17:16:44 +01:00
Renovate Bot
efc67b1783 Update dependency @playwright/test to v1.22.1 2022-05-17 15:55:31 +01:00
Matt Hanley
236d07c90a
Added CLI command structure (#14821)
Added CLI commands for REPL and timetravel functionality

- Added TimeTravel command for updating test data with a date offset
- Added REPL command for access to models and knex in development
- Added pattern for creating new CLI commands, including
  - User input
  - Output
  - Validation of `NODE_ENV`
- TimeTravel command is in the main Ghost repo because it requires the schema
2022-05-17 15:40:12 +01:00
Simon Backx
8b973dcfaa
Added subscription.price.tier mapping (#14849)
refs https://ghost.slack.com/archives/C02G9E68C/p1652781104970769
refs https://github.com/TryGhost/Team/issues/1145

- subscription.price.product was not mapped yet, but already used in the admin app.
- removes products property from members
2022-05-17 16:38:25 +02:00
Daniel Lockyer
e258e32f04
Fixed coverage/ directory included in local builds
- without this, the `coverage/` directory gets included in builds
  because `grunt-contrib-copy` doesn't operate on just the folder name
- this avoids us zipping up coverage with builds and helps bring CI and
  local builds closer together
- my commit here was incorrect: 815a2d0f7d
2022-05-17 11:11:52 +01:00
Naz
acb3e25ef0 Removed redundant page attribute deletion
refs https://github.com/TryGhost/Toolbox/issues/332

- 'page' property has been dropped completely from the database schema, so there's no need to clean up this model property in the output serializer
2022-05-17 17:21:38 +08:00
Naz
214949fe8c Fixed comment 2022-05-17 17:21:38 +08:00
Naz
0260ec5a64 Removed useless comment
no issue

- Engines in theme's package json have no effect whatsoever on how Ghost instance runs.
2022-05-17 17:21:38 +08:00
Naz
5c2ece9668 Improved assertions in frontend test suite
no issue

- When the tests were rewritten to async/await they didn't get the same header checks as the old style suite.
2022-05-17 17:21:38 +08:00
Naz
1cc3f66d5f Reworked preview controller output
refs https://github.com/TryGhost/Toolbox/issues/332

- With 'page' property being gone from page/post resources we need consistency across internal "preview API" too
- the handling is still hacky as we are exposing the "type" property to the preview pages, which is not exposed through Content API. this a long outstanding issue will have to be handled separately
2022-05-17 17:21:38 +08:00
Daniel Lockyer
5cd9d97a07
Updated @tryghost packages
- these packages contain small code changes or dependency updates that
  we've been forced to publish because of Lerna
2022-05-17 09:17:11 +01:00
Hannah Wolfe
8ec8a21b71
Renamed "client" references to "admin"
refs: https://github.com/TryGhost/Toolbox/issues/299

- renamed lots of things that reference Ghost admin as "client"
- these things make even less sense in a post core/client world
2022-05-17 09:05:44 +01:00
Renovate Bot
bfc2ddec84 Update dependency knex-migrator to v4.2.10 2022-05-17 08:41:25 +01:00
Hannah Wolfe
64fd6f21fa
Renamed core/client to core/admin (#14837)
closes: https://github.com/TryGhost/Toolbox/issues/299

- core/client doesn't really make sense any more now that we don't have just a client and server folder
- this folder contains ghost admin, so admin makes waaaay more sense
2022-05-17 08:27:13 +01:00
Renovate Bot
68512147f0 Update dependency cssnano to v5.1.8 2022-05-17 07:55:58 +01:00
Rishabh
4d300ee89a Updated portal to use new tiers api structure
refs https://github.com/TryGhost/Team/issues/1575

- updates portal to handle the tiers api structure in new format
2022-05-17 12:23:40 +05:30
Naz
3ff757fbad Fixed /edit shortcut route for pages
refs https://github.com/TryGhost/Toolbox/issues/332
refs f5f1221e14

- Adding an `/edit/` post-fix to a static page URL broke when the `page: true` property support was dropped in the Content API
- The changeset adds tests covering the scenario for both page and post resources
2022-05-17 14:31:31 +08:00
Naz
5abd67809d Cleaned up AMP rendering of "page" resources
refs https://github.com/TryGhost/Toolbox/issues/332

- After dropping support for `page: (true|false)` for post resources in Content API there is no need to check for `body.post.page` in the AMP renderer. Furthermore, the AMP router uses `public-post` controller that **only** returns "post" resources. This check was a redundant, unnecessary piece of logic
2022-05-17 11:39:52 +08:00
Renovate Bot
d8e9cbf9db
Update dependency c8 to v7.11.3 2022-05-17 00:26:57 +00:00
Hannah Wolfe
5090d75d96
Improved theme asset handling - permissible assets
refs: https://github.com/TryGhost/Team/issues/1633

- this makes /assets/ a more permissible folder - it can serve anything _except_ hbs files
- meanwhile the root folder becomes less permissible, and won't serve theme dev files commonly found in the root
2022-05-16 19:54:33 +01:00
Fabien 'egg' O'Carroll
d9e6dfe97e
Updated Tiers API data structure (#14795)
refs https://github.com/TryGhost/Team/issues/1575

- Updates the admin-api-schema to reflect new data structure
- Updates members-api to allow Portal to use new data structure
- Data is only mapped at the serialised level to avoid changing the underlying implementation
- Ensure only one version of domain-events present in yarn.lock
2022-05-16 19:47:18 +01:00
Kevin Ansfield
c14f82fec0 Fixed settings test snapshots
refs 340e30f62d
2022-05-16 18:20:44 +01:00
Kevin Ansfield
340e30f62d Removed "publishingFlow" labs flag
no issue

- all uses of the flag have been removed from Admin so it's no longer needed
2022-05-16 18:12:11 +01:00
Matt Hanley
09804244f5 Added newsletters table to default export
refs https://github.com/TryGhost/Team/issues/1629

- We want to export the default newsletter so that we don't lose the post<>newsletter relationship when exporting
- The newsletter_id is currently ignored in the post importer (https://github.com/TryGhost/Ghost/pull/14720) so imports won't work right now
- This change means that exports created in 5.0+ will work later on with no data loss once the importer supports it
- The counts displayed for the newsletters are a count of email records, not post records - and we don't export/import emails so the count will always be 0 after importing a newsletter
2022-05-16 17:49:25 +01:00
Hannah Wolfe
12aff14dff Removed oauth experiment
refs: https://github.com/TryGhost/Team/issues/1625

- this didn't work the way we wanted to
- removing this will free up the namespaces to start over
2022-05-16 17:37:13 +01:00
Hannah Wolfe
18cf73c3b3
Updated output logic to correctly use excerpt 2022-05-16 15:51:14 +01:00
Hannah Wolfe
6d66fe9e22 Switch settings.edit to use an allow list
refs: https://github.com/TryGhost/Team/issues/1625

- Ensure that we maintain a list of exactly which settings can be edited
- Bypass this for internal settings changes for now
- TODO: use the settingsBreadService internally instead of the api directly
2022-05-16 15:07:31 +01:00
Hannah Wolfe
349cbdfc07 Cleaned settings API to only return key & value
refs: https://github.com/TryGhost/Team/issues/1625

- none of the other fields are useful externally, so don't expose them
- "liberal in what we accept, conservative in what we send"
2022-05-16 15:07:31 +01:00
Hannah Wolfe
51a016ac7f Removed code + test for old type param
refs: https://github.com/TryGhost/Team/issues/1625

- type was renamed to group, and type is used to store the actual value type
- we no longer need any backwards compatibility for the old concept of type
2022-05-16 15:07:31 +01:00
Naz
0c097f6532 Fixed frontend rendering of page resource
refs https://github.com/TryGhost/Toolbox/issues/332

- After removing the concept of a boolean "page: true" from the page/post resources frontend resource rendering didn't have enough information to pick the correct template
- Resolved this issue through passing of additional "context" to the template picker. Something nicer should be worked on in the future, as context pattern feels dirty here.
2022-05-16 22:06:55 +08:00
Naz
44c72ddd81 Removed output of "page" filter in Admin/Content APIs
closes https://github.com/TryGhost/Toolbox/issues/332
refs https://github.com/TryGhost/Ghost/issues/10922

- The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing
2022-05-16 22:06:55 +08:00
Naz
f5f1221e14 Removed output of "page" attributes from APIs
refs https://github.com/TryGhost/Toolbox/issues/332
refs https://github.com/TryGhost/Ghost/issues/10922

- The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing
2022-05-16 22:06:55 +08:00
Kevin Ansfield
27337e5f00
Added newsletter param to email preview endpoint (#14820)
refs https://github.com/TryGhost/Team/issues/1621

We want to allow previewing emails based on the selected newsletter. The post model doesn't get a newsletter attached until a publish occurs so we can't use `post.newsletter` and need to give the option of specifying which newsletter to preview via query params.

- added support for `newsletter` query param on the `GET /email_previews/posts/:id/` endpoint where the value is a newsletter slug
- updated `generateEmailContent()` signature to use an options object because the order of memberSegment/newsletter arguments doesn't matter and is difficult to reason about if not named
- adjusted `generateEmailContent()` to fetch the newsletter matching the provided slug, falling back to the default newsletter if no slug is provided
2022-05-16 12:15:54 +01:00
Hannah Wolfe
3f0172e755 Removed backwards compatibility for slack setting
refs: https://github.com/TryGhost/Team/issues/1625

- we changed slack to be two separate settings some time ago
- this cleans up the compatibility code
2022-05-16 11:38:59 +01:00
Daniel Lockyer
93339b3e42
Removed unused code for logging in MySQL lib
- `mysql2` doesn't support this and we haven't had it enabled for a long time
- if we need this feature, we can re-add it with a working implementation
2022-05-16 10:53:08 +01:00
Hannah Wolfe
9957c2a77c
Revert "Updated plaintext to be a partial doc"
This reverts commit 8f90ca949d.

- plaintext is used in search features so this is probably a bad idea
2022-05-16 10:20:26 +01:00
Renovate Bot
55c065df62 Update dependency @tryghost/color-utils to v0.1.17 2022-05-16 09:40:55 +01:00
Renovate Bot
a2c5993625 Update dependency @tryghost/helpers to v1.1.68 2022-05-16 09:40:46 +01:00
Hannah Wolfe
8f90ca949d Updated plaintext to be a partial doc
refs: https://github.com/TryGhost/Ghost/issues/11407

- there's no need for us to process the whole document as it's only used for excerpts
- emails need the whole document, but they're managed seprately now
- this is more efficient and means we could potentially do it on the fly 🤔
2022-05-16 09:38:16 +01:00
Hannah Wolfe
9d4d6688d8 Removed links and figcaptions from excerpts
refs: https://github.com/TryGhost/Team/issues/1609
refs: https://github.com/TryGhost/Ghost/issues/11532
refs: https://github.com/TryGhost/Ghost/issues/11407

- these don't read correctly in an excert context
2022-05-16 09:38:16 +01:00
Hannah Wolfe
338dc3ae6c Refactored html-to-plaintext to have two functions
refs: https://github.com/TryGhost/Team/issues/1609

- Split html-to-plaintext into a function for excerpts and emails
- Updated all usages so they use the correct function
- There's currently no difference between the two
2022-05-16 09:38:16 +01:00
Hannah Wolfe
f73a84abac Update dependency html-to-text to v8
refs: https://github.com/TryGhost/Ghost/pull/13035
refs: https://github.com/TryGhost/Team/issues/1609

- Upgraded to the latest html-to-text
- Matched the options to what we had as close as we can
- The output changes slightly, but in most cases those are bugfixes
- We are going to tune this output more soon, so accept the changes for now
2022-05-16 09:38:16 +01:00
Hannah Wolfe
f436d23f87 Removed 80 char wordwrap in excerpts
refs: https://github.com/TryGhost/Team/issues/1609

- remove the 80 char wordwrap
- this makes the function the same as used in the post serializer
- updated references everywhere to use the same function
2022-05-16 09:38:16 +01:00
Simon Backx
6b3a657f88
Renamed newsletter_id and email_recipient_filter options (#14798)
refs https://github.com/TryGhost/Team/issues/1596

- Renamed `newsletter_id` to `newsletter` option, the `newsletter` option expects a slug instead of an id
- Renamed `email_recipient_filter` to `email_segment` option
- Default `email_segment` to `all`. Ignored if no newsletter is set
- `email_segment` is ignored if no newsletter is set
- When reverting a post to a draft, both `newsletter` and `email_segment` are reset to their default values (null, all)
- Removed legacy mapping from old email_recipient_filter values 'paid' and 'free' (already a migration in place)
- Dropped legacy throwing errors when email_recipient_filter is paid or free in transformEmailRecipientFilter
- Reorganized transformEmailRecipientFilter parameters for the now required newsletter parameter
- Fixed an issue where the newsletter filter wasn't working because it wasn't in permittedoptions
- Fixed an issue where you could send to an archived newsletter
- Added an extra protection when scheduling to an active, and later archiving the newsletter
- Dropped support for `send_email_when_published` in API
- When importing posts we currently don't have a system in place to set the newsletter_id to map the `send_email_when_published` behaviour. Since this was already the case, I won't include a fix in this PR.
- Stripped `email_recipient_filter`/`email_segment` from Content API (https://ghost.slack.com/archives/C02G9E68C/p1652363211841359?thread_ts=1650623650.233229&cid=C02G9E68C)
- Updated `admin-api-schema` to 3.2.0, which includes the new email_segment property
- Contains a temporary fix for https://github.com/TryGhost/Team/issues/1626, where the `.related('newsletter').fetch` call fails when the newsletter relation is already loaded, because of the overridden `formatOnWrite` method.

Since the `email_recipient_filter` is no longer used without a newsletter, the `none` value is no longer used. A migration transforms all those values to `all`. This should be safe, because we only send an email now when newsletter_id is not null (scheduled posts should already have a newsletter_id, even if at the time of scheduling they didn't add the newsletter_id option, because at that time, we defaulted to the default newsletter).

Admin changes to make this work: https://github.com/TryGhost/Admin/pull/2380
2022-05-16 10:18:04 +02:00
Naz
f83ceb80d6 Removed need for redundant "strip" attribute in schemas
refs https://github.com/TryGhost/Toolbox/issues/314

- Writing schema definitions will become more concise without a need to specify all valid resource properties that could be accepted by the Admin API - no need to define "strip" attribute on every known
2022-05-16 15:44:25 +08:00
Naz
3e1d206d84 Added gscan check for {{@member.products}} helper
refs https://github.com/TryGhost/Toolbox/issues/329

- Adds and improves gscan checks for use of following helpers:
  - @labs.members
  - @member.products
  - @price

@labs.members going in favour @site.members_enabled

@member.products gone in favour of @member.subscriptions

@price and it's variations gone in favour of {{price}} + {{@member.subscriptions}}
2022-05-16 13:27:22 +08:00
Renovate Bot
0c7cf97615
Update dependency glob to v8.0.3 2022-05-13 23:55:59 +00:00
Hannah Wolfe
705a72431d
Removed GET settings/:key route
refs: https://github.com/TryGhost/Team/issues/1625

- there's not really a usecase for this route, so removing so we don't have to maintain it
2022-05-13 23:18:53 +01:00
Hannah Wolfe
37818a1b71
Removed settings that are no longer in use (#14802)
refs: TryGhost/Team#1625
refs: TryGhost/Team#1558

- none of these settings are actively used anymore

Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
2022-05-13 21:19:21 +01:00