Commit Graph

2633 Commits

Author SHA1 Message Date
Simon Backx
320eaac4c4
Removed usage of unquoted ids in filter strings (#19031)
fixes GRO-34
fixes GRO-33

This also adds a new way to run all tests with enforced numeric ObjectIDs.
These numeric ids cause issues if they are used withing NQL filters. So they
surface tiny bugs in our codebase.

You can run tests using this option via:
NUMERIC_IDS=1 yarn test:e2e

Also removed some defensive logic that could be explained by unquoted ids.
2023-11-20 14:00:31 +01:00
Kevin Ansfield
1be490ae9e
Reduced size of social metadata images (#19048)
refs https://github.com/TryGhost/Product/issues/4140

- added `social-image` image size to our `internalImagesSizes` list with a max-width of 1200
- extracted image utils from `{{img_url}}` helper to a utils file for re-use
- updated `getImageDimensions` method that reads image dimensions and modifies the finalised `metaData` object before use to adjust dimensions and associated URLs to match max width of 1200px
2023-11-20 12:39:51 +00:00
renovate[bot]
0cf25d0afe Update dependency yjs to v13.6.9 2023-11-20 12:25:48 +00:00
Jono M
5e057dee11
Added tests to AdminX framework package (#19022)
refs https://github.com/TryGhost/Product/issues/4159

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset)
Generated by Copilot at 9e68f4d</samp>

This pull request refactors several components in the `admin-x-settings`
app to use common hooks from the `@tryghost/admin-x-framework` package,
which reduces code duplication and improves consistency. It also updates
the `package.json` file and adds unit tests for the `admin-x-framework`
package, which improves the formatting, testing, and dependency
management. Additionally, it makes some minor changes to the `hooks.ts`,
`FrameworkProvider.tsx`, and `.eslintrc.cjs` files in the
`admin-x-framework` package, which enhance the public API and the
linting configuration.
2023-11-20 11:00:51 +00:00
Ghost CI
a1d7aa6dba v5.74.0 2023-11-17 16:05:58 +00:00
Ghost CI
d77ef5de7c 🎨 Updated Source to v1.1.1 2023-11-17 16:05:58 +00:00
Simon Backx
32d0d2b293 Added filter to filter members by email disabled
fixes GRO-23

Co-authored-by: Djordje Vlaisavljevic <dzvlais@gmail.com>
Co-authored-by: Sag <guptazy@gmail.com>
2023-11-16 19:16:20 +01:00
Sag
69ee4a5ff5
Added option to unsubscribe in one-click from emails (#19032)
refs https://github.com/TryGhost/Product/issues/4051
- added a "List-Unsubscribe" header to emails, in compliance with the
RFC 8058 requirements
- Gmail, Apple Mail, Yahoo Mail, and other popular email clients offer
an option to unsubscribe in one-click, based on the "List-Unsubscribe"
header. Some require an HTTPS endpoint, some a mailto address; both
options are provided in the "List-Unsubscribe" header

Co-authored-by: Simon Backx <simon@ghost.org>
Co-authored-by: Djordje Vlaisavljevic <dzvlais@gmail.com>
2023-11-16 14:50:24 -03:00
Daniel Lockyer
5acecf2cae ️ Improved GScan performance for themes with many partials
refs https://github.com/TryGhost/DevOps/issues/3
refs b6d8e0192a

- see referenced commit for full context but this should improve the
  theme check time for themes with a large number of files and partials
- locally, checking a particularly heavy theme goes from 5s to 1.7s with this
  commit, and the improvement is larger on slower machines
2023-11-16 13:55:57 +01:00
Simon Backx
e3cdc24d6b
Added test to test default theme against linked gscan version (#19020)
fixes GRO-32

If we ever introduce errors in the linked source theme and linked gscan
version combination, this test will catch it.
2023-11-16 12:03:00 +00:00
Simon Backx
3a78cf48c9
Fixed deleting session when requesting identity for invalid session (#19017)
ref https://ghost.slack.com/archives/C02G9E68C/p1700129928489809

- When the GET /api/session endpoint is called, the session is deleted
if it is invalid
- We don't have a body parser for this GET endoint, and the request
object was passed to the deleteSession handler. This caused a type error
(cannot read properties of undefined)
- We had dangling promise because deleteSession is async and wasn't
awaited, causing random errors in tests
- Added a test that would have caught this earlier
2023-11-16 11:01:50 +00:00
Ronald Langeveld
2bd597fe0d
Added createdAt prop to Offers API request. (#19012)
refs https://github.com/TryGhost/Product/issues/4153

- We need use the `created_at` timestamp in the new AdminX offers. The
API doesn't return that value.
- With this change the API returns the created_at property so that we
can consume it.
---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset)
Generated by Copilot at dc282af</samp>

This pull request adds a `createdAt` property to the offer domain model,
data transfer object, and repository. This allows tracking and auditing
the creation and modification of offers and offer codes in
`ghost/offers`.
2023-11-16 17:33:01 +07:00
Simon Backx
e5f644c27f
🐛 Fixed contain/starts/endsWith filters with /, _ or % in them (#19015)
fixes GRO-25

Updated @tryghost/nql to 0.12.0 and other packages that depend on it

1. SQLite: when a filter string contains /.

When we use a NQL contain/starts/endsWith filter that contains a slash,
underlyingly the whole filter will get converted to a MongoDB query, in
which we just use a regexp to represent the filter. In here we will
escape the slash: \/ as expected in a regexp. Later when we convert this
MongoDB query back to knex/SQL, we use a SQL LIKE query. Currently we
don't remove the escaping here for a normal slash. MySQL seems to ignore
this (kinda incorrect). SQLite doesn't like it, and this breaks queries
on SQLite that use slashes. The solution here is simple: remove the
backslash escaping when converting the regexp to LIKE, just like we do
with other special regexp characters.

2. We don't escape % and _, which have a special meaning in LIKE queries

Usage of % and _ is now as expected and doesn't have the special SQL
meaning anymore.
2023-11-16 09:35:20 +00:00
Steve Larson
d0fa385848
Added jpeg compression (#19006)
refs TryGhost/Product#4140
- bumped image-transform to add jpeg compression
2023-11-15 23:30:48 +00:00
Steve Larson
40a8e969b8
Revert "Bumped image transform package (#19003)" (#19004)
This reverts commit 557c01f48c.
2023-11-15 20:25:29 +00:00
Steve Larson
557c01f48c
Bumped image transform package (#19003)
refs TryGhost/Product#4140
- adds compression for jpeg > jpeg or any > jpeg asset generation
2023-11-15 19:14:23 +00:00
Simon Backx
75bb53f065
🔒 Added support for logging out members on all devices (#18935)
fixes https://github.com/TryGhost/Product/issues/3738
https://www.notion.so/ghost/Member-Session-Invalidation-13254316f2244c34bcbc65c101eb5cc4

- Adds the transient_id column to the members table. This defaults to
email, to keep it backwards compatible (not logging out all existing
sessions)
- Instead of using the email in the cookies, we now use the transient_id
- Updating the transient_id means invalidating all sessions of a member
- Adds an endpoint to the admin api to log out a member from all devices
- Added the `all` body property to the DELETE session endpoint in the
members API. Setting it to true will sign a member out from all devices.
- Adds a UI button in Admin to sign a member out from all devices
- Portal 'sign out of all devices' will not be added for now

Related changes (added because these areas were affected by the code
changes):
- Adds a serializer to member events / activity feed endpoints - all
member fields were returned here, so the transient_id would also be
returned - which is not needed and bloats the API response size
(`transient_id` is not a secret because the cookies are signed)
- Removed `loadMemberSession` from public settings browse (not used
anymore + bad pattern)

Performance tests on site with 50.000 members (on Macbook M1 Pro):
- Migrate: 6s (adding column 4s, setting to email is 1s, dropping
nullable: 1s)
- Rollback: 2s
2023-11-15 17:10:28 +01:00
Kevin Ansfield
3358ba305b
🐛 Fixed highlight formatting not showing in rendered posts (#18997)
closes https://github.com/TryGhost/Product/issues/4144

- bumped `@tryghost/kg-lexical-html-renderer` which adds highlight (`<mark>`) support
2023-11-15 14:08:14 +00:00
Kevin Ansfield
26554bc206
Improved lexical render performance (#18967)
closes https://github.com/TryGhost/Product/issues/4133

- we were creating a new JSDOM instance every time we rendered a card which lowered performance because JSDOM instantiation is heavy
- updated Koenig packages to remove the need for passing in an external `createDocument` option method as they now re-use the renderer's internal single instance of JSDOM
2023-11-15 12:33:22 +00:00
Daniel Lockyer
05977d5c26 Added boot time performance test to CI
refs https://github.com/TryGhost/DevOps/issues/105

- this will run a small benchmark on the boot time for Ghost, and push
  the stats to another repository which has GitHub Pages enabled, so we
  can visualise the change over time
- will only run on pushes to `main` so we don't pollute the stats with
  commits from PRs
- just a test for now to see if we get stable numbers
2023-11-15 13:24:56 +01:00
renovate[bot]
4651ef3d9b Update sentry-javascript monorepo to v7.80.1 2023-11-15 12:31:56 +01:00
Ghost CI
d8aba91f51 Merged v5.73.2 into main 2023-11-14 22:14:15 +00:00
Ghost CI
499b894f8d v5.73.2 2023-11-14 22:14:14 +00:00
Kevin Ansfield
4394580c1a
🐛 Fixed and improved various editor issues
closes https://github.com/TryGhost/Product/issues/4146
closes https://github.com/TryGhost/Ghost/issues/17753
closes https://github.com/TryGhost/Product/issues/4127
closes https://github.com/TryGhost/Ghost/issues/18903

- 🐛 Fixed blank render output in some cases when using line breaks
- 🐛 Fixed backspace at end of link sometimes deleting whole link in Firefox
- 🐛 Fixed plain black generated video thumbnails in Safari
- 🎨 Added `srcset` and `loading="lazy"` to header card images
- 🎨 Improved accessibility of buttons in render output by adding `aria-role` attributes
- 🎨 Removed Ctrl/Cmd+H shortcut as it clashed with expected OS shortcut
2023-11-14 21:59:45 +00:00
Steve Larson
0fe573b1d0
🐛 Redirected email previews to /email/ route (#18976)
closes TryGhost/Product#4136
- the `/p/` route is only intended for drafts, not published content
(e.g. sent newsletters)
- email-only posts (newsletters) do not get assigned a slug, and could
still be viewed at `/p/:uuid`, which didn't hide paid/member content
2023-11-14 13:31:41 -06:00
Simon Backx
370c6b465b
Filter members by email disabled (#18884)
fixes https://github.com/TryGhost/Product/issues/4108

- Updates filters behind a new alpha feature flag so you can also filter
on members who have email disabled (because the email had a permanent
bounce, they reported spam or the email address is invalid)
- When returning members, we now also use the email_disabled flag to set
email_suppression.suppressed correctly (in case they are out of sync,
which should normally never happen).
2023-11-14 14:37:01 +01:00
renovate[bot]
7799e0f47b Update dependency json-stable-stringify to v1.1.0 2023-11-13 23:16:24 +00:00
Sag
6db7cc8156
Removed email from Mailgun's suppression list on unsubscribe (#18922)
closes https://github.com/TryGhost/Product/issues/4075

- when a member clicks on "Unsubscribe from that list" from Apple Mail,
the member's email is put into Mailgun's Unsubscribe suppression list.
Ghost listens for "Unsubscribe" events from Mailgun, and unsubscribes
the member from all the newsletters
- now, the member is only unsubscribed from the newsletter they
unsubscribe to (not all of them)
- now, the email is also deleted from Mailgun's suppression list, so
that it doesn't affect any other membership
2023-11-13 16:56:37 -03:00
Daniel Lockyer
3513ef3032 Fixed extra quote in logging line
- spotted in logs
2023-11-13 16:23:26 +01:00
Sanne de Vries
6f3ebae4c0
Fixed cursor on toggle button to display as pointer (#18964)
No ref
2023-11-13 15:07:35 +00:00
Daniel Lockyer
337b550b7e Moved monobundle into monorepo
fixes https://github.com/TryGhost/DevOps/issues/99

- this inlines the `monobundle` script into the monorepo from an
  external repo in order to avoid some caching issues we've seen
- it also makes it easier to maintain because you can change the script
  alongside changes in the monorepo
2023-11-13 13:30:38 +01:00
Sanne de Vries
5b73dd9f22
Fixed broken toggle card icon on iOS (#18959)
Closes https://github.com/TryGhost/Ghost/issues/18902
2023-11-13 11:01:25 +00:00
Simon Backx
14927ee24b
Added quotes to NQL filters with ids (#18958)
refs https://github.com/TryGhost/Product/issues/4120

Updated some places where we don't add quotes around ids in NQL filters,
which can be an issue when the id is a number
2023-11-13 12:00:20 +01:00
renovate[bot]
93fc6106dd Update dependency luxon to v3.4.4 2023-11-13 09:50:36 +01:00
Ghost CI
590505ca17 v5.73.1 2023-11-13 08:19:25 +00:00
Ghost CI
f46ba34c54 v5.73.0 2023-11-10 16:04:09 +00:00
Ghost CI
44791446a2 Merged v5.72.2 into main 2023-11-10 01:45:16 +00:00
Ghost CI
a333820324 v5.72.2 2023-11-10 01:45:14 +00:00
Kevin Ansfield
30a66da4e3
🐛 Fixed various editor issues (#18934)
refs https://github.com/tryghost/ghost/issues/18752, https://github.com/TryGhost/Product/issues/3897, https://github.com/TryGhost/Product/issues/4112,https://github.com/TryGhost/Product/issues/3802, https://github.com/TryGhost/Product/issues/4104, https://github.com/TryGhost/Ghost/issues/18866, https://github.com/TryGhost/Ghost/issues/18753, https://github.com/TryGhost/Product/issues/4116, https://github.com/TryGhost/Ghost/issues/18888, https://github.com/TryGhost/Ghost/issues/18844

- 🐛 Fixed browser focus on editor when clicking card ([Koenig/#1051](https://github.com/TryGhost/Koenig/pull/1051))
- 🐛 Fixed signup card styles with image background ([Koenig/#1052](https://github.com/TryGhost/Koenig/pull/1052))
- 🐛 Fixed slash menu having fixed position when scrolling ([Koenig/#1054](https://github.com/TryGhost/Koenig/pull/1054))
- 🐛 Fixed signup card text color with transparent background ([Koenig/#1053](https://github.com/TryGhost/Koenig/pull/1053))
- 🐛 Fixed text formats being lost when copy/pasting from Google Docs ([Koenig/#1055](https://github.com/TryGhost/Koenig/pull/1055))
- 🐛 Fixed pasting link behaviour in single line nested editors ([Koenig/#1056](https://github.com/TryGhost/Koenig/pull/1056))
- 🐛 Fixed backspace behaviour at start of aside/quote ([Koenig/#1057](https://github.com/TryGhost/Koenig/pull/1057))
- 🐛 Fixed text having unexpected formats when rendering ([Koenig/#1058](https://github.com/TryGhost/Koenig/pull/1058))
- 🐛 Fixed placeholder descenders being cut off in nested editor ([Koenig/#1059](https://github.com/TryGhost/Koenig/pull/1059))
- 🐛 Fixed HTML->Lexical conversion not handling paragraphs inside blockquotes ([Koenig/#1061](https://github.com/TryGhost/Koenig/pull/1061))
2023-11-09 16:26:22 +00:00
Michael Barrett
bcfb8e1291
Misc Sentry tweaks (#18900)
no refs

- Removed redundant duplicated `save_revision` tag when capturing slow
saves
- Standardised Sentry tags casing (`snake_case`)
- Renamed tag `adminX settings component-` to
`adminx_settings_component`
2023-11-09 14:10:53 +00:00
Djordje Vlaisavljevic
057d952e27
Made new recommendation email more flexible (#18915)
refs https://github.com/TryGhost/Product/issues/4095

- Removes `min-height` of the card in order to make the template more
flexible half-empty states look better (missing description, short
description, featured image...)
- Fixes wrong variables used in Outlook-specific template
2023-11-08 16:44:48 +00:00
Simon Backx
986296cac9 🐛 Fixed unsubscribe button requiring manual action + wrong confirmation
fixes https://github.com/TryGhost/Product/issues/4118

The newsletter uuids were not passed when fetching all the members current newsletters. Therefore, Portals logic broke to remove all newsletters that matched the uuid that was passed to the unsubscribe link. No newsletters were removed, still the notification toast said that the member was unsubscribed from the newsletter.
2023-11-08 15:05:47 +01:00
renovate[bot]
85979df33d Update sentry-javascript monorepo to v7.78.0 2023-11-08 14:06:32 +01:00
Kevin Ansfield
3a975fee18
Added debug timing logs for HTML conversion library import+convert (#18912)
refs https://github.com/TryGhost/Product/issues/4086

- we're seeing random test timeouts on CI but not locally, these logs should help pinpoint if it's the require that's taking a long time, the conversion itself, or something else entirely
2023-11-08 12:26:03 +00:00
renovate[bot]
2ca1083de7 Update Types packages 2023-11-08 12:13:12 +01:00
Sag
e16102f4f1
Fixed metadata for recommendations from private sites (#18901)
refs https://github.com/TryGhost/Product/issues/4098
- added basic metadata (title, description, image, url) on the password
wall for private sites
- when a private site recommends me, I can now see the usual metadata
2023-11-07 17:41:53 -03:00
Daniel Lockyer
5739fbe3d2 Fixed bundling apps/ packages into tarball
refs 811679e94b
refs https://ghost.slack.com/archives/C0568LN2CGJ/p1699352735496789

- this bumps monobundle so it doesn't include `apps/` packages in the
  tarball
- soon we'll inline the script into this repo anyway
2023-11-07 12:10:47 +01:00
Sanne de Vries
dbe00929d3
Changed "latest posts" layout in email template on mobile (#18894)
Refs https://ghost.slack.com/archives/C019B1K4FAM/p1699127038805739

- Removed mobile styles so that latest posts are always in the same
layout, instead of in a single column on mobile
- Fixed img caption font size rendering too large on mobile
2023-11-07 11:23:03 +01:00
Nick Moreton
b9b1502772
🐛Changed "free_signups" to "signups" in Post Exporter (#18883)
ref https://github.com/TryGhost/Product/issues/4110

Made this change to increase clarity in data export

---

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

Renamed a column in posts export data and updated the corresponding test
case. This change makes the export data more consistent and clear for
users who have different member features enabled.
2023-11-07 09:52:28 +00:00
Daniel Lockyer
9c6dc044b3 Skipped random flaky HTML -> Lexical test
refs https://github.com/TryGhost/Product/issues/4086

- this test is randomly timing out so we're disabling it until we figure out
  the cause
2023-11-07 09:50:53 +01:00