Commit Graph

2547 Commits

Author SHA1 Message Date
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
Ghost CI
81ef2ade39 Merged v5.57.3 into main 2023-08-03 10:25:36 +00:00
Ghost CI
34b6f1917f v5.57.3 2023-08-03 10:25:34 +00:00
Fabien "egg" O'Carroll
148cf059dc Disabled Collections sync when flag disabled
We've been seeing an increased number of database queries, which are potentially
caused by the collections syncing logic. Whilst we haven't narrowed the cause
down precisely we want to disable this logic unless the flag is enabled.
2023-08-03 11:08:25 +01:00
Steve Larson
c539417e89
🐛 Fixed bookmark card metadata styles (#17577)
refs TryGhost/Product#3609
- author and publisher styles were mixed up in mobiledoc
- made consistent for author coming after publisher for md and lexical
- updated renderer packages
2023-08-02 14:13:25 -05:00
Ghost CI
e2a6d8b987 Merged v5.57.2 into main 2023-08-02 15:12:37 +00:00
Ghost CI
afce648fd7 v5.57.2 2023-08-02 15:12:35 +00:00
Steve Larson
6936007052
🐛 Updated gscan error handling for page errors (#17575)
refs https://github.com/TryGhost/Product/issues/3676

- add filter for sidebar display of theme errors (angry red box)
- filter specific to each page feature, will need to add each one by this approach
2023-08-02 09:56:40 -05:00
Fabien "egg" O'Carroll
2cd50d47af 🐛 Fixed superfluous DB queries on Collection save
We have a global hook for the bookshelf-relations plugin which updates the
sort_order for pivot tables when saving the parent model. This hook requires
that we fetch each row in the pivot table related to the model and then run an
update on each one. Since we have a "latest" Collection this means at least N
update queries where N is the number of Posts for a site. For large sites this
was crippling the database. We only need the sort_order to be updated for
Collections with a type of "manual". We currently don't have a way to disable
the update based on model attributes, so instead we have disabled the update for
all Collections - this is okay because 1. Collections is not released and 2. we
don't have full support for manual Collections yet anyway.
2023-08-02 15:19:47 +01:00
Ghost CI
f839c2289c Merged v5.57.1 into main 2023-08-01 19:57:00 +00:00
Ghost CI
c81baebdbb v5.57.1 2023-08-01 19:56:59 +00:00
Fabien 'egg' O'Carroll
ada5b838a5
🐛 Fixed custom routing with collections (#17561)
When we updated the way we handled NQL filter expansion, we broke custom
routing collections. This reverts the change and fixes custom routing.
2023-08-01 19:54:41 +01:00
Naz
346eeef2e3 Removed flatUrls labs flag
refs 4372a7e1a8

- We ended up developing a proper customizable routing on the `arch` branch. This flag is obsolete.
2023-08-01 15:13:15 +08:00
Naz
7464dbc1af Added e2e test coverage for bulk collection edits
refs https://github.com/TryGhost/Arch/issues/16

- Makes sure post bulk actions also update collection posts
2023-08-01 15:11:00 +08:00
Naz
8635f4efeb Added collections handling for PostsBulkFeaturedEvent/PostsBulkUnfeaturedEvent
refs https://github.com/TryGhost/Arch/issues/16

- When posts produce PostsBulkFeaturedEvent/PostsBulkUnfeaturedEvent the collections having a featured filter should update the posts belonging to them.
2023-08-01 15:11:00 +08:00
Ghost CI
b6e8208950 v5.57.0 2023-07-31 20:42:08 +00:00
Ghost CI
29a4521235 🎨 Updated Casper to v5.6.0 2023-07-31 20:42:08 +00:00
Ghost CI
650487f8ee Merged v5.56.1 into main 2023-07-31 19:38:23 +00:00
Ghost CI
09d967a197 v5.56.1 2023-07-31 19:38:21 +00:00
Steve Larson
5fe72462bc
Enabled page features (#17544)
no refs
-moved hide page title and feature image to GA
-updated gscan
2023-07-31 14:22:19 -05:00
Simon Backx
841e52ccfe
Added donations API (#17495)
refs https://github.com/TryGhost/Product/issues/3648

- Refactored Members API RouterController.createCheckoutSession: Split the method into smaller parts so we can reuse individual parts for the upcoming donation checkout session.
- Wired up donation checkout creation
- Added donation events
2023-07-31 16:00:52 +00:00
Simon Backx
18cf5dd582
Added migrations for donations API (#17536)
fixes https://github.com/TryGhost/Product/issues/3655

- This adds a new table for storing donation events in the database.
- Makes it possible to store stripe_products without associating it with
a tier/Ghost product (required for one time purchases).
- Updates the schema for stripe_prices to allow enum value of
`donation`, which is required to query specifically on the prices used
for donations (existing one_time is not enough).

Database changes are discussed in the Tech Spec:
https://www.notion.so/ghost/Tech-Spec-5cd6929f7960462ebcbf198176e0d899?pvs=4#1f18cc5a38294f61a091e5be63fe1059
2023-07-31 17:29:36 +02:00
Ronald Langeveld
e8bf24045b
Bumped Koenig Packages (#17535)
no issue

- We made some styling changes in the rendering nodes for the new header
card.
- This bumps the affected packages.

---

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

Updated content rendering packages to fix bugs and improve output. This
affects how Ghost converts markdown to `HTML`, `AMP`, or `email`
formats.
2023-07-31 07:52:27 +00:00
Ghost CI
e97140fabb v5.56.0 2023-07-28 15:03:19 +00:00
Steve Larson
e45b947d61
Updated gscan (#17521)
no refs
- add check for unknown global use in themes
- removed `@page` check until ready for release
2023-07-27 15:43:22 +00:00
Ghost CI
145d0b84f5 Merged v5.55.2 into main 2023-07-27 07:38:59 +00:00
Ghost CI
5273b56e88 v5.55.2 2023-07-27 07:38:58 +00:00
renovate[bot]
c05976645c Update sentry-javascript monorepo to v7.60.1 2023-07-27 09:24:27 +02:00
Ronald Langeveld
abc7af8082 Added test email rate limiting (#17505)
refs https://github.com/TryGhost/Product/issues/3651

- This is a security fix that addresses an issue causing malicious users
to abuse the test / preview email API endpoint.
- We have multiple procedures in place now to limit such users.
- First, we now only allow one email address to be passed into the
`sendTestEmail` method. This method only have one purpose, which is to
compliment the test email functionality within the Editor in Admin and
therefore have no reason to send to more than one email address at a
time.
- We then add an additional rate limiter to prevent a user from making
multiple requests, eg via a script.
- The new imposed limit is 10 test emails per hour.
2023-07-27 09:22:26 +02:00
Ronald Langeveld
0029c444ad
Added test email rate limiting (#17505)
refs https://github.com/TryGhost/Product/issues/3651

- This is a security fix that addresses an issue causing malicious users
to abuse the test / preview email API endpoint.
- We have multiple procedures in place now to limit such users.
- First, we now only allow one email address to be passed into the
`sendTestEmail` method. This method only have one purpose, which is to
compliment the test email functionality within the Editor in Admin and
therefore have no reason to send to more than one email address at a
time.
- We then add an additional rate limiter to prevent a user from making
multiple requests, eg via a script.
- The new imposed limit is 10 test emails per hour.
2023-07-27 08:46:50 +02:00
Steve Larson
b77521ece9
Updated gscan (#17509)
no refs
2023-07-26 15:58:22 +00:00
Steve Larson
005e80b466
Updated gscan (#17507)
no refs
2023-07-26 13:06:23 +00:00
Naz
48ccea818a Fixed unpublished collection posts filtering
closes https://github.com/TryGhost/Arch/issues/58

- Following assumptions were broken:
- Posts Admin API should include posts of all statuses when filtering by collection
-  Posts Content API should not include any unpublished posts
- Updated the "status" filter which fixes the problem. We still disallow any custom filters to be applied on top of collections filter.
2023-07-26 16:45:57 +08:00
Sodbileg Gansukh
dc5cc28036 Cleaned up the styles for the new Header card
no issues

- using .kg-v2 as an indicator to add the v2-specific styles
- .kg-header-card and .kg-header-card-button are the class names that confict with the existing Header card, so only using .kg-v2 to style those elements
2023-07-26 15:18:22 +08:00
Djordje Vlaisavljevic
ae314679fa
Add Tips and donations section to Membership settings (#17497)
refs https://github.com/TryGhost/Product/issues/3561

- Added a static section to Membership settings with a button to copy
the Tips & donations Stripe link
- Added a `tipsAndDonations` feature flag
2023-07-25 22:46:34 +01:00
Fabien "egg" O'Carroll
322dda10ab Removed flag check for running the collection service
This ensures that collections are updated in the background regardless of
whether or not the labs flag is enabled, which is important for the stability
of the collections database tables. In order to make sure we don't add a tonne
of event listeners during the tests we have to add a flag to make sure that the
service is treated as a singleton and only instanciated once. This should only
affect code running in tests, as we don't initialise services multiple times
2023-07-25 17:35:43 +02:00
Fabien "egg" O'Carroll
3d0825ea2f Supported ?include=count.posts for Collections API
Unfortuantely our framework is bookshelf centric so we have to refer to the
`withRelated` property rather than a more generic `include` property.

The collection entity already contains the list of post ids, so we can just
return the length of that array.
2023-07-25 16:56:22 +02:00
Fabien "egg" O'Carroll
431f0ed842 Fixed the "Can add a Collection" test
The test was addign an extra collection, but not cleaning it up - which makes it
hard to reason about other tests, especially when running them in isolation and
the state is different. This just cleans up the test and updates the browse test
to match the right snapshot.
2023-07-25 16:56:22 +02:00
Fabien "egg" O'Carroll
517c406e17 Added Collections Content API
The only usecases we need to support at the moment are reading individual
collections by ID and by Slug. We can extend this API as we get more usescases
in future.
2023-07-25 16:14:02 +02:00
Fabien 'egg' O'Carroll
63ab254e33
Removed posts from Collections API
The correct mechanism for fetching posts from a collection is via the Posts API.
This removes all functionality of getting posts from the Collections API.

Co-authored-by: Naz <hi@nazavo.com>
2023-07-25 13:19:19 +00:00
Naz
694ab1d32d Added support for expansions in collection filters
refs https://github.com/TryGhost/Arch/issues/46

- Similarly to post filters, collection filters now support both 'tag' and 'tags' nql filter keys when defining a filter for related tag slugs. For example, both `tag:avocado` and `tags:avocado` would both be valid collection filters that would filter by the same 'slug' property of the tags assigned to a post.
- Along with these changes had to rework the tags property of the collection posts to match the shape used in post resources. Moved from:
`tags: ['bacon', 'broc']`
to
`tags:[{slug: 'bacon'}, {slug: 'broc'}]`
2023-07-25 19:01:56 +08:00
Naz
8fa36916d7 Migrated admin and core modules to use nql-filter-expansions
refs https://github.com/TryGhost/Arch/issues/46

- Reused posts expansions from nql-filter-expansions module
2023-07-25 19:01:56 +08:00
Naz
c4351456c6 Made tag snapshots more accurate in collections test suite
refs https://github.com/TryGhost/Arch/issues/46

- Allows to actually verify in the snapshot itself if the tag filter is working correctly or not.
2023-07-25 19:01:56 +08:00
renovate[bot]
3830401d55 Update dependency @playwright/test to v1.36.2 2023-07-25 12:26:15 +02:00
Michael Barrett
8095843939
Added feature flag for import tier functionality (#17480)
refs https://github.com/TryGhost/Product/issues/3629
2023-07-25 10:52:52 +01:00
Sodbileg Gansukh
0b00c653cc Added margin override to the signup card input
no issues

- some themes have global styles applied to inputs and it breaks the card input layout because of the style conflict
- this adds some default margin values to fix the issue
2023-07-25 14:22:44 +08:00
Ghost CI
fc50d1e92c Merged v5.55.1 into main 2023-07-25 02:46:04 +00:00
Ghost CI
95d343a786 v5.55.1 2023-07-25 02:46:02 +00:00
Aileen Booker
eb303ec221 Fixed Segment event named wrong 2023-07-24 15:49:33 +01:00
Daniel Lockyer
d0f9c8cf0c Deduplicated eslint and eslint-plugin-ghost to top-level package.json
refs https://github.com/TryGhost/DevOps/issues/50

- this deduplicates where we define the version of `eslint` and
  `eslint-plugin-ghost` so it's easier to maintain
2023-07-24 16:21:47 +02:00
renovate[bot]
b5453e740e Update dependency yjs to v13.6.7 2023-07-24 10:38:06 +00:00
renovate[bot]
3b9b8009e1 Update dependency mysql2 to v3.5.2 2023-07-24 10:29:26 +00:00
Michael Barrett
184c6ae951
Retain newsletter subscriptions on suppression (#17373)
refs https://github.com/TryGhost/Product/issues/2610
2023-07-24 10:47:57 +01:00
Naz
baf0f4b692 Added /collections/slug/:slug Admin API endpoint
closes https://github.com/TryGhost/Arch/issues/45

- This endpoint is here to keep the convention of being able to fetch the resource by it's slug through a `GET /{resource_name}/slug/:slug`. It has identical output as the `GET /collections/:id` endpoint
- The alternative would be having an alias and try fetching by :id and then by slug if the result for id was null, but that would be a completely new pattern we have not used anywhere else yet.
2023-07-24 14:27:17 +08:00
Ghost CI
1b884a49ac v5.55.0 2023-07-21 15:03:14 +00:00
Fabien "egg" O'Carroll
66f7dcafab Fixed the {{#collection}} helper
We were not passing the `slug` to the `apiOptions` so the posts were not
correctly filtered, and on top of that the `collection` option had not been
added to the allow list of the Posts Content API. With these two fixes the
collection helper works as expected.
2023-07-21 16:23:31 +02:00
renovate[bot]
401c1a0d10 Update dependency postcss to v8.4.27 2023-07-21 14:42:30 +02:00
Naz
08c06129d3 Removed /collections/:id/posts endpoint
refs https://github.com/TryGhost/Arch/issues/16

- We made a decision to limit the API for fetching posts belonging to a certain collection to only the Posts API. The endpoint on the collections was an experiment that only brings unnecessary maintenance at this point of time.
2023-07-21 19:46:22 +08:00
Naz
6361423ff7 Fixed ability to remove post from an automatic collection
refs https://github.com/TryGhost/Arch/issues/16

- Post can be removed from a manual collection, but never from an automatic collection.
2023-07-21 19:46:22 +08:00
Naz
d7bbb0b935 Reworked PostsRepository to use model layer
refs https://github.com/TryGhost/Arch/issues/16

- Using the API directly on the repository level prevented us from ensuring collection consistency through transactions.
- This change migrates the PostsRepository to use Bookshelf model layer directly, which also allows to put queries into transactions.
- Additional optimization here was removing the `getAllPosts` method from CollectionService. This is an attempt to reduce the API surface of the  of the service before calling it a GA.
2023-07-21 19:46:22 +08:00
Naz
ef41fd86c2 Enabled all collection tests
refs https://github.com/TryGhost/Arch/issues/16
refs 97f24338bf

- With introduction of transactional post_collections updates the test flakiness should go away.
2023-07-21 19:46:22 +08:00
Naz
3dc27f505c Wrapped collection's creation in transaction
refs https://github.com/TryGhost/Arch/issues/16

- This is needed to avoid stale data/race conditions when processing collection post updates
2023-07-21 19:46:22 +08:00
Naz
0880770d50 Wrapped collection's post adding logic in transaction
refs https://github.com/TryGhost/Arch/issues/16

- Having transactional collection post updates makes sure there are no race conditions when updating collection_posts relations. Without the transactions collection was prone to update relations based on a stale state causing problems like described in the linked issue
2023-07-21 19:46:22 +08:00
renovate[bot]
3a751e6f84 Update sentry-javascript monorepo to v7.60.0 2023-07-21 12:36:13 +02:00
Steve Larson
22441fe730
Made lexical rendering async (#17438)
-moved lexical rendering to async
-includes rendering for front end and email
-necessary to pull dynamic data into render method, e.g. collections
2023-07-20 17:48:48 -05:00
Sanne de Vries
9e61f26586
Fixed visual bug on signup card frontend html (#17430)
No ref
2023-07-20 10:07:54 +00:00
renovate[bot]
dd328f39f7 Update sentry-javascript monorepo to v7.59.3 2023-07-20 07:27:24 +02:00
Ghost CI
a17b2f024e Merged v5.54.4 into main 2023-07-19 13:18:09 +00:00
Ghost CI
a715b8f3ed v5.54.4 2023-07-19 13:18:06 +00:00
Daniel Lockyer
b7aac3e360
🐛 Fixed ghost.min.css asset compilation
refs https://github.com/TryGhost/DevOps/issues/48

- due to changes in the build workflow, we no longer depended on
  `ghost`'s own `build` before producing the tarball
- as a result, the minified css was not produced and private pages were
  unstyled
- this adds our own `build` step to the list of dependencies for
  `archive`
2023-07-19 14:51:17 +02:00
Ronald Langeveld
5b7bca1f1e
Bumped Koenig Packages (#17418)
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 bfc259e</samp>

Updated content rendering packages to fix bugs and improve performance.
This affects how Ghost outputs HTML and AMP pages from the
`@tryghost/kg-default-nodes` and `@tryghost/kg-lexical-html-renderer`
modules.
2023-07-19 11:11:15 +00:00
renovate[bot]
b82cbeec04 Update sentry-javascript monorepo to v7.59.2 2023-07-19 07:53:05 +02:00
Naz
53f9f954c1 Added tag filter support to collections
refs https://github.com/TryGhost/Arch/issues/41

- When an new collection is created the relational "tags" filter is now picked up properly and appropriate posts matching the tag filter are assigned and stored in the collection. Example collection filter that is now supported: `tags:['bacon']`
- Additionally cleaned up returned collection post DTOs, so we return as little data as possible and add only the fields that are needed
2023-07-18 20:18:54 +08:00
Ghost CI
367ff21ed6 Merged v5.54.3 into main 2023-07-17 14:18:35 +00:00
Ghost CI
b74e29aa70 v5.54.3 2023-07-17 14:18:33 +00:00
Kevin Ansfield
53096e214c
🐛 Fixed poor performance when rendering beta editor posts (#17388)
no issue

- bumps `@tryghost/kg-lexical-html-renderer` which includes a change to drastically reduce the number of `jsdom` instantiations made when rendering text content
2023-07-17 14:21:37 +01:00
Kevin Ansfield
636b1e67b2
Fixed pages API test snapshot having a flaky cache string (#17391)
no issue

- `x-cache-invalidate` will vary across different runs as the post's preview uuid will be different each time the post is created
2023-07-17 13:21:00 +00:00
Kevin Ansfield
135f5fa287
🐛 Fixed poor performance when rendering beta editor posts (#17388)
no issue

- bumps `@tryghost/kg-lexical-html-renderer` which includes a change to drastically reduce the number of `jsdom` instantiations made when rendering text content
2023-07-17 13:42:55 +01:00
Naz
97f24338bf Commented out flaky collections tests
refs https://github.com/TryGhost/Arch/issues/16

- There's a race condition happening when processing multiple collection updates at the same time. It causes the state to be inconsistent between the runs.
- Once the event handling is improved these tests should be put back into action
2023-07-17 20:02:54 +08:00
Ronald Langeveld
baa84f4765
Added base styles for Header Card v2 (#17387)
refs https://github.com/TryGhost/Product/issues/3508

- copied over styles from the signup card, which is what the new header
card is loosely based on.
- this is meant to be hacked till we have the new header card look
pretty.

---

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

This change introduces a new header card v2 component that allows users
to create custom headers for their Ghost site. It adds a new CSS file
`header_v2.css` that defines the styles and responsive behavior for the
component. The file uses modern CSS features to achieve a flexible and
consistent design. The file is part of the frontend module of the Ghost
core repository.
2023-07-17 10:49:48 +00:00
Naz
ea2defb76c Updated collection descriptions
refs https://github.com/TryGhost/Arch/issues/25

- Updated collection descriptions to be less wordy and avoid a redundant "Collection" in them.
2023-07-17 18:43:21 +08:00
Naz
c733424cc5 Fixed collections ordering
refs https://github.com/TryGhost/Arch/issues/25

- When run against different DB Engines the returned order of collections belonging to a post is not consistent (SQLite vs MySQL). Having a primitive ordering by slug allows to keep the order compatible
2023-07-17 18:43:21 +08:00
Naz
9bfb197a85 Added fixtures for collection posts
refs https://github.com/TryGhost/Arch/issues/25

- Adds collection_posts fixtures
2023-07-17 18:43:21 +08:00
Naz
b5d1245be1 Added posts_collections table population
refs https://github.com/TryGhost/Ghost/pull/17247

- When the instance is started the posts_collections records should be pre-filled for built-in collections. This is to avoid expensive processing during every instance startup.
2023-07-17 18:43:21 +08:00
Naz
ed91412cd5 Changed "index" collection name to "latest"
https://github.com/TryGhost/Arch/issues/25

- This naming matches how the collection will be visible in the cards and how it's marketed. Naming it "index" even for internal purposes will get confusing.
2023-07-17 18:43:21 +08:00
Naz
acbe3a250e Added built in collection fixtures
refs https://github.com/TryGhost/Arch/issues/25

- The instance should have two built-in collections "latest" (prviously known as "index") and "featured". These have been filled through in-memory tricks before, now they should come pre-populated through fixtures mechanism.
2023-07-17 18:43:21 +08:00
Fabien "egg" O'Carroll
605aa18d6a Added collections helper
This is an initial implementation which uses the Posts Content API rather than
the Collections Content API, this is because we haven't added the Collections
Content API yet, but we can added it later when necessary.
2023-07-17 11:35:30 +01:00
Fabien "egg" O'Carroll
be0dbe3e91 Used posts-service for Posts Content API
We want to keep the differences between the Content & Admin API's in the API
layer, rather than at the service layer. The caching functionality hasn't been
moved yet though, and can be handled separately.
2023-07-17 11:35:30 +01:00
renovate[bot]
8e4393d16f Update dependency @playwright/test to v1.36.1 2023-07-17 09:48:14 +02:00
Chris Raible
b625fe76b1
Updated snapshots to include show_title_and_feature_image in event payload (#17378)
no issue

- Tests were failing for me locally because the snapshot for testing
page event payloads didn't include the new
`show_title_and_feature_image` property
- Updated snapshot to include this property, which also changed a few content lengths and `x-cache-invalidate` headers as a side effect
2023-07-14 16:03:40 -07:00
Ghost CI
fad31e0bca v5.54.2 2023-07-14 15:34:52 +00:00
Ghost CI
a7292cbf1f v5.54.1 2023-07-14 15:03:30 +00:00
Daniel Lockyer
704fc18856 Removed duplicate build step during tarballing
- we don't need to define this in `prepack` because Nx can be configured
  to do this for us
2023-07-14 14:29:14 +02:00
Daniel Lockyer
9f40c90e07 Switched to Nx runner for more tasks
- this switches us to using Nx for `ghost:dev`, which means we can
  configure its dependencies and ensure that the TS projects are built
  beforehand
- also switches to Nx for `ghost:archive` so we don't need to run
  `build:ts` for all `yarn` commands
2023-07-14 08:52:01 +02:00
Naz
382d7fa25f Removed unused collections repositories
no issue

- These repositories were leftover from first phases of collections development. Not needed any longer as we have more specialized bookshelf repositories in the core code
2023-07-14 14:20:37 +08:00
renovate[bot]
6a13e5e737 Update dependency postcss to v8.4.26 2023-07-14 08:16:06 +02:00
Kevin Ansfield
3fdf5adbfd
Moved show_title_and_feature_image to @page.show_title_and_feature_image (#17353)
no issue

- updated frontend's `formatResponse` method to add `@page` to the local template data
  - added here because it's the first place we have both context and page data available
  - makes the property available outside of the page context so it can be used to modify layouts
- updated `prepareContextResource()` to delete `show_title_and_feature_image`
  - ensures `@page.show_title_and_feature_image` is the only way of accessing that property
  - method is used when rendering multiple entries so it also prevents differences in context data between looped pages and single pages
2023-07-13 14:26:33 +00:00
renovate[bot]
eec68d876b Update sentry-javascript monorepo to v7.58.1 2023-07-13 15:08:54 +02:00
renovate[bot]
672a19f78e Update sentry-javascript monorepo to v7.58.0 2023-07-13 06:03:29 +02:00
Steve Larson
42d87d1437
Updated koenig lexical packages (#17325)
no refs
-updated to get collections card changes
2023-07-12 10:59:20 -05:00
Daniel Lockyer
2aa7da3a0b Improved monorepo tooling setup
refs https://github.com/TryGhost/DevOps/issues/45

- this switches the monorepo over to using Nx instead of Lerna, because
  we don't currently need the versioning+publishing capabilities
- this also adds an `nx.json`, which allows us to enable task caching
- also adds `build:ts` to the TS projects, which is cached for fast execution
- how these interact with the dev.js script will hopefully soon be
  reworked to be a better experience
2023-07-12 16:27:39 +02:00
renovate[bot]
828d3e4a1a Update dependency @playwright/test to v1.36.0 2023-07-11 20:53:08 +02:00
Daniel Lockyer
f7c767d473 Removed unused Bluebird import
refs https://github.com/TryGhost/Ghost/issues/14882

- this is no longer used so we can remove it as we move towards removing
  Bluebird from the codebase
2023-07-11 17:49:26 +02:00