Commit Graph

2449 Commits

Author SHA1 Message Date
Kevin Ansfield
12621d8157
Added core content API integration fixture (#18114)
refs https://github.com/TryGhost/Product/issues/3874

- the new collections card needs to access the Content API rather than the Admin API in order to show the card as it will appear on the front-end but we don't have a default integration that can be fetched via the Admin API for Admin to use when fetching from the Content API
- adds a new "Ghost Core Content API" integration with the `core` type so that it can be read via the `/admin/integrations/` endpoint and used in Admin to make Content API requests
2023-09-13 17:04:49 +01:00
Simon Backx
e888a4e820
Added recommendation events tables (#18084)
fixes https://github.com/TryGhost/Product/issues/3852

Tech spec:
https://www.notion.so/ghost/Recommentions-Tech-Spec-598f09e4109f4eef8d9e32db7245a90c?pvs=4#d30e0081613a4f51860acd40169a4d68
2023-09-13 17:18:40 +02:00
Sanne de Vries
dbc93bf1c7
Added collection card frontend CSS (#18107)
Refs https://github.com/TryGhost/Product/issues/3630
2023-09-13 11:54:41 +00:00
Fabien 'egg' O'Carroll
9dde39b2a4
Handled CollectionPost relations manually (#18081)
refs https://github.com/TryGhost/Arch/issues/86

bookshelf-relations was generating tonnes of select queries from the
posts table in order to update the relations. We've instead implemented
this ourselves, so as to avoid the superfluous fetches. Working closer to
the db like this is nice, and makes you think more about performance.

This logic could be pulled out into a util (not bookshelf plugin) where
it could be used explicitly, but with the complexity hidden, we'll see ig.
2023-09-13 14:16:22 +07:00
renovate[bot]
ed57df7ec6 Update dependency lib0 to v0.2.84 2023-09-13 07:58:24 +02:00
Naz
ce10d34e5e Allowed optionally enabling collections through a flag
refs https://github.com/TryGhost/Ghost/pull/18028

- The previous conditional meant that if the "host settings" collections enabled flag was set, we couldn't disable collections. The referenced pull request would also disable the collections across all of the hosted environment instances. The updated logic optionally takes into account the "labs" flag, as it should have from the very beginning.
2023-09-13 13:56:56 +08:00
Naz
bbb5b64ec5 Cleaned up member's neswletter test suite
refs https://github.com/TryGhost/Arch/issues/87

- We just introduce member's newsletters serialization, so removed the comments reminding to do so.
2023-09-13 13:18:43 +08:00
Naz
282de7f0b4 Added newsletter payload serializer
refs https://github.com/TryGhost/Arch/issues/87

- The newsletters in members payload have leaked internal properties from Public Members API. The code skipped the output serialization step, which is now in place.
- The newsletter resource returned from the API consistently returns these properties:
id,
name,
description,
sort_order
2023-09-13 13:18:43 +08:00
Naz
a284e8275d Added a test for Public member data endpoint
refs https://github.com/TryGhost/Arch/issues/87

- There was no test whatsoever! Adding a super basic test to have some certainty the output doesn't change after a refactor
2023-09-13 13:18:43 +08:00
Naz
e73b16979f Trimmed down Members Admin API response data
refs https://github.com/TryGhost/Arch/issues/87

- The Members Admin API and members.* webhooks were returning too many fields in the nested `newsletters` objects. There was no "allowlist" serializer for the newsletter object, which meant every time we add a new field to the database we would unintentionally return extra fields without a second thought.
- With this change only following fields will be returned with `members[x].newsletters[x]`:
'id',
'name',
'description',
'status'
2023-09-13 13:18:43 +08:00
Naz
2e84cdca36 Added specific newsletters and attribution tests
refs https://github.com/TryGhost/Arch/issues/87

- Round 2 for the previous commit. Removes use of `anyArray` for all
- Using `anyArray` in snapshot test is an anti-pattern which leads to leaking output fields unintentionally when the API changes.
- Adding these fixes is fundamental work before changing the output of 'member.newsletters' property
2023-09-13 13:18:43 +08:00
Naz
4999523289 Added specific newsletters and attribution tests
refs https://github.com/TryGhost/Arch/issues/87

- Using `anyArray` in snapshot test is an anti-pattern which leads to leaking output fields unintentionally when the API changes.
- Adding these fixes is fundamental work before changing the output of 'member.newsletters' property
2023-09-13 13:18:43 +08:00
Kevin Ansfield
ff0426fd86
🐛 Fixed incorrect order of author/publisher in bookmarks cards created with beta editor (#18085)
no issue

- bumps Koenig packages
- `@tryghost/kg-default-nodes` contains fix for swapped author/publisher in bookmark renderer
- all packages contain bumped Lexical dependencies
2023-09-12 16:29:07 +00:00
renovate[bot]
a276335b66 Update dependency @types/common-tags to v1.8.2 2023-09-12 14:36:23 +02:00
renovate[bot]
7ffb3206a8 Update dependency uuid to v9.0.1 2023-09-12 12:29:51 +02:00
Simon Backx
d166977ae4
Updated Portal to always honor outboundLinkTagging setting (#18079)
no issue

- Do not set ?ref in recommendations if analytics is disabled
- Do not send url_history if analytics is disabled
- Expose outboundLinkTagging as a public setting
2023-09-12 10:27:04 +00:00
renovate[bot]
e32e0cb7af Update dependency luxon to v3.4.3 2023-09-12 09:02:09 +02:00
renovate[bot]
c6cf4fc2f3 Update dependency @actions/core to v1.10.1 2023-09-11 21:34:39 +02:00
Simon Backx
f566729ed6
Fixed recommendation order (#18060)
fixes https://github.com/TryGhost/Product/issues/3851

- Order was not applied via the CRUD plugin
- Removed usage of CRUD findAll, and swapped to Bookshelf fetchAll
instead, to decrease dependencies of invisible Bookshelf plugins logic
- Reverted page and limit options possibility via findAll method
2023-09-11 11:04:34 +00:00
renovate[bot]
73aca83fe5 Update dependency mysql2 to v3.6.1 2023-09-11 02:07:34 +00:00
renovate[bot]
7f6bd5ec31 Update dependency ws to v8.14.1 2023-09-08 18:31:09 +00:00
Ghost CI
88efa1a930 v5.62.0 2023-09-08 15:03:00 +00:00
Simon Backx
669be72673
Wired up pagination to recommendations (#18018)
fixes https://github.com/TryGhost/Product/issues/3822
fixes https://github.com/TryGhost/Product/issues/3838

This PR became a bit big because it affected multiple parts of Ghost
that needed to be updated to prevent breaking anything.

### Backend
- Added pagination to the recommendations API's
- Updated BookshelfRepository template implementation to handle
pagination
- Allow to pass `page` and `limit` options to Models `findAll`, to allow
fetching a page without also fetching the count/metadata (=> in the
repository pattern we prefer to fetch the count explicitly if we need
pagination metadata)
- Added E2E tests for public recommendations API (content API)
- Extended E2E tests of admin recommendations API

### Portal
- Corrected recommendations always loaded in Portal. Instead they are
now only fetched when the recommendations page is opened.

### Admin-X
- Added `usePagination` hook: internally used in the new
`usePaginatedQuery` hook. This automatically adds working pagination to
a query that can be used to display in a table by passing the
`pagination` and `isLoading` results to the `<Table>`
- Added placeholder `<LoadingIndicator>` component
- Added a loading indicator to `<Table>`. This remembers the previous
height of the table, to avoid layout jumps when going to the next page.
2023-09-08 12:32:06 +02:00
renovate[bot]
9e3e1d8c73 Update dependency newrelic to v11.1.0 2023-09-07 21:33:43 +00:00
Jono M
1366296330
Bumped AdminX settings and fixed default JS path (#18007)
no issue
2023-09-07 08:53:51 +00:00
Kevin Ansfield
8c91662a47
Added conversion to beta editor format when creating content via ?source=html (#18000)
closes https://github.com/TryGhost/Product/issues/3803

Previously when the beta editor was enabled, using `?source=html` to create posts via the API would create posts in the old editor rather than the beta. This change switches conversion over to the new editor format when the beta is enabled so the full flow can be tested.

- added `htmlToLexicalConverter` method to our lexical library
- updated post and page input serializers to add html-to-lexical conversion when the beta editor is enabled
- updated post model to handle the mobiledoc+lexical co-existing state
  - this is a special case that is only valid for `?source=html` because providing both directly via the API is prohibited
  - we need the extra check here because at the input serializer layer we don't have access to the model to check if we're updating a mobiledoc post or a lexical post so the serializer sets both formats on a `?source=html` request when the beta is enabled and lets the model handle choosing the correct one
2023-09-06 21:16:40 +00:00
Simon Backx
62ee0928bb Bumped Portal to v2.35.0 2023-09-06 17:33:42 +02:00
renovate[bot]
a3a71a6728 Update dependency ws to v8.14.0 2023-09-06 15:27:00 +00:00
Simon Backx
f71c074d31
Added one-click-subscribe detection (#17995)
fixes https://github.com/TryGhost/Product/issues/3820

- This adds a new public site endpoint in the members API to check if a
site can offer the one-click-subscribe feature
- This is implemented on the members API as a copy of the `site`
endpoint because the admin API site endpoint is protected by CORS and
mainly because it can be served on a different domain than the
recommended site and this is hard to detect reliably from the frontend
- Added a new calculated setting `allow_self_signup`, which can replace
the setting that is currently used in Portal (best to do this after a
release otherwise we risk creating issues if a patch release happens)
2023-09-06 15:11:14 +00:00
Ghost CI
0387f75eeb Merged v5.61.3 into main 2023-09-06 10:55:49 +00:00
Ghost CI
1fd32288e0 v5.61.3 2023-09-06 10:55:47 +00:00
Sag
a08e0ed14e
Added logic to update the recommendations_enabled setting on add/delete (#17975)
closes https://github.com/TryGhost/Product/issues/3799

- the recommendations_enabled setting is updated when a recommendation
is created or deleted. It's enabled as soon as there is at least one
recommendation in the database
- the recommendations_enabled setting exists to avoid fetching the
recommendation count from the database directly in themes. The setting
is cached and doesn't need a read every time from the database
2023-09-05 18:31:48 +00:00
Ghost CI
ca91b847f3 Merged v5.61.2 into main 2023-09-05 17:55:54 +00:00
Ghost CI
50341d164f v5.61.2 2023-09-05 17:55:51 +00:00
Kevin Ansfield
0b37e835af
🐛 Fixed incorrect rendering of links following line breaks in beta editor
closes https://github.com/TryGhost/Product/issues/3827

- links following a line break in the editor were being rendered before the line break when previewing/publishing
- bumps Koenig packages which includes relevant fix in `@tryghost/kg-lexical-html-renderer`
2023-09-05 18:28:39 +01:00
Simon Backx
8b1ca62025
Added "Recommended you" section to settings (#17973)
fixes https://github.com/TryGhost/Product/issues/3808 
refs https://github.com/TryGhost/Product/issues/3791
2023-09-05 12:46:27 +02:00
renovate[bot]
0d6e979077 Update dependency express-hbs to v2.4.2 2023-09-05 06:52:42 +00:00
Daniel Lockyer
f65c31c8b2 Removed unnecessary callback function
- `serveStatic` doesn't even support this parameter, so the function is
  never called
- this clears up a big red line in code editors
2023-09-04 16:50:53 +02:00
Ghost CI
d7c0b2392b Merged v5.61.1 into main 2023-09-04 08:11:31 +00:00
Ghost CI
be3905b822 v5.61.1 2023-09-04 08:11:30 +00:00
Daniel Lockyer
d4217bd321
🐛 Fixed missing Admin assets in published tarball
refs https://github.com/TryGhost/Ghost/issues/17932

- we were missing `chunk.208.dbf172ad32f72f21a5dc.js` from our published tarball
- turns out this is due to the lines in the `.npmignore` file to remove
  .db files, which also matched this file
- we can make the regex more specific to avoid these cases
2023-09-04 10:09:16 +02:00
Fabien "egg" O'Carroll
5e3470a3a1 Fixed invalid Offers from throwing when reading
closes https://github.com/TryGhost/Product/issues/3675
refs c98bf80248

As part of our architecture guidelines Repository implementations should protect
against invalid or malformed data in persistence. We do not want read operations
of Entities to throw because of such data. For some fields that bad data can be
fixed or handled in the constructor or static create factory method and replaced
with valid data, others will cause the factory to throw.

This means that Repositories should catch these errors and exclude those
entities from their results. We log the errors in Sentry so that we have
visibility on the state of bad data in DBs
2023-09-02 16:58:48 +07:00
Fabien "egg" O'Carroll
84e6026408 Fixed Offer entity types in OfferBookshelfRepository
JSDoc has a problem with using values as types across repositories, rather than
getting `Offer` as the type we end up with `typeof Offer` as the type - which is
incorrect. Instead we use `import` syntax inside of JSDoc which resolves correctly
2023-09-02 16:58:48 +07:00
Fabien "egg" O'Carroll
127c61d4c6 Moved OfferRepository to core
As per our architecture guidelines we want to keep bookshelf implementations of
Repositories in Ghost core, so that all the bookshelf code is kept together, and
the packages implementing business logic with entities and services require less
dependencies to test. This separation should also help us inadvertently add
business logic to repository implementations by having a more "physical"
boundary between them.
2023-09-02 16:58:48 +07:00
Ghost CI
31d9165296 v5.61.0 2023-09-01 15:04:56 +00:00
Daniel Lockyer
c6cb35074a Updated linting and testing packages 2023-09-01 15:51:17 +02:00
Simon Backx
8600ccf387 Added BookshelfRepository and BookshelfRecommendationRepository
refs https://github.com/TryGhost/Product/issues/3800
2023-09-01 15:10:34 +02:00
Simon Backx
d5c8804e23 Updated InMemoryRecommendationRepository to follow newer pattern
refs https://github.com/TryGhost/Product/issues/3800
2023-09-01 15:10:34 +02:00
Sag
96d9099195
Revert "Added support for importing Stripe Coupons as Offers (#17415)" (#17915)
refs https://github.com/TryGhost/Product/issues/3674
refs https://github.com/TryGhost/Product/issues/3675

- this reverts commits 8a32941ae8 and
b587429008
- the reverted commits added some logic to create offers based on a
Stripe coupon. However, the logic bypassed the Offer entity, and
therefore skipped any validations/constraints — causing invalid data in
the database and some sites to crash.
2023-09-01 09:49:29 +02:00
Sanne de Vries
a19883ac75
Fixed signup and header card split layout bug on frontend (#17916)
No ref
2023-09-01 07:20:17 +00:00
Kevin Ansfield
ea60b40a4c
Bumped @tryghost/bookshelf-plugins (#17913)
no issue

- adds additional debug data to `UpdateCollisionError`
2023-08-31 16:19:22 +00:00
renovate[bot]
de13a7ff65 Update dependency socket.io to v4.7.2 2023-08-31 15:17:43 +00:00
Simon Backx
96fefaea69
Added well known recommendations service (#17895)
fixes https://github.com/TryGhost/Product/issues/3797 
fixes https://github.com/TryGhost/Product/issues/3776 
fixes https://github.com/TryGhost/Product/issues/3798

- Added support for storing json webmentions
- Improved handling deleted webmentions (set deleted to true instead of verified to false)
2023-08-31 14:57:18 +00:00
renovate[bot]
b891b8be6b Update dependency mysql2 to v3.6.0 2023-08-31 14:32:07 +00:00
Kevin Ansfield
b15d4b0c2b
Bumped Koenig packages (#17891)
no issue

- includes fix for posts showing as edited and requiring save after automatic mobiledoc->lexical conversion (https://github.com/TryGhost/Koenig/pull/898)
2023-08-31 11:38:13 +00:00
Sag
f56c36ca24
Wired up recommendations in Portal (#17888)
closes https://github.com/TryGhost/Product/issues/3796
refs https://github.com/TryGhost/Product/issues/3770

- also added a public endpoint for Recommendations in the Content API
2023-08-31 10:07:49 +00:00
renovate[bot]
eab974687f Update dependency express-lazy-router to v1.0.6 2023-08-31 08:52:28 +00:00
Sodbileg Gansukh
c759f419a1 Added max padding limit to Signup and Header cards
refs https://forum.ghost.org/t/anyone-else-seeing-page-too-wide-errors/40695

- google search console snapshots websites with their full height instead of scrolling
- that makes the value of vmax too much, especially when a page has lots of content
- this fixes the issue by adding max limit to the padding values with vmax
2023-08-31 16:16:20 +08:00
Kevin Ansfield
5f5ad4d5dd
Added automatic conversion of old content when opening in beta editor (#17876)
no issue

Previously the beta editor only worked for newly created posts/pages, any older content would open with the original editor. This change enables automatic conversion of old content to the new content format when a post/page is opened in the admin interface allowing new features like signup and advanced header cards to be used on existing content.

- removed `convertToLexical` feature flag
  - where necessary switched to using just the `lexicalEditor` feature flag in its place
- moved the "L"/"M" indicators on the posts list to a new `lexicalIndicators` feature flag to make debugging/development easier
- added a redirect to the original editor route so that any route to opening the editor (such as the `/edit` front-end shortcut, or other areas of Admin) will open in the beta editor
  - avoids confusing/inconsistent behavior
2023-08-30 16:54:03 +01:00
renovate[bot]
d418a431be Update sentry-javascript monorepo to v7.66.0 2023-08-30 14:00:40 +02:00
Simon Backx
78ae776c5e
Added Recommendations browse API to admin-x-settings (#17870)
refs https://github.com/TryGhost/Product/issues/3786
2023-08-30 10:25:31 +00:00
Naz
b54191dbe4 Added killswitch for collection sync functionality
refs https://github.com/TryGhost/Arch/issues/80
refs 3960bfac1d

- The killswitch (a setting in host settings) is needed to control the feature on a hosted environment, so we can safely turn it off if it causes any major issues.
2023-08-30 18:22:22 +08:00
Daniel Lockyer
cc085bafe9 Added function names to all Express middleware
refs https://github.com/TryGhost/DevOps/issues/68

- without a name, tools such as New Relic report the function as
  `<anonymous>`, which makes it incredible hard to follow the code flow
- this commit adds a function name to all middleware I can find that
  doesn't already have one, which should fill in a lot of those gaps
2023-08-30 11:47:50 +02:00
Daniel Lockyer
eb718276e8 Configured New Relic to load earlier in the process
refs https://github.com/TryGhost/DevOps/issues/68

- we want New Relic to be one of the first modules to load so it can
  instrument the rest of our code
- previously this would not have been the case, and it would have missed
  out on instrumenting the config and logging code
- this moves the require to be the first step in the process if the
  PRO_ENV env var is set
2023-08-30 11:47:50 +02:00
Sag
f1cd6432a8
Added new setting to enable Recommendations (#17856)
closes https://github.com/TryGhost/Product/issues/3772

- Recommendations are disabled by default and will get enabled when a
first recommendation is added. The "recommendations_enabled" setting
will be not shown explicitly in Admin, it will rather be set implicitly
based on whether there is at least one recommendation
- The "recommendations_enabled" setting belongs to a new setting group
called "recommendations"

Tech Spec: https://www.notion.so/ghost/Recommentions-Tech-Spec-598f09e4109f4eef8d9e32db7245a90c?pvs=4
2023-08-30 08:56:21 +00:00
Sag
89e9e4a2b8
Added Recommendations table (#17862)
closes https://github.com/TryGhost/Product/issues/3775

- Recommendations tech spec:
https://www.notion.so/ghost/Recommentions-Tech-Spec-598f09e4109f4eef8d9e32db7245a90c?pvs=4#d59dd64cf40144bc944319b65436a730
2023-08-30 10:33:49 +02:00
renovate[bot]
f977227d18 Update dependency postcss to v8.4.29 2023-08-30 08:29:32 +02:00
Simon Backx
935ac43584
Added recommendations CRUD api (#17845)
fixes https://github.com/TryGhost/Product/issues/3784

- Includes migrations for new permissions needed for the new endpoints
2023-08-29 15:06:57 +00:00
Djordje Vlaisavljevic
8416278ea7
Added Recommendations settings placeholder under feature flag (#17855)
refs https://github.com/TryGhost/Product/issues/3787

- Added Recommendations feature flag
- Added an empty placeholder settings section for Recommendations under the feature flag
2023-08-29 12:36:50 +01:00
renovate[bot]
9a2c915a96 Update dependency lib0 to v0.2.83 2023-08-29 11:25:42 +01:00
kai
687cf5a95c
Removed Bluebird dependency (#17831)
refs https://github.com/TryGhost/Ghost/issues/14882

- this removes the last usage of Bluebird within Ghost and removes the dependency as it's no longer required within the codebase
2023-08-29 11:55:14 +02:00
renovate[bot]
240ca0fd07 Update dependency lib0 to v0.2.81 2023-08-29 10:30:55 +01:00
Daniel Lockyer
e6ef88fc68 Configured New Relic integration within Ghost core
refs https://github.com/TryGhost/DevOps/issues/66

- this allows us to enable New Relic within Ghost by providing some sane
  defaults
2023-08-29 09:30:25 +01:00
renovate[bot]
ad1743816a Update dependency @playwright/test to v1.37.1 2023-08-29 08:38:03 +01:00
Naz
dc7b20d50b Extracted domain event interceptor to separate init
closes https://github.com/TryGhost/Arch/issues/13

- Model to Domain event interceptor is a class that does not strictly belong to Collections. It's supposed to be used in any new code that depends on legacy bookshelf model events. Extracted it's initialization to it's own service for clarity and visibility.
2023-08-29 15:21:18 +08:00
renovate[bot]
bd8c43c7b5 Update dependency luxon to v3.4.2 2023-08-28 19:07:40 +01:00
renovate[bot]
1a44d8106b Update sentry-javascript monorepo to v7.65.0 2023-08-28 19:06:53 +01:00
Fabien 'egg' O'Carroll
c1a9f2d6a6
Enabled RO Collections Admin API
The future work around collections requires the read only portions
of the Collections Admin API to be enabled without a flag.

The write endpoints are only for custom collections which aren't required.
2023-08-28 06:49:09 +00:00
Fabien "egg" O'Carroll
3960bfac1d Enabled Collection background syncing
refs https://github.com/TryGhost/Arch/issues/73

Since we've fixed the issues which were executing performance affecting DB
queries, we can enable the background syncing of collections again. This couple
with a new migration to populate the default collections will allow us to start
work on the collections card and will make rolling that card out to GA smoother
and easier as all the required data will be in place.
2023-08-28 13:36:22 +07:00
Ghost CI
b545f234b2 v5.60.0 2023-08-25 15:03:14 +00:00
Ghost CI
24ee0bc740 🎨 Updated Casper to v5.7.0 2023-08-25 15:03:14 +00:00
Steve Larson
e15b9eb891
Bumped Koenig packages (#17826)
no refs
- contains various fixes and improvements to the beta editor
2023-08-24 22:12:38 +00:00
Fabien 'egg' O'Carroll
44ae0dcbe1
Added rudimentary tests for Collections DB queries (#17820)
refs https://github.com/TryGhost/Arch/issues/73

This is just an initial stab at making sure we don't introduce extra DB
queries related to collections without being aware of it.
2023-08-24 13:08:36 +00:00
Simon Backx
08e436c4f3 Bumped comments-ui to v0.13
no issue

- Use comments-ui v0.13
- Removed styles option from comments (no longer used starting from v0.13)
2023-08-24 11:05:19 +02:00
Naz
46f8c15448 Fixed flaky test behavior for bulk actions
refs https://ghost.slack.com/archives/C02G9E68C/p1692816097875899

- With introduction of extra e2e test coverage for Collections some tests started to fail at random. The root issue here was the transaction processing collections was started before the original bulk action (bulk edit, bulk publish/unpublish, etc.) was fully committed. The full transaction commit happens with the bulkAction method return inside of `if (!options.transacting) {` block.
2023-08-24 16:06:41 +08:00
Chris Raible
08d6425a53
Bumped Koenig packages (#17809)
no issue
    
    - @tryghost/kg-converters@0.0.9 > 0.0.12
    - @tryghost/kg-default-nodes@0.1.20 > 0.1.23
    - @tryghost/kg-lexical-html-renderer@0.3.16 > 0.3.19
2023-08-23 14:20:52 -07:00
Simon Backx
375a6d37c2
Added support for i18n in comments-ui (#17797)
refs https://github.com/TryGhost/Product/issues/3504

- This adds support for translations, but doesn't yet translate every
possible string in the app.
- Only active if beta translations is enabled
2023-08-23 13:57:37 +00:00
Naz
437a080580 Added test coverage for collection update on tag removal
refs https://github.com/TryGhost/Arch/issues/77

- We were missing e2e test coverage for when the tag used in collection filters was removed. This changeset improves the situation.
2023-08-23 20:44:08 +08:00
Fabien "egg" O'Carroll
288859fc95 Bumbed express-hbs and fixed inline async helpers
refs ce088f06ff

TL;DR This makes {{asyncHelper "foo"}} usage more stable.

See the linked commit for details on the fix.
2023-08-23 17:35:35 +07:00
Naz
acccc16614 Added collections update after bulk adding tags
refs https://github.com/TryGhost/Arch/issues/77

- During initial development we have missed to support collections update when tags are added to posts in bulk. It's especially valid usecase since we can define automatic collection with a filter containing not yet existing tags.
2023-08-23 17:12:08 +08:00
Fabien "egg" O'Carroll
62d5ca558d Validated filters for collections
refs https://github.com/TryGhost/Arch/issues/47

This ensures that we only have collections which have a valid filter in terms of
  - Valid NQL string
  - Uses only properties which are valid to filter on
  - Only has an empty filter in the case of the "latest" collection
2023-08-23 15:49:06 +07:00
Fabien "egg" O'Carroll
c98bf80248 Removed invalid entities from results
refs https://github.com/TryGhost/Arch/issues/47

This change allows us to throw errors when instantiating invalid entities,
whilst not breaking things when we have bad data in the database. What we can
do is act as if the bad rows are not present, whilst surfacing an error in
sentry to alert us to such cases.
2023-08-23 15:49:06 +07:00
Fabien "egg" O'Carroll
27bfa30f97 Handled our forced null conversion in bookshelf
refs https://github.com/TryGhost/Arch/issues/47

We've configured bookshelf to force empty strings to null, but this is
undesired behaviour here, so unfortunately we have to leak some business
logic into the repository.

This needs to be done to correctly support our filter validation logic.
2023-08-23 15:49:06 +07:00
renovate[bot]
2159b4fb30 Update dependency luxon to v3.4.1 2023-08-22 22:47:51 +01:00
Ghost CI
cebe8d7db6 Merged v5.59.4 into main 2023-08-22 11:46:13 +00:00
Ghost CI
5f2b5d9d11 v5.59.4 2023-08-22 11:46:11 +00:00
Simon Backx
a011151e24
🐛 Fixed handling multiple Stripe subscriptions for same member (#17773)
fixes https://github.com/TryGhost/Product/issues/3752

- Added some extra tests for edge cases
- Updated handling of multiple subscriptions so they are handled better
- Canceling a subscription when the member still has other subscriptions will now get handled correctly where the status and products of the member stay intact
2023-08-22 13:27:21 +02:00
Naz
df3aaed3c8 Added test coverage for collection updates
refs https://github.com/TryGhost/Arch/issues/77

- The test covers collection updates on post resource add/edit/delete operations
2023-08-22 17:16:35 +08:00
Naz
e638d72e70 Refactored collections e2e Admin API test suite
refs https://github.com/TryGhost/Arch/issues/71

- With describe/it block levels mixed on the top level of the test suite the order fo test execution was scattered around. Having "describe" groups for each of the BREAD methods makes things more organized and readable.
2023-08-22 17:16:35 +08:00
Ghost CI
a0efe7a864 Merged v5.59.3 into main 2023-08-21 21:27:36 +00:00
Ghost CI
808ea02e45 v5.59.3 2023-08-21 21:27:34 +00:00
Fabien "egg" O'Carroll
a343f39559 Handled sort_order updates for Collections
refs https://github.com/TryGhost/Arch/issues/73

With the latest version of bookshelf-relations we're able to define a model
specific hook which allows us to ignore sort_order updates on automatic
collections, which don't require their order to be persisted.
2023-08-21 12:16:32 +01:00
Ghost CI
d0c95a37e1 v5.59.2 2023-08-18 15:03:06 +00:00
Michael Barrett
3a95caf48f
Implement member import with tier (#17506)
refs https://github.com/TryGhost/Product/issues/3629
2023-08-18 15:24:31 +01:00
Simon Backx
b587429008
🐛 Fixed importing offers when importing members from Stripe (#17739)
fixes https://github.com/TryGhost/Product/issues/3728

- When importing members from Stripe with an existing offer, that didn't
exist in Ghost, the offer never got linked with the imported
subscription because of a missing return statement.
- Fixes importing offers with duplicate names
- Added E2E tests for creating members from a Stripe Customer ID
2023-08-16 13:25:57 +00:00
Naz
49a4a60d82 Fixed posts Content API test run in isolation
closes https://github.com/TryGhost/Arch/issues/76

- The posts test suite was failing when run in isolation. This was due to "collections" labs flag not being turned on, the events were not going through to collections service correctly
2023-08-16 16:07:01 +08:00
renovate[bot]
e1d92d642a Update dependency postcss to v8.4.28 2023-08-16 06:08:42 +02:00
Steve Larson
fecd326510
📦 Updated koenig dependencies (#17728)
no refs
-contains multiple bug fixes and improvements
2023-08-15 11:38:41 -05:00
Simon Backx
13b732f905
Added Playwright tests for donations (#17699)
fixes https://github.com/TryGhost/Product/issues/3723

This also fixes usage of localhost instead of 127.0.0.1 as a test URL
for playwright. This caused issues for cookies because the member
impersonation navigated to 127.0.0.1 instead of localhost, meaning that
the next page.goto call would go to localhost and lose the cookies.
2023-08-15 15:20:18 +02:00
Daniel Lockyer
6a721d4dab
Merged v5.59.1 into main 2023-08-15 13:31:54 +02:00
Ghost CI
e8836652cc v5.59.1 2023-08-15 11:22:18 +00:00
Simon Backx
690fbf3f73
🔒 Fixed arbitrary file read via symlinks in content import
refs https://github.com/TryGhost/Product/issues/3726
refs https://github.com/TryGhost/Ghost/security/advisories/GHSA-9c9v-w225-v5rg

- credits to https://github.com/ixSly
2023-08-15 13:01:11 +02:00
renovate[bot]
bed89b7bec Update sentry-javascript monorepo to v7.64.0 2023-08-15 12:17:01 +02:00
Ghost CI
f26158b26b v5.59.0 2023-08-11 15:14:28 +00:00
Sam Lord
b2fb38ea52 Fixed case where reseting cache on a test retry could fail build
no issue
2023-08-11 15:12:15 +01:00
Kevin Ansfield
1ebdac3997
🐛 Fixed missing @page object in themes when rendering custom routed page (#17693)
closes https://github.com/TryGhost/Ghost/issues/17681

- updated `prepareContextResource()` to make sure `show_title_and_feature_image` is always removed from pages
- updated `formatResponse.entries()` to apply the same `@page` local behaviour when it's passed a `data.page` object to account for custom routed pages
2023-08-11 14:50:01 +01:00
Simon Backx
e14df6479b
Added E2E tests for donations API (#17694)
fixes https://github.com/TryGhost/Product/issues/3722
2023-08-11 14:25:53 +02:00
renovate[bot]
1a59377d01 Update dependency lib0 to v0.2.80 2023-08-11 13:57:56 +02:00
Aileen Nowak
a72dfdddb7 Prevented Explore iframe to be loading before needed
no issue

- We were loading the Explore iframe together with all assets in Admin
- This change will avoid that and only start loading and rendering Explore, once it's clicked
2023-08-11 10:47:47 +01:00
Naz
92fb2a54ae Fixed non-deretministic post ordering in content gating test suite
refs https://github.com/TryGhost/Ghost/pull/17609

- The tests for content gating started to fail with introduction of the index on `published_at` data in for `posts` table. The reason for the failure was identical `published_at` date set during the fixture insertion, making the returned results change order non-deterministically. The problem is mostly in how the test is set up as it's quite unrealistic to have multiple posts in the system inserted at the same time down to millisecond. Maybe... by some coincidence, but thats not a problem we should care too much about imo.
2023-08-11 17:31:13 +08:00
Naz
d068409fac Added index on posts table for published_at column
refs https://github.com/TryGhost/Arch/issues/18

- The prev/next helpers are slow and are causing major performance issues. The helpers are using `posts.published_at` for comparisons extensively, which causes a full table scan - bad for query performance.
- We use published_at in other queries too (like default order for queries fetching all posts), so there  might be a slight performance boost across the system with this new index.
2023-08-11 17:31:13 +08:00
renovate[bot]
9f2fac34ad Update sentry-javascript monorepo to v7.63.0 2023-08-11 09:27:14 +02:00
renovate[bot]
4d6e52b28c Update dependency @playwright/test to v1.37.0 2023-08-11 08:53:10 +02:00
Sag
4ace11a441
Added logic to load Portal when Tips & Donations are enabled (#17659)
closes https://github.com/TryGhost/Product/issues/3661

- until now, Portal was not loaded if members were disabled. With the
introduction of Tips & Donations, signed-off readers can also make
payments, using the Portal link /#/portal/support.
- now, Portal is loaded when Tips & Donations are enabled, even if
Memberships are disabled
- depending on the member signup access, the top bar / trigger button
Portal buttons are hidden as before (signup/subscribe hidden if access is set to none, subscribe hidden if
access is set to invite-only)
- for any other signup / signin Portal links (e.g., added by the theme,
or added via a Post/Page), a new popup informs the reader when
Memberships are disabled: "Memberships unavailable, contact the site
owner for access".
2023-08-10 15:45:02 +02:00
Steve Larson
8273671425
Updated bookmark card renderer (#17662)
refs https://github.com/TryGhost/Product/issues/3609
-reverted css changes
-reverted mobiledoc renderer
-made lexical renderer consistent with mobiledoc
-css classes were inverted for theme backwards compatibility
2023-08-10 13:41:59 +00:00
Ronald Langeveld
04ce1154a1
Added new enhanced Header Card (#17654)
no issue

- Keep an eye on Ghost's changelog (https://ghost.org/changelog/) for
the full feature announcement. 🎉

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 8367091</samp>

This pull request removes the `headerUpgrade` feature flag and enables
the new header card by default in the editor. It also hides the old
header card from the editor menu unless the `labs.headerV1` setting is
enabled.
2023-08-10 10:40:10 +02:00
Simon Backx
874552bdbe
Added donation events to activity feeds (#17632)
fixes TryGhost/Product#3698
fixes TryGhost/Product#3699
2023-08-10 09:16:47 +02:00
Sag
6cfa4bb6e8
Revert "Added logic to load Portal when Tips & Donations are enabled" (#17655)
no issue

- this reverts commit b95c8275f2
- browser tests needs to be fixed
2023-08-09 13:53:17 +00:00
Sag
b95c8275f2
Added logic to load Portal when Tips & Donations are enabled (#17634)
closes https://github.com/TryGhost/Product/issues/3661

- until now, Portal was not loaded if members were disabled. With the
introduction of Tips & Donations, signed-off readers can also make
payments, using the Portal link /#/portal/support.
- now, Portal is loaded when Tips & Donations are enabled, even if
Memberships are disabled
- depending on the member signup access, the "sign in" / "subscribe"
Portal buttons are hidden (both hidden if none, signup hidden if
invite-only)
- for any other signup / signin Portal links (e.g., added by the theme,
or added via a Post/Page), a new popup informs the reader as such when
Memberships are disabled: "Memberships unavailable, contact the site owner for access".
2023-08-09 12:44:07 +00:00
renovate[bot]
f56d9a5794 Update dependency luxon to v3.4.0 2023-08-09 11:15:27 +02:00
Sam Lord
000b356fff Prevent prepack errors when cache restored in CI
refs: https://github.com/TryGhost/DevOps/issues/56

The new monobundle package now ignores any package directory if it doesn't contain a package.json. These non-packages are occasionally restored from cache when pulling dependencies.
2023-08-09 09:37:58 +01:00
renovate[bot]
93948948a2 Update dependency inquirer to v8.2.6 2023-08-09 09:51:09 +02:00
Chris Raible
9ea4fbd7a7
Added feature to convert and open mobiledoc posts in the lexical editor (#17453)
refs TryGhost/Product#3638

- Added `convert_to_lexical` flag to the posts/pages edit endpoint
- Added 'convertToLexical' feature flag so we can enable/disable this
feature independently from the main lexical beta flag
- Modified admin posts/pages list to point to the lexical editor for
_all_ posts, regardless of mobiledoc vs lexical (if the flag is on)
- Added call to edit endpoint with `convert_to_lexical` in the lexical
editor admin route if the page/post is currently in mobiledoc and the
flag is enabled
2023-08-08 15:44:54 -07:00
Simon Backx
4c8179312d
🎨 Added support for relative links in emails (#17630)
fixes https://github.com/TryGhost/Product/issues/3687

After this change, relative URLs in emails will be replaced with
absolute URLs using the post URL. Making relative Portal URLs possible
etc.

Updates the test data generator to fix invalid URL encoding (somehow a
backslash + escaped double quote was added when it wasn't required).
2023-08-08 13:22:56 +02:00
Ronald Langeveld
d5026068da
Updated Koenig packages (#17626)
no issue

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 2f86a35</samp>

Updated packages for rendering post and page content. This fixes some
bugs and improves the handling of HTML elements.
2023-08-08 11:20:53 +02:00
Simon Backx
5462bc0a96 Added email notification for new donations
fixes https://github.com/TryGhost/Product/issues/3692
2023-08-07 16:32:35 +02:00
Simon Backx
66675a1383
Added donation notifications column (#17607)
fixes https://github.com/TryGhost/Product/issues/3691

When a site receives a donation, we'll send an email to all
administrator. They can disable this in their profile settings. This
migration adds the required column to make this possible. It defaults to
true.

Link to tech spec:
https://www.notion.so/ghost/Tech-Spec-5cd6929f7960462ebcbf198176e0d899?pvs=4#156834b0231d4968a203d797c6817d21
2023-08-07 15:31:36 +02:00
Ronald Langeveld
b889e9bf83
Updated header email rendering package (#17613)
no issue

- some tweaks inside `kg-default-nodes`, requires an update in Ghost.

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
copilot:summary
2023-08-07 13:12:57 +00:00
Sag
ecc9c4aee5
Released Portal 2.34.0 (#17610)
no issue

- this version contains a WIP version of the Tips & Donations feature
2023-08-07 12:59:39 +00:00
Ronald Langeveld
5d6c38b99f
Bumped Koenig Packages (#17608)
no issue

- made adjustment to `kg-default-nodes` that needs bumping on Ghost to
have those changes reflected.
 
---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 77ea2d6</samp>

Updated Koenig Editor dependencies to fix bugs and enhance performance.
This affects the `@tryghost/kg-default-nodes` and
`@tryghost/kg-lexical-html-renderer` packages in
`ghost/core/package.json`.
2023-08-07 13:47:59 +02:00
Sam Lord
06011bf513 Fixed retried tests with snapshots in CI
refs: TryGhost/DevOps#53

Tests with snapshots which are retried in CI will no longer have false positive results
2023-08-07 11:57:22 +01:00
Fabien 'egg' O'Carroll
2459d70048
Added CollectionPost model & relation to Collection (#17588)
By using the `collections_posts` table as a pivot table, I couldn't see
a way to get bookshelf to *not* load the Post models for the relation.
We don't actually need those Post models for our usescases, the the
queries were causing issues with our database servers! Here we've added
a new CollectionPost model which allows us to treat the
collections_posts table as a resource ratherthan pivot, and means we can
use the hasMany relation rather than belongsToMany relation. This
removes all queries to the posts table when fetching collections with
relations
2023-08-07 09:17:36 +01:00
Ronald Langeveld
a9d980f9c1
Bumped Koenig Packages (#17604)
no issue

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at ee5f8bf</samp>

Updated Koenig Editor dependencies in `package.json` to improve editor
performance and stability.
2023-08-07 07:09:21 +00:00
Sodbileg Gansukh
26e07a5f54 Better spacing for the header card 2023-08-07 10:49:32 +08:00
Chris Raible
a4c04da443
Updated Posts Content API snapshots (#17600)
no issue

- Snapshot tests were incorrect but we weren't catching it because CI
was retrying them and yielding false passes
- This fix just fixes the broken tests, which will allow us to fix the
issue with CI yielding false passing results
2023-08-04 22:31:54 +00:00
Sag
81c3555106
Added logic for currency and suggested amount for Tips & Donations (#17599)
closes https://github.com/TryGhost/Product/issues/3666

- added computed setting "donations_enabled"
- added logic to persist "donations_suggested_amount" and "donations_currency"
- used  "donations_suggested_amount" and "donations_currency" when initiating a new Stripe Checkout for donations
- added copy functionality to "your link" in Tips & Donations settings
2023-08-04 18:17:35 +00:00
Ghost CI
299cdb4387 v5.58.0 2023-08-04 15:02:54 +00:00
Sam Lord
4ff467794f Entirely rewrote data generator to simplify codebase
refs: https://github.com/TryGhost/DevOps/issues/11

This is a pretty huge commit, but the relevant points are:
* Each importer no longer needs to be passed a set of data, it just gets the data it needs
* Each importer specifies its dependencies, so that the order of import can be determined at runtime using a topological sort
* The main data generator function can just tell each importer to import the data it has

This makes working on the data generator much easier.

Some other benefits are:
* Batched importing, massively speeding up the whole process
* `--tables` to set the exact tables you want to import, and specify the quantity of each
2023-08-04 13:36:09 +01:00
Sag
19bdb0efef
Added migrations for Tips & Donations' settings (#17576)
closes https://github.com/TryGhost/Product/issues/3668

- Tips and Donations feature offers two settings: "donations_currency", and "donations_suggested_amount"
    - "donation_currency": the currency to be used for the donation. Defaults to "USD", not nullable.
    - "donation_suggested_amount": an anchor price for the donation. Defaults to 0, not nullable.
- Both settings belong to a new group "donations"

Tech Spec: https://www.notion.so/ghost/Tech-Spec-5cd6929f7960462ebcbf198176e0d899?pvs=4#6e8b34c45f0c4c78b48c9e7725a307c8
2023-08-03 22:13:47 +02:00
John O'Nolan
265e62229f
2023 2023-08-03 20:40:44 +01:00