Commit Graph

213 Commits

Author SHA1 Message Date
Simon Backx
17ec1e8937
Added email address alignment protections (#19094)
ref GRO-54
fixes GRO-63
fixes GRO-62
fixes GRO-69

When the config `hostSettings:managedEmail:enabled` is enabled, or the
new flag (`newEmailAddresses`) is enabled for self-hosters, we'll start
to check the from addresses of all outgoing emails more strictly.

- Current flow: nothing changes if the managedEmail config is not set or
the `newEmailAddresses` feature flag is not set
- When managedEmail is enabled: never allow to send an email from any
chosen email. We always use `mail.from` for all outgoing emails. Custom
addresses should be set as replyTo instead. Changing the newsletter
sender_email is not allowed anymore (and ignored if it is set).
- When managedEmail is enabled with a custom sending domain: if a from
address doesn't match the sending domain, we'll default to mail.from and
use the original as a replyTo if appropriate and only when no other
replyTo was set. A newsletter sender email addresss can only be set to
an email address on this domain.
- When `newEmailAddresses` is enabled: self hosters are free to set all
email addresses to whatever they want, without verification. In addition
to that, we stop making up our own email addresses and send from
`mail.from` by default instead of generating a `noreply`+ `@` +
`sitedomain.com` address

A more in depth example of all cases can be seen in
`ghost/core/test/integration/services/email-addresses.test.js`

Includes lots of new E2E tests for most new situations. Apart from that,
all email snapshots are changed because the from and replyTo addresses
are now included in snapshots (so we can see unexpected changes in the
future).

Dropped test coverage requirement, because tests were failing coverage
locally, but not in CI

Fixed settings test that set the site title to an array - bug tracked in
GRO-68
2023-11-23 10:25:30 +01:00
Simon Backx
b6519e0f1f
Removed usage of unquoted ids in filter strings (#19070)
fixes GRO-34
fixes GRO-33

This is a revision of a previous commit, that broke the browser tests
because changes in the data generator (requiring bookshelf had side
effects).

This 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

Removed some defensive logic that could be explained by this discovered
issue.
2023-11-21 09:45:36 +01:00
Simon Backx
d5492bd63c
Revert "Removed usage of unquoted ids in filter strings" (#19052)
Reverts TryGhost/Ghost#19031

Browser tests are failing with an unknown cause
2023-11-20 13:50:07 +00:00
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
renovate[bot]
3d3015dfba Update dependency html-validate to v8.7.2 2023-11-20 08:48:20 +01: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
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]
79cbf34b1b Update dependency html-validate to v8.7.1 2023-11-13 09:50:52 +01:00
Steve Larson
342b5512fc
🐛 Fix edge case resulting in duplicate emails for some recipients (#18941)
refs https://ghost.slack.com/archives/CTH5NDJMS/p1699359241142969

It's possible for `ObjectIDs` to have only numeric characters. We were
previously letting the type be inferred, which created a very rare but
possible edge case where the last recipient of an email batch had a
numeric ObjectID, resulting in a numeric comparison against alphanumeric
`ObjectIDs` in the database.
- updated the filter to add `'`'s around the `lastId` parameter
- updated tests to check for the type of the id filter parameter value
- can't fully test for numeric object IDs using what we have because
javascript cannot handle numerics of that size; may be able to look at
using fixture data loaded directly into the db
2023-11-10 01:24:56 +00: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
Chris Raible
3a4417ebd6
🐛 Fixed email rendering bug in Gmail for Android (#18886)
refs https://github.com/TryGhost/Ghost/pull/18587/files and
https://github.com/TryGhost/Ghost/pull/17475/files

- In October 2022, `juice`, a library Ghost uses to inline CSS for email
rendering, introduced a small change that began inlining `width: auto`
and `height: auto` from CSS on image tags, resulting in `width="auto"`
and `height="auto"` attributes being added to image tags in rendered emails
(cb62062794)
- This change in `juice` broke our email rendering in Outlook, which
doesn't play well with `width="auto"` attributes. The first two attempts
to workaround this new behavior in `juice` ended up fixing the issue in
Outlook, but breaking the rendering in other clients
- This commit stores the `height` and `width` attributes of all images
_before_ inlining the CSS with `juice`, and resets them to their
original values, only if they were set to `auto`
2023-11-06 16:40:08 -08:00
Chris Raible
0c972d8276
Fixed EmailRenderer stripping inline width tags from images (#18587)
no issue

- product card outputs the original width/height of the image in emails
which results in overflown images in Outlook
- Combined with https://github.com/TryGhost/Koenig/pull/983/files, this
change fixes rendering for product card images in Outlook

---------

Co-authored-by: Sodbileg Gansukh <sodbileg.gansukh@gmail.com>
2023-11-01 15:05:39 -07:00
Kevin Ansfield
75672a902b
Enabled emoji picker in feature image caption (#18824)
closes https://github.com/TryGhost/Koenig/pull/1038

- updated `<KoenigLexicalEditorInput>` to load `<EmojiPickerPlugin>` and compose it into the editor unless used with `<KoenigLexicalEditorInput @emojiPicker={{false}} />`
- bumped Koenig packages so `EmojiPickerPlugin` is available to import from `koenig-lexical`
2023-11-01 21:22:56 +00:00
Sanne de Vries
a38461a00d
Fixed email paywall styling bug on mobile (#18818)
Closes https://github.com/TryGhost/Product/issues/4089
2023-11-01 14:13:51 +00:00
renovate[bot]
057d9599f5 Update TryGhost packages 2023-10-31 20:54:17 +01:00
Simon Backx
6cc19e1851
Added List-Unsubscribe https endpoint (#18758)
refs TryGhost/Product#4052
2023-10-25 16:16:31 +02:00
Simon Backx
d0d0453833
Added mailto to list-unsubscribe test header (#18742)
refs https://github.com/TryGhost/Product/issues/4053

Testing changes
2023-10-24 13:34:52 +00:00
Simon Backx
c8f71e8504
Added list-unsubscribe feature flag and header (#18736)
refs https://github.com/TryGhost/Product/issues/4053

This adds the feature flag. If enabled, the list-unsubscribe header
should be set. The value currently is only for testing purposes and
probably won't work yet.
2023-10-24 10:35:47 +00:00
renovate[bot]
aabeb64a38 Update dependency html-validate to v8.7.0 2023-10-23 11:14:51 +02:00
renovate[bot]
24849d8787
🐛 Fixed indent behaviour for paragraphs (#18724)
no issue

- updates `@tryghost/koenig-lexical` with indent improvements
  - prevents indents on paragraphs/headings etc which are not supported when rendering for front-end display
  - improves indent behaviour for lists so <kbd>Tab</kbd> can be pressed anywhere in a list item to indent rather than only at the beginning of the list
2023-10-23 08:43:25 +00:00
renovate[bot]
93382df314
🐛 Fixed various editor issues (#18645)
closes https://github.com/TryGhost/Ghost/issues/18448

- improved slash menu positioning when opening at the bottom of a post
- fixed backspace sometimes deleting a preceding card (e.g. backspace at end of link inside a paragraph preceded by a card)
- fixed `?source=html` issues
  - images not rendering in front-end output after import
  - images wrapped in links losing their link after import
- fixed inline styles in HTML card content not displaying in the editor
- fixed broken help link in the email card
2023-10-19 19:17:23 +01:00
renovate[bot]
6af69a8bcd Update dependency html-validate to v8.6.0 2023-10-16 08:02:03 +02:00
Daniel Lockyer
85d41d0562 Aligned dependencies with resolution values
- this commit brings all dependencies up-to-date with the version set as
  a resolution
2023-10-13 08:37:36 +02:00
renovate[bot]
394c09be49 Update Koenig packages 2023-10-06 12:40:19 +01:00
renovate[bot]
991f815a51
Update Koenig packages (#18477)
[![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-card-factory](https://togithub.com/TryGhost/Koenig/tree/master#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`4.0.10` ->
`4.0.11`](https://renovatebot.com/diffs/npm/@tryghost%2fkg-card-factory/4.0.10/4.0.11)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkg-card-factory/4.0.11?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkg-card-factory/4.0.11?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkg-card-factory/4.0.10/4.0.11?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkg-card-factory/4.0.10/4.0.11?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@tryghost/kg-default-cards](https://togithub.com/TryGhost/Koenig/tree/master#readme)
([source](https://togithub.com/TryGhost/Koenig)) | [`9.1.4` ->
`9.1.5`](https://renovatebot.com/diffs/npm/@tryghost%2fkg-default-cards/9.1.4/9.1.5)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@tryghost%2fkg-default-cards/9.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tryghost%2fkg-default-cards/9.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tryghost%2fkg-default-cards/9.1.4/9.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tryghost%2fkg-default-cards/9.1.4/9.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

###
[`v4.0.11`](https://togithub.com/TryGhost/Koenig/compare/@tryghost/kg-card-factory@4.0.10...@tryghost/kg-card-factory@4.0.11)

[Compare
Source](https://togithub.com/TryGhost/Koenig/compare/@tryghost/kg-card-factory@4.0.10...@tryghost/kg-card-factory@4.0.11)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 10:53:31 +01:00
Daniel Lockyer
85098e07d4 Configured all unit tests to use dot reporter
refs https://ghost.slack.com/archives/C02G9E68C/p1696490748701419

- this configures mocha to use the dot reporter because the default is
  way too verbose in CI
2023-10-05 12:24:24 +02:00
renovate[bot]
b06ec3929d Update dependency html-validate to v8.5.0 2023-10-02 08:51:10 +02:00
Simon Backx
3a5c233122
🐛 Fixed staff emails eventually having invalid styles (#18363)
fixes https://github.com/TryGhost/Ghost/issues/17937

- We used a global Handlebars instance, which means it was reused across
Ghost
- Partials are different between parts of Ghost, that means the partials
were overwritten every time a normal Mailgun email was send
- All staff emails send after a normal newsletter would have invalid
styles because the partials for styles were overwritten
2023-09-26 16:25:03 +02:00
renovate[bot]
a9bd5ce820 Update dependency html-validate to v8.4.1 2023-09-25 09:09:49 +02:00
renovate[bot]
f35af08e03 Update dependency html-validate to v8.4.0 2023-09-11 17:31:03 +02:00
Daniel Lockyer
c6cb35074a Updated linting and testing packages 2023-09-01 15:51:17 +02:00
renovate[bot]
13837b166d Update dependency handlebars to v4.7.8 2023-08-31 13:26:36 +00:00
Sodbileg Gansukh
1a2fa55c1e Fixed product card image overflow in Gmail
no issues

- product card images have explicit width/height attributes, and when the width value is large (e.g. 2560), it causes an overflow on Gmail on Android
- the reason why there's no issue on other email clients is that Gmail on Android has autofit feature which makes the email width fit inside the screen automatically, and it made the email width very narrow when the product card image width isn't responsive
- this fix makes the product card image width responsive by explicitly setting it 100%
2023-08-23 22:02:54 +08:00
renovate[bot]
8f780ba763 Update dependency html-validate to v8.3.0 2023-08-22 17:40:25 +01:00
Steve Larson
fecd326510
📦 Updated koenig dependencies (#17728)
no refs
-contains multiple bug fixes and improvements
2023-08-15 11:38:41 -05:00
Sodbileg Gansukh
2a8c09e3d4
Fixed enormous site icon issue in Outlook (#17672)
refs https://github.com/TryGhost/Product/issues/3704

- the site icon has sizes defined in CSS and it works great for most
browsers
- but it becomes very large in Outlook and it requires explicit sizes in
the image markup for some reason
2023-08-10 17:26:55 -07:00
Steve Larson
8273671425
Updated bookmark card renderer (#17662)
refs https://github.com/TryGhost/Product/issues/3609
-reverted css changes
-reverted mobiledoc renderer
-made lexical renderer consistent with mobiledoc
-css classes were inverted for theme backwards compatibility
2023-08-10 13:41:59 +00:00
Sodbileg Gansukh
6a1906b14e Improved mobile styles of the header card email 2023-08-10 20:07:41 +08:00
renovate[bot]
eea5752841 Update dependency html-validate to v8.2.0 2023-08-09 11:28:06 +02:00
Simon Backx
4c8179312d
🎨 Added support for relative links in emails (#17630)
fixes https://github.com/TryGhost/Product/issues/3687

After this change, relative URLs in emails will be replaced with
absolute URLs using the post URL. Making relative Portal URLs possible
etc.

Updates the test data generator to fix invalid URL encoding (somehow a
backslash + escaped double quote was added when it wasn't required).
2023-08-08 13:22:56 +02:00
Sodbileg Gansukh
7d08b4a2fc Fixed background repeat of split header email 2023-08-08 18:50:44 +08:00
Sodbileg Gansukh
209649c556 Adjusted padding of the split header content 2023-08-08 16:08:14 +08:00
Sodbileg Gansukh
267d0fc045 Increased padding of the header card email 2023-08-07 08:37:57 +08:00
Sodbileg Gansukh
b9b959cd3c Header card email typography and spacing 2023-08-07 08:37:57 +08:00
Sodbileg Gansukh
013719f2db Reverted old header card styles and added explicit rules for the new card 2023-08-07 08:37:57 +08:00
Sodbileg Gansukh
4699f5b86e Added email styles for Header v2 2023-08-07 08:37:57 +08:00
Steve Larson
c539417e89
🐛 Fixed bookmark card metadata styles (#17577)
refs TryGhost/Product#3609
- author and publisher styles were mixed up in mobiledoc
- made consistent for author coming after publisher for md and lexical
- updated renderer packages
2023-08-02 14:13:25 -05:00
Ronald Langeveld
0029c444ad
Added test email rate limiting (#17505)
refs https://github.com/TryGhost/Product/issues/3651

- This is a security fix that addresses an issue causing malicious users
to abuse the test / preview email API endpoint.
- We have multiple procedures in place now to limit such users.
- First, we now only allow one email address to be passed into the
`sendTestEmail` method. This method only have one purpose, which is to
compliment the test email functionality within the Editor in Admin and
therefore have no reason to send to more than one email address at a
time.
- We then add an additional rate limiter to prevent a user from making
multiple requests, eg via a script.
- The new imposed limit is 10 test emails per hour.
2023-07-27 08:46:50 +02:00
Ghost CI
fc50d1e92c Merged v5.55.1 into main 2023-07-25 02:46:04 +00:00
Chris Raible
e50ad7561c
🐛 Fixed image rendering in Outlook email client (#17475)
refs TryGhost/Product#3647

- The latest version of juice (which Ghost uses to inline css in email
newsletters) included new functionality to add height="auto" and
width="auto" for any images with dimensions set to auto in css
- This was causing rendering issues in Outlook, which would render the
image at full width, which often added a horizontal scroll and generally
messed up the flow of the document
- This change prevents juice from modifying the height or width of `<img
/>` tags
2023-07-24 18:33:56 -07:00