0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Disabled version compatibility emails temporarily

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

- we shouldn't send these emails in 4.x
This commit is contained in:
Hannah Wolfe 2022-04-28 14:58:43 +01:00
parent c7b247a079
commit 9a0d143fb1
2 changed files with 20 additions and 14 deletions

View file

@ -1,11 +1,12 @@
const APIVersionCompatibilityService = require('@tryghost/api-version-compatibility-service');
const VersionNotificationsDataService = require('@tryghost/version-notifications-data-service');
const {GhostMailer} = require('../mail');
// const {GhostMailer} = require('../mail');
const settingsService = require('../../services/settings');
const models = require('../../models');
const logging = require('@tryghost/logging');
const init = () => {
const ghostMailer = new GhostMailer();
//const ghostMailer = new GhostMailer();
const versionNotificationsDataService = new VersionNotificationsDataService({
UserModel: models.User,
settingsService: settingsService.getSettingsBREADServiceInstance()
@ -14,7 +15,9 @@ const init = () => {
this.APIVersionCompatibilityServiceInstance = new APIVersionCompatibilityService({
sendEmail: (options) => {
// NOTE: not using bind here because mockMailer is having trouble mocking bound methods
return ghostMailer.send(options);
//return ghostMailer.send(options);
// For now log a warning, rather than sending an email
logging.warn(options.html);
},
fetchEmailsToNotify: versionNotificationsDataService.getNotificationEmails.bind(versionNotificationsDataService),
fetchHandled: versionNotificationsDataService.fetchNotification.bind(versionNotificationsDataService),

View file

@ -99,11 +99,12 @@ describe('API Versioning', function () {
}]
});
mockManager.assert.sentEmailCount(1);
mockManager.assert.sentEmail({
subject: 'Attention required: Your Zapier 1.3 integration has failed',
to: 'jbloggs@example.com'
});
// temporarily disable email sending
mockManager.assert.sentEmailCount(0);
// mockManager.assert.sentEmail({
// subject: 'Attention required: Your Zapier 1.3 integration has failed',
// to: 'jbloggs@example.com'
// });
});
it('responds with error and sends email ONCE when requested version is BEHIND and CANNOT respond multiple times', async function () {
@ -122,11 +123,12 @@ describe('API Versioning', function () {
}]
});
mockManager.assert.sentEmailCount(1);
mockManager.assert.sentEmail({
subject: 'Attention required: Your Zapier 1.4 integration has failed',
to: 'jbloggs@example.com'
});
// temporarily disable email sending
mockManager.assert.sentEmailCount(0);
// mockManager.assert.sentEmail({
// subject: 'Attention required: Your Zapier 1.4 integration has failed',
// to: 'jbloggs@example.com'
// });
await agentAdminAPI
.get('removed_endpoint')
@ -143,7 +145,8 @@ describe('API Versioning', function () {
}]
});
mockManager.assert.sentEmailCount(1);
// temporarily disable email sending
mockManager.assert.sentEmailCount(0);
});
it('responds with 404 error when the resource cannot be found', async function () {