Commit Graph

16212 Commits

Author SHA1 Message Date
Fabien "egg" O'Carroll
531e4ab1a9 Removed service.js files from unit test coverage
The service.js files are rarely unit tested because they are
essentially glue code which acts as a singleton and doesn't use
dependency injection, this lil cocktail makes it difficult to stub
dependencies, as well as to call the init method more than once in a
test suite. This change should give us improved unit test coverage
2023-03-13 17:26:03 +07:00
Sodbileg Gansukh
905c2ed090 Adjusted hover text for scheduled email-only posts
refs https://github.com/TryGhost/Team/issues/2533

- changes the text from "to be published and sent" to "to be sent"
- this applies to scheduled email-only posts only
2023-03-13 17:54:34 +08:00
Sanne de Vries
f31c69d7d5 Added UI for new settings in email newsletter settings
Refs https://github.com/TryGhost/Team/issues/2699

- Added 'Making it rain' feature flag
- Added toggles for newsletter title section, comment links, and latest posts
2023-03-13 09:56:35 +01:00
renovate[bot]
2223db5379
Update Test & linting packages 2023-03-13 02:36:20 +00:00
renovate[bot]
d622631087
Update dependency webpack to v5.76.1 2023-03-13 00:08:13 +00:00
Aileen Nowak
465e88510a Improved FirstPromoter integration to run on all subdomains
closes https://www.notion.so/ghost/Update-FirstPromoter-implementation-to-allow-subdomains-d108aee94aaa417eb552db7e825f1e44?pvs=4

