Skip to content

Commit

Permalink
Inlined context use so it matches convention used in most of the code…
Browse files Browse the repository at this point in the history
…base
  • Loading branch information
naz committed Nov 7, 2019
1 parent 47bc7c4 commit cc581c6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/server/services/mega/mega.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const models = require('../../models');
const postEmailSerializer = require('./post-email-serializer');
const urlUtils = require('../../lib/url-utils');

const internalContext = {context: {internal: true}};

const getEmailData = (post, members) => {
const emailTmpl = postEmailSerializer.serialize(post);

Expand Down Expand Up @@ -57,7 +55,7 @@ const addEmail = async (post) => {
return null;
}

const existing = await models.Email.findOne({post_id: post.id}, internalContext);
const existing = await models.Email.findOne({post_id: post.id}, {context: {internal: true}});

if (!existing) {
return models.Email.add({
Expand All @@ -68,7 +66,7 @@ const addEmail = async (post) => {
html: emailTmpl.html,
plaintext: emailTmpl.plaintext,
submitted_at: moment().toDate()
}, internalContext);
}, {context: {internal: true}});
} else {
return existing;
}
Expand Down Expand Up @@ -159,7 +157,7 @@ async function listener(emailModel, options) {
return;
}

const postModel = await models.Post.findOne({id: emailModel.get('post_id')}, internalContext);
const postModel = await models.Post.findOne({id: emailModel.get('post_id')}, {context: {internal: true}});

const post = await serialize(postModel);

Expand Down

0 comments on commit cc581c6

Please sign in to comment.