Commit Graph

2414 Commits

Author SHA1 Message Date
Sanne de Vries
f180e8762d
Updated hover state of collection card post on frontend (#18298)
Refs https://github.com/TryGhost/Product/issues/3630
2023-09-22 11:54:06 +00:00
Fabien "egg" O'Carroll
db488b4124 Optimised the storage of collection posts relations
refs https://github.com/TryGhost/Arch/issues/95

Rather than a big nested loop to reconcile the in-memory vs. persisted
PostCollections we can instead use the events to know which rows we have to
delete and which we have to insert. This removes a tonne of work.

This implementation isn't perfect, and misses cases where the same post is
added and removed, our use-cases don't currently support that however.
2023-09-22 18:32:17 +07:00
Fabien "egg" O'Carroll
c6f2c985f1 Wired up events to CollectionsBookshelfRepository
refs https://github.com/TryGhost/Arch/issues/95

This handles actually dispatching the events
2023-09-22 18:32:17 +07:00
Kevin Ansfield
f98467611c
Added page html reset and re-render to handle dynamic collection card content (#18265)
no issue

Collection cards contain dynamic data that can change when there's any change to a published post but in Ghost all post/page content is rendered once on save and stored as a static string meaning we need a new approach for triggering a re-render of pages that plays well with caching.

- fixed typo in the relations/authors code that meant we weren't correctly calling the prototype method on the Post model inside the `onFetchedCollection` event handler
- updated Post model to clear the `html` field of all pages when saving or deleting a published post
- updated Post model to re-render `html` fields when fetching individual posts or a collection of posts
- modified `insertExtraPostsTags` fixture util to wrap it's concurrent post edits in a transaction otherwise MySQL errors because it hits a deadlock
2023-09-21 14:51:08 +00:00
Simon Backx
098f4353a7
Disabled network retries for webmentions in tests (#18269)
refs https://ghost.slack.com/archives/C02G9E68C/p1695296293667689

- We block all outgoing networking by default in tests. When editing a
post/page, Ghost tries to send a webmention. Because of my earlier
changes
(1e3232cf82)
it tries 3 times - all network requests fail instantly when networking
is disabled - but it adds a delay in between those retries. So my change
disables retries during tests.
- Adds a warning when afterEach hook tooks longer than 2s due to
awaiting jobs/events
- We reduce the amount of webmentions that are send, by only sending
webmentions for added or removed urls, no longer when a post html is
changed (unless post is published/removed).
2023-09-21 16:17:05 +02:00
renovate[bot]
6e960bf477 Update sentry-javascript monorepo to v7.70.0 2023-09-21 11:51:47 +02:00
Sag
8515bdf587
Updated uniqueness validation for the Recommendations URL (#18253)
closes https://github.com/TryGhost/Product/issues/3818

- instead of fetching all recommendations and matching URLs on the frontend, we now query the database directly to find an existing Recommendation by URL. When comparing URLs, we don't take into account the protocol, www, query parameters nor hash fragments
2023-09-20 16:53:10 +00:00
Simon Backx
715d658e11
Disabled one-click subscribe when Portal checkbox is required (#18252)
fixes https://github.com/TryGhost/Product/issues/3911

For now we decided that we don't want to enable one-click-subscribe in
case a site has a required checkbox (which isn't shown during the
one-click-subscribe flow)
2023-09-20 15:35:10 +00:00
Sanne de Vries
7cd9864a7a
Updated collection card margins on frontend (#18246)
Closes https://github.com/TryGhost/Product/issues/3909
2023-09-20 12:16:57 +00:00
Sanne de Vries
0886dc00d7
Fixed css typo in collection card (#18245)
No ref
2023-09-20 11:59:24 +00:00
Simon Backx
1e3232cf82
Improved webmention stability in case of slow external servers (#18242)
refs https://github.com/TryGhost/Product/issues/3850

- Added a recheck for recommendation related webmentions after boot (to
check missed webmentions during down time)
- Increased general timeouts to 15s for all webmention related HTTP
requests. Instead, increased retries to 3.
- Increased timeout for fetching webmention metadata from 2s to 15s
- Added more logging about verification and deletion status of
webmentions
2023-09-20 13:09:47 +02:00
renovate[bot]
474923ba8a Update dependency human-number to v2.0.3 2023-09-20 09:57:23 +00:00
Sanne de Vries
1653533ebe
Updated collection card typography on frontend (#18240)
Refs
https://www.notion.so/ghost/Feedback-2d148e43ff704a63b41222a4ec63b8d3?p=77bcb825854045858785272676393b85&pm=s
2023-09-20 09:09:09 +00:00
Daniel Lockyer
d46aab5b43 Optimized bundle size of @tryghost/limit-service
refs https://ghost.slack.com/archives/C0568LN2CGJ/p1695149803260239
refs 290bc71d6a

- previous versions of `@tryghost/limit-service` did a full import of
  lodash, which would bloat the bundle size, especially when we only use
  a few of its functions
- I've since fixed that and this commit bumps Ghost to the smaller
  version
2023-09-20 09:54:07 +02:00
renovate[bot]
188b6d3fd8 Update dependency ws to v8.14.2 2023-09-20 08:30:23 +02:00
Ghost CI
ff3c3a904b Merged v5.64.0 into main 2023-09-20 03:59:19 +00:00
Ghost CI
24bebc1ace v5.64.0 2023-09-20 03:59:17 +00:00
Steve Larson
c0f70144fc
🐛 Fixed collection card post excerpts (#18232)
refs TryGhost/Product#3913
- posts starting with a lexical card resulted in blank space in excerpts
2023-09-19 23:12:57 +00:00
Sag
e1c966b6d7
Added filter option to the Recommendations Admin API's browse endpoint (#18233)
closes https://github.com/TryGhost/Product/issues/3907
2023-09-19 20:42:27 +00:00
Steve Larson
fada0237b8
Added link to collections card posts (#18228)
closes TryGhost/Product#3905
- added link to collections card posts
2023-09-19 12:05:29 -05:00
Kevin Ansfield
ff3eb63fd8
Revert "Added page html reset and re-render to handle dynamic collection card content (#18146)" (#18229)
This reverts commit 3e9da6df0c.

- changes introduced an error fetching `/admin/pages/` when using MySQL
- "The values in where clause must not be object or array"
2023-09-19 16:59:56 +00:00
renovate[bot]
65838394c3 Update dependency ws to v8.14.2 2023-09-19 15:59:51 +00:00
Kevin Ansfield
3e9da6df0c
Added page html reset and re-render to handle dynamic collection card content (#18146)
no issue

Collection cards contain dynamic data that can change when there's any change to a published post but in Ghost all post/page content is rendered once on save and stored as a static string meaning we need a new approach for triggering a re-render of pages that plays well with caching.

- fixed typo in the relations/authors code that meant we weren't correctly calling the prototype method on the Post model inside the `onFetchedCollection` event handler
- updated Post model to clear the `html` field of all pages when saving or deleting a published post
- updated Post model to re-render `html` fields when fetching individual posts or a collection of posts
- modified `insertExtraPostsTags` fixture util to wrap it's concurrent post edits in a transaction otherwise MySQL errors because it hits a deadlock
2023-09-19 16:46:38 +01:00
Simon Backx
64b472166c Removed required webmentions flag for mentions admin endpoint
fixes https://github.com/TryGhost/Product/issues/3830

This endpoint is required for recommendations to work: admin-x loads the incoming recommendations by querying the mentions endpoint. If the mentions flag was not enabled, this endpoint wasn't available.
2023-09-19 17:31:55 +02:00
Simon Backx
95c8ba11d6
Added E2E tests for Public Site Settings in members API (#18223)
fixes https://github.com/TryGhost/Product/issues/3901
2023-09-19 14:47:34 +00:00
Sag
d5ad5d2dd0
Added read endpoint to the Recommendations Admin API (#18221)
closes https://github.com/TryGhost/Product/issues/3910
2023-09-19 13:56:26 +00:00
Naz
00e5f84d88
Repopulated collections_posts built-in collections data
closes https://github.com/TryGhost/Arch/issues/74
refs b5d1245be1

- We have turned off the collections feature flag after a unsuccessful attempt to make collections GA. With the flag turned off, collections_posts data has gone stale and needs repopulation to function properly again.
- This migration is meant to clear the data on collections_posts table and repopulated it again the same way initial migration did in 5.5/2023-07-10-05-16-55-add-built-in-collection-posts.js script.
2023-09-19 21:23:53 +08:00
naz
826b5be002
Optimized collection repository queries (#18194)
refs https://github.com/TryGhost/Arch/issues/86

- Creating bookshelf models for each collection_post relation created a
massive overhead. On a dataset with 500k collections_posts records the
timing was roughly 7s comparing to 810ms after the optimization.
- Optimized memory and performance of collections fetching by querying post
ids only by default
2023-09-19 21:07:11 +08:00
renovate[bot]
8843d3c25b Update dependency y-protocols to v1.0.6 2023-09-19 09:53:53 +00:00
Daniel Lockyer
f705dda314 Updated Admin-X bundling process
refs https://github.com/TryGhost/DevOps/issues/80

- as part of moving Admin-X-Setting towards GA, we want to change it from
  loading the settings externally via a CDN, to bundling it in with
  Admin
- the bulk of the changes here are removing the config in Ghost, setting
  up the copy to the Admin assets dir, and loading the new path in Admin
- several other changes have come along the way as I've cleaned up
  unneeded code
2023-09-19 11:31:55 +02:00
naz
9cd542dc59
Optimized collection repository queries (#18194)
refs https://github.com/TryGhost/Arch/issues/86

- Creating bookshelf models for each collection_post relation created a
massive overhead. On a dataset with 500k collections_posts records the
timing was roughly 7s comparing to 810ms after the optimization.
- Optimized memory and performance of collections fetching by querying post
ids only by default
2023-09-19 16:02:14 +08:00
renovate[bot]
8cfff3743b Update dependency postcss to v8.4.30 2023-09-19 08:09:20 +02:00
Fabien "egg" O'Carroll
cbea9e8948 Restricted content gating filter to status & tiers
refs https://github.com/TryGhost/Arch/issues/83

As we've only used the status and tiers in the cache key generation (as those
are currently the only ones that are present in DB's) we want to make sure that
content gating doesn't use any other properties, which means the cache behaviour
will match the content gating behaviour
2023-09-19 12:39:50 +07:00
Fabien "egg" O'Carroll
e865f57e88 Customised key generation for Posts Content API
refs https://github.com/TryGhost/Arch/issues/83

The options included are the only ones which have an effect on the response
data, as well as that we are using the properties of members which are used by
content-gating module. For the read operation we need to include the ID too.
2023-09-19 12:39:50 +07:00
Fabien "egg" O'Carroll
cfef41cd8f Added support for custom cache key generation
refs https://github.com/TryGhost/Arch/issues/83

This allows endpoints to implement their own key generation, with access to the
frame object they can be smart about key generation and use only options and
context values that are appropriate.
2023-09-19 12:39:50 +07:00
Steve Larson
0b64247ad2
Bumped Koenig packages (#18211)
no refs
- few improvements to collections card behaviour
2023-09-18 21:18:52 +00:00
Sag
3b1fcb6c16
Added fixed height to avoid jumps in the Recommendations settings (#18184)
closes https://github.com/TryGhost/Product/issues/3881

We observe the height of the recommendation table, and keep it fixed between pages — so that the UX is smoother when navigating between pages.
2023-09-18 17:43:57 +02:00
Simon Backx
b545dfa0cc
Improved recommendation controller structure (#18208)
fixes https://github.com/TryGhost/Product/issues/3900

1. The service never returns a Recommendation Entity, but always plain
objects (which for now is the same as Recommendation without the
methods).
2. Updated the controller to be more readable and minimal (we keep this
controller, in addition to the existing endpoints and serializers)
- The controller does minimal validation and allows for type checking
(so we get compile time errors in case the service expects new fields)
- The controller uses the `UnsafeData` class to easily validate the
input from requests, and throws appropriate errors (with correct field
descriptions — "Expected a string at recommendations.0.title") without
too much boilerplate code. In addition the interface is typed, so we get
compile errors if there are breaking changes in the service.
- Removed `EntityWithIncludes`, since we now use plain objects, we
inject the relations directly into those plain objects (with some new
types that add type support)
- Added new tests to make sure that edits only affect the given fields,
and never undefined fields
2023-09-18 14:36:49 +00:00
Sanne de Vries
353c565739
Fixed collection card empty parameters outputting null on frontend (#18205)
Refs https://github.com/TryGhost/Product/issues/3630

- Bumped kg-default-nodes to 0.1.30
2023-09-18 13:49:45 +00:00
Sanne de Vries
a27ba55b50
Fixed reading time not showing up on frontend (#18201)
Refs https://github.com/TryGhost/Product/issues/3630
2023-09-18 10:58:44 +00:00
Sanne de Vries
6273568718
Added default margin to collection cards (#18199)
Refs https://github.com/TryGhost/Product/issues/3630
2023-09-18 10:24:49 +00:00
renovate[bot]
290ff10dad Update dependency yjs to v13.6.8 2023-09-18 10:17:00 +00:00
Steve Larson
3001e4c032
Enabled dynamic post rendering (#18183)
no refs
- contains changes for dynamic rendering with lexical posts
2023-09-15 18:18:18 +00:00
Steve Larson
37a9ffc63e
Bumped serializer to later in boot (#18181)
no refs
- import was too early in boot process, causing db init to fail
2023-09-15 16:32:12 +00:00
Steve Larson
077bd2c883
Added serialization to collection posts fetch (#18179)
no refs
- renderer was missing data from serializer
2023-09-15 15:33:36 +00:00
Ghost CI
3a8fac8348 v5.63.0 2023-09-15 15:14:27 +00:00
Simon Backx
07bc183702 Bumped Portal to 2.36.0 2023-09-15 16:47:12 +02:00
Eduard Mayer
082a67c7f6
Updated page metadata to use author image over cover image (#17689)
- the schema.org data fo an author should primarily use the authors image as the image item instead of the cover image.
- otherwise the schema.org metadata will be invalid, since the image item is missing when no cover image has been uploaded.
2023-09-15 16:07:06 +02:00
Simon Backx
4e2710ada2 Added stats to recommendations endpoints
fixes https://github.com/TryGhost/Product/issues/3854
fixes https://github.com/TryGhost/Product/issues/3864
2023-09-15 15:57:27 +02:00
Sag
6e68c43f78
Added uniqueness validation for the recommendation URL (#18163)
closes https://github.com/TryGhost/Product/issues/3818

- in Admin, when adding a recommendation, the URL is compared against all existing ones. If the URL is already recommended, the publisher is shown an error: "A recommendation with this URL already exists.". Protocol, www, query parameters and hash fragments are ignored during the URL comparison.
- on the backend, there is another uniqueness validation for the recommendation URL. This check is redundant when adding a recommendation from Admin, but helps to keep data integrity when recommendations are added through other paths (e.g. via the API)
2023-09-15 13:14:47 +00:00