- Allow the FirstPromoter script to run on all subdomains of the root site domain by removing any subdomain from the used domain and prefixing the root with a `.`.
2023-03-12 10:59:16 +00:00
Steve Larson
8d76832b07 added e2e tests to cover page events
no refs
-added e2e tests for sending mentions on various page events
2023-03-10 15:25:10 -06:00
Simon Backx
80cec29144
Added Stripe Mocker to make testing easier (#16396)
no issue

The Stripe Mocker mocks the Stripe API in memory, to make it much easier
to test subscription flows. Currently it is more a POC to see if it
works well. It probably needs a bit more work to support more scenarios.
- Added new tests for the subscription stats endpoint for 3D secure +
free trial flows using the new Stripe Mocker
- Updated members admin api tests to use Stripe Mocker (+ added new test
for deleting members with Stripe cancellation)
- Some tests called mockStripe at the beginning, but that method did
nothing apart from disabling network (which is the default now), then
they mocked Stripe inside the tests file... so I've removed those
because those conflict with the new mocker that is enabled when calling
mockStripe. We'll need to port those over later.
2023-03-10 18:43:35 +01:00
Ghost CI
c5b116e2b0 v5.38.0 2023-03-10 16:00:46 +00:00
Simon Backx
db717f446f 🐛 Fixed free trials not visible in paid subscriptions graph
fixes https://github.com/TryGhost/Team/issues/2607

When a free trial converts to a paid subscription, and increases the MRR, it just creates a 'updated' paid subscription event.

To fix this, we need to count updated events that didn't change plan but do have a positive MRR. As an extension we could also check if the MRR change matches the expected MRR for the corresponsing Stripe plan, but that requires a more complex condition check (because for yearly subscriptions we need to convert to monthly), I don't think that is required here.
2023-03-10 16:16:17 +01:00
Simon Backx
400e1b4ab6 🐛 Fixed 3D secure payment not counted as paid subscription in graph
fixes https://github.com/TryGhost/Team/issues/2644

A 3D secure payment first has a status of incomplete, then active.

With the current logic, this creates 2 MemberPaidSubscriptionEvents:

- `created` with mrr_delta of 0
- `active` with mrr_delta of 5

We need to also count 'active' events. And to complement that, also 'inactive' events to make sure we balance out in rare cases.
2023-03-10 16:16:17 +01:00
Rishabh Garg
c71582877c
Added page attribution to member email alerts (#16381)
refs https://github.com/TryGhost/Team/issues/2489

- adds attribution title and url for new free members and paid subscriptions to email alert

---------

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2023-03-10 20:14:53 +05:30
Daniel Lockyer
89493893d1 Removed all unused variables from test files
- this cleans up all imports or variables that aren't currently being used
- this really helps keep the tests clean by only allowing what is needed
- I've left `should` as an exemption for now because we need to clean up
  how it is used
2023-03-10 14:29:55 +01:00
Daniel Lockyer
42333a3349 Removed custom assertions
- these are no longer used in favor of snapshots in tests
2023-03-10 14:29:55 +01:00
Daniel Lockyer
08f84475e7 Removed sleep lib from test utils
- this is generally an anti-pattern in tests and leads to flaky
  behaviour when tests are ran on different machines/loads
- this is currently unused so it is an easy removal
2023-03-10 14:29:55 +01:00
Elena Baidakova
6f9f83bee8 Revert "Removed explicit timeout for offer creation helper"
This reverts commit ac427e4253.
2023-03-10 13:44:45 +04:00
Elena Baidakova
ac427e4253 Removed explicit timeout for offer creation helper
refs TryGhost/Team#2667
- Removed timeout to make it the same as a global one
2023-03-10 13:24:38 +04:00
Daniel Lockyer
8df5b1a974 Refactored events wrapper into class
- we have our own class in order to add the `hasRegisteredListener`
  function
- this commit refactors the implementation to use the class syntactic
  sugar, which means we get better editor autocomplete
- this shouldn't change the functionality
2023-03-10 10:19:05 +01:00
renovate[bot]
b93b38a8e8 Update @tryghost 2023-03-10 09:52:02 +01:00
Peter Zimon
d6317708af Refined spacing and position of mentions dropdown
no refs.

- The empty state of mentions dropdown was a little tight on the top
- The dropdown was too close to the trigger button
2023-03-10 09:32:58 +01:00
Ronald Langeveld
ab01e4fcbf Added new Tier e2e test
refs https://github.com/TryGhost/Team/issues/1446

- Added a test for successfully creating a new tier.
2023-03-10 13:29:25 +08:00
renovate[bot]
97830ac79a
Update dependency terser to v5.16.6 2023-03-09 23:47:55 +00:00
Steve Larson
6b29e51c67
🐛 enabled mentions for pages (#16388)
no refs
-mentions were not being sent for pages
-added listeners for page events (published, unpublished, edited)
2023-03-09 17:31:29 -06:00
Djordje Vlaisavljevic
9fd75191ff Updated empty state design
refs https://github.com/TryGhost/Team/issues/2608
2023-03-09 19:41:28 +00:00
renovate[bot]
8a6d87353f
Update dependency metascraper to v5.33.9 2023-03-09 15:22:00 +00:00
Steve Larson
c5dd576d52 updated mentions labs text
no refs
-mentions labs description was incorrect
-mentions always send and receive, flag controls UI only
2023-03-09 09:10:47 -06:00
Simon Backx
832610fd2a
🐛 Fixed retrying failed emails when rescheduling them (#16383)
fixes https://github.com/TryGhost/Team/issues/2560

When an email fails, and you reschedule the post, the error dialog was
shown (from the previous try). The retry button on that page allowed you
to retry sending the email immediately, which could be very confusing.

- The email error dialog is no longer shown for scheduled emails
- The email status is no longer polled for scheduled emails
- Retrying an email is not possible via the API if the post status is
not published or sent
- Added some extra snapshot tests
- When retrying an email, we immediately update the email status to
'pending' to have a better API response (instead of still returning
failed).
- Disabled email sending retrying in development (otherwise very hard to
test failed emails if it takes 10 mins before it gives up automatic
retrying)
2023-03-09 12:32:22 +01:00
Elena Baidakova
8b191a8d01 Removed all tiers archive from portal tests to reduce relation between tests
refs TryGhost/Team#2667
2023-03-09 12:55:27 +04:00
Ronald Langeveld
7539a681fe
Excludes sites with canonical_url meta from sitemap. (#16376)
closes https://github.com/TryGhost/Team/issues/2531

This commit fixes the issue where non-canonical URLs are included in the
XML sitemap, leading to poor SEO for our user's sites. The solution
implemented is to exclude any page or post that specifies a canonical
URL in its metadata from the sitemap.

To achieve this, a condition has been added to the 'addUrl' method,
which checks for the existence of a canonical URL in the metadata of the
resource being added to the sitemap. If a canonical URL is present, the
resource is excluded from the sitemap.

With this fix, our user's sites will have better SEO and improved search
engine visibility.
2023-03-09 16:38:43 +08:00
renovate[bot]
0b13d542f8
Update dependency webpack to v5.76.0 2023-03-09 00:27:33 +00:00
Steve Larson
6402d89e08 removed require should 2023-03-08 16:50:03 -06:00
Steve Larson
cb05fae5a3
🐛 Fixed maintaining archived newsletter subscriptions for members (#16375)
refs #16355
-archived newsletters will no longer be unsubscribed when saving member
-fixed bug with initialMember load
-fixed errors in unit tests
2023-03-08 16:39:28 -06:00
Simon Backx
4184b279d2
🐛 Fixed HTML escaping when using outbound link tagging (#16380)
fixes https://github.com/TryGhost/Team/issues/2666

- Somehow occurrences of `&map_` got replaced with `&#x21A6;`
- Disables escaping &, ', " and other HTML characters when not needed
(escaping is already handled by mobiledoc/lexical)
- Bumps unit test coverage of link replacer to 100%
2023-03-08 16:30:54 +01:00
Elena Baidakova
00cda68125
Disabled fraud detection for e2e browser tests (#16379)
refs TryGhost/Team#2667
2023-03-08 16:01:08 +04:00
Simon Backx
3d89dbb775 Fixed whistelisted domains in Playwright tests and network connectivity
no issue

- Nock doesn't support multiple calls to enableNetConnect -> only the last one counts. This fixes that issue.
- Some tests interacted directly with nock instead of using the mockManager to restore everything.
2023-03-08 12:40:21 +01:00
Simon Backx
df9df4be80 Allowed Stripe network access in Playwright tests
no issue

Previous test change that blocks network access broke the Playwright tests, that need to access the Stripe checkout page.
2023-03-08 11:49:36 +01:00
Kevin Ansfield
6f8dc6b29e
Added admin/jsconfig.json to fix vscode decorator warnings
no issue

- vscode started adding warnings to all uses of decorators in Admin which was rather annoying
- added `jsconfig.json` with the necessary compiler options and an exclude list to keep performance happy
2023-03-08 10:37:49 +00:00
Naz
46508b7299
Fixed external media inliner logs
refs https://github.com/TryGhost/Toolbox/issues/524

- The "tableName" property is not present on the bookshelf model instance - it was a mistake assumption using it for logs. In case the logs are too ambiguous we could figure pass around model names separately into the "inlineSimpleFields" method
2023-03-08 15:24:21 +08:00
Naz
6fa00faaa2
Added naive domain matching when inlining media
refs https://github.com/TryGhost/Toolbox/issues/524

- Mobiledoc from a migrated content could contain html/markdown cards that could have a variety of different resource <> url pairs. To avoid complex logic and parsing html/md going with a simplest approach - matching external content URLs purely based on provided domains. This gives useful enough of a tool to migrate external content for a specific service (e.g Revue)
- In cases where the content is not supported the fetching will fail with a message and move on to the next match - which is a reasonable behavior for a migration tool
2023-03-08 15:22:51 +08:00
Naz
93ea9a2976
Added a not on media inlining perf improvement
refs https://github.com/TryGhost/Toolbox/issues/524

- Fetching media from a remote server is an expensive network operation. Given there's probability for the content to reuse the same image in different posts or in multiple places, we could save on extra fetches by adding caching to the remote media fetch method
2023-03-08 14:16:28 +08:00
Naz
831a76505c
Fixed root zip image/media/files copying during import
https://github.com/TryGhost/Toolbox/issues/523

- During import process of content files the files from the root directory were also copied over. This is causing chaos in the root of content folder with files that only needed for data import. For example, the csv files needed for Revue import were also copied over by "file importer" even though those do not belong to any content.
- Any content import files - images, media, files, should be in according folders in the imported zip file. The root files in the base zip directory are for data-related imports
2023-03-08 11:03:47 +08:00
renovate[bot]
ec869cfa0d
Update dependency mysql2 to v3.2.0 2023-03-07 23:33:30 +00:00
renovate[bot]
a613e5f9b0
Update dependency mailgun.js to v8.2.1 2023-03-07 21:13:12 +00:00
Steve Larson
c111f8bef4 🐛 Fixed referrals to web archive
no refs
-removed ref param for archive.org domain
-ref links to archive.org were broken
2023-03-07 13:35:34 -06:00
renovate[bot]
f6280d835d
Update dependency i18next to v22.4.11 2023-03-07 15:12:44 +00:00
Simon Backx
38de815d98
Removed old email flow (#16349)
fixes https://github.com/TryGhost/Team/issues/2611

The old email flow is no longer used since we introduced the email stability flow. This commit removes the related code and tests. The general test coverage decreased a bit as a result, because the old email flow probably had a high test coverage. The new flow is in separate packages, so it couldn't contribute to a higher test coverage (but it does have 100% unit test coverage).
2023-03-07 16:08:40 +01:00
Simon Backx
3db434736b
🐛 Fixed replacements with fallback in plaintext newsletters (#16372)
fixes https://github.com/TryGhost/Team/issues/2683

When sending a newsletter with a replacement that has a fallback, the
replacement only happens in the HTML version of the newsletter. The
plaintext version isn't replaced.

This commit fixes the issue and adds some tests to make sure it doesn't
happen again.

The cause of the issue was that we used the original matched Regex text
to replace. But that was calculated on the HTML version, so double
quotes were encoded. This change updates the generated 'token' regex to
also match on both a double quote as the escaped double quote.
2023-03-07 15:34:43 +01:00
Peter Zimon
d58f01bac7 Refined new signup email templates
refs. https://github.com/TryGhost/Team/issues/2489

- Alignment of avatar in free and paid signup email template was off
- Paragraphs was mixed in free signup email template which resulted in an unwanted space
2023-03-07 14:19:30 +01:00
Simon Backx
f50224f445
Improved network access and mocking in tests (#16371)
refs https://github.com/TryGhost/Team/issues/2667

Some tests still accessed the internet. Now network access is disabled
by default. This change also introduces two helper methods related to
networking (mocking Slack and Mailgun).

This fixes two unreliable tests:
- Staff service was accessing a Slack test API -> timeout possible
- MentionSendingService was trying to send webmentions for every post
publish/change -> possible timeouts and job issues
2023-03-07 13:20:28 +01:00
Daniel Lockyer
b3d36709ab
Downgraded expect and @playwright/test packages
refs 6460522352

- these were both bumped around the time that Playwright browser tests
  started going awry, so they may be the cause of some random failures
2023-03-07 12:11:05 +01:00