Commit Graph

2449 Commits

Author SHA1 Message Date
Sag
7cdf7ce82e
Moved initiatialisation of the Recommendation services behind a feature flag (#18429)
no issue
2023-10-02 19:00:30 +00:00
Simon Backx
b5fc527f8d
Added order option to recommendations API with sorting on counts (#18417)
refs https://github.com/TryGhost/Product/issues/3957

This changes how we fetch recommendations:
- Relations can be included in one query instead of extra queries
- Sorting is now possible by click or subscriber counts
2023-10-02 14:51:03 +00:00
Sag
b1e4ead01c
Fixed uniqueness validation of Recommendation URL (#18383)
refs https://github.com/TryGhost/Product/issues/3818

- added a check to compare hostname and pathnames of URLs. Different
subdomain or different pathname = different URLs, but protocol, www,
query parameters and hash fragments are ignored.
2023-10-02 10:34:59 -03:00
Ghost CI
991beb4d70 Merged v5.66.1 into main 2023-10-02 12:19:57 +00:00
Ghost CI
ae3cd0edc1 v5.66.1 2023-10-02 12:19:55 +00:00
Jono M
bb0dff3571
Updated to highlight searched keywords in AdminX settings (#18112)
refs https://github.com/TryGhost/Product/issues/3832

---

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

Added search functionality to the settings page using a custom hook and
a service. The `useSearch` hook uses the `useSearchService` function to
create a search service object that provides the filter and highlight
logic. The `highlightKeywords` function from the search service is
passed to the `SettingsGroupHeader` component to render the settings
with the matching keywords.
2023-10-02 09:33:24 +01:00
renovate[bot]
de3a222231 Update dependency postcss to v8.4.31 2023-10-02 08:51:53 +02:00
Ghost CI
edba377657 v5.66.0 2023-09-29 15:03:04 +00:00
Kevin Ansfield
d541991046 Fixed collection cards not re-rendering when posts were bulk-edited
no issue

- bulk edit actions bypass the Bookshelf model hooks which meant our page reset behaviour in `onSaving` and `onDestroyed` was not being hit
- added overrides to `bulkEdit` and `bulkDestroy` to add the same page-reset behaviour any time we have a bulk edit or destroy
2023-09-28 18:05:01 +01:00
Djordje Vlaisavljevic
e4f518868e
Updated Recommendations design (#18390)
refs https://github.com/TryGhost/Product/issues/3938

- Updated "Recommendation received" email design
- Slightly improved how dark favicons show in dark mode
- Added TabView with counter variant to Storybook
2023-09-28 15:22:00 +01:00
Simon Backx
05215734af
Added recommend back URL (#18382)
refs https://github.com/TryGhost/Product/issues/3958

- Disabled automatic network retries for external site lookups (=> timed
out to 5s in every situation because it returned 404 when a site doesn't
implement the Ghost api)
- Disabled representing a modal when it is already present on hash
changes
- Added support for search params in modals
- Handle `?url` search param in the addRecommendationModal
2023-09-28 10:54:16 +00:00
Sag
3d91c37d5b
Added Enter as shortcut to go next, when adding a recommendation (#18381)
closes https://github.com/TryGhost/Product/issues/3953
2023-09-27 17:03:36 +02:00
Ghost CI
390ba70c88 Merged v5.65.1 into main 2023-09-27 08:20:40 +00:00
Ghost CI
bddbf19a76 v5.65.1 2023-09-27 08:20:39 +00:00
Simon Backx
b51e12d90f
Added emails for recommendations (#18361)
fixes https://github.com/TryGhost/Product/issues/3938
2023-09-26 15:29:17 +00:00
Sag
d24c7c5fa6
Added {{recommendations}} theme helper (#18340)
refs https://github.com/TryGhost/Product/issues/3940

- the {{recommendation}} helper fetches recommendations from the Content
API and renders a HTML template with pre-defined CSS classes
- the HTML template can be overridden in themes, by uploading a file
under partials/recommendations.hbs
- the CSS classes are not pre-defined, they need to be defined in
individual themes
- if there are no recommendations, nothing is rendered
- the {{recommendations}} helper currently accepts "page", "limit",
"filter", and "order" as options
2023-09-26 17:15:17 +02:00
Simon Backx
3a5c233122
🐛 Fixed staff emails eventually having invalid styles (#18363)
fixes https://github.com/TryGhost/Ghost/issues/17937

- We used a global Handlebars instance, which means it was reused across
Ghost
- Partials are different between parts of Ghost, that means the partials
were overwritten every time a normal Mailgun email was send
- All staff emails send after a normal newsletter would have invalid
styles because the partials for styles were overwritten
2023-09-26 16:25:03 +02:00
Sam Lord
5836685d29 Updated snapshots to include got 13 support for brotli
no issue
2023-09-26 12:45:14 +01:00
Sam Lord
fd7ead6ce6 Upgraded to latest version of @tryghost/request
refs: https://github.com/TryGhost/Product/issues/3782

Latest version of request avoids using the OS-level name resolution system. This prevents long shutdowns from occuring where the OS is blocking the process from exiting cleanly.

The new version uses `got` 13, which has many breaking changes. Some of these are resolved within @tryghost/request (like response errors), but input parameters need to be changed.
2023-09-26 12:45:14 +01:00
Kevin Ansfield
f296761577 Fixed snapshot errors for changing dates in collection card tests
no issue

- including a body snapshot for the pages API collection card tests causes issues because the generated HTML is dynamic and contains post creation times meaning the snapshot was unstable
- removed the body snapshot for the tests concerned for now as they are mostly there to catch saving issues rather than rendering issues
2023-09-26 12:23:33 +01:00
Kevin Ansfield
562e8af26a Fixed saving collection card with 'latest' collection on sqlite
no issue

- added passthrough of `transaction` property when fetching post IDs otherwise SQLite will error with ` "Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?"`
2023-09-25 15:11:05 +01:00
Kevin Ansfield
6480cfb161 Added e2e tests for creating+saving pages containing collection cards
no issue

- act as regression tests for internal collection code changes
- useful to test as we've hit missing transaction passthrough for sqlite a couple of times that wasn't caught
2023-09-25 15:11:05 +01:00
Daniel Lockyer
49d36fc1a1 Allowed config to override labs flags
fixes https://github.com/TryGhost/DevOps/issues/72

- in order to have greater control of labs flags outside of Ghost, this
  commit allows Ghost to respect the value of `labs: { flagName: boolean }`
- this means we can hardcode a value to true or false, irrespective of
  the value in the DB or GA flags array
- also adds tests to check functionality
2023-09-25 11:24:32 +02:00
Daniel Lockyer
1432c6f311 Rewritten labs unit test to use assert over should
refs https://github.com/TryGhost/DevOps/issues/72

- assert is the way we're going with assertion libraries and makes the
  code a little clearer
2023-09-25 11:24:32 +02:00
Daniel Lockyer
500507ff21 Moved labs unit test to correct folder
refs https://github.com/TryGhost/DevOps/issues/72

- labs.js is in the shared folder, so I've moved it to the corresponding
  folder to make understanding the tests easier
2023-09-25 11:24:32 +02:00
renovate[bot]
369cb62f5e Update dependency lib0 to v0.2.86 2023-09-25 10:22:57 +02:00
renovate[bot]
1387c64e5a Update dependency @playwright/test to v1.38.1 2023-09-25 09:12:04 +02:00
Simon Backx
b82a93beac
Added recommendation_notifications column to users table (#18304)
fixes https://github.com/TryGhost/Product/issues/3939
2023-09-22 15:35:55 +00:00
Ghost CI
65ecb8ccd1 v5.65.0 2023-09-22 15:04:47 +00:00
Naz
1fecb08957 Reworked the collections killswitch to always override labs
refs https://github.com/TryGhost/Arch/issues/95

- We are releasing with a slight risk of failing over, so need a switch to allow disabling collections on hosted environment.
2023-09-22 22:33:50 +08:00
Naz
ca6ee41806 Promoted collections feature to GA
refs https://github.com/TryGhost/Arch/issues/95

- The collections endpoints APIs are stable and  ready to be used by internal Ghost features
2023-09-22 22:33:50 +08:00
Naz
1fd4861e97 Cleaned up fixtures from latest collections entry
refs https://github.com/TryGhost/Arch/issues/95
refs 45c1a82909

- Latest collection has become "dynamic" in the referenced commit, this means we don't need stored entries in the database.
2023-09-22 22:23:30 +08:00
Naz
8655f960c8 Nooped v5.64 migrations
refs https://github.com/TryGhost/Arch/issues/95

- The migrations in v5.65 are clearing the collections data again and only populate the "featured" collection.
2023-09-22 22:23:30 +08:00
Naz
8d02752802 🏗️ Repopulate featured collection records
refs https://github.com/TryGhost/Arch/issues/95
refs 00e5f84d88

- Maintaining "latest" collection's static content is causing performance issues we are not able to overcome in a short period of time. Instead we leave it as a "dynamic" collection, which equals the contents of the Posts API. The "featured" collection will be saved in a "static" form as previously.
- This is roughly the same migration as in 5.64 version (see refed commit). It wipes out all of the stored collections data and only populates the featured collection.
2023-09-22 22:23:30 +08:00
Fabien "egg" O'Carroll
9b2a94f931 Implemented "virtual" Collection for "latest"
refs https://github.com/TryGhost/Arch/issues/95

Rather than storing all of the relations between the latest collection and
posts, we know that it contains all posts. This means we don't have to keep the
collections posts in sync. Instead we can fetch them from the posts table. This
saves a lot of work during recalculation.
2023-09-22 19:05:37 +07:00
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