Commit Graph

1180 Commits

Author SHA1 Message Date
Rishabh Garg
c7230f1858
Improved email stability (#16159)
- bumps new email flows to GA improving overall email stability
2023-01-20 18:55:20 +05:30
Simon Backx
e879406659
Added outbound link tagging setting (#16146)
fixes https://github.com/TryGhost/Team/issues/2432
    
Adds outbound_link_tagging setting (enabled by default and behind
feature flag). If the feature flag is enabled, and the setting is
disabled, we won't add ?ref to links in emails.
    
This includes new E2E tests for email click tracking, which were also
extended to check outbound link tagging (for both MEGA and the new email
stability flow).

Also fixes a test fixture for the comments_enabled setting.
2023-01-20 13:41:36 +01:00
Simon Backx
8a95c62ff1
🐛 Fixed post links being marked as edited when they were not (#16153)
fixes https://github.com/TryGhost/Team/issues/2461

- Ignores 'edited' links when there is only one second differences.
- Make sure we don't set updatedAt when linking a post to a redirect
2023-01-20 13:31:54 +01:00
Daniel Lockyer
34fe49b110
Added version information to log lines
refs https://github.com/TryGhost/Toolbox/issues/501

- this reverts commit 48dda23554
- also includes a resolution for `@elastic/elasticsearch` so we don't
  run a version that is potentially problematic - see referenced issue
  for context
2023-01-20 13:18:44 +01:00
Fabien "egg" O'Carroll
40c280f6ac Improved naming of output serializer url util 2023-01-20 18:49:26 +07:00
Fabien "egg" O'Carroll
68f469c78b Fixed mock instantiation
This mock will fail by default now, which stops us from adding bad data in prod.
2023-01-20 18:49:26 +07:00
Fabien "egg" O'Carroll
833182bc7f Implemented a basic RoutingService for Mentions
refs https://github.com/TryGhost/Team/issues/2466

This initial implementation just checks that we're on the right origin and
subdomain, but should be extended to check if the URL actually resolves to a
page hosted on the site!
2023-01-20 18:49:26 +07:00
Fabien "egg" O'Carroll
5b4bc01504 Added initial inline ResourceService implementation
refs https://github.com/TryGhost/Team/issues/2465

We've restricted this to Post resources for now until we update the Mention
entity to be able to handle multiple resource types.
2023-01-20 18:49:26 +07:00
Naz
d44386dae3
Refactored resource config as a DI in Resources
refs https://github.com/TryGhost/Toolbox/issues/503
refs https://github.com/TryGhost/Toolbox/issues/406

- In Ghost 5.x we dropped multi-versioned API, which means there's no need to track resource configs dynamically as there can only be one version
- Along with removed "initResourceConfig" refactored the "config" file itself to be injected into Resource's constructor - allows for easier testing.
2023-01-20 19:47:26 +08:00
Ronald Langeveld
3061fb2b3b
Added mentions database table (#16150)
closes https://github.com/TryGhost/Team/issues/2417

- added new `mentions` database table to be able to store incoming webmentions.
- updated schema and tests to match.
2023-01-20 19:08:07 +08:00
Steve Larson
8895d22602
Added mention discovery service (#16154)
fixes https://github.com/TryGhost/Team/issues/2407

The MentionDiscoveryService fetches mentioned sites to return the webmention endpoint.
2023-01-20 11:45:48 +01:00
Fabien 'egg' O'Carroll
b1e6eb0b5e
Unsubscribed existing Members with suppressed emails (#15952)
refs https://github.com/TryGhost/Team/issues/2367

We already have existing Members which have their emails suppressed that
need to have their newsletter subscriptions removed.
2023-01-20 16:14:50 +07:00
renovate[bot]
81fe4840dd Update dependency postcss to v8.4.21 2023-01-20 09:07:51 +01:00
Simon Backx
a596acf7d2
Added MentionSendingService (#16151)
fixes https://github.com/TryGhost/Team/issues/2409

The MentionSendingService listens for post changes and sends webmentions
for outbound links in the post.
2023-01-19 17:35:10 +01:00
Fabien "egg" O'Carroll
111c5742c9 Implemented WebmentionMetadata using the oembed service
https://github.com/TryGhost/Team/issues/2458

This is an initial pass at pulling metadata from webmention sources, we've also
updated the fake data to pull from some real-world sites which implement
webmentions. We've reused the oembed service here, long term it would be nice to
pull the metadata parsing/pulling part out, so that we can have more generic
error messages.
2023-01-19 19:25:52 +07:00
Fabien "egg" O'Carroll
743da542d0 Wired up the Webmention receive endpoint to the Mentions service
refs https://github.com/TryGhost/Team/issues/2419

This is the initial stab at having everything wired up, we're not
using a queue but we are handling the processing of the Webmention
asyncrounsly so that the HTTP response can be end immediately.

We've also laid the groundwork for extending and implementing the
correct processing of Webmentions, for example checking if the target
URL exists in the system, pulling out the metadata from the Webmention
source and fetching any internal resources.
2023-01-19 18:41:49 +07:00
Fabien "egg" O'Carroll
d0d45d45bc Refactored OEmbed service into a proper service
This allows us to share the implementation with other parts of the codebase, the
specific usecase here being fetching the metadata from webmention sources, for
display in the mentions UI, which will be borrowing a lot of stuff from the
bookmark card.
2023-01-19 18:41:49 +07:00
Fabien "egg" O'Carroll
a7eeb8f628 Fixed Mention Admin API mapper
There was a typo when reading the featured image property causing it not to show
up in the API responses.
2023-01-19 18:41:49 +07:00
Fabien "egg" O'Carroll
52892e0695 Added source_site_title and source_author to Mentions Admin API
refs https://github.com/TryGhost/Team/issues/2435

We need to update the API to explicitly include the new data from our Mention
entity
2023-01-19 18:41:49 +07:00
Daniel Lockyer
f45bba21f6
Disabled autoRefresh for inserted Actions events
- we don't end up using the inserted model from Bookshelf, so we
  shouldn't be performing a SELECT on the entry
- this disables refreshing the model using Bookshelf's `autoRefresh:
  false` and allows the key through the sanitization for `add
2023-01-19 09:28:28 +01:00
Daniel Lockyer
5b2fc983c6
Added email snapshots to settings BREAD service test
refs https://github.com/TryGhost/Toolbox/issues/499

- switching to email snapshots allows us to track more of our output to check for regresssions
2023-01-18 14:19:27 +01:00
Simon Backx
4d54880113
Added error handling for ENAMETOOLONG import error (#16054)
fixes https://github.com/TryGhost/Team/issues/2200

When zipping a folder that contains files with UTF-8 characters in the filename, using the MacOS Archive Utility, the resulting zip will be missing some UTF-8 configuration bit. This breaks the unzipper, causing it to decode the filenames using the wrong encodign.

When the file names are long, and become longer than the length allowed by the OS, an ENAMETOOLONG error is thrown. This error is not handled by the importer, and causes the import to fail.

This adds a specific check for this error so we can show a clear error message to the user, that helps them to resolve the issue. We are currently unable to fix the issue on our side, because of a lack of well supported zip libraries for node.
2023-01-18 13:28:36 +01:00
Simon Backx
6c2af0793c Fixed failing Stripe webhook test
refs acf0baa8c7

Due to the bump in express-test, we now handle string bodies 'properly'. So they now pass all the Express middlewares. In the past this failing test did not really pass by the bodyParser.raw middleware,
so the content-type check on the `bodyParser.raw({type: 'application/json'})` middleware was not executed. Now it is, and the test fails because the content-type header was not set to application/json.
2023-01-18 12:05:55 +01:00
Simon Backx
acf0baa8c7 Updated express-test to 0.13.0
no issue

This includes support for uploading files in tests.
2023-01-18 11:42:42 +01:00
Simon Backx
2dc9c7dbba
🐛 Fixed suppression list data for emails with plus sign (#16140)
no issue

When fetching the suppression list data for emails with a plus sign, the
parsing of the NQL filter fails:

```at Child.applyDefaultAndCustomFilters (/Ghost/node_modules/@tryghost/bookshelf-filter/lib/bookshelf-filter.js:66:23)
[ghost] email:[simon+test@ghos
[ghost] ------------^
[ghost] Expecting 'OR', 'RBRACKET', got 'AND'
```
2023-01-18 10:17:57 +01:00
Daniel Lockyer
9ba251238a Added Content-Version header to all API requests
refs https://github.com/TryGhost/Team/issues/2400

- we've deemed it useful to start to return `Content-Version` for all
  API requests, because it becomes useful to know which version of Ghost
  a response has come from in logs
- this should also help us detect Admin<->Ghost API mismatches, which
  was the cause of a bug recently (ref'd issue)
2023-01-18 08:38:07 +01:00
Daniel Lockyer
85051199e3
Added email snapshots for API versioning tests (#16139) 2023-01-18 08:09:28 +01:00
renovate[bot]
28ed23c13e Update dependency knex to v2.4.1 2023-01-18 07:43:07 +01:00
Naz
967dd7d244
Added deprecation notice to mockManager's sentEmailCount
refs https://github.com/TryGhost/Toolbox/issues/499

- The mockManager's sentEmailCount is left here to avoid breaking many tests that already depend on this method. With future improvements to email snapshot tests this method should not be used. Instead, emailMockReceiver's own sentEmailCount method should be used directly.
2023-01-18 12:55:45 +08:00
Simon Backx
87be76ebb3 Added externalAttribution feature flag
fixes https://github.com/TryGhost/Team/issues/2430
2023-01-17 15:15:32 +01:00
Simon Backx
34d4e5c8d0
Added logging to webmention endpoint (#16137)
closes https://github.com/TryGhost/Team/issues/2424

Adds the new webmention endpoint, responds with the correct statuscode
and empty body at `https://site.ghost/webmentions/receive/`.

Also updates the head link tag to the new endpoint location. We don't
use /webmention because that could conflict with post slugs.
2023-01-17 14:26:43 +01:00
Daniel Lockyer
48dda23554
Reverted "Added version information to log lines"
refs https://github.com/TryGhost/Toolbox/issues/501

- this reverts commit f2116357b7
- something with Elasticsearch is causing high CPU usage, so this commit
  reverts that for now
2023-01-17 13:20:47 +01:00
Fabien "egg" O'Carroll
008d83ad08 Fixed the Mention mapper
This had some leftover code in that shouldn't have been merged.
2023-01-17 17:06:22 +07:00
Fabien "egg" O'Carroll
1babf6126a Added initial basic Mentions implementation
refs https://github.com/TryGhost/Team/issues/2416

This extends the mock API to use a more formal pattern of moving our
entity code into a separate package, and use the service/repository
patterns we've been work toward.

The repository is currently in memory, this allows us to start using
the API without having to make commitments to the database structure.

We've also injected a single fake webmention for testing. I'd expect
the Mention object to change a lot from this initial definition as we
gain more information about the type of data we expect to see.
2023-01-17 17:01:20 +07:00
renovate[bot]
3d79d10ddf Update dependency mysql2 to v3.0.1 2023-01-17 08:22:53 +01:00
Fabien 'egg' O'Carroll
a8a279d667
Wired up mock Mentions Admin API (#16134)
refs https://github.com/TryGhost/Team/issues/2416

This doesn't even return a Mention in the correct format at the moment,
but it's just to get an endpoint there, behind a flag and returning data
so that we can start playing with the API and having it hooked up the
the Admin.

The next step will be fleshing this out further and defining the
services and repository to back it, as well as updating the Admin so that
we can fetch mentions to display in the UI
2023-01-17 12:39:32 +07:00
Naz
112ab23968
Removed direct use of @tryghost/jest-snapshot
refs https://github.com/TryGhost/Toolbox/issues/499
refs 6bcc47a0ad

- Using module directly caused issues with snapshots manager instance initialization (mocha hooks did not apply to a correct instance)
- See refed commit for more
2023-01-17 12:50:49 +08:00
Naz
1f6b2b4d5e
Added email content testing capabilities
refs https://github.com/TryGhost/Toolbox/issues/499

- Outgoing emails have been a weak point of Ghost's stability recently. The concept of "emailMockReceiver" similarly to "webhookMockReceiver", allows to test side-effects like outgoing emails.
- This is a first iteration which should lay groundwork for testing all outgoing emails in the future
- The change adds a new concept of "email mock receiver" which is very similar to how the "webhook mock receiver" works. The email mock receiver exposes two methods to record and verify snapshots:
- matchHTMLSnapshot - records and verifies only the HTML content of the outgoint email
- matchMetadataSnapshot - records and verifies all the non-HTML properties sent along an email content, e.g.: to address, plaintext, subject, etc.
- What's missing is matching content based on dynamic content like dates, links with JWT tokens, etc.
2023-01-17 12:50:49 +08:00
Steve Larson
9199547bfe add webmentions feature flag
refs #2406
Adding the alpha feature flag so we can begin testing.
2023-01-16 15:03:36 -06:00
renovate[bot]
e95cff2ef4 Update dependency glob to v8.1.0 2023-01-16 09:59:45 +01:00
renovate[bot]
15c6fbb12a Update dependency html-validate to v7.13.1 2023-01-16 09:57:58 +01:00
Ghost CI
460d2dc339 v5.30.1 2023-01-16 05:35:14 +00:00
Fabien 'egg' O'Carroll
a30bbd5c69
Added webmention endpoint discovery link to ghost_head (#16126)
We've wrapped both changes in a try/catch to make sure this has no
adverse affects. The endpoint currently doesn't exist - we're only
adding this to get an idea of how much traffic we'll expect to see.

Long term we'll want to read the endpoint from the webmention service.
2023-01-16 12:32:04 +07:00
renovate[bot]
9dda708305
Update dependency eslint to v8.32.0 2023-01-16 00:19:30 +00:00
Ghost CI
2884521195 v5.30.0 2023-01-13 16:00:44 +00:00
Rishabh Garg
7d060e5edb
Bumped email stability flag to beta (#16116)
- allows email stability to be turned on without developer experiments enabled
2023-01-13 20:30:15 +05:30
renovate[bot]
a990769e31 Update dependency jwks-rsa to v3.0.1 2023-01-13 14:07:10 +01:00
Fabien 'egg' O'Carroll
14f282d640
Improved newsletter delivery rates and email suppression handling
This introduces the new suppressions feature which will automatically
unsubscribe members from newsletters when their email is added to the
suppression list in Mailgun, this is usually due to emails either
permanently bouncing to the address, or the member making a spam
complaint.

Both Members and Admins are able to see that the email has been added to
the list, and Members are be able to request their email be removed from
the list via Portal.

Overall this feature should improve delivery rates of newsletters and
improve the rating of the domain you're sending from.
2023-01-13 15:46:57 +07:00
Naz
c2b18f0c87
🔥 Removed support for {{lang}} helper
refs https://github.com/TryGhost/Toolbox/issues/497
refs https://github.com/TryGhost/Toolbox/issues/406

- Removes {{lang}} helper which has been completely deprecated since Ghost 5.0. When using the helper in themes with 5.x backend the output will be empty
2023-01-13 13:12:53 +07:00
Rishabh Garg
755e031017
Fixed hidden free tier in Portal settings (#16072)
closes https://github.com/TryGhost/Team/issues/2338

If a site has the Free tier hidden from the Portal, and subsequently the Stripe connection is disconnected, this produces a dead-end state where no new members can sign up and the Free tier cannot be reactivated again in Portal settings as its hidden. This change -

- enables free tier toggle to be always shown on site irrespective of Stripe connection
2023-01-12 19:29:17 +05:30