mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
Added use of email templates for version mismatch notifications
refs https://github.com/TryGhost/Toolbox/issues/292 - This change allows to reuse existing pattern present in Ghost on the version mismatch service layer, where we define the contents of the sent email through email templates instead of plain text. - Apart form templates, there's now failed request URL present in the data passed to the email template along with site title and site url
This commit is contained in:
parent
38b9cf2472
commit
648530009d
@ -1,12 +1,13 @@
|
||||
const routeMatch = require('path-match')();
|
||||
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');
|
||||
const settingsService = require('../../services/settings');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
const models = require('../../models');
|
||||
const routeMatch = require('path-match')();
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
const settingsCache = require('../../../shared/settings-cache');
|
||||
|
||||
let serviceInstance;
|
||||
|
||||
@ -24,7 +25,9 @@ const init = () => {
|
||||
},
|
||||
fetchEmailsToNotify: versionNotificationsDataService.getNotificationEmails.bind(versionNotificationsDataService),
|
||||
fetchHandled: versionNotificationsDataService.fetchNotification.bind(versionNotificationsDataService),
|
||||
saveHandled: versionNotificationsDataService.saveNotification.bind(versionNotificationsDataService)
|
||||
saveHandled: versionNotificationsDataService.saveNotification.bind(versionNotificationsDataService),
|
||||
getSiteUrl: () => urlUtils.urlFor('home', true),
|
||||
getSiteTitle: () => settingsCache.get('title')
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,7 @@ const sentry = require('../../../../../shared/sentry');
|
||||
const shared = require('../../../shared');
|
||||
const routes = require('./routes');
|
||||
const errorHandler = require('@tryghost/mw-error-handler');
|
||||
const versionMissmatchHandler = require('@tryghost/mw-api-version-mismatch');
|
||||
const {APIVersionCompatibilityServiceInstance} = require('../../../../services/api-version-compatibility');
|
||||
const apiVersionCompatibility = require('../../../../services/api-version-compatibility');
|
||||
|
||||
module.exports = function setupApiApp() {
|
||||
debug('Content API canary setup start');
|
||||
@ -29,7 +28,7 @@ module.exports = function setupApiApp() {
|
||||
|
||||
// API error handling
|
||||
apiApp.use(errorHandler.resourceNotFound);
|
||||
apiApp.use(versionMissmatchHandler(APIVersionCompatibilityServiceInstance));
|
||||
apiApp.use(apiVersionCompatibility.errorHandler);
|
||||
apiApp.use(errorHandler.handleJSONResponse(sentry));
|
||||
|
||||
debug('Content API canary setup end');
|
||||
|
@ -58,7 +58,7 @@
|
||||
"@sentry/node": "6.19.7",
|
||||
"@tryghost/adapter-manager": "0.2.29",
|
||||
"@tryghost/admin-api-schema": "2.14.0",
|
||||
"@tryghost/api-version-compatibility-service": "0.1.1",
|
||||
"@tryghost/api-version-compatibility-service": "0.2.0",
|
||||
"@tryghost/bookshelf-plugins": "0.4.1",
|
||||
"@tryghost/bootstrap-socket": "0.2.18",
|
||||
"@tryghost/color-utils": "0.1.13",
|
||||
@ -93,7 +93,7 @@
|
||||
"@tryghost/members-stripe-service": "0.10.3",
|
||||
"@tryghost/metrics": "1.0.11",
|
||||
"@tryghost/minifier": "0.1.13",
|
||||
"@tryghost/mw-api-version-mismatch": "0.1.1",
|
||||
"@tryghost/mw-api-version-mismatch": "0.1.3",
|
||||
"@tryghost/mw-error-handler": "0.2.4",
|
||||
"@tryghost/mw-session-from-token": "0.1.30",
|
||||
"@tryghost/nodemailer": "0.3.22",
|
||||
|
25
yarn.lock
25
yarn.lock
@ -1727,10 +1727,12 @@
|
||||
"@tryghost/errors" "^1.0.0"
|
||||
lodash "^4.17.11"
|
||||
|
||||
"@tryghost/api-version-compatibility-service@0.1.1":
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/api-version-compatibility-service/-/api-version-compatibility-service-0.1.1.tgz#037ec31a745f59577d531abc0e67558fb83b287e"
|
||||
integrity sha512-NLpSqTQIP4be8keF8L9vwXtoFeiwldH/WNyieMlqjBWVnAEHVpdGqQzEpltDVkIrkti1T6jT2NP0OIddM3GMYQ==
|
||||
"@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==
|
||||
dependencies:
|
||||
"@tryghost/email-content-generator" "^0.1.1"
|
||||
|
||||
"@tryghost/bookshelf-collision@^0.1.22":
|
||||
version "0.1.22"
|
||||
@ -1937,6 +1939,13 @@
|
||||
dependencies:
|
||||
html-to-text "^5.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/errors@1.2.10":
|
||||
version "1.2.10"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/errors/-/errors-1.2.10.tgz#b01b16744986005784ffd6916eec48a3e93976a9"
|
||||
@ -2296,10 +2305,10 @@
|
||||
dependencies:
|
||||
lodash "^4.17.11"
|
||||
|
||||
"@tryghost/mw-api-version-mismatch@0.1.1":
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/mw-api-version-mismatch/-/mw-api-version-mismatch-0.1.1.tgz#913c8941ebe274eac4c3ac872fbe6268534f0003"
|
||||
integrity sha512-N1H3P/ua7MCJTQrhFd6RjBFL95pjB+y3Ih1ZyKToBzicU3RShLUsgVlBC7YNaJVGFG/RYCImzlm09QCV8qwgpg==
|
||||
"@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-error-handler@0.2.4":
|
||||
version "0.2.4"
|
||||
|
Loading…
Reference in New Issue
Block a user