Commit Graph

1414 Commits

Author SHA1 Message Date
Naz
e14520115a
Extracted Image Importer test suite
refs https://github.com/TryGhost/Toolbox/issues/523
refs 3119a5cc4c

- The "index.test.js" is doing too much, has to be broken down to allow things to move into new packages
2023-03-01 16:48:38 +08:00
Daniel Lockyer
4c2ff0539d
Fixed tests for ImportManager audio types
refs c5a4ee89c9

- as of the referenced commit, the supported list of mime types has been
  updated
2023-03-01 09:14:09 +01:00
Naz
6c9e046b4b
Reduced urlUtils dependency in ImageHandler
refs https://github.com/TryGhost/Toolbox/issues/523

- url-utils module is actively being stripped down from usages across codebase. The "urlUtils.STATIC_IMAGE_URL_PREFIX" and "store.staticFileURLPrefix" are the same values - the main difference is with the value coming from store we can make this module more generic for any store type (images, media, files, etc)
2023-03-01 16:10:54 +08:00
Naz
3119a5cc4c
Extracted ImageHandler test suite
refs https://github.com/TryGhost/Toolbox/issues/523

- The "importer/index.test.js" test suite is testing more than it should. ImageHandler test suite section is one of the examples of test cases that should live in a separate file.
- Having these tests in different files makes it easier to reason about coverage and extract to it's own packages.
2023-03-01 15:55:10 +08:00
Naz
ce5eea5707
Added media file handling to Ghost importer
refs https://github.com/TryGhost/Toolbox/issues/523

- When a zip file is imported into Ghost we need to recognize and process media files with following extensions:
".mp4",".webm", ".ogv", ".mp3", ".wav", ".ogg", ".m4a"
- The media files can come from a "media" or "content/media" folder inside of zip file
2023-03-01 15:55:10 +08:00
Naz
23e2fdde95
Added image importer test coverage
refs https://github.com/TryGhost/Toolbox/issues/523

- The test cases for "content" and "content/images" zip import file structure were missing.
2023-03-01 15:55:10 +08:00
renovate[bot]
a431c16968 Update dependency cli-progress to v3.12.0 2023-03-01 08:45:10 +01:00
monkey sees
838516efb0 🐛 Fixed Handlebars’ asset helper for SafeString input
closes https://github.com/TryGhost/Ghost/issues/16332

Passing `SafeString` input to `asset` helper was resulting in the
exception being thrown. This meant that we couldn’t combine `asset`
helper with other helpers which produce `SafeString` e.g. `concat`
helper for string concatenation.
2023-03-01 08:39:14 +01:00
Reupen Shah
c5a4ee89c9 🐛 Fixed uploads of m4a files with audio/mp4 content type
fixes https://github.com/TryGhost/Ghost/issues/16301

