0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Fixed missing failed request URL if version emails

refs https://github.com/TryGhost/Toolbox/issues/292

- The version mismatch notification emails were missing a URL of the endpoint that was being accessed by an outdated integraton
- Also squeezed in a refactor simplifying APIVersionCompatibilityService initialization
This commit is contained in:
Naz 2022-05-09 20:09:19 +08:00
parent e5c5661701
commit b2db80c9fe
3 changed files with 26 additions and 25 deletions

View file

@ -1,5 +1,4 @@
const APIVersionCompatibilityService = require('@tryghost/api-version-compatibility-service');
const VersionNotificationsDataService = require('@tryghost/version-notifications-data-service');
const versionMismatchHandler = require('@tryghost/mw-api-version-mismatch');
const ghostVersion = require('@tryghost/version');
const {GhostMailer} = require('../mail');
@ -12,19 +11,14 @@ let serviceInstance;
const init = () => {
const ghostMailer = new GhostMailer();
const versionNotificationsDataService = new VersionNotificationsDataService({
UserModel: models.User,
settingsService: settingsService.getSettingsBREADServiceInstance()
});
serviceInstance = new APIVersionCompatibilityService({
UserModel: models.User,
settingsService: settingsService.getSettingsBREADServiceInstance(),
sendEmail: (options) => {
// NOTE: not using bind here because mockMailer is having trouble mocking bound methods
return ghostMailer.send(options);
},
fetchEmailsToNotify: versionNotificationsDataService.getNotificationEmails.bind(versionNotificationsDataService),
fetchHandled: versionNotificationsDataService.fetchNotification.bind(versionNotificationsDataService),
saveHandled: versionNotificationsDataService.saveNotification.bind(versionNotificationsDataService),
getSiteUrl: () => urlUtils.urlFor('home', true),
getSiteTitle: () => settingsCache.get('title')
});

View file

@ -58,7 +58,7 @@
"@sentry/node": "6.19.7",
"@tryghost/adapter-manager": "0.2.30",
"@tryghost/admin-api-schema": "2.15.0",
"@tryghost/api-version-compatibility-service": "0.2.0",
"@tryghost/api-version-compatibility-service": "0.3.1",
"@tryghost/bookshelf-plugins": "0.4.1",
"@tryghost/bootstrap-socket": "0.2.19",
"@tryghost/color-utils": "0.1.15",
@ -93,7 +93,7 @@
"@tryghost/members-stripe-service": "0.10.3",
"@tryghost/metrics": "1.0.11",
"@tryghost/minifier": "0.1.14",
"@tryghost/mw-api-version-mismatch": "0.1.3",
"@tryghost/mw-api-version-mismatch": "0.1.4",
"@tryghost/mw-error-handler": "1.0.0",
"@tryghost/mw-session-from-token": "0.1.31",
"@tryghost/nodemailer": "0.3.22",
@ -114,7 +114,6 @@
"@tryghost/validator": "0.1.24",
"@tryghost/verification-trigger": "0.2.3",
"@tryghost/version": "0.1.14",
"@tryghost/version-notifications-data-service": "0.1.1",
"@tryghost/vhost-middleware": "1.0.25",
"@tryghost/zip": "1.1.24",
"amperize": "0.6.1",

View file

@ -1727,12 +1727,13 @@
"@tryghost/errors" "^1.0.0"
lodash "^4.17.11"
"@tryghost/api-version-compatibility-service@0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@tryghost/api-version-compatibility-service/-/api-version-compatibility-service-0.2.0.tgz#439cb89ab09f5af276ed2649ba9924122a960ffd"
integrity sha512-/i0zqxNhZ2yao0EtUiAdgOeEggXJDs+yyGwBP2Kzmt8cpe3hB7FnMvSSPfJDVGowhCEXWsKn4/SWwLB2AY1W3g==
"@tryghost/api-version-compatibility-service@0.3.1":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@tryghost/api-version-compatibility-service/-/api-version-compatibility-service-0.3.1.tgz#b7a656c18fdd31131f74d450aa70897f9ed47742"
integrity sha512-LioWdzPbouxHQ+btLz+XpbLvTonF31x2EkbDmjxqoe2V751RMdJHG226HlqQP5vnrC0Jew7gKLMmQzsUSrLkEA==
dependencies:
"@tryghost/email-content-generator" "^0.1.1"
"@tryghost/email-content-generator" "^0.1.2"
"@tryghost/version-notifications-data-service" "^0.1.2"
"@tryghost/bookshelf-collision@^0.1.22":
version "0.1.22"
@ -1932,13 +1933,20 @@
"@tryghost/debug" "^0.1.9"
lodash "^4.17.20"
"@tryghost/email-content-generator@0.1.1", "@tryghost/email-content-generator@^0.1.1":
"@tryghost/email-content-generator@0.1.1":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@tryghost/email-content-generator/-/email-content-generator-0.1.1.tgz#95bf2eb1cc8e3eb1c3c0e5d7d4950de30aa30811"
integrity sha512-FWtIrmCs3EU+RptoTCElTSoxf/HiAfdVe15tGJIQNArJ7OVAA9dQgHGIgXIiK6cvUYoE6KqxGKX15TJsyXc2rQ==
dependencies:
html-to-text "^5.1.1"
"@tryghost/email-content-generator@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@tryghost/email-content-generator/-/email-content-generator-0.1.2.tgz#edb4acb7108e031cb1ae01db262c59f362a2c059"
integrity sha512-oWRwnONxk4lLm7H26G/fvwQCBXq9WRS0K5WTBFgMUUh9WHet6WSX4oNXI8AQC0AFXI/o9bnzA0+vNZgwxe5X3Q==
dependencies:
html-to-text "^5.1.1"
"@tryghost/errors@1.2.10":
version "1.2.10"
resolved "https://registry.yarnpkg.com/@tryghost/errors/-/errors-1.2.10.tgz#b01b16744986005784ffd6916eec48a3e93976a9"
@ -2298,10 +2306,10 @@
dependencies:
lodash "^4.17.11"
"@tryghost/mw-api-version-mismatch@0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@tryghost/mw-api-version-mismatch/-/mw-api-version-mismatch-0.1.3.tgz#64304d65d6cf6c92cae270801be466c154932283"
integrity sha512-+J/s4KGnSGZ4LBQCzx2fvkkeyTqeOEJBcfUHOF5726r1L32wQnwJ+WVIS7KHNNPevGSXyZupG4jmyLZub9RGsw==
"@tryghost/mw-api-version-mismatch@0.1.4":
version "0.1.4"
resolved "https://registry.yarnpkg.com/@tryghost/mw-api-version-mismatch/-/mw-api-version-mismatch-0.1.4.tgz#0a8cd94572a6fd45bc327d7bc871b1f8de02c8ec"
integrity sha512-V50d2nP3Z+HUialKef9of8UIKEjmTo8ogszgqDy2DH08aNYWUYDRFEWWjUiqdcTXGJMhhPzYlR6cAaYhPj8YwA==
"@tryghost/mw-error-handler@1.0.0":
version "1.0.0"
@ -2524,10 +2532,10 @@
"@tryghost/domain-events" "^0.1.12"
"@tryghost/member-events" "^0.4.4"
"@tryghost/version-notifications-data-service@0.1.1":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@tryghost/version-notifications-data-service/-/version-notifications-data-service-0.1.1.tgz#420787b51d4b4e4708e47e678d473184fd4c4537"
integrity sha512-z32wCo4t6bnOGnaZXcZCAi8Uo9jqepNLfa08ubyStdcUJ8sPJjmptWu4Itg3zQQBf42JNk9gbIEZQptMt6WErQ==
"@tryghost/version-notifications-data-service@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@tryghost/version-notifications-data-service/-/version-notifications-data-service-0.1.2.tgz#2a99315a721b74a945fc88615f57db1f54483dfb"
integrity sha512-NjGqYYsZUrT82GAmvGWPWWQ2Z2XJDuFDz0Ep8j1jk/xxhty0Qas6uweQFn9HvbTOF3W7kvbVSEvmevyBWiQfJQ==
"@tryghost/version@0.1.14", "@tryghost/version@^0.1.14":
version "0.1.14"