mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added email-suppression-list service & mock implementation
refs https://github.com/TryGhost/Team/issues/2267 This will eventually be replaced by a Mailgun specific implementation, but for now we're using mock one which responds with fake data for local development.
This commit is contained in:
parent
22fe3ec88b
commit
cbe1573fd5
4 changed files with 37 additions and 1 deletions
|
@ -290,6 +290,7 @@ async function initServices({config}) {
|
|||
const membersEvents = require('./server/services/members-events');
|
||||
const linkTracking = require('./server/services/link-tracking');
|
||||
const audienceFeedback = require('./server/services/audience-feedback');
|
||||
const emailSuppressionList = require('./server/services/email-suppression-list');
|
||||
|
||||
const urlUtils = require('./shared/url-utils');
|
||||
|
||||
|
@ -319,7 +320,8 @@ async function initServices({config}) {
|
|||
}),
|
||||
comments.init(),
|
||||
linkTracking.init(),
|
||||
audienceFeedback.init()
|
||||
audienceFeedback.init(),
|
||||
emailSuppressionList.init()
|
||||
]);
|
||||
debug('End: Services');
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./service');
|
|
@ -0,0 +1,32 @@
|
|||
const {AbstractEmailSuppressionList, EmailSuppressionData} = require('@tryghost/email-suppression-list');
|
||||
|
||||
class InMemoryEmailSuppressionList extends AbstractEmailSuppressionList {
|
||||
async removeEmail(email) {
|
||||
if (email === 'fail@member.test') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async getSuppressionData(email) {
|
||||
if (email === 'spam@member.test') {
|
||||
return new EmailSuppressionData(true, {
|
||||
timestamp: new Date(),
|
||||
reason: 'spam'
|
||||
});
|
||||
}
|
||||
if (email === 'fail@member.test') {
|
||||
return new EmailSuppressionData(true, {
|
||||
timestamp: new Date(),
|
||||
reason: 'fail'
|
||||
});
|
||||
}
|
||||
return new EmailSuppressionData(false);
|
||||
}
|
||||
|
||||
async init() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new InMemoryEmailSuppressionList();
|
|
@ -74,6 +74,7 @@
|
|||
"@tryghost/email-analytics-provider-mailgun": "0.0.0",
|
||||
"@tryghost/email-analytics-service": "0.0.0",
|
||||
"@tryghost/email-content-generator": "0.0.0",
|
||||
"@tryghost/email-suppression-list": "0.0.0",
|
||||
"@tryghost/errors": "1.2.18",
|
||||
"@tryghost/express-dynamic-redirects": "0.0.0",
|
||||
"@tryghost/helpers": "1.1.74",
|
||||
|
|
Loading…
Add table
Reference in a new issue