mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Moved sending email error into MEGA
closes https://github.com/TryGhost/Team/issues/913 - Having a limit service rule triggered was a temporary hack to get a basic email blocking version working - As the freeze value is now persisted in the DB it's possible to read and rely on it to throw an error straight from MEGA.
This commit is contained in:
parent
086840873e
commit
93e8814589
2 changed files with 9 additions and 11 deletions
|
@ -25,7 +25,8 @@ const events = require('../../lib/common/events');
|
|||
const messages = {
|
||||
invalidSegment: 'Invalid segment value. Use one of the valid:"status:free" or "status:-free" values.',
|
||||
unexpectedFilterError: 'Unexpected {property} value "{value}", expected an NQL equivalent',
|
||||
noneFilterError: 'Cannot send email to "none" {property}'
|
||||
noneFilterError: 'Cannot send email to "none" {property}',
|
||||
emailSendingDisabled: `Sending is temporarily disabled because your account is currently in review. You should have an email about this from us already, but you can also reach us any time at support@ghost.org`
|
||||
};
|
||||
|
||||
const getFromAddress = () => {
|
||||
|
@ -159,6 +160,12 @@ const addEmail = async (postModel, options) => {
|
|||
await limitService.errorIfWouldGoOverLimit('emails');
|
||||
}
|
||||
|
||||
if (settingsCache.get('email_verification_required') === true) {
|
||||
throw new errors.HostLimitError({
|
||||
message: tpl(messages.emailSendingDisabled)
|
||||
});
|
||||
}
|
||||
|
||||
const knexOptions = _.pick(options, ['transacting', 'forUpdate']);
|
||||
const filterOptions = Object.assign({}, knexOptions, {limit: 1});
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@ const ghostVersion = require('@tryghost/version');
|
|||
const _ = require('lodash');
|
||||
const {GhostMailer} = require('../mail');
|
||||
const jobsService = require('../jobs');
|
||||
const limits = require('../limits');
|
||||
|
||||
const messages = {
|
||||
noLiveKeysInDevelopment: 'Cannot use live stripe keys in development. Please restart in production mode.',
|
||||
sslRequiredForStripe: 'Cannot run Ghost without SSL when Stripe is connected. Please update your url config to use "https://".',
|
||||
remoteWebhooksInDevelopment: 'Cannot use remote webhooks in development. See https://ghost.org/docs/webhooks/#stripe-webhooks for developing with Stripe.',
|
||||
emailVerificationNeeded: `To make sure you get great deliverability on a list of that size, we'll need to enable some extra features for your account. A member of our team will be in touch with you by email to review your account make sure everything is configured correctly so you're ready to go.`,
|
||||
emailSendingDisabled: `Sending is temporarily disabled because your account is currently in review. You should have an email about this from us already, but you can also reach us any time at support@ghost.org`
|
||||
emailVerificationNeeded: `To make sure you get great deliverability on a list of that size, we'll need to enable some extra features for your account. A member of our team will be in touch with you by email to review your account make sure everything is configured correctly so you're ready to go.`
|
||||
};
|
||||
|
||||
// Bind to settings.edited to update systems based on settings changes, similar to the bridge and models/base/listeners
|
||||
|
@ -77,13 +75,6 @@ const processImport = async (options) => {
|
|||
const isVerifiedEmail = config.get('hostSettings:emailVerification:verified') === true;
|
||||
|
||||
if ((!isVerifiedEmail) && freezeTriggered) {
|
||||
limits.init({
|
||||
emails: {
|
||||
disabled: true,
|
||||
error: tpl(messages.emailSendingDisabled)
|
||||
}
|
||||
});
|
||||
|
||||
await models.Settings.edit([{
|
||||
key: 'email_freeze',
|
||||
value: true
|
||||
|
|
Loading…
Add table
Reference in a new issue