mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Removed redundant context passing
- Context object is not needed when model is used directly
This commit is contained in:
parent
d7d06653df
commit
3ca25886eb
1 changed files with 5 additions and 7 deletions
|
@ -55,7 +55,7 @@ const addEmail = async (post) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const existing = await models.Email.findOne({post_id: post.id}, {context: {internal: true}});
|
const existing = await models.Email.findOne({post_id: post.id});
|
||||||
|
|
||||||
if (!existing) {
|
if (!existing) {
|
||||||
return models.Email.add({
|
return models.Email.add({
|
||||||
|
@ -66,7 +66,7 @@ const addEmail = async (post) => {
|
||||||
html: emailTmpl.html,
|
html: emailTmpl.html,
|
||||||
plaintext: emailTmpl.plaintext,
|
plaintext: emailTmpl.plaintext,
|
||||||
submitted_at: moment().toDate()
|
submitted_at: moment().toDate()
|
||||||
}, {context: {internal: true}});
|
});
|
||||||
} else {
|
} else {
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ async function listener(emailModel, options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const postModel = await models.Post.findOne({id: emailModel.get('post_id')}, {context: {internal: true}});
|
const postModel = await models.Post.findOne({id: emailModel.get('post_id')});
|
||||||
|
|
||||||
const post = await serialize(postModel);
|
const post = await serialize(postModel);
|
||||||
|
|
||||||
|
@ -174,8 +174,7 @@ async function listener(emailModel, options) {
|
||||||
await models.Email.edit({
|
await models.Email.edit({
|
||||||
status: 'submitting'
|
status: 'submitting'
|
||||||
}, {
|
}, {
|
||||||
id: emailModel.id,
|
id: emailModel.id
|
||||||
internalContext
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await sendEmail(post, members);
|
await sendEmail(post, members);
|
||||||
|
@ -183,8 +182,7 @@ async function listener(emailModel, options) {
|
||||||
await models.Email.edit({
|
await models.Email.edit({
|
||||||
status: 'submitted'
|
status: 'submitted'
|
||||||
}, {
|
}, {
|
||||||
id: emailModel.id,
|
id: emailModel.id
|
||||||
internalContext
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue