Commit Graph

20360 Commits

Author SHA1 Message Date
Kevin Ansfield
a896e1ccb7 Added "@" shortcut to trigger internal linking search (beta)
no issue

Typing "@" in the editor will immediately trigger an internal link search to make it faster to link to one of your articles. After typing "@" continue typing to search, results can be selected using Up/Down arrow keys or the mouse, then pressing Enter or clicking will insert the selected result's title pre-linked. Pressing Escape or moving the cursor out of the search box will cancel the search.

- removed labs flag
- updated Koenig feature flag for at-linking to use the same flag as our internal linking beta
2024-06-19 14:58:04 +01:00
renovate[bot]
ace8a2fb65
Update Koenig packages (#20415)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@tryghost/kg-default-cards](https://togithub.com/TryGhost/Koenig/tree/master#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`10.0.5` ->
`10.0.6`](https://renovatebot.com/diffs/npm/@tryghost%2fkg-default-cards/10.0.5/10.0.6)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkg-default-cards/10.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkg-default-cards/10.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkg-default-cards/10.0.5/10.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkg-default-cards/10.0.5/10.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@tryghost/kg-default-nodes](https://togithub.com/TryGhost/Koenig/tree/main#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`1.1.2` ->
`1.1.3`](https://renovatebot.com/diffs/npm/@tryghost%2fkg-default-nodes/1.1.2/1.1.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkg-default-nodes/1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkg-default-nodes/1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkg-default-nodes/1.1.2/1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkg-default-nodes/1.1.2/1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@tryghost/kg-html-to-lexical](https://togithub.com/TryGhost/Koenig/tree/main#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`1.1.3` ->
`1.1.4`](https://renovatebot.com/diffs/npm/@tryghost%2fkg-html-to-lexical/1.1.3/1.1.4)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkg-html-to-lexical/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkg-html-to-lexical/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkg-html-to-lexical/1.1.3/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkg-html-to-lexical/1.1.3/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@tryghost/kg-lexical-html-renderer](https://togithub.com/TryGhost/Koenig/tree/main#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`1.1.3` ->
`1.1.4`](https://renovatebot.com/diffs/npm/@tryghost%2fkg-lexical-html-renderer/1.1.3/1.1.4)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkg-lexical-html-renderer/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkg-lexical-html-renderer/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkg-lexical-html-renderer/1.1.3/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkg-lexical-html-renderer/1.1.3/1.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@tryghost/koenig-lexical](https://togithub.com/TryGhost/Koenig/tree/master#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`1.2.6` ->
`1.2.7`](https://renovatebot.com/diffs/npm/@tryghost%2fkoenig-lexical/1.2.6/1.2.7)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkoenig-lexical/1.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkoenig-lexical/1.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkoenig-lexical/1.2.6/1.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkoenig-lexical/1.2.6/1.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>TryGhost/Koenig (@&#8203;tryghost/kg-default-cards)</summary>

###
[`v10.0.6`](https://togithub.com/TryGhost/Koenig/compare/@tryghost/kg-default-cards@10.0.5...@tryghost/kg-default-cards@10.0.6)

[Compare
Source](https://togithub.com/TryGhost/Koenig/compare/@tryghost/kg-default-cards@10.0.5...@tryghost/kg-default-cards@10.0.6)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekday" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/TryGhost/Ghost).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MTAuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQxMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-19 12:00:21 +00:00
Peter Zimon
962365e6ea
Fixed "What's new" notification for contributors (#20413)
DES-363

The "What's new" notification took up the whole width of the admin for
contributors and it wasn't possible to interact with it.
2024-06-19 11:18:02 +00:00
Peter Zimon
73a88d0c13
Refined newsletter typography (#20406)
DES-459

The font size of subtitles/excerpts in newsletters was similar to the
body font size which doesn't reflect the content hierarchy
appropriately. Also, the spacing should be adjusted to represent that
the title and the subtitle belong together.
2024-06-19 11:57:29 +02:00
Fabien 'egg' O'Carroll
5acdafc0e8
Removed ActivityPub backend from Ghost (#20410)
We are no longer going to run any ActivityPub logic inside of Ghost,
instead we're moving to a separate service, so all of this code is now
redundant.
2024-06-19 15:36:36 +07:00
Chris Raible
5154e8d24f
Fixed race condition when updating member's last_seen_at timestamp (#20389)
ref
https://linear.app/tryghost/issue/ENG-1240/race-condition-when-updating-members-last-seen-at-timestamp
    
When members click a link in an email, Ghost updates the member's
`last_seen_at` timestamp, but it should only update the timestamp if the
member hasn't yet been seen in the current day (based on the
publication's timezone).
    
Currently there is a race condition present where multiple simultaneous
requests from the same member (if e.g. an email link checker is
following all links in an email) can cause the `last_seen_at` timestamp
to be updated multiple times in the same day for the same member. These
additional queries add a significant load on Ghost and its database,
which can contribute to the exhaustion of the connection pool and
eventually requests may time out.
    
The primary motivation for this change is to avoid that race condition
by adding a lock to the member row, checking if `last_seen_at` has
already been updated in the current day, and only updating it if it
hasn't.
    
Another beneficial side-effect of this change is that it avoids locking
the `labels` and `newsletters` tables, which are locked when we update
the `last_seen_at` timestamp in the `members` table currently. This
should improve Ghost's ability to handle a large influx of requests to
redirect endpoints (confirmed with load tests), which tend to happen
immediately after a publisher sends an email.
2024-06-18 20:03:32 -07:00
Steve Larson
783984d4d3
Added Sentry logging for unsaved changes modal in admin (#20408)
ref https://linear.app/tryghost/issue/ONC-94
- adds Sentry logging for the unsaved changes modal in Admin (tags,
members, collections)

This will let us monitor for spikes in rates so we know if a change to
Ghost has caused faulty logic in detecting dirty models.
2024-06-18 13:44:43 -05:00
renovate[bot]
dbd4aa61d0 Update dependency yjs to v13.6.18 2024-06-18 17:04:29 +00:00
renovate[bot]
e2ef5d30bb Update dependency jose to v4.15.7 2024-06-18 12:54:10 +00:00
Daniel Lockyer
9a40440e82 Fixed handling SVG files with missing tag
fix https://linear.app/tryghost/issue/SLO-151/[ghost]-cannot-read-properties-of-null-reading-attributes-an

- in the event the file doesn't contain a tag, the code currently crashes
  because it tries to read `attributes from `undefined`
- we can fix that by checking the first element exists before reading
  from it
- also includes a breaking test
2024-06-18 14:41:11 +02:00
Daniël van der Winden
f456494776
Newsletter captions fix (#20396)
Fixes
https://linear.app/tryghost/issue/DES-4/image-caption-size-in-email-newsletter.

There were no styles defined for captions for cards beyond the featured
image (bookmark, gallery, video), and we had no way of targeting those
captions with CSS. They are now wrapped in a div with a specific class,
which allows for more selective styling, and are styled similarly to the
caption of the featured image.
2024-06-18 11:26:20 +02:00
Daniel Lockyer
4ff51f4187 Fixed shutdown signal compatibility issue with Node 20
fix https://linear.app/tryghost/issue/ENG-1250/fix-node-20-shutdown-signal-compatibility-issue

- in Node 20, support for string-based arguments to `process.exit` are
  removed
- we can just switch this to an anonymous function and call `.shutdown`
  directly, as we don't need to pass any integer codes to it
2024-06-18 10:05:19 +02:00
renovate[bot]
4da6851113 Update dependency @types/node to v20.14.3 2024-06-18 08:53:53 +02:00
Steve Larson
b53dfbbfef
Removed .only from admin controller test (#20399)
ref d732f83
- removed .only that wasn't caught by linter
2024-06-17 16:10:45 -05:00
Steve Larson
d732f83a9f
🎨 Improved editor behavior to automatically update slug for draft posts (#20388)
ref https://linear.app/tryghost/issue/ENG-1211
- the post slug now re-generates based on the post title for draft posts
unless manually set
- updated unit tests to be a bit more comprehensive

It's frequently the case that draft posts might have WIP titles. We
would generate a post slug based on the title and never change it, so
unless writers remembered to come back in to update it for their final
post, it could look off to readers. This should make that a bit more
intelligent.

Going forward, we will change the slug unless we expect it to be a custom slug (user-set in the side panel). If the title is cleared out and saved, we will also reset it. We will only ever automatically generate & change the slug for draft posts.
2024-06-17 16:00:13 -05:00
renovate[bot]
f6367621d2 Update dependency yjs to v13.6.17 2024-06-17 14:36:26 +00:00
renovate[bot]
e5592aa09d Update nest monorepo to v10.3.9 2024-06-17 16:24:55 +02:00
Kevin Ansfield
428e10f147 Updated data-generator to create lexical rather than mobiledoc posts
closes https://linear.app/tryghost/issue/ONC-96

- better matches Ghost's current usage
- avoids mismatch in expected data when `post_revisions` is populated in future
2024-06-17 11:53:03 +01:00
renovate[bot]
f85656460f Update dependency @ember/optional-features to v2.1.0 2024-06-17 10:57:31 +02:00
renovate[bot]
cc9a0eeb97 Update dependency ws to v8.17.1 2024-06-17 00:33:52 +00:00
Ghost CI
158c1ae570 v5.85.1 2024-06-14 16:04:19 +00:00
renovate[bot]
710488ef82 Update dependency mysql2 to v3.10.1 2024-06-14 00:48:34 +00:00
Kevin Ansfield
83ee649e82 Added improved search into internal linking beta
closes https://linear.app/tryghost/issue/MOM-117
closes https://linear.app/tryghost/issue/MOM-70

- updated flag handling to move the improved search into the `internalLinking` beta flag
- removed now-unused `internalLinkingSearchImprovements` flag
2024-06-13 17:30:15 +01:00
Kevin Ansfield
048b67e574 Removed excerpt from beta search provider
no issue

- reverting this change for now as the benefit vs decreased result legibility wasn't high enough
2024-06-13 17:09:33 +01:00
Steve Larson
59b304dfca
🐛 Fixed editor 'are you sure?' modal displaying when no user changes occurred (#20370)
ref https://linear.app/tryghost/issue/ENG-661
- added a dirty check to ignore the `direction` field from the lexical
object; this is set dynamically and shouldn't be serialized, see
facebook/lexical/issues/4998
- fixed a bug where the modal wouldn't display on leaving the editor if
the post had no revisions (e.g. import); this could result in content
being saved over published content with no user action
- added Sentry logging for the modal

We would sometimes see the "Are you sure?" modal pop up when opening a
post in the editor and attempting to navigate away immediately, without
any changes to the post. This appears to be an issue with the serialized
Lexical data, which would change after loading into the editor,
resulting in the scratch and model's lexical values to differ, making
Admin think the user changed the content.

Ideally we'll see a fix upstream (or fix it ourselves). We may need to
revisit this if we experience other such situations. It's awfully
difficult to be able to set a flag saying 'the editor is done loading',
so this seems to be the best path for the moment.

Testing is difficult because we don't actually load the new Lexical editor into e2e/acceptance tests. I've added a unit test that can at least simulate the editor state changing on editor load.
2024-06-13 11:07:56 -05:00
Kevin Ansfield
555a2a4e8d Improved search index request order
no issue

- we weren't adding an `order` param to our posts/pages requests used to populate the search index which meant the default Admin API ordering was applied which isn't optimal for this use-case
- switched to ordering by `updated_at` to use a simple order that has an optimised index in the database
2024-06-13 17:01:17 +01:00
Kevin Ansfield
f9cc2bec0d Fixed data generator not setting posts.plaintext value
no issue

- without `plaintext` set the API will not add generated excerpts to responses
2024-06-13 16:20:53 +01:00
Sag
66f7911d24
Ignored posthog-js and ember-concurrency cancellation errors in Sentry (#20383)
fixes https://linear.app/tryghost/issue/SLO-126
fixes https://linear.app/tryghost/issue/SLO-141
fixes https://linear.app/tryghost/issue/SLO-150

- during a session, posthog-js' rrweb extension can start throwing a lot
of errors. These errors do not affect the application
- similarly, ember-concurrency's task cancellation errors do not affect
the application. Task in ember-concurrency are expected to be canceled.
However, if they're cast to a Promise, they show up as unhandled Promise
rejections as Promises do not have a concept of cancellation
2024-06-13 10:38:46 +00:00
Ronald Langeveld
b16671839c
Wired up contentVisibility flag to Koenig (#20382)
ref MOM-221

- wired up the contentVisibility flag to be passed to Koenig from Ghost
/ Admin.
2024-06-13 11:30:21 +07:00
Chris Raible
7d5ff4d16e
Updated documentation for LinkRedirects (#20378)
no issue

- Reduced opacity in background rectangles to improve readability of the
sequence diagram when rendered on Github
2024-06-12 23:27:15 +00:00
Sag
d00b6994c6
Fixed validation error handling before previewing a post (#20375)
fixes https://linear.app/tryghost/issue/SLO-143

- in the editor, if there is a validation error on a post (e.g. the excerpt is longer than 300 chars), a validation error is rendered as a red banner error. However, when clicking on Preview, this error was bypassed
- additionally, we were throwing an undefined error when a validation error happened. This was unnecessary and caused hundreds of unhandled errors per week
2024-06-12 18:29:46 +02:00
renovate[bot]
c54d3d8a8c Update dependency @types/node to v20.14.2 2024-06-12 16:09:26 +02:00
renovate[bot]
238588cfa3
🐛 Fixed internal link search sometimes showing latest posts after pasting URL (#20374)
no issue

- bumps `@tryghost/koenig-lexical` to include a fix related to debounced searches overwriting our "Insert URL" state of the results popup
2024-06-12 13:01:21 +00:00
Ronald Langeveld
a33ae00dee
Bumped Comments UI to 0.17 minor (#20373)
ref MOM-211
2024-06-12 11:33:16 +00:00
renovate[bot]
03cb264935 Update dependency @types/node to v20.12.13 2024-06-12 13:11:00 +02:00
renovate[bot]
14c4df4cde Update dependency html-validate to v8.20.1 2024-06-12 13:08:05 +02:00
Ronald Langeveld
63d912b2d8
Added content visibility feature flag (#20371)
ref MOM-221

- added new feature flag for content visibility.
2024-06-12 16:55:47 +07:00
Jason Tragakis
a00305c239
Added Greek locale for comments, portal, signup-form, ghost. (#20361)
We have noticed some attempts at Greek translation with no follow-up
from contributors. This is a complete translation with accurate file
naming conventions. We are native speakers and professionals.

Co-authored-by: Ryan Feigenbaum <48868107+royalfig@users.noreply.github.com>
2024-06-11 16:49:01 -04:00
Amel Sućeska
6863e370b6
Added bs (Bosnian) locale (#20251)
Comprehensive, context aware, Bosnian translations for all available
strings.

Informal addressing of users (as is widely accepted in Bosnia and
Herzegovina).

Co-authored-by: Ryan Feigenbaum <48868107+royalfig@users.noreply.github.com>
2024-06-11 16:05:36 -04:00
Kevin Ansfield
9540b85a50 Fixed missing URLs in improved search results
ref https://linear.app/tryghost/issue/MOM-117

- `url` was missing in the results objects that we generate from the underlying search results
- updated service integration test with check for url presence
- updated service integration test to also run against the beta search
- added missing page factory to mirage setup
- updated mirage post serializer to include a uniquely identifiable URL for unpublished posts
2024-06-11 16:53:08 +01:00
renovate[bot]
5f0a161a20 Update dependency webpack to v5.92.0 2024-06-11 15:30:49 +00:00
Kevin Ansfield
8ed4d1f25a Updated Admin search acceptance test
ref https://github.com/TryGhost/Ghost/pull/20363

- updated test to match the new labs flag name
2024-06-11 16:30:25 +01:00
Kevin Ansfield
54812dc67a
Added improved Admin search behind labs flag (#20363)
ref https://linear.app/tryghost/issue/MOM-117
ref https://linear.app/tryghost/issue/MOM-70

- moved current search into new `search-provider` service and updated `search` service to use the provider service internally
- added `search-provider-beta` service
  - uses `flexsearch` as the underlying index for each document so we have better indexing and matching compared to the naive exact-match search we had previously
  - adds `excerpt` matching for posts and pages
  - keeps results output the same as the original search provider
- added `internalLinkingSearchImprovements` labs flag so we can test this internally before reaching our internal linking beta testers
- updated `search` service to switch between providers based on labs flag
2024-06-11 15:18:28 +00:00
Sam Lord
0aa36b901d Added comments to data generator
ref ENG-1219

Includes a minor fix to ensure posts are published in the past, so
that comments can be created after.
2024-06-11 11:58:14 +01:00
Sag
63c674828a
Removed Sentry message on successful Lexical save (#20362)
fixes https://linear.app/tryghost/issue/SLO-147

- removed Sentry message when the Lexical save is slow but successful
- bumped Sentry message to error level when the Lexical is slow and
fails
2024-06-11 10:17:21 +00:00
renovate[bot]
f454aed9c9 Update dependency testem to v3.14.0 2024-06-11 09:36:09 +02:00
renovate[bot]
a95291f462 Update dependency html-validate to v8.20.0 2024-06-11 09:35:51 +02:00
renovate[bot]
e93bdba689 Update sentry-javascript monorepo to v7.117.0 2024-06-11 09:35:31 +02:00
Sodbileg Gansukh
9ef92035f6
Adjusted spacing and amount of text of newsletter latest posts (#20285)
ref DES-347

- adjusted title and excerpt length of latest posts in emails
- as the layout is same (horizontal) on both desktop and mobile, truncateHtml() needed some update
- now maxLength is expected to be larger than maxLengthMobile, because the mobile layout isn't stacked anymore
- some spacing adjustment has been made as well
2024-06-11 12:30:32 +08:00
Ghost CI
2ce8351c4b v5.85.0 2024-06-10 17:14:15 +00:00
Steve Larson
3c247d93fe
Added posts.updated_at index to schema (#20357)
ref 6dbbdff
- added index to schema
2024-06-10 11:35:21 -05:00
Kevin Ansfield
14afe23d7e 🐛 Fixed cursor movement across fields in excerpt-in-editor beta
no issue

- during the subtitle->excerpt rename some instances were missed resulting in the excerpt field element not being registered correctly
- fixed mismatched action name and renamed remaining uses of "subtitle"
2024-06-10 17:20:58 +01:00
renovate[bot]
c1d1a89a8a
Added searching indicator to internal linking popups (#20355)
closes https://linear.app/tryghost/issue/MOM-174

- bumps @tryghost/koenig-lexical to version that includes a spinner in search popups whilst a search is in progress
2024-06-10 16:52:20 +01:00
Steve Larson
6dbbdfff49
Added updated_at index to the posts table (#20354)
ref https://linear.app/tryghost/issue/ONC-82
- added migration for adding a posts.updated_at index
2024-06-10 10:37:10 -05:00
renovate[bot]
67d7aadcbe Update dependency cssnano to v7.0.2 2024-06-10 15:18:42 +02:00
renovate[bot]
c641174f94 Update dependency yjs to v13.6.16 2024-06-10 12:14:26 +00:00
Ghost CI
fefb9ec395 v5.84.2 2024-06-07 16:04:25 +00:00
Chris Raible
4a6d427673
Removed members caching cookies when no member is logged in (#20349)
ref
https://linear.app/tryghost/issue/KTLO-58/dont-send-ghost-acess-cookies-if-no-member-is-logged-in

- Currently when member's caching is enabled, but no member is logged
in, we always send `ghost-access=null;` and `ghost-access-hmac=null;`
cookies in the requests to `/members/api/member/`. This is done to clear
the cookies, but an unintended consequence is that these requests can
never be cached since there is a cookie in the response.
- This PR removes the cookies from the requests when no member is logged
in, the cookies will not be sent, allowing the requests to be cached
- It also unsets the cookies when deleting a member's session, so that
the cookies are not sent in the requests after the member logs out
- This should improve the cache hit ratio with members caching enabled
2024-06-06 16:28:36 -07:00
Steve Larson
734ed0b414
Added selectRaw to permitted options for posts model (#20340)
ref https://linear.app/tryghost/issue/CFR-29/
- this allows our content api requests to omit fields we do not use,
improving performance
2024-06-06 13:45:02 -05:00
Chris Raible
bd030c47bb
Added documentation for link redirects (#20327)
no issue

- No code changes, only documentation
- Added detailed overview of everything that happens when a member
clicks on a redirect link in an email, along with a `mermaid.js`
sequence diagram
2024-06-06 10:32:02 -07:00
Ghost CI
bf1852a913 v5.84.1 2024-06-06 16:54:25 +00:00
Kevin Ansfield
202fd7ebbd Added fallback to current excerpt when revision excerpt is null
no issue

- following on from the removal of the `post_revisions.custom_excerpt` column population it was possible in some circumstances to lose your excerpt when restoring an old version
- this change means when no custom_excerpt exists on a revision we both preview and restore the current custom_excerpt to avoid any data loss
2024-06-06 17:25:42 +01:00
Kevin Ansfield
c8fc93e989 Noop'ed the post_revisions.custom_excerpt population migration
no issue

- the query can take a very long time to run on large sites causing problems during the upgrade process
- impact from not populating the column:
  - only has an effect when the inline excerpt beta is enabled
  - when beta enabled, if a revision created before the upgrade is restored then the excerpt will be removed (will be visibly empty in preview before restoring, if any edit has occurred on the post after upgrading then it can still be recovered by restoring the later version or copy/pasting from the preview)
2024-06-06 17:25:42 +01:00
renovate[bot]
16a0bf66fd Update dependency terser to v5.31.1 2024-06-06 15:59:09 +00:00
Ghost CI
3b6d3b1a02 v5.84.0 2024-06-06 08:34:57 +00:00
Ghost CI
5c29bb6bb9 🎨 Updated Source to v1.2.3 2024-06-06 08:34:57 +00:00
Kevin Ansfield
a7a1166310
Added beta feature toggle for moving excerpt field into editor (#20341)
closes https://linear.app/tryghost/issue/MOM-179

Full details coming soon to https://ghost.org/changelog

- Adds a toggle to labs setting that moves the excerpt input below the post title in the editor
2024-06-05 20:14:34 +01:00
Kevin Ansfield
4a94b5efc9 Added newsletter design setting to display excerpt as subtitle
no issue

Full details coming soon to https://ghost.org/changelog/

- when enabled in newsletter design settings a post's custom excerpt will be displayed as a subtitle in the email
2024-06-05 19:46:50 +01:00
Steve Larson
e49021b7ea
🐛 Fixed default sort for the content API posts endpoint with included relations (#20333)
ref https://linear.app/tryghost/issue/CFR-31/
- when relations were included, erroneous logic resulted in the model's
default sort being applied
- the model default sort is not intended for the content API and
needlessly slowed down responses
- there's a change for users here that should be incredibly unlikely to
be hit; default sort is `published_at desc` which will be secondarily
sorted by `id desc` instead of `published_at desc, updated_at desc, id
desc`

This is a very significant performance improvement for content API
requests with includes for sites with a significant amount of data,
which will primarily impact those using Ghost as a CMS or theme {{#get}}
helpers.
2024-06-05 13:26:10 -05:00
Kevin Ansfield
9ca1f3ce24
Renamed subtitle to excerpt (#20334)
no issue

We've settled on using "excerpt" naming in place of "subtitle" to better reflect the underlying property name and tie in with themes and historical usage.

- added migration to rename the `show_subtitle` newsletter setting to `show_excerpt`
- renamed all places in the codebase that referenced subtitle
2024-06-05 17:59:30 +01:00
Michael Barrett
7f92777f89
Added logging to track offer redemption (#20329)
refs
[ONC-56](https://linear.app/tryghost/issue/ONC-56/support-escalation-re-offers-not-tracking)

Added logging to track offer redemption logic to debug issue with offer
redemptions tracking incorrectly
2024-06-05 17:48:43 +01:00
Michael Barrett
0f283da8eb
🐛 Fixed Slack integration using member content in excerpt (#20328)
- refs
[ONC-63](https://linear.app/tryghost/issue/ONC-63/discordslack-webhook-integration)
- fixes [#20304](https://github.com/TryGhost/Ghost/issues/20304)

When a post is published and sent to Slack via webhook, the excerpt
generated could contain member content. This change ensures that the
excerpt does not contain member content. This change also ensures that
the author for the post is correctly shown in Slack
2024-06-05 17:46:21 +01:00
Kevin Ansfield
b447a26832
Added custom excerpt to post revisions (#20323)
closes https://linear.app/tryghost/issue/MOM-170

When the subtitle field is included in the editor it creates a disconnect with post revisions if the underlying custom excerpt data is not included so we'd like to both preview and restore the subtitle when the in-editor subtitle field is enabled.

- added `post_revisions.custom_excerpt` column to schema
- added migration to add `post_revisions.custom_excerpt` to existing databases
- added migration to populate `post_revisions.custom_excerpt` with the current `post.custom_excerpt` value from the associated record
  - ensures no data is inadvertently lost when restoring an old version
- using current data matches what would have happened previously where custom_excerpt was never overwritten when restoring an old version
- updated post revisions handling to accept the `custom_excerpt` field
- updated Admin's revision preview and restoration to display and set the `custom_excerpt` field
2024-06-05 14:47:33 +01:00
renovate[bot]
d40ef32ca8
🐛 Fixed mailto: not being recognised in internal-linking search (#20331)
closes https://linear.app/tryghost/issue/MOM-195

- bumped Koenig packages with updated URL-matching
2024-06-05 14:30:24 +01:00
renovate[bot]
3f93f5f5c5 Pin dependency @ember/test-waiters to 3.1.0 2024-06-04 21:46:24 +01:00
Kevin Ansfield
36ba47604f Added Admin acceptance test for post revision restoration
ref https://linear.app/tryghost/issue/ENG-1078

- adds required setup for acceptance testing post revisions
- adds happy-path test for listing, previewing, and restoring a post revision
2024-06-04 20:16:19 +01:00
Sag
98b51b666d
Fixed ember concurrency cancellation errors (#20324)
fixes https://linear.app/tryghost/issue/SLO-121
fixes https://linear.app/tryghost/issue/SLO-138
fixes https://linear.app/tryghost/issue/SLO-139
fixes https://linear.app/tryghost/issue/SLO-140
fixes https://linear.app/tryghost/issue/SLO-141
fixes https://linear.app/tryghost/issue/SLO-142

- ember-concurrency prevents two executions of the same task from
running at the same time
- when a task is cancelled, the library raises an error by default
- however, we don't need to surface that error as the cancellation of
the second execution is intentional
2024-06-04 16:20:49 +02:00
Peter Zimon
0efec254ec
Refine subtitle typography in newsletters (#20321)
MOM-190
MOM-192

- The subtitle style (serif/sans) was tied to the body style which was
misleading. It makes more sense to connect it to the title style both
from the UX and the output POV.
- Newsletter design preview was not updated according to subtitle
styles.

---------

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2024-06-04 15:39:14 +02:00
Kevin Ansfield
952a89f673
Renamed show_subhead to show_subtitle (#20320)
closes https://linear.app/tryghost/issue/MOM-194

- whilst working on the feature our naming changed from "Subhead" to "Subtitle"
- this rename of the newsletter design setting column brings naming back into a consistent state before public release
2024-06-04 10:57:14 +00:00
Sag
d751d648c7
Fixed offer not found case during Stripe checkout (#20322)
fixes https://linear.app/tryghost/issue/SLO-135

- handles edge cases when an invalid `offerId` is provided during Stripe
checkout
2024-06-04 10:27:45 +00:00
Kevin Ansfield
f7de6308b4 Fixed unwanted period being added to end of subtitle in newsletter
closes https://linear.app/tryghost/issue/MOM-186
2024-06-04 09:57:46 +01:00
Kevin Ansfield
9ab9a88d5b Adjusted subtitle copy
closes https://linear.app/tryghost/issue/MOM-180
closes https://linear.app/tryghost/issue/MOM-184
2024-06-04 09:31:00 +01:00
Sag
ba2bbe7ca2
Fixed unhandled error when saving member data fails validations (#20316)
fixes https://linear.app/tryghost/issue/SLO-122
2024-06-04 06:46:57 +00:00
Kevin Ansfield
72a00b5fcc Wired up subtitle in newsletter template
closes https://linear.app/tryghost/issue/MOM-173

- updated email renderer to add `post.customExcerpt` data
- updated template to skip rendering subtitle when no custom excerpt is present
- updated template to use actual custom excerpt
2024-06-03 17:58:53 +01:00
Kevin Ansfield
a8342e153e Fixed subtitle error being sticky
closes https://linear.app/tryghost/issue/MOM-182

- we were seeing some odd behaviour with the validation engine when validating individual properties that meant our tracked property wasn't auto-updating on subtitle change after a body edit/autosave event
- switched to a manually tracked property that's updated based on the validate call status
2024-06-03 16:44:06 +01:00
Kevin Ansfield
77afd0a47e Adjusted subtitle field styling
closes https://linear.app/tryghost/issue/MOM-181
closes https://linear.app/tryghost/issue/MOM-183

- adjusted subtitle font sizing to be more in harmony with body font
- moved error to be underneath the divider line
2024-06-03 16:28:43 +01:00
Kevin Ansfield
d94a4c581f Added TK support to subtitle
closes https://linear.app/tryghost/issue/MOM-176

- display TK next to subtitle field as per the title field
- include subtitle TK in the pre-publish TK check
2024-06-03 13:22:16 +01:00
Kevin Ansfield
1d4fedf4f2 Fixed subtitle not fully collapsing for auto-expansion
closes https://linear.app/tryghost/issue/MOM-149

- our styles set all `textarea` elements to have a min-height of 100px which wasn't being overridden for our subtitle element meaning our auto-expand code was never able to fully collapse it to a single line
2024-06-03 13:03:42 +01:00
Kevin Ansfield
76a41d4e92 Fixed cursor movement across title/subtitle/editor
closes https://linear.app/tryghost/issue/MOM-175

- matches cursor behaviour on Up/Down/Left/Right/Tab/Enter to our previous behaviour when we only had the title and editor
2024-06-03 12:56:37 +01:00
Ronald Langeveld
833ac83921
Added validation logic to in-editor subtitle (#20284)
closes https://linear.app/tryghost/issue/MOM-150

- use our validation engine to display an error state when >300 characters have been typed in the subtitle input field

---------

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2024-06-03 11:02:18 +00:00
Ghost CI
46cb819feb v5.83.0 2024-05-31 16:04:36 +00:00
renovate[bot]
418316959c Update dependency mysql2 to v3.10.0 2024-05-30 19:28:02 +00:00
Kevin Ansfield
2734a88ca9 Fixed "no results" state flashing in @-linking
closes https://linear.app/tryghost/issue/MOM-160

- return `undefined` early from `searchLinks` when the underlying task gets cancelled
- bump `@tryghost/koenig-lexical` so it properly handles cancelled search promises
2024-05-30 20:10:58 +01:00
Sanne de Vries
e2b6d6c137
Aligned the subtitle font with the body font in the newsletter template (#20296)
REF MOM-146
- This ensures the body serif / sans-serif style is applied to the
subtitle as well
2024-05-30 15:48:37 +00:00
renovate[bot]
3fdacb16ee Update dependency @tryghost/koenig-lexical to v1.2.2 2024-05-30 15:01:34 +01:00
Kevin Ansfield
4165a93ec5 Removed staff with 404 URLs from internal link searches
closes https://linear.app/tryghost/issue/MOM-172

- staff users with no posts won't have a front-end URL so it can be confusing for them to appear in the internal link search results within the editor
- added filtering for `/404/` in staff URLs so we don't list unlinkable staff members
2024-05-30 14:47:44 +01:00
Sanne de Vries
6bc91a1e3b
Synced newsletter preview in settings with newsletter template (#20290)
REF MOM-147

- Updated newsletter preview in settings to match the newsletter
template
- Updated spacing for a few edge-case newsletter template combinations
2024-05-30 13:12:00 +02:00
Sanne de Vries
a323739a1c
Updated excerpt placeholder text from "subtitle" to "post excerpt" in… (#20288)
… the editor

REF MOM-167
2024-05-30 09:56:03 +00:00
Sanne de Vries
b14dfebe2f
Fixed broken post-title background color in dark mode (#20287)
No ref
2024-05-30 10:10:09 +02:00
Steve Larson
65b929d1d8
Added JSDoc to stripe-mocker (#20282)
no ref
2024-05-29 17:38:24 -05:00
renovate[bot]
d507c5c6c2 Update Koenig packages 2024-05-29 22:28:20 +01:00
Kevin Ansfield
55015ccbcc
Added '@' internal link shortcut to editor (#20272)
closes https://linear.app/tryghost/issue/MOM-83

- added additional labs flag to allow internal testing prior to private beta release
- bumped Koenig packages containing support for @-link feature
2024-05-29 18:13:52 +01:00
Sanne de Vries
acac7801f4
Split subhead feature into two feature flags (#20279)
REF MOM-119
- Split subhead feature flag into two: editorSubtitle and
newsletterSubtitle
- Updated UI copy, feature flag names and class names from subhead to
subtitle
2024-05-29 17:59:25 +02:00
renovate[bot]
4ef1dd2146 Update dependency mysql2 to v3.9.9 2024-05-29 15:14:00 +00:00
Sanne de Vries
b0940f1b5a
Added subhead to newsletter template (#20276)
REF MOM-146
- Added subhead to email template behind a flag and and wired it up to
the subhead newsletter setting.
2024-05-29 16:22:42 +02:00
Ronald Langeveld
fddcf3ffee
Added Subheads behind a flag (#20265)
refs MOM-152 MOM-148 MOM-151

- Added Subheads behind a flag + toggle in settings.
- Removes Excerpt fields from post settings if flag is enabled.
- Added subhead toggle in newsletter settings.
- Loads of styling

---------

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
2024-05-29 09:53:40 +00:00
Sodbileg Gansukh
9099ab47c4
Fixed label name not showing as title (#20275)
ref DES-205
2024-05-29 07:56:24 +00:00
Ronald Langeveld
fb465e4704
Added hasFeature email template helper (#20271)
refs
https://ghost.slack.com/archives/C06TQR9SHSM/p1716816764653789?thread_ts=1716795330.737919&cid=C06TQR9SHSM MOM-158

- adds a new `hasFeature` helper for adding content behind a flag within
Email Templates.
- Usage: `{{#hasFeature 'flagname'}} <p>html behind flag</p>
{{/hasFeature}}`
- Added additional testing for testing the helpers
2024-05-29 11:43:46 +07:00
Sag
7617759ae6
Added Sentry Session Replay in Ghost Admin (2/2) (#20263)
ref https://linear.app/tryghost/issue/SLO-128

- Sentry will record session replays when errors happen in Admin (Settings, Editor) to facilitate debugging
- The recorded sessions mask sensitive information (input fields, media items, content in the editor, metrics in the dashboard)
2024-05-28 17:25:38 +02:00
Sanne de Vries
3ad77bd2c2
Updated email newsletter spacing and font sizes (#20273)
REF MOM-146

- These styling changes are a general newsletter template improvement,
and are also laying the groundwork for including a subhead in the
newsletter header. Both the newsletter template as well as the
newsletter preview in settings have been updated.
2024-05-28 14:29:49 +00:00
Steve Larson
e6fcbf45a1
Added sanitization for svg uploads (#20264)
ref https://linear.app/tryghost/issue/ENG-856
- svgs were not previously sanitized and could contain scripts
2024-05-28 08:58:16 -05:00
timemanagementsk
d5cf717437
Corrected typos and wrong translations in SK language (#20241)
Got some code for us? Awesome 🎊!

Please include a description of your change & check your PR against this
list, thanks!

- [ ] There's a clear use-case for this code change, explained below
- [ ] Commit message has a short title & references relevant issues
- [ ] The build will pass (run `yarn test:all` and `yarn lint`)

We appreciate your contribution!

---------

Co-authored-by: Ryan Feigenbaum <48868107+royalfig@users.noreply.github.com>
2024-05-28 09:22:19 -04:00
Ronald Langeveld
d799f2ecb1
Added show_subhead column to newsletters table (#20268)
refs MOM-152

Adds `show_subhead` column to newsletter table. False by default.
2024-05-28 16:29:20 +07:00
Fabien 'egg' O'Carroll
6a8ae57a24
Used a base64 encoded string for hmac secret (#20269)
We want to use a randomly generated 64 byte secret for the hmac, and
utf8 encoding isn't nice to work with for this, so we're going to use a
base64 string and decode it into a buffer for the secret.
2024-05-28 14:12:48 +07:00
renovate[bot]
5c5ec9da9f Update dependency ember-auto-import to v2.7.3 2024-05-28 08:55:23 +02:00
renovate[bot]
4b059e1654 Pin dependencies 2024-05-28 08:53:24 +02:00
renovate[bot]
6ea2b8f658 Pin dependency @types/node to 20.12.12 2024-05-27 18:46:47 +02:00
renovate[bot]
c472a3ac4b
Pinned dependencies (#20257) 2024-05-27 15:29:32 +00:00
renovate[bot]
3ebe206ea7 Update TryGhost packages 2024-05-27 16:58:32 +02:00
Sam Lord
618c4b9623 Data generator: Reduced limit on importer to prevent test crashes
ref: ENG-955

Tested with a static number, using 35 causes failures, 30 seems safe
2024-05-27 15:41:02 +01:00
Sag
ed0a76e985
Added Sentry Session Replay for in Ghost Admin (#20255)
refs
https://linear.app/tryghost/issue/SLO-128/enable-sentry-replay-in-admin-adminx-editor

- this option lets us replay a session in Sentry when an error happens
2024-05-27 12:59:43 +00:00
renovate[bot]
6ff08c5c14 Update dependency mysql2 to v3.9.8 2024-05-27 08:04:34 +00:00
Daniel Lockyer
ecc6053e5d Cleaned up jsdom dependency usage
- we don't need this in `ghost/core` as it's not used in there
- we need to declare this dependency for the apps, as they use it for
  running tests
- this doesn't change the lockfile but it means we're declaring the
  dependency in the right places now
2024-05-27 09:49:43 +02:00
renovate[bot]
78dbbe2294 Update dependency html-validate to v8.19.1 2024-05-27 09:33:26 +02:00
renovate[bot]
3e3bcb81fd Update dependency jsdom to v24 2024-05-27 09:07:18 +02:00
Ghost CI
43e25f44dc v5.82.12 2024-05-27 06:39:20 +00:00
Chris Raible
98d49f57d5
Added experimental headers to allow caching members content (#20200)
ref
https://linear.app/tryghost/issue/KTLO-45/deploy-members-caching-solution-to-a-single-site-to-validate-and-test

Currently we only cache publicly available content. Any content that is
accessed by a logged in member is only cached for that specific member
based on their cookie. As a result, almost all requests from logged in
members bypass our caching layer and reach Ghost, which adds unnecessary
load to Ghost and its database.

This change adds experimental headers that allow our CDN to understand
which tier to cache the content against, and securely tell the CDN which
tier a logged in member has access to. With these changes, we can cache
the member content against the tier, rather than the individual member,
which should result in a higher cache HIT ratio and reduce the load on
Ghost.

For requests to the frontend of the site, Ghost will set a custom
`X-Member-Cache-Tier` header to the ID of the tier of the member who is
accessing the content. This tells the CDN which tier to cache the
content against.

For requests to either `/members/?token=...` endpoint (the magic link
endpoint) or `/members/api/member`, Ghost will set a `ghost-access` and
`ghost-access-hmac` cookie with the ID of the tier of the logged in
member. With these two pieces of information, our CDN can serve cached
content to logged in members.

These headers are experimental, and can only be enabled via Ghost's
config. To enable these headers, set `cacheMembersContent:enabled` to
`true` and provide an HMAC key in `cacheMembersContent:hmacSecret`.
2024-05-23 19:06:45 -07:00
renovate[bot]
d302d4049c Update Koenig packages 2024-05-23 19:13:38 +01:00
Amir
7a045ded00
Adding Persian/Farsi to supported languages (#20219)
Fixes #20214
2024-05-23 09:54:28 -04:00
Daniel Lockyer
4a02938774 Reverted "Enabled includeLocalVariables option in Sentry"
refs https://app.incident.io/ghost/incidents/73
refs https://blog.sentry.io/local-variables-for-nodejs-in-sentry/

- this reverts commit cc76fda3e8
- it turns out that enabling this causes the entire program to pause
  whilst it collects local variables
- this was only added to aid with debugging, so it's not critical to
  have and can be disabled
2024-05-23 12:04:10 +02:00
Peter Zimon
184457b33f
Fixed tooltip for scheduled posts in postlist (#20237)
DES-194

The tooltip of scheduled posts always showed subscribers even if it was
not sent as a newsletter.
2024-05-22 09:02:53 +00:00
Peter Zimon
fb44c2393c
Fixed schedule date formatting (#20236)
DES-355

There's been an orphan in the schedule toast notification and the date
format was non-standard.
2024-05-22 08:29:03 +00:00
renovate[bot]
ad48d8eb25 Update sentry-javascript monorepo to v7.116.0 2024-05-21 14:24:23 +01:00
Peter Zimon
0c2f59e0a8
Update post/page status change copy (#20233)
DES-354

Minor copy improvements when a post or page changes status. E.g. instead
of "Updated" show "Post updated"
2024-05-21 15:08:55 +02:00
Peter Zimon
5bb945e89b
What's new popup (#20112)
DES-192

We often hear that people are not aware of the new features we ship.
Ways in which people can find out are social media/changelog/dashboard –
all of these are easy to miss. We'd like to introduce a template for a
simple notification in the sidebar that can be used any time a new and noteworthy feature has
shipped. The purpose of this is simply to notify and will
disappear forever after it's been dismissed.
2024-05-21 12:36:28 +02:00
renovate[bot]
f01e06153f Update dependency i18next to v23.11.5 2024-05-20 21:41:46 +00:00
Steve Larson
9d9a421b54
Added a column disallow list in the content API posts serializer (#20207)
ref https://linear.app/tryghost/issue/CFR-29
- Removed the mobiledoc and lexical columns from the posts input
serializer, meaning they will no longer be queried for.

Get helpers are essentially a gateway to the Content API. We already
strip out the mobiledoc and lexical fields in the output
serializer/returned response, but this means we're passing the mobiledoc
and lexical fields back from the db. This is pointless and these fields
are substantial in size - by far the largest fields in the whole ghost
db - leading to slowed performance.

I've updated the posts input serializer to strip out the lexical and mobiledoc
columns so we stop doing a `select *` with every query.
2024-05-20 08:25:20 -05:00
Ronald Langeveld
e5056d8d9d
🐛 Fixed External Image URLs being incorrectly prefixed (#20226)
ref ENG-824

- the bug is causing resize prefixes being added to images served from
outside of Ghost.
- this now would only append the prefex to images served by Ghost and
other images urls' would get served as is.
- we can determine that by checking whether imageName doesn't exist,
meaning the source is a third party.
- this mostly affect edge case users, eg where a feature image url was
passed in via the API and doesn't get served by Ghost.
2024-05-20 18:06:03 +08:00
renovate[bot]
a4dc6c5cf6 Update dependency i18next-parser to v8.13.0 2024-05-20 10:40:32 +01:00
renovate[bot]
7f4da080a2 Update dependency html-validate to v8.19.0 2024-05-20 10:37:52 +01:00
Ronald Langeveld
9a60254cd2
🐛 Fixed redundant member data loading for static assets (#20031)
refs CFR-21

Reorganised middleware execution so that member data is not redundantly loaded for static assets or the sitemap.

---------

Co-authored-by: Michael Barrett <mike@ghost.org>
2024-05-20 13:55:45 +08:00
Ghost CI
589793f0c5 v5.82.11 2024-05-17 16:04:53 +00:00
Sanne de Vries
c157619e3e
Fixed error message of the date-time-picker not breaking onto next line (#20221)
REF DES-261

- Also updated error message copy of both the date-time-picker and the
date-picker to be friendlier.
2024-05-16 14:59:07 +00:00
renovate[bot]
239b5b6369
🐛 Fixed certain snippets not inserting correctly (#20129)
ref https://linear.app/tryghost/issue/ONC-26/support-escalation-template-bug
ref https://github.com/TryGhost/Ghost/issues/18948

- bumps `@tryghost/koenig-lexical` to version that doesn't crash during snippet insertion when last node doesn't match expectations for inserting a trailing paragraph
- bumps all Koenig packages to ensure internal dependencies are pinned to prevent potential issues from mixed versions caused by yarn resolution
2024-05-16 11:39:03 +00:00
Fabien O'Carroll
fd8bbeebcf Added support for GET /inbox/:owner
ref https://linear.app/tryghost/issue/MOM-127

We're gonna want auth & filtering on this long term, but for now whilst in
development it's fine as is.
2024-05-16 17:22:45 +07:00
Fabien O'Carroll
a70afcd117 Fixed reconstruction of Activity from JSONLD
The use of Article and Actor in Activity meant that we got way more data in the
JSONLD representation, but it wasn't be picked up when reconstructing from data
over the wire. This makes sure that we can recreate the object from the JSONLD.
2024-05-16 16:39:25 +07:00
Fabien O'Carroll
17fe2395bd Fixed bug with converting URI to value
Subdomains weren't working because of the missing trailing slash
2024-05-16 16:39:25 +07:00
Fabien O'Carroll
5e0f1a1732 Used Actor object for actor in Activity
ref https://linear.app/tryghost/issue/MOM-126

Similar to using the Article object for object in Activity, this allows us to
more easily pull out all of the extra data for Actors. At the moment its the
full JSONLD representation, but we can slim that down in future.
2024-05-16 16:39:25 +07:00
Fabien O'Carroll
c4091fc000 Added more data to Articles
ref https://linear.app/tryghost/issue/MOM-128

We want to render more than just the content, so we need to bulk out the
Article objects with metadata like feature images etc...
2024-05-16 16:39:25 +07:00
Fabien O'Carroll
ea40c6ad65 Used Article as Activity object
ref https://linear.app/tryghost/issue/MOM-126

This allows us to pull out all of the data when converting to JSONLD
2024-05-16 16:39:25 +07:00
Fabien O'Carroll
8842dc2312 Included full Object in Activities
ref https://linear.app/tryghost/issue/MOM-127

This will save us on network fetches when trying to hydrate the inbox, instead
we can include all of the data we want/need. I had to improve the typing a bit
here to work properly which meant ensuring that we have a `type` property.
2024-05-16 16:39:25 +07:00
Fabien O'Carroll
d15858e16a Supported delivering Activities to a Collection of Actors
ref https://linear.app/tryghost/issue/MOM-126

Now that we're setting the recipient of our Create Activites to the Followers
Collection, we need to actually dereference it and pull out all the inboxes.
This is all done over the network at the moment, but we'll start storing this
information locally when we've got the DB wired up.
2024-05-16 12:39:51 +07:00
Fabien O'Carroll
603891645d Used proper ActivityPub Collection for Followers/Following
ref https://linear.app/tryghost/issue/MOM-126

We want to return proper ActivityPub JSONLD rather than a plain array!
That was just a stop-gap to get us moving.
2024-05-16 12:39:51 +07:00
Fabien O'Carroll
27b8bad664 Used Followers Collection to address Create Activitites
ref https://linear.app/tryghost/issue/MOM-126

This is the first step of handling delivery of Activities to our Followers as
we can dereference the Collection and get a list of all our Followers Inboxes
2024-05-16 12:39:51 +07:00
Fabien O'Carroll
f289111f6d Extracted Actor resource ids into getters
Now that we have the URI object, we don't need to convert the Actor to JSONLD
to get its resource ids. Instead we can have shared getters that expose the ids
as a URI, that can be realized as/when they're needed with the base URL.

This makes the code a little cleaner and more performant.
2024-05-16 12:39:51 +07:00
Ghost CI
b7efe4ff8e Merged v5.82.10 into main 2024-05-16 02:19:02 +00:00
Ghost CI
f6f04792ea v5.82.10 2024-05-16 02:19:00 +00:00
Ronald Langeveld
ae18b31ebd 🐛 Fixed direct paid signups on Stripe beta (#20215)
ref ONC-35

- customer_update should only be defined where cutomer_id exists and
labs are enabled.
- added additional unit testing
2024-05-16 10:05:43 +08:00
Ronald Langeveld
010e8394aa
🐛 Fixed direct paid signups on Stripe beta (#20215)
ref ONC-35

- customer_update should only be defined where cutomer_id exists and
labs are enabled.
- added additional unit testing
2024-05-16 08:47:23 +08:00
Galdin Raphael
93eaee7e08
Added missing <html> opening tag to the maintenance page (#20203)
- this was previously missing
2024-05-15 09:10:37 +02:00
Laurent Goderre
d67fc8c353
Added jackspeak resolution to core to fix ESM + CJS compat issue (#20199)
refs #20197

- adds a jackspeak resolution to Ghost core so we can try and ensure the compatible version of jackspeak/string-width is used when the lockfile is regenerated
2024-05-15 08:47:04 +02:00
Fabien O'Carroll
ddd803e1da Fixed usernames in Following list
This is a temporary solution whilst we only support Ghost2Ghost
2024-05-15 13:23:17 +07:00
Fabien O'Carroll
df1774d8e9 Supported Ghost2Ghost Follow/Accept
ref https://linear.app/tryghost/issue/MOM-108

Apologies to my future self and maintainers if you come across this commit.

This is a bit of a mega commit because we need to cut corners somewhere and it
came down to commit atomicity or tests/code quality.

The main changes here are a bunch of tests, as well as some scaffolding for
Inbox handling of Activities and delivery of Activities. The structure is not
final at all - and we have logic split across services which isn't ideal - but
thsi will do for now as we play around and discover the structure through
building.
2024-05-15 12:41:34 +07:00
Fabien O'Carroll
ba1d36bcda Allowed underscore prefixed unused params
With TypeScript, when creating mock instances, it's preferable to maintain a
reference to the params, even if they're not used. This allows us to have
unused variables as long as they're prefixed with an underscore.
2024-05-15 12:41:34 +07:00
Fabien O'Carroll
efe160862f Added testing utilities for NestJS
The supertest lib is the officially recommended way of testing NestJS e2e
2024-05-15 12:41:34 +07:00
Fabien O'Carroll
3a56b79a8c Added service for delivering activities
ref https://linear.app/tryghost/issue/MOM-120

This will allow us to deliver Follow activities to other sites
2024-05-15 12:41:34 +07:00
Fabien O'Carroll
4d24bdbccb Added finger functionality to WebFingerService
ref https://linear.app/tryghost/issue/MOM-120

We need to do this to lookup the inbox which we need to send a Follow activity
2024-05-15 12:41:34 +07:00
Fabien O'Carroll
f31330a228 Improved HTTPSignature library
ref https://linear.app/tryghost/issue/MOM-73

We've made it easier to use by adding defaults for required header, as well as
adding support for signing POST requests.
2024-05-15 12:41:34 +07:00
Fabien O'Carroll
e98f505ae3 Added body parsing to the frontend
ref https://linear.app/tryghost/issue/MOM-73

We need to add body parsing middleware here, so that NestJS has access to it.
We also attach the rawBody which is used to validate the HTTP Signatures
2024-05-15 12:41:34 +07:00
Sodbileg Gansukh
60da243d0c
Updated signup and private page forms for consistency (#20208)
ref TRI-92
2024-05-15 04:47:02 +00:00
Kevin Ansfield
d2da9d3c17
Updated metadata shown on hover in internal link lists (#20204)
closes https://linear.app/tryghost/issue/MOM-80

- updated internal linking search results items
  - removed visibility text from meta data
  - added additional icon for paid/specific tier visibility
  - added titles to icons
- bumped `@tryghost/koenig-lexical` to include support for meta icon titles
- bumped other Koenig packages due to sub-dependency updates
2024-05-14 16:07:04 +00:00
Kevin Ansfield
21321c7012
Improved internal linking copy and added query highlighting (#20191)
no issue

- bumped @tryghost/koenig-lexical to latest version
2024-05-14 11:04:06 +01:00
Peter Zimon
770f657ae9
Improve messaging and error handling (#20078)
ref DES-228

This PR updates messaging and error handling in order to make Ghost calmer and friendlier. High level summary of the changes:

- Removed all onBlur validation in Settings -> now it’s possible to just click around without being warned to fill mandatory fields
- Removed  lot of technical errors like `ValidationError: Validation (isEmpty) failed for locale`
- Completely removed the red background toast notifications, it was aggressive and raw esp. on the top
- Removed some unnecessary notifications (e.g. when removing a webhook, the removal already communicates the result)
- Now we show field errors on submitting forms, and in case of an error we show a “Retry” button in Settings too. This allowed to remove a lot of unnecessary error messages, like the big error message on the top, plus it’s consistent with the patterns outside Settings.
- Notification style is white now with filled color icons which makes everything much calmer and more refined.
- Removes redundant copy (e.g. "successful(ly)") from notifications

---------

Co-authored-by: Sodbileg Gansukh <sodbileg.gansukh@gmail.com>
2024-05-14 09:31:19 +02:00
Steve Larson
842290cbef
Improved performance for filter strings with multiple neq statements (#20198)
ref https://linear.app/tryghost/issue/CFR-27
- updated packages to include performance improvement for NQL filter
strings including multiple neq filters for the same resource
- bumped `bookshelf-plugins`
- bumped NQL versions

We identified a performance fix that allows us to combine not equal
(neq) filters for the same resource in a logically-equivalent way that
also has far more performant resulting SQL.

We're effectively automatically combining strings like
'tag:-tag1+tag:-tag2` into 'tag:-[tag1,tag2]'.
2024-05-13 10:35:27 -05:00
Daniel Lockyer
e3fa095c80 Fixed misc JSDoc types
- nothing crazy, but cleans up a few editor warnings
2024-05-13 14:53:53 +02:00
Daniel Lockyer
a5e7eb2208 Renamed wrapper to ImplWrapper
- helps with debugging and understanding the code flow
2024-05-13 14:53:53 +02:00
Daniel Lockyer
8fa3acfd80 Fixed providing err to IncorrectUsageError
- it appears as though we only accept `err` when it's in the constructor
  of the IncorrectUsageError, so in its current form, it is ignored
- this commit performs a minor refactor to switch to constructing a new
  IncorrectUsageError and then throwing it
- detected by tsserver complaining about the `err` property not existing
  on the error
2024-05-13 14:53:53 +02:00
Sag
cb8213e7d3
Fixed validation when tierId is missing during Stripe checkout (#20195)
refs https://linear.app/tryghost/issue/SLO-90
refs
https://www.notion.so/ghost/Decoupling-Members-from-Stripe-13b644d4dccb43ea83f683473c690b82

- the members API didn't support passing a Stripe Price ID directly
during checkout since end of 2022. However, we did not update the param
validation accordingly
2024-05-13 14:47:39 +02:00
Ghost CI
b1c5a2985c v5.82.9 2024-05-13 07:01:15 +00:00
renovate[bot]
4edb6b6731 Update dependency i18next to v23.11.4 2024-05-10 10:07:11 +00:00
renovate[bot]
fc41947738 Update dependency semver to v7.6.2 2024-05-10 08:30:32 +02:00
Sam Lord
8c3e5ece01 Added option to disable fast import for data generator
Data generator uses CSV imports for a massive speed increase, but
can't be used in some environments where SQL admin isn't
available. This allows us to set a flag to use the original
insert-based importer.
2024-05-09 15:22:15 +01:00
Fabien 'egg' O'Carroll
56d984f05f
Used subscription currency for setup session (#19991)
ref https://linear.app/tryghost/issue/ENG-812
ref https://github.com/TryGhost/Ghost/commit/5b694761bc

We wanna use the currency of the subscription to avoid the edge-case where the 
subscription currency doesn't match the sites current tiers currency.
2024-05-09 13:03:11 +00:00
renovate[bot]
50a1ef1cd8 Update dependency mailgun.js to v10 2024-05-09 13:08:08 +02:00
renovate[bot]
72e136f3ff Update dependency ember-svg-jar to v2.4.9 2024-05-09 13:03:47 +02:00
renovate[bot]
545247af28 Update dependency ember-svg-jar to v2.4.8 2024-05-09 12:48:51 +02:00
renovate[bot]
e004db0636 Update dependency html-validate to v8.18.2 2024-05-09 10:42:38 +02:00
renovate[bot]
512c3e1413 Update CSS preprocessors 2024-05-09 10:36:59 +02:00
renovate[bot]
e13c2b1c23 Update dependency webpack to v5.91.0 2024-05-09 08:25:51 +00:00
renovate[bot]
4c1ecabfc7 Update sentry-javascript monorepo to v7.114.0 2024-05-09 10:16:37 +02:00
Ghost CI
88ad62558a Merged v5.82.8 into main 2024-05-08 19:30:39 +00:00
Ghost CI
f303432ba9 v5.82.8 2024-05-08 19:30:37 +00:00
Sag
5b694761bc 🐛 Fixed updating payment method when beta flag is on (#20171)
refs https://linear.app/tryghost/issue/ONC-20
refs https://linear.app/tryghost/issue/ENG-867

- when using dynamic payment methods in Stripe, we need to provide a
currency. Stripe uses that parameter to determine which payment methods
to render
- docs: https://docs.stripe.com/api/checkout/sessions/create
2024-05-08 20:59:10 +02:00
Sag
60ac3c735b
🐛 Fixed updating payment method when beta flag is on (#20171)
refs https://linear.app/tryghost/issue/ONC-20
refs https://linear.app/tryghost/issue/ENG-867

- when using dynamic payment methods in Stripe, we need to provide a
currency. Stripe uses that parameter to determine which payment methods
to render
- docs: https://docs.stripe.com/api/checkout/sessions/create
2024-05-08 20:56:17 +02:00
Daniel Lockyer
7e9d82655e Added extra validation for reset_password endpoint
fix https://linear.app/tryghost/issue/SLO-104/cannot-read-properties-of-undefined-reading-0-an-unexpected-error

- if the request body didn't contain the correct keys, it'd just HTTP
  500 out of there
- this adds some optional chaining so we end up with undefined if
  anything isn't as expected, and the following if-statement does the
  rest of the check for us
- this also adds a breaking test (the first E2E test for authentication, yay!)
2024-05-08 18:05:04 +02:00
Kevin Ansfield
b5af65a130
Added access and publish date display to internal link list on hover (#20168)
closes https://linear.app/tryghost/issue/MOM-80

- bumps @tryghost/koenig-lexical to add support for search result metadata in internal links as well as some improvements to the internal linking UI/UX
- updates search service to fetch and expose additional `visibility` and `published_at` fields for post/page resources
- updates `searchLinks` method passed to editor to decorate the search results with appropriate meta text and icon based on publish date, post visibility and member settings
2024-05-08 16:04:05 +00:00
Kevin Ansfield
2cd0eb62a7
Re-ordered Admin search results (#20166)
closes https://linear.app/tryghost/issue/MOM-106

- the search results can hide any matching authors/tags due to them appearing after matching posts which is typically a longer list that needs scrolling through
- changed the order to list matched authors and tags before posts, this matches the behaviour in our front-end search
2024-05-08 13:35:23 +00:00
Daniel Lockyer
76c6e92006
Handled invalid files when uploading DB zips (#20165)
fix
https://linear.app/tryghost/issue/SLO-103/invalid-comment-length-expected-7-found-0-an-unexpected-error-occurred

- similar to
e8e3447f15,
this captures a specific error from yauzl and throws a user-friendly
error
- perhaps in the future we can just look for yauzl errors and always
return user-friendly errors, but let's monitor that first
- also includes a breaking test
2024-05-08 14:59:34 +02:00
Daniel Lockyer
f276abf9e8 Condensed logic for determining whether to send Sentry events
refs https://docs.sentry.io/platforms/javascript/configuration/filtering/#using--1%20

- this simplifies our logic to determine whether we should send events
  by moving the code to `beforeSend`
- `errorHandler` is going away in Sentry v8 so this results in a shorter
  diff in the future
- the logic should be the same, always send non-Ghost errors, and only
  send HTTP 500 Ghost errors
2024-05-08 14:25:00 +02:00
Daniel Lockyer
77fc66340a Refactored Sentry beforeSend code
- this tidies up the implementation by removing the very verbose ternary
  operator, and also uses the optional chaining operator
2024-05-08 14:25:00 +02:00
Daniel Lockyer
c4ad593a5a Added JSDoc types to Sentry
- this helps editors with identifying what the types of parameters are
2024-05-08 14:25:00 +02:00
Daniel Lockyer
e8e3447f15 Fixed handling empty zip file uploads
fix https://linear.app/tryghost/issue/SLO-102/end-of-central-directory-record-signature-not-found-an-unexpected

- previously, uploading an empty zip would result in a HTTP 500 error
  because yauzl would error and we'd bubble that up as an
  InternalServerError
- now, we catch the specific error message and return a more user
  friendly error
- also includes tests and sample zip file
2024-05-08 11:19:47 +02:00
Daniel Lockyer
00f42855e3 Excluded docName key from API controller method map
- due to the structure of our API controllers, the docName and methods
  are under the same structure
- this code loops over the keys of the controller and forms the method
  map
- however, it currently also loops over every character of the docName,
  so the resulting map contains a weird structure of chars
- we don't need the docName for this, so we can just exclude it from the
  keys
- this doesn't change any functionality
2024-05-08 11:19:47 +02:00
Daniel Lockyer
d82b136a6a Handled uploads with invalid form bodies
fix https://linear.app/tryghost/issue/SLO-101/http-500-with-invalid-multipart-data

- previously, busboy would error out if we supplied a body that was
  invalid (such as an empty FormData)
- we would then return a HTTP 500 to the user, which causes all manner
  of problems
- now we catch errors from busboy and return a nice BadRequestError
2024-05-08 11:19:47 +02:00
Daniel Lockyer
ae88dc8548 Handled invalid timestamp format in filters
fix https://linear.app/tryghost/issue/SLO-85/fix-http-500-on-contentposts

- in the event we give the incorrect format in a filter, MySQL will
  throw an error and we'll throw a HTTP 500 error
- we can capture this error and return a more useful error to the user
- ideally we'd do this in a validation step before attempting the query,
  but parsing this out of NQL and detecting which columns are DATETIME
  could be quite tricky
2024-05-08 09:28:56 +02:00
Daniel Lockyer
82c612bad9 Rolled out API framework JSDoc typing to more places
- this updates a bunch of places where we're just using Object to cheat
  the system
- doing this means editor autocomplete and basic type checking is better
  because we now have proper types in place
- functionality should not change, these are just comments
2024-05-08 09:28:31 +02:00
renovate[bot]
1fea2fc616 Update dependency semver to v7.6.1 2024-05-08 09:04:44 +02:00
Ghost CI
7201006f05 Merged v5.82.7 into main 2024-05-07 18:13:36 +00:00
Ghost CI
000616ac02 v5.82.7 2024-05-07 18:13:34 +00:00
Djordje Vlaisavljevic
9fe0d13232 Fixed typo
ref https://linear.app/tryghost/issue/DES-338/subscription-details-section-on-mobile-spacing-issues
2024-05-07 20:00:11 +02:00
Kevin Ansfield
d831e687a5 Added initial implementation of internal linking for standard links (#20139)
ref https://linear.app/tryghost/issue/MOM-81

- bumps `@tryghost/koenig-lexical` to version with updated internal linking beta features
2024-05-07 19:59:46 +02:00
Kevin Ansfield
b24f976b34 Fixed empty groups in internal link searches (#20142)
closes https://linear.app/tryghost/issue/MOM-101

- we were mapping over the grouped search results which meant we still got a group even if it's options/items list was empty after filtering for published
2024-05-07 19:59:40 +02:00
Kevin Ansfield
0f482907e1 🐛 Fixed Admin search sometimes stalling on first query (#20143)
closes https://linear.app/tryghost/issue/MOM-103

- the `yield waitForProperty(...)` call that was supposed to return once the content refresh occurred never reached a valid state so the first search query (or any later query) where a content refresh occurred would never resolve causing search to look like it had stalled
- switched to waiting for the last running task to resolve instead which does the same as the previous code intended
- exported the `getPosts` request handler function so in mirage config so we can re-use it with different timing on a per-case basis
2024-05-07 19:59:33 +02:00
Djordje Vlaisavljevic
bae5ae43c9 Fixed typo
ref https://linear.app/tryghost/issue/DES-338/subscription-details-section-on-mobile-spacing-issues
2024-05-07 18:29:25 +01:00
Daniel Lockyer
2659e5aa40 Added handling for parsing errors with user-submitted HTML
fix https://linear.app/tryghost/issue/SLO-87/cannot-read-properties-of-undefined-reading-createimpl-an-unexpected
refs https://github.com/jsdom/jsdom/issues/3709

- in the event we are given some HTML to parse, and that fails, we
  currently return a HTTP 500 because it's unhandled
- the instance we saw was due to `<constructor>` crashing jsdom, we've
  opened an issue for that
- in terms of handling the error gracefully, we can surround the code
  in a try-catch and return a more suitable error. I've gone for a
  ValidationError for now - you could debate whether a different one is
  more appropriate
- also added Sentry error capturing so we're not blind to these,
  ultimately we should make sure the parser can handle all
  user-submitted data
2024-05-07 17:25:48 +02:00
Kevin Ansfield
40ee2043e0
Reduced Admin search re-indexes (#20154)
closes https://linear.app/tryghost/issue/MOM-97

The 30s search content expiry didn't really make sense and caused unnecessary delays and server load now that search will be more widely used within the editor.

- replaced concept of time-based expiry with explicit expiry
  - content still fetched on query if not already loaded or marked as stale
  - added `.expireContent()` method on search service to allow explicit expiry
- updated editor to pre-fetch search content when not already loaded or marked as stale
  - removes delay when first using internal linking search inside the editor
- updated post model to expire search content on save
  - expires on published post save or delete
  - expires on publish and unpublish
- updated tag model to expire content on create/save/delete
  - only expires when name or url is changed
- updated user model to expire on save/delete
  - only expires when name or url is changed
  - does not handle creation because that's done server-side via invites
2024-05-07 15:24:20 +01:00
Sanne de Vries
2b16a65720
Updated lock icon from hardcoded black to using currentColor (#20152)
REF MOM-80
2024-05-07 11:58:41 +00:00
Daniel Lockyer
dccb4ac84e Cleaned up unused controller method
- this isn't being used anywhere, so we can clean it up
2024-05-07 11:44:07 +02:00
Daniel Lockyer
1fd155d56a Fixed extra arguments being supplied to function calls
- identified by tsc, this shouldn't change any functionality because
  there were extra arguments being supplied and were unused
2024-05-07 11:44:07 +02:00
Daniel Lockyer
29cc3003c7 Fixed misc JSDoc types
- nothing crazy, just fixing minor typing issues that I've come across
2024-05-07 11:44:07 +02:00
Ronald Langeveld
4f3bfebfea
Revert "Added latest_event_timestamp to email table (#20118)" (#20149)
This reverts commit 3246a8d2c9.
2024-05-07 08:58:42 +00:00
Daniel Lockyer
c298db912c Added JSDoc types for API controllers
- this adds a simple set of types to the @tryghost/api-framework
  package that should describe all of the keys available on a
  controller, and then rolls it out to all API controllers
- unfortunately, due to https://github.com/microsoft/TypeScript/issues/47107, we have
  to split apart `module.exports` into a variable assignment in order for type-checking
  to be done
- the main benefit of this is that `frame` is now typed, and editors understand what keys
  are available, so intellisense works properly
2024-05-07 10:49:44 +02:00
Ronald Langeveld
3246a8d2c9
Added latest_event_timestamp to email table (#20118)
ref ENG-832

- Added migrations for `latest_event_timestamp` column in emails table.
- updated schema
- updated emails model
2024-05-07 16:12:51 +08:00
Daniel Lockyer
de435238f4 Fixed wrong status code type
- `statusCode` should be a number, but we were passing a string
- this doesn't really affect anything, but tsserver was flagging it up
  as the wrong type
2024-05-07 08:29:48 +02:00
Daniel Lockyer
b29c897da3 Fixed passing error to IncorrectUsageError
- we should pass it as `err` and not `error`
- this probably slipped in because the catch parameter is called
  `error`, so I've updated that and fixed the references
2024-05-07 08:29:48 +02:00
Daniel Lockyer
efc59dd315 Fixed extra parameter to function
- `serializeTier` only takes 2 parameters
- flagged by tsserver
2024-05-07 08:29:48 +02:00
Daniel Lockyer
f72d7b77ac Fixed miscellaneous jsdoc comments
- this helps tsserver figure out what the type of things is around our
  codebase
- nothing crazy, mostly Express types for the middleware, application and router levels
2024-05-07 08:29:48 +02:00
Kevin Ansfield
27e771b3a8
🐛 Fixed Admin search sometimes stalling on first query (#20143)
closes https://linear.app/tryghost/issue/MOM-103

- the `yield waitForProperty(...)` call that was supposed to return once the content refresh occurred never reached a valid state so the first search query (or any later query) where a content refresh occurred would never resolve causing search to look like it had stalled
- switched to waiting for the last running task to resolve instead which does the same as the previous code intended
- exported the `getPosts` request handler function so in mirage config so we can re-use it with different timing on a per-case basis
2024-05-06 21:04:13 +00:00
Kevin Ansfield
7f3731e9d1
Fixed empty groups in internal link searches (#20142)
closes https://linear.app/tryghost/issue/MOM-101

- we were mapping over the grouped search results which meant we still got a group even if it's options/items list was empty after filtering for published
2024-05-06 15:55:16 +00:00
Daniel Lockyer
265a8dd16f Added function names to more middleware
refs 319f251ad2

- this helps debugging because all middleware in the stack will have a
  function name, so it'll show up instead of `<anonymous>`
2024-05-06 17:51:39 +02:00
Kevin Ansfield
2aad4ca06f
Added initial implementation of internal linking for standard links (#20139)
ref https://linear.app/tryghost/issue/MOM-81

- bumps `@tryghost/koenig-lexical` to version with updated internal linking beta features
2024-05-06 15:12:11 +00:00
Daniel Lockyer
a50bb8d79e Added missing error messages for members uploader
fix https://linear.app/tryghost/issue/SLO-97/missing-messages-for-members-file-upload

- these were missing, so if the members importer wasn't given a file, it
  would crash with an HTTP 500 error
- also added a test to ensure we get a 422 back
2024-05-06 15:17:25 +02:00
Daniel Lockyer
5a8145139a Fixed handling cutoff boundary data in image + media upload
fix https://linear.app/tryghost/issue/SLO-95/unexpected-end-of-multipart-data-for-broken-image-upload-request

- in the event the client sends an invalid body to the image or media
  upload endpoints, Dicer will throw an error if the boundary data is
  malformed
- previously, we've just been bubbling that up as an InternalServerError
  and that results in an HTTP 500
- we can capture errors produced by dicer and return a handled
  BadRequestError, as it's the client's fault
- also includes breaking tests
2024-05-06 13:41:25 +02:00
Daniel Lockyer
3e79712466 Fixed handling malformed image + media upload requests
fix https://linear.app/tryghost/issue/SLO-94/unexpected-field-when-given-broken-image-upload-request

- in the event the body of an image or media upload request is malformed
  (broken metadata / blob or something), we get a MulterError and this
  bubbles up as an InternalServerError and spits out a HTTP 500
- we can capture this and return a BadRequestError, as it's the client's
  fault for not providing the correct body
- this implements that and adds breaking tests
2024-05-06 13:24:26 +02:00
Daniel Lockyer
4c35e00721 Fixed handling of invalid Accept-Version header
fix https://linear.app/tryghost/issue/SLO-96/invalid-version-must-be-a-string-got-type-object-an-unexpected-error

- in the event that a non-semver Accept-Version header is given, the
  current code will throw an error because the semver lib can't compare null
  against a valid version
- the error in question is `Must be a string. Got type "object"`
- to fix this, we can just detect a null and early return with a
  BadRequestError
- also adds a breaking test
2024-05-06 12:01:08 +02:00
Daniel Lockyer
319f251ad2 Added function names to mw-error-handler middleware
- this helps with debugging because all the middleware will now have
  function names, so it'll show up as something labeled vs `<anonymous>`
2024-05-06 12:01:08 +02:00
Daniel Lockyer
dd214aa67c Refactored @tryghost/mw-error-handler to assert
- removes should as our preferred assertion lib is `assert`
- removes empty test utils, these won't be needed
2024-05-06 12:01:08 +02:00
renovate[bot]
88957ca1f4 Update dependency @types/nodemailer to v6.4.15 2024-05-06 11:55:52 +02:00
Fabien O'Carroll
e6552ddb63 Added ability for Actor to sign requests
ref https://linear.app/tryghost/issue/MOM-74

This will allow us to generated signed requests for Activites.
2024-05-06 14:21:16 +07:00
Fabien O'Carroll
deb6e05889 Added HTTPSignature service
ref https://linear.app/tryghost/issue/MOM-72

This module handles signing and validating HTTP signatures, which is a core
part of interfacing with ActivityPub enabled servers.
2024-05-06 14:21:16 +07:00
Ghost CI
f34c33f330 v5.82.6 2024-05-03 16:04:14 +00:00
Chris Raible
d8b629c713
Added an optional timeout parameter to AdapterCacheRedis (#20131)
ref
https://linear.app/tryghost/issue/ENG-902/add-an-optional-timeout-in-the-redis-cache-adapter-in-case-redis

- Added an optional timeout parameter to AdapterCacheRedis, so that the
`get(key)` method will return `null` after the timeout if it hasn't
received a response from Redis
- When load testing the `LinkRedirectRepository` with the Redis cache
enabled on staging, we noticed that for some reason Redis stopped
responding to commands for ~30 seconds.
- The `LinkRedirectRepository` was waiting for the Redis cache to
respond and resulted in a drastic increase in response times for link
redirects
- This change will allow us to set a timeout on the `get(key)` method,
so that if Redis doesn't respond within the timeout, the method will
return `null` as if it were a cache miss.
- Then the `LinkRedirectRepository` will fall back to the database and
return the link redirect from the database instead of waiting
indefinitely for Redis to respond
2024-05-02 20:39:23 -07:00
Chris Raible
b9f7ea65e9
Revert "Added new member signup flow behind labs flag (#19986)" (#20130)
ref https://linear.app/tryghost/issue/KTLO-1/members-spam-signups

This reverts commit 01d0b2b304.

- Removed the new member signup flow because it didn't solve the
problems with spam signups
2024-05-02 13:02:32 -07:00
Kevin Ansfield
0fbea2d503
Revert "Added initial implementation of internal linking for standard links (#20126)" (#20128)
This reverts commit 41111893b4.

- reverting for further polish before it ends up in next release
2024-05-02 18:50:29 +00:00
Kevin Ansfield
41111893b4
Added initial implementation of internal linking for standard links (#20126)
ref https://linear.app/tryghost/issue/MOM-81

- bumps `@tryghost/koenig-lexical` to version with updated internal linking beta features
2024-05-02 17:28:19 +00:00
Daniel Lockyer
7950122ffe Protected against deleting non-existent image during upload
fix https://linear.app/tryghost/issue/SLO-93/undefined-path-error-with-bad-image-upload

- in the event we receive a request to upload an image, that doesn't
  contain an image, we still try and unlink the files
- this is a dangling promise, so it doesn't cause an explicit HTTP
  error, but it does show up as a console error
- fixed it by checking for the path, and early returning if it doesn't
  exist
- also added a test that would fail without this
2024-05-02 17:29:03 +02:00
Sag
e996213122
Moved POST /members/api/member behind alpha flag (#20124)
ref https://linear.app/tryghost/issue/SLO-78

- the `POST /members/api/member` endpoint is solely used by the alpha
feature `membersSpamPrevention` and should not be available otherwise
2024-05-02 16:34:32 +02:00
Daniel Lockyer
cc76fda3e8 Enabled includeLocalVariables option in Sentry
ref https://linear.app/tryghost/issue/SLO-92/enable-extra-sentry-integrations
refs https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#include-local-variables

- this will capture the local stack variables when producing a stack
  trace, which would be super useful when debugging
2024-05-02 13:52:40 +02:00
Daniel Lockyer
5b28dc9246 Enabled Sentry's ExtraErrorData integration
refs https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/extraerrordata/
ref https://linear.app/tryghost/issue/SLO-92/enable-extra-sentry-integrations

- this enables the ExtraErrorData integration, which should help us
  capture more of the properties of the errors we're producing, which
  _may_ help with debugging
2024-05-02 13:52:40 +02:00
Daniel Lockyer
6c7b230efe Fixed handling requests with mismatching version and missing key
fix https://linear.app/tryghost/issue/SLO-88/typeerror-cannot-read-properties-of-null-reading-relations

- in the event that we make it through the version mismatch code, but
  without a key, which is possible if you send a request like POST
  /ghost/api/v2/content/posts/`, then the version mismatch code will try
  and look up the API key attached to a null key, which won't work
- we should handle this case and soft return, to avoid trying to read
  `.relations` from `null`
- I'm not entirely convinced by how this code works in general, it seems
  quite confusing to reason about, but this commit should solve the HTTP
  500 we've been seeing from this
- perhaps in the future we can return earlier in the flow if we receive
  a `null` key
2024-05-02 13:03:26 +02:00