Previously, audio/x-m4a was allowed but not audio/mp4. This meant
uploads of m4a files failed in some cases e.g. Firefox on Windows.
2023-03-01 08:32:21 +01:00
Steve Larson
9e58181398
combined fetch for metadata and verification (#16330)
refs TryGhost/Team#2582
-removed duplicative fetch request
-added mention as type in oembed service
2023-02-28 08:39:28 -06:00
Sam Lord
579ecd5b0b Prevent error logging in Urls tests from being output
refs: https://github.com/TryGhost/Toolbox/issues/389
2023-02-28 11:14:11 +00:00
Sam Lord
6512fc770d Prevent xmlprc tests from outputting errors for failure cases
refs: https://github.com/TryGhost/Toolbox/issues/389
2023-02-28 11:14:11 +00:00
Sam Lord
007adb6a33 Prevent tests from erroring when calling validate.init()
refs: https://github.com/TryGhost/Toolbox/issues/389

Calling validate always uses the cache system, so this commit makes sure that the cache system is always initialised correctly by the tests.
2023-02-28 11:14:11 +00:00
Fabien "egg" O'Carroll
6fcc7364e0 Wired up enableAutomaticTax feature flag to Stripe API
The automatic_tax option is required to enable tax collection for
Stripe Checkout sessions. We've used getters here rather than an
explicit function, might wanna change that in future.
2023-02-28 14:09:52 +07:00
Fabien "egg" O'Carroll
6a093f4549 Added stripeAutomaticTax feature flag as private beta
This will be used to test the use of the Stripe Tax feature during
development. We want it behind a private beta flag so that we can
stick it in production without causing problems with payment systems
for existing sites.
2023-02-28 14:07:32 +07:00
Steve Larson
fe7253da1e
removed before after card (#16341)
refs TryGhost/Team#2405
-removed koenig before after card
-removed labs setting
-will rebuild in lexical if we want it in the future
2023-02-27 14:18:48 -06:00
Daniel Lockyer
93e0898c12
Extracted version-match middleware to separate package
- this middlware is standalone and has 100% test coverage, therefore we
  can move it out to a separate package and remap the requires
  accordingly
2023-02-27 18:34:03 +01:00
Daniel Lockyer
025ebb7890
Cleaned up duplicate middleware
refs 621cfd9866

- this file was meant to be moved to a folder in the referenced commit,
  but that never happened
- this commit fixes that
2023-02-27 18:02:40 +01:00
Daniel Lockyer
1a04e75e8b
Set backup file encoding as utf8
- we write files in the default encoding (which is `utf8`) and this
  files a types issue with `JSON.parse` operating on a Buffer
2023-02-27 17:48:41 +01:00
Daniel Lockyer
268e72309f
Reduced code coverage limits temporarily
- I'm shifting some code around but the code coverage keeps flagging
- in order to not get sidetracked, I'm reducing the threshold by 1% and I'll
  increase it again once we're in a better state
2023-02-27 17:37:48 +01:00
Daniel Lockyer
51a25769eb
Moved Segment analytics file into service
- this file is already in our "init"-style, so this commit simply moves
  the file into a service and fixes the import paths
2023-02-27 17:27:28 +01:00
Daniel Lockyer
1ecf77db48 Inlined client database helpers
- these have been lingering around for a while but don't really get a
  lot of love
- I'm planning on moving the migration utils/schema commands into a
  separate package at some point, and these files are just cluttering
  things up
- to make life easier, I'm going to inline them for now
2023-02-27 17:27:22 +01:00
Daniel Lockyer
b1ff826a61 Removed Bluebird from DB backup file
refs https://github.com/TryGhost/Ghost/issues/14882

- we're slowly moving away from Bluebird and don't need it here to
  achieve what we need
2023-02-27 16:37:54 +01:00
Daniel Lockyer
31bc57fbe1
Removed log line from AMP parsing
refs https://github.com/TryGhost/Ghost/pull/9097

- this was originally added to measure the AMP parsing time but AMP is
  becoming less and less important (it's disabled by default in Ghost
  now)
- this also causes a lot of noise when viewing logs, and I've never
  experienced an issue with AMP parsing time that we've needed to review
  these logs
- therefore, this commit deletes it
2023-02-27 15:03:51 +01:00
renovate[bot]
90f64bf212 Update dependency @playwright/test to v1.31.1 2023-02-27 14:45:10 +01:00
Naz
96a64b4982
Added error rethrow to update check run as a job
closes https://github.com/TryGhost/Toolbox/issues/525

- When the update check is run as an offloaded job (in a worker thread) the errors that are handled over "logger.error" do not get bubbled up to the job manager to be handled fully. With an optional "rethrowErrors" flag it's not possible to throw errors when the update check is run as a "job" and handle as usual when run in the main thread (through the admin route trigger)
2023-02-27 19:48:42 +08:00
Naz
81f8abdbd6
🐛 Fixed failing update-check job
refs https://github.com/TryGhost/Toolbox/issues/525
refs https://github.com/TryGhost/Ghost/pull/16224

- The update check job has been failing due to uninitialized Members Service. Loading Tiers in the context of update check is not important because all we are looking for is the posts count.
- The products repository list service is also about to be replace by Tiers repository, so getting correctly initialized members service is not crucial.
2023-02-27 15:58:00 +08:00
Elena Baidakova
6afcf8eec8 Fixed copying text from editor after adding video card
refs TryGhost/Team#2600
- Copying text from editor after adding video card broke it due to error in video node renderer.
2023-02-27 10:28:39 +04:00
renovate[bot]
a260d5396b
Update Test & linting packages 2023-02-27 03:18:16 +00:00
Ghost CI
9fa44f4d3f v5.36.0 2023-02-24 16:00:48 +00:00
Aileen Nowak
d441fe2e2a Fixed tests 2023-02-23 17:21:20 +02:00
Aileen Nowak
086da740a2 Changed maxPercentageFromMilestone to 10% 2023-02-23 17:21:20 +02:00
Aileen Nowak
74a65f3b1c Simplyfied milestone event meta data
no issue

- Reduced the amount of diffeerent properties by not populating a `currentARR` and `currentMembers` fields, but use a `currentValue` instead.
- The type of milestone can still be determined by its `type` property, so we actually don't need two different props here
2023-02-23 17:21:20 +02:00
Aileen Nowak
d820b961b0 Avoid sending milestone email when actual value is too far from milestone
no issue

- Switches to used newly added config values throughout the services
- Updated the `shouldSendEmail` fn to check if actual value is too far from achieved milestone as determined by the percentage setting (e. g. 998 members should not accidentally receive an email for achieving 100 members)
2023-02-23 17:21:20 +02:00
Aileen Nowak
be84d227cd Added more configurable parameters to shared milstone config
no issue

- Instead of having those values hard coded, make them quickly configurable
- Those values are deciding if we send an email or not, the milestones will be created either way:
    - minDaysSinceImported: the amount of that days should've passed since the last member was imported
    - minDaysSinceLastEmail: minimum amount of days that need to pass
    - maxPercentageFromMilestone: the max percentage that the current value can be away from the achieved milestone (e. g. 999 members should not send and email for 100 members)
2023-02-23 17:21:20 +02:00
Simon Backx
89ababb71f
Updated email event fetching to stop when begin and end are the same (#16326)
no issue

Optimization that makes sure we stop fetching when it is no longer
needed.
2023-02-23 15:44:01 +01:00
Simon Backx
3ded0bbee8
Added outbound link tagging setting (#16324)
no issue

Enable or disable outbound link tagging in both web posts and
newsletters.
2023-02-23 14:37:23 +01:00
Aileen Nowak
ff3568293c Updated milestones e2e test to better check for last email sent safeguard
refs https://www.notion.so/ghost/Marketing-Milestone-email-campaigns-1d2c9dee3cfa4029863edb16092ad5c4?pvs=4

- Didn't check for the specific case before and fixed a bug that was allowiing the test to pass even though it should fail
2023-02-23 14:10:12 +02:00
Aileen Nowak
314b88cfb5 Fixed milestone query for imported members not using correct date
refs https://www.notion.so/ghost/Marketing-Milestone-email-campaigns-1d2c9dee3cfa4029863edb16092ad5c4?pvs=4

- I was passing in the days threshold of 7 to compare with the `created_at` value instead of creating an actual new data to compare
2023-02-23 14:10:12 +02:00
Simon Backx
f6bc3479f9
Added webmentions emails flag (#16321)
fixes https://github.com/TryGhost/Team/issues/2599

Disables sending webmentions notification emails, and hides it behind a new flag instead.
2023-02-23 11:42:14 +01:00
Simon Backx
c9fa1068a0
Updated outbound_link_tagging to match members_track_sources (#16322)
fixes https://github.com/TryGhost/Team/issues/2601

Sets the value of outbound_link_tagging to the same value of
members_track_sources, so that is disabled by default for privacy
sensitive sites.

Also makes sure the `outbound_link_tagging` setting is available in
admin (currently excluded because it is in the analytics group)
2023-02-23 11:33:23 +01:00
Aileen Booker
e0331bbfcf
Added MilestoneCreatedEvent to staff service notifications (#16307)
refs
https://www.notion.so/ghost/Marketing-Milestone-email-campaigns-1d2c9dee3cfa4029863edb16092ad5c4?pvs=4

- Added MilestoneCreatedEvent subscription to staff-service incl. first
handling
- Logs information for now instead of actually sending an email
2023-02-23 11:20:13 +02:00
Naz
6b72b2f51f
Removed public-resource-repository
refs https://github.com/TryGhost/Toolbox/issues/522

- Using a generic resource repository for caching purposes didn't prove to be effective as code was moved to api-level caching. There's no need to introduce extra abstraction level for simple calls like findPage when there's no extra logic to it.
2023-02-23 13:07:04 +08:00
Naz
b8bdd3e742
Moved Tags Content API to api-level caching
refs https://github.com/TryGhost/Toolbox/issues/522

- Caching on a repository level was pretty hard to achieve with more complex models like "posts", so that approach was abandoned in favor of API-response level caching.
- Also removed use of "public-resource-repository" as it was not serving any specific purpose anymore.
2023-02-23 13:07:04 +08:00
Naz
33f176a9de
Cleaned up use of public-resource-repository
no issue

- The caching has been moved down the layer  - the the api-framework's "pipeline", so there's no need to add complexity to post fetching logic with repository pattern.
2023-02-23 13:07:04 +08:00
Naz
f049e89a20
Hooked up event aware cache wrapper to posts cache
refs https://github.com/TryGhost/Toolbox/issues/522

- When caching responses the posts cache can create a situation where it becomes stale within the TTL period and would give stale responses to shared caches.
- Having full cache reset on 'site.changed' event makes cached content evergreen reducing the risk of caching stale content in shared caches
2023-02-23 13:07:04 +08:00
Naz
0ddf0dd003
Added simple non-expiring caching to Posts API
refs https://github.com/TryGhost/Toolbox/issues/522

- The public posts "browse" endpoint is causing the most strain on the instance performance. Caching responses with small TTL would allow to reduce the amount of request processing.
2023-02-23 13:07:04 +08:00
Aileen Nowak
80ebd1c5be Fixed random timeouts in milestone service e2e test
no issue

- Passed specific config to `useFakeTimers` so the test only fakes the `setTimeout` call
2023-02-22 20:26:53 +02:00
Simon Backx
94f5ad60c3 Added temporary fix for email suppression list error logs in tests
refs https://github.com/TryGhost/Team/issues/2598

In tests the model is undefined because the service is imported too early.
2023-02-22 19:13:52 +01:00
Simon Backx
7220be92e2 Webmentions sending tests stability improvements
no issue
2023-02-22 18:25:06 +01:00