Commit Graph

20502 Commits

Author SHA1 Message Date
Michael Barrett
e58fd86b96
🐛 Fixed image editing not saving changes (#20543)
refs
[ENG-1363](https://linear.app/tryghost/issue/ENG-1363/bug-with-image-editing-not-saving-changes)

Bumped `@tryghost/koenig-lexical` to `1.3.3` to fix image editing not
saving changes
2024-07-04 11:48:48 +01:00
Daniel Lockyer
98d171cfc6 Bumped @tryghost/metrics package
- this change contains the removal of the `promise.allsettled` package,
  as this is not needed on Node 12+, which removes 75 further dependencies
  in production mode
2024-07-04 11:40:56 +02:00
renovate[bot]
6fadf45f4a Update dependency ws to v8.18.0 2024-07-03 17:36:56 +00:00
Kevin Ansfield
e6df014f84 Cleaned up newsletterExcerpt flag
no issue

- feature is GA so the flag and related conditionals are no longer required
2024-07-03 18:22:39 +01:00
Daniel Lockyer
33c9786025 Removed unused dependency
- this dependency is also present in `dependencies`, so it's not needed
  here
2024-07-03 14:35:31 +02:00
Sanne de Vries
e393676e8d
Removed duplicate email template and styles files (#20528)
Refs https://ghost.slack.com/archives/C02G9E68C/p1720003723371169
- These duplicate files have been lingering since working on an email
customisation feature that was never released.
2024-07-03 14:35:17 +02:00
Sag
6e0b009034
🎨 Added 'Payment failed' subscription cancellation reason (#20527)
ref https://linear.app/tryghost/issue/ENG-1254

- we currently only store a cancellation reason when a member cancels
manually in Portal
- we now also store "Payment failed" when the cancellation is automatic
due to several payment failures
2024-07-03 13:12:01 +02:00
Sanne de Vries
be77080f39
Updated typography and spacing for callout cards and blockquotes (#20525)
REF DES-542
2024-07-03 09:43:51 +00:00
renovate[bot]
6c6d3b6ce4 Update dependency jose to v4.15.9 2024-07-03 09:16:44 +00:00
Daniel Lockyer
895e3719bd Revert "🐛 Fixed unexpected leave confirmation after Cmd+S on member profile"
This reverts commit 186c6f3c42.
2024-07-02 21:49:08 +02:00
renovate[bot]
8d33c9d64f Update dependency lib0 to v0.2.94 2024-07-02 18:27:02 +02:00
renovate[bot]
31ea0ba6a3 Update metascraper 2024-07-02 15:57:06 +00:00
Princi Vershwal
bec647412f
🐛 Fixed url decoding issue - URLs sent in emails containing a % can now be updated(#20518)
fixes https://linear.app/tryghost/issue/ENG-447/🐛-urls-sent-in-emails-containing-a-percent-can-not-be-updated

URLs were decoded before making a search query to the db. This is the reason the `%2F` character gets converted to  `/`. This decoding is not required.
2024-07-02 21:13:32 +05:30
Michael Barrett
b36c2356fc
Added custom redirects ReDoS validation (#20515)
refs
[ENG-709](https://linear.app/tryghost/issue/ENG-709/%F0%9F%90%9B-bad-redirects-causing-container-tear-down)

Added validation to prevent RegEx's susceptible to ReDoS from being used
with custom redirects. Also moved error details out of `context` and
into `errorDetails` to be consistent with error logging elsewhere as
well as fix issue in admin-x where blank screen would be shown when an
error occurred during redirects upload (due to logic not accounting for
`context` being an object)
2024-07-02 16:00:19 +01:00
Steve Larson
fe31ee34e8
Revert "Improved performance in Admin Posts view (#20503)" (#20514)
ref https://linear.app/tryghost/issue/ONC-111

This reverts commit 3d9d552271.

This commit broke bulk post actions which we do not have tests for, so
we will need to address that as well as add tests.
2024-07-02 14:27:44 +00:00
Sanne de Vries
3618632129
Updated password updated successfully notification copy (#20512)
REF DES-540
2024-07-02 16:26:12 +02:00
Sag
92a84f77fd
Removed leftover .only on Admin unit tests (#20513)
no issue
2024-07-02 14:10:23 +00:00
Fabien 'egg' O'Carroll
a4107b8202
🐛 Fixed incorrect member subscription details in Admin (#20476)
fixes https://linear.app/tryghost/issue/ENG-642

- When a subscription is in the `canceled` state the corresponding
Member has no access to the Ghost site. The only time a Member will
continue to have access if their subscription is due to cancel at the
period end is if it is still in an active state, which is one of
`active` `trialing` `unpaid` or `past_due`
- When a subscription is canceled immediately (i.e. before the end of
the current billing period), we now render "Ended" without a date,
because we don't store the cancellation date in the subscription object.
We previously used "Ended {current_period_end}" which would sometimes
lead to dates in the future
- Bonus: refactored code and added unit tests

---------

Co-authored-by: Sag <guptazy@gmail.com>
2024-07-02 13:58:20 +00:00
Sanne de Vries
18719e2168
Updated password reset notification (#20510)
REF DES-540
2024-07-02 15:24:14 +02:00
Daniel Lockyer
23075b7bf8 Optimized aggregating member attribution statistics
- the existing code creates a new moment instance, takes away some days
  and then formats the result
- this is run for every entry of the member attribution stats, which
  means dashboards for big sites with a lot of attribution data become
  slow
- this value doesn't change across each iteration of the filter, so we
  can just extract it out and calculate it once
- this commit removes this code block from the flamegraph completely
2024-07-02 11:44:22 +02:00
Princi Vershwal
62aad6fd84
🐛 Fixed analytics sources to not be case sensitive (#20506)
fixes https://linear.app/tryghost/issue/ENG-925/analytics-sources-shouldnt-be-case-sensitive
2024-07-02 08:41:32 +00:00
Princi Vershwal
e6b1f8a8bf
Fixed analytics sources to not be case sensitive (#20506)
fixes
https://linear.app/tryghost/issue/ENG-925/analytics-sources-shouldnt-be-case-sensitive
2024-07-02 12:17:13 +05:30
renovate[bot]
9522ef8ca8 Update nest monorepo to v10.3.10 2024-07-02 08:31:07 +02:00
Daniel Lockyer
186c6f3c42 🐛 Fixed unexpected leave confirmation after Cmd+S on member profile
fix https://linear.app/tryghost/issue/ENG-779/%F0%9F%90%9B-cmds-does-not-save-member-profile-changes

- previously, pressing Cmd+S on a member profile would save the profile,
  but the dirty attributes weren't being cleaned, so the application
  would trigger the leave confirmation when exiting
- now, we've fixed the code to keep a dynamic scratch member,
- long term, we should get rid of the scratch model, but this still
  allows us to fix the bug for now
2024-07-02 08:30:53 +02:00
renovate[bot]
90033eff2d Update dependency @tryghost/kg-html-to-lexical to v1.1.6 2024-07-02 08:26:16 +02:00
Kevin Ansfield
2fd9116499
🐛 Fixed unwanted extra blank paragraphs when copy/pasting from Google Docs (#20505)
closes https://linear.app/tryghost/issue/ENG-1255

- updated Koenig packages including:
  - addition of `/preview` for public preview card
  - fix for HTML import from Google Docs
  - fix for embed thumbnails being cut off in email
  - fix for wide image card width on medium screens
- multiple fixes for unhandled (but non user-visible) errors causing noise in console and error logging
2024-07-01 21:14:07 +01:00
Steve Larson
3d9d552271
Improved performance in Admin Posts view (#20503)
ref https://linear.app/tryghost/issue/ONC-111
- changed posts fetching/display behavior to be client-side instead of server-side
- admin will issue (potentially multiple) requests based on the desired status(es)
- updated admin acceptance test for missing coverage

I've pulled the sort from the database query as this triple sort
performs very poorly at scale (taking ~4s+ past ~20k posts sometimes).
Instead, we now split up the fetch to grab only one status at a time and
use the front-end logic to handle displaying scheduled, then drafts,
then published. This should result in a much more responsive view.

We will separately change the default sort on the Admin API as that was the ultimate intent for this change.
2024-07-01 19:43:41 +00:00
Sag
7f963e9c2a
🎨 Added 'Changed email address' event to Member Activity (#20493)
fixes https://linear.app/tryghost/issue/ENG-1256

- when a member changes their email address, surface it in Member
Activity
2024-07-01 15:33:33 +00:00
Michael Barrett
c285b0a0f1
🔒 Added timestamp to webhook signature hash (#20500)
refs
[ENG-1238](https://linear.app/tryghost/issue/ENG-1238/🔒-webhook-signatures-dont-include-timestamp-in-the-signature)

Added timestamp to the webhook signature hash to prevent replay attacks.
This is
a breaking change for webhook consumers as signature verification logic
will need to be updated to account for the timestamp in the hash, for
example:

```js
const crypto = require('crypto');

// Webhook secret from Ghost Admin
const WEBHOOK_SECRET = 'FOOBARBAZ'

// Sample incoming webhook request object
const req = {
    headers: {
        'x-ghost-signature': 'sha256=fc9749d5b3333109bd779f65d4b1b891576bc5c92febea3b1d186a7f946d0745, t=1719842984367'
    },
    body: {
        tag: {
            current: {
                id: '6682b8a8e10cc04306284330',
                name: 'test',
                slug: 'test',
                description: null,
                feature_image: null,
                visibility: 'public',
                og_image: null,
                og_title: null,
                og_description: null,
                twitter_image: null,
                twitter_title: null,
                twitter_description: null,
                meta_title: null,
                meta_description: null,
                codeinjection_head: null,
                codeinjection_foot: null,
                canonical_url: null,
                accent_color: null,
                created_at: '2024-07-01T14:09:44.000Z',
                updated_at: '2024-07-01T14:09:44.000Z',
                url: 'http://localhost:2368/404/'
            },
            previous: {}
        }
    }
};

// Get the request body as a JSON string
const reqBodyJSON = JSON.stringify(req.body);

// Extract the hash and timestamp from the x-ghost-signature header
const {sha256: hash, t: timestamp} = req.headers['x-ghost-signature']
    .split(', ')
    .map((x) => x.split('='))
    .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})

// Recreate the hash using the secret, request body, and timestamp and compare it to the hash from the header
const isValid = crypto.createHmac('sha256', WEBHOOK_SECRET).update(`${reqBodyJSON}${timestamp}`).digest('hex') === hash

if (isValid) {
    console.log('Valid signature!')
}
```
2024-07-01 15:59:04 +01:00
Daniel Lockyer
fcb95ecc1a Switched faker to @faker-js/faker
- `faker` was the original dependency but the maintainer ended up
  deleting the repo, so development continued in `@faker-js/faker`
- we're already using that dependency, so we can make a few simple
  changes and remove the old dependency from our repo
2024-07-01 14:49:42 +02:00
Daniel Lockyer
60f37ed118 Fixed browser tests
refs 6378d7d66f

- the buttons have been renamed and split apart into separate ones
2024-07-01 14:49:20 +02:00
Daniel Lockyer
a146709c16 Cleaned up unused core dependencies
- analytics-node usage was removed a while back
- juice is used by a different package now
2024-07-01 13:56:31 +02:00
Sanne de Vries
95a4895e8f
Center aligned feature image in email template (#20491)
REF DES-380
- Center aligned feature image in email template
- Updated feature image css in editor to better display image overlay
and improve caption spacing
2024-07-01 08:43:26 +00:00
Daniel Lockyer
5f36bef451 Changed "commented" link in member feed to redirect to post
fix https://linear.app/tryghost/issue/ENG-1217/activity-log-link-for-comments-goes-to-wrong-place

- the post analytics page does not contain any comments, so it's not the
  most intuitive location to point the user. Instead, we can send them
  to the frontend of the post, where they can view comments
2024-07-01 10:15:46 +02:00
renovate[bot]
f561f362f4 Update dependency postcss to v8.4.39 2024-07-01 07:28:24 +02:00
renovate[bot]
41d8240d50 Update dependency mysql2 to v3.10.2 2024-07-01 02:07:18 +00:00
Ghost CI
0d60c74957 v5.87.0 2024-06-28 16:27:27 +00:00
Daniel Lockyer
34b903a12b Added browser autoplay error to Sentry ignore list
fix https://linear.app/tryghost/issue/SLO-179/notallowederror-the-request-is-not-allowed-by-the-user-agent-or-the

- this adds another browser error to the Sentry ignore list, as we don't
  have control over it, and it doesn't affect the user
2024-06-27 15:33:35 +02:00
renovate[bot]
430a2ca383 Update dependency testem to v3.15.0 2024-06-27 14:06:48 +02:00
Princi Vershwal
7bffe5b79a
Added option param to skip distinct from count query for members API
ref https://linear.app/tryghost/issue/SLO-173/removed-distinct-from-member-count-query

Performance of GET /members API can be improved by dropping the distinct from the total members count query.

select count(distinct members.id) as aggregate from `members`; // 275ms
select count(*) as aggregate from `members`; // 30ms

In this case we know that the result set will always be unique.
2024-06-27 17:35:19 +05:30
Daniel Lockyer
f9a6610823 Added AbortError to list of excluded errors
fix https://linear.app/tryghost/issue/SLO-175/error-aborterror-the-operation-was-aborted

- this error can occur when a user's browser navigates away mid-request,
  which causes the request to be aborted. However, we don't control
  this, nor do we particularly care, so we can just ignore it
2024-06-27 11:58:02 +02:00
Michael Barrett
ecf52d4685
Removed request queue enablement flag (#20466)
refs
[CFR-26](https://linear.app/tryghost/issue/CFR-26/remove-request-queue-config-flag)

Removed request queue enablement flag and updated the logic so that the
request queue is enabled when there is explicit configuration for it.
2024-06-27 09:30:07 +01:00
Daniel Lockyer
aa0110c842 Adjusted Sentry ignore list to cover more browser play errors
fix https://linear.app/tryghost/issue/SLO-172/error-aborterror-the-play-request-was-interrupted-because-the-media

- there are a few error messages we can ignore here, as browsers output
  slightly different messages for various types of these errors, which
  don't affect the user
2024-06-27 08:59:58 +02:00
Steve Larson
2e593ebcee
Improved performance fetching posts (#20460)
ref https://linear.app/tryghost/issue/ONC-111
- added composite index to posts_tags for post_id,tag_id for faster
lookup
- added composite index to posts for updated_at; this is commonly used
by get helpers on the front end to display data like the latest posts

In testing, this provided a very dramatic improvement for simple get
helper requests like 'filter="id:-{{post.id}}+tag:sampleTag" limit="3"'
which are by default sorted by updated_at desc. I'm not entirely clear
why when sorting by published_at we do not need a composite index - so
far it doesn't seem to be necessary. This should cover the primary cases
for get helpers - the latest posts with a given tag or set of tags.
2024-06-26 16:29:02 -05:00
renovate[bot]
dfc27b02c8
Update Koenig packages (#20453)
closes https://linear.app/tryghost/issue/MOM-247

- includes a few fixes for errors we've seen in our reporting
2024-06-26 14:48:17 +01:00
Daniel Lockyer
f250898a3b Optimized stats aggregation code for Admin dashboard
fix https://linear.app/tryghost/issue/SLO-168/rangeerror-maximum-call-stack-size-exceeded

- this code takes the API output and reduces it down to collect together
  stats per date
- the current code is recursive, and we've seen errors with the
  recursion hitting a `RangeError: Maximum call stack size exceeded`
  error
- as well as that, we're doing a lot of array concat'ing and cloning,
  which burns memory and CPU time
- instead, we can just use `.reduce`
- the new implementation is much faster than the existing one (1ms vs
  85ms) and uses no recursion, so those errors should go away
- I've also verified that the output is the same between the two
  functions
2024-06-26 15:46:39 +02:00
Daniel Lockyer
43bb83f7bb Extracted stats aggregation function to util
ref https://linear.app/tryghost/issue/SLO-168/rangeerror-maximum-call-stack-size-exceeded

- this extracts a function to a util so we can unit test it
- this function is about to be optimized but having unit tests allows us
  to make the change with confidence
2024-06-26 15:46:39 +02:00
Daniel Lockyer
019f417c7d Moved error exclusion to correct place
- adding it to ignoreErrors is better than beforeSend because it's built
  for this purpose and we've just looking at the error message
2024-06-26 12:43:55 +02:00
Daniel Lockyer
dd39576de0 Added more errors to Sentry exclusion list
fix https://linear.app/tryghost/issue/SLO-165/add-more-errors-to-allowlist

- we don't want to capture Sentry errors for these because they are out
  of our control (like the user's internet connection dropping out)
2024-06-26 12:43:55 +02:00
Sanne de Vries
e34c36007e
Updated frontend styles for bookmark card (#20468)
REF DES-263
- Added default white background color and sans-serif font to bookmark
card
2024-06-26 12:02:25 +02:00
Daniel Lockyer
5f5293cf6d Excluded errors caused by browser power-saving settings
fix https://linear.app/tryghost/issue/SLO-164/error-aborterror-the-play-request-was-interrupted-because-video-only

- in the case that the browser has power-saving settings enabled, we get
  an error in Sentry
- this error does not affect the user experience, so it should be safe
  to ignore
- this adds an exclusion to Sentry to ignore these errors
2024-06-26 11:49:42 +02:00
Daniel Lockyer
6c07b1cff9 Fixed TypeError when editor is focussed when not loaded
fix https://linear.app/tryghost/issue/SLO-162/typeerror-thiseditorapi-is-null

- if the editor does not load for some reason (network issue), and the
  editor area is clicked, we throw an error because we don't protect
  against a null `editorAPI`
- this adds that check
2024-06-26 11:49:42 +02:00
Ronald Langeveld
6099a14082
Fixed flaky admin test in Publish+Send Flow (#20463)
ref ONC-109

- Attempt to fix flaky Admin test, "Publish flow members enabled can
schedule publish+send"
- Adjusted the time calculation to the nearest minute to avoid
off-by-one minute errors
- Added `waitFor` to ensure elements are present and stable before
making assertions.
- Rounded the new scheduled date and time to the nearest minute to
maintain consistency
- Included extra `waitFor` and `settled` calls to allow time for UI
elements to fully load and reflect changes before assertions.
2024-06-26 16:05:51 +07:00
Sanne de Vries
df16fe1cf4
Added contentVisibility feature flag to FeatureService (#20465)
REF MOM-221
2024-06-26 08:37:01 +00:00
Sanne de Vries
03113313ce
🎨 Updated editor toolbar and action button designs (#20405)
REF https://linear.app/tryghost/issue/MOM-238

- Updated feature image action button styles
- Aligned button and tooltip styles with the rest of the editor
- Updated `koenig-lexical` version to pull in new toolbar design
2024-06-25 10:26:30 +00:00
renovate[bot]
68dcec143e Update dependency ember-auto-import to v2.7.4 2024-06-25 11:39:52 +02:00
Sag
516a2e1ff6
Reduced Sentry replays sample rate to 50% (#20458)
fixes https://linear.app/tryghost/issue/SLO-156
- we have reached our 10k replays per month quota in 20 days, by using a
100% error sampling rate
- we would need a sampling rate < 0.64% to stay under the quota
- from now on, we will be using a 50% error sampling rate to have a bit
of margin, and have a rounder number that is easier to reason about (1
out of 2 error sessions are recorded in Sentry)
2024-06-25 10:52:34 +02:00
Kevin Ansfield
21a2a8236e Added analytic events to internal linking feature
closes https://linear.app/tryghost/issue/MOM-77
closes https://linear.app/tryghost/issue/MOM-78

- bumps Koenig to support events
- adds `siteUrl` pass-through to Koenig to allow differentiation between internal and external URLs
2024-06-24 21:46:15 +01:00
Sag
725ebc3e9f
Fixed invalid tierId handling during member paid checkout (#20455)
- fixes https://linear.app/tryghost/issue/SLO-90
2024-06-24 15:33:39 +00:00
Steve Larson
b10b81b7d7
Prevented pages content api queries from returning mobiledoc or lexical fields (#20454)
ref https://linear.app/tryghost/issue/CFR-43/
ref 9d9a421

We recently stopped `select *` from posts when making Content API
requests. This is now being applied to the pages endpoint to help
improve performance. These fields were already being stripped out in the
output serializer, and they will now no longer be returned from the db
at all, reducing the amount of data transferred.
2024-06-24 15:17:45 +00:00
Sag
b9240271fe
Added config to hide labels from the signup card for contributors (#20429)
ref https://linear.app/tryghost/issue/SLO-127

- problem: contributors see an empty list of labels in the Signup card,
even if some exist
- cause: contributors do not have permission to browse labels
- solution: hide the label input entirely for contributors in the Signup
card, based on the new `renderLabels` config parameter
2024-06-24 14:14:09 +00:00
Steve Larson
4f6842b99a
Added composite index to posts table for type,status (#20437)
ref https://linear.app/tryghost/issue/CFR-35
- performance improvement intended for the content api/get helpers

The posts table is shared by posts and pages and seldom is queried for
both. It makes sense to add an index on type, and from the perspective
of the content API, also on status as you're almost only ever querying
for published posts or published pages.
2024-06-24 09:13:20 -05:00
Michael Barrett
897481b3b4
Added time field to slow get helper logging (#20427)
refs
[CFR-36](https://linear.app/tryghost/issue/CFR-36/pull-out-response-time-from-ghost-logs-message-field-for-get-helper)

Added time field to slow get helper logging to make it easier to query
and filter on this value in elastic without having to parse the message
field
2024-06-24 14:28:42 +01:00
Daniel Lockyer
d5013199b3 Fixed handling objects as API input parameters
fix https://linear.app/tryghost/issue/SLO-155/paramsmap-is-not-a-function-an-unexpected-error-occurred-please-try

- in the case you provide an object to the API, this code will throw an
  error because it can't map over an object
- we can just assert that params should be an array and throw an error
  otherwise
2024-06-24 10:14:43 +02:00
renovate[bot]
c1df0c9d3d Update dependency @types/node to v20.14.8 2024-06-24 10:07:19 +02:00
Ghost CI
bfd7a26370 v5.86.2 2024-06-23 20:39:22 +00:00
Kevin Ansfield
1593fd87d2 🐛 Fixed YouTube bookmark creation
https://github.com/TryGhost/Ghost/issues/20445

- after switching to a browser-like user-agent, YouTube started responding with a "supported browsers" message rather than the actual video meaning bookmark creation failed
- when trying other user-agents it was discovered that nytimes.com (why the user-agent was originally changed) had a problem with the github.com address in the user-agent. By switching to using https://ghost.org instead the request was allowed through fixing both YouTube and NYTimes embeds
2024-06-23 21:09:25 +01:00
Ghost CI
7dcc82b951 v5.86.1 2024-06-21 21:27:33 +00:00
Kevin Ansfield
5b2eaec982 🐛 Fixed 500 errors when viewing posts in development mode
closes https://linear.app/tryghost/issue/ONC-115

- OpenTelemetry was throwing errors when viewing posts
- disabled the instrumentation in development mode so it requires explicit config to enable
2024-06-21 21:59:03 +01:00
Ghost CI
a837cf0247 v5.86.0 2024-06-21 16:04:16 +00:00
renovate[bot]
ccf2d22f4b Update sentry-javascript monorepo to v7.118.0 2024-06-21 13:07:47 +01:00
Daniel Lockyer
12cbb22b85 Lazyloaded OpenTelemetry packages to avoid boot time regression
- we don't want to load the Otel packages unless the instrumentation is
  enabled, because they dramatically increase the boot time (2x locally!)
2024-06-21 11:26:37 +01:00
renovate[bot]
bec000567d Update dependency @opentelemetry/auto-instrumentations-node to v0.47.1 2024-06-21 11:23:14 +01:00
renovate[bot]
4609b43ad7 Update dependency @opentelemetry/instrumentation-runtime-node to v0.5.0 2024-06-21 11:22:50 +01:00
renovate[bot]
63a215700b Update dependency @types/node to v20.14.7 2024-06-21 10:55:13 +01:00
renovate[bot]
478ac0460b Update opentelemetry-js monorepo 2024-06-21 10:55:03 +01:00
renovate[bot]
360088603f Update dependency @opentelemetry/instrumentation-knex to v0.37.0 2024-06-21 10:00:10 +01:00
renovate[bot]
4fd28d4947 Update dependency cssnano to v7.0.3 2024-06-21 09:43:36 +01:00
renovate[bot]
4c8a780e2e Pin dependencies 2024-06-21 09:35:29 +01:00
Kevin Ansfield
0b4e249037 🐛 Fixed bookmark creation for sites that block some user agents
closes https://linear.app/tryghost/issue/ENG-762

- nytimes.com and other sites return 403 responses when requests do not match typical browser user-agents
- our bookmark fetching requests were using `Ghost(https://github.com/TryGhost/Ghost)` meaning bookmark creation failed for these user-agent-blocking sites
- switched to using a standard browser user-agent string to avoid such blocks
2024-06-20 22:15:38 +01:00
Kevin Ansfield
3bc5eb8cf9
🐛 Fixed Bluesky URLs creating bookmarks rather than embeds (#20435)
closes https://github.com/TryGhost/Ghost/issues/20028

It's fairly common practice for oembed providers to skip some of the "required" fields from the oembed spec such as `height` when it doesn't make sense for the embeddable content, this was the case with Bluesky embeds which return `height: null`

- removed validation for `height` being present in the response for it to be recognised as an embed because we don't use it anywhere and the validation is blocking otherwise valid embeds
2024-06-20 20:41:24 +00:00
Kevin Ansfield
5248fbd98e 🐛 Fixed inability to override accent color variable via code injection
closes https://linear.app/tryghost/issue/ONC-72

- moved output of the accent color style element before the site and post/page/tag code injection output
2024-06-20 20:47:11 +01:00
Kevin Ansfield
414b2ff514 Moved internal linking feature out of beta
no issue

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

- Link toolbar and bookmark cards now let you search your existing posts/pages/tags/authors in addition to manually entering the URL
- Typing "@" inside your content lets you quickly search and add a text link
- Typing "@" on a blank paragraph provides a quick way to search and add a bookmark
2024-06-20 17:50:11 +01:00
Sag
1c972c7dd1
🐛 Fixed button URL suggestions not loading for contributors, editors and authors (#20416)
ref https://linear.app/tryghost/issue/SLO-127

- problem: when using a card with a button (Button, Email CTA, Header,
Product), the Button URL suggestions fail to load for Contributors,
Authors, and Editors
- cause: Contributors, Authors and Editors don’t have permission to
fetch offers, and this causes the entire list of button url suggestions
to break
- solution: if offers fail to fetch for any reason, the rest of the url
suggestions for cards with a button is now still populated (i.e. offers
URLs are ignored)
2024-06-20 14:22:41 +02:00
Kevin Ansfield
524fe6ee19 Cleaned up onboardingChecklist GA labs flag
no issue

- removed labs flag
- removed labs flag conditionals
- removed code related to old setup/done screen
- fixed tests that weren't correctly running against the GA flag code
2024-06-20 11:42:42 +01:00
Kevin Ansfield
643b80ad4c 🐛 Fixed dashboard appearing blank if members disabled before completing onboarding
closes https://linear.app/tryghost/issue/ONC-106

- moved onboarding display outside of the `isMembersEnabled` conditional block
2024-06-20 10:43:58 +01:00
Ghost CI
be79f385f2 Merged v5.85.2 into main 2024-06-19 23:16:28 +00:00
Ghost CI
0c61e0cf59 v5.85.2 2024-06-19 23:16:27 +00:00
Chris Raible
a8e1a707d5 🐛 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-19 15:58:54 -07:00
Chris Raible
417c9c49ea
Added OpenTelemetry instrumentation to Ghost backend (#20144)
This commit adds OpenTelemetry instrumentation to Ghost's backend, which
allows us to view traces similar to what we see in Sentry Performance
locally.

OpenTelemetry is enabled if `NODE_ENV === 'development'` or if it is
explicitly enabled via config with `opentelemetry:enabled`.

It also adds a [Jaeger](https://www.jaegertracing.io/) container to
Ghost's docker-compose file for viewing the traces. There's no setup
required (beyond running `yarn docker:reset` to pickup the changes in
the docker-compose file the first time — but this will also reset your
DB so be careful). This will launch the Jaeger container, and you can
view the UI to see the traces at `http://localhost:16686/search`.
2024-06-19 13:56:51 -07:00
renovate[bot]
ae6e7d9134 Update dependency webpack to v5.92.1 2024-06-19 16:55:02 +00:00
renovate[bot]
f43cc93760 Update dependency nodemailer to v6.9.14 2024-06-19 16:54:52 +00:00
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