refactor story.js mailer and remove some cruft

pull/320/head
Michael Q Larson 2015-04-09 17:50:10 -07:00
parent 3b7ea3d9a4
commit 332d4f1875
4 changed files with 9 additions and 45 deletions

View File

@ -450,7 +450,12 @@ function commentSave(comment, Context, res, next) {
if (err) {
return next(err);
}
var recipients = '';
if (data.originalStoryAuthorEmail && (data.originalStoryAuthorEmail !== recipient.email)) {
recipients = data.originalStoryAuthorEmail + ',' + recipient.email;
} else {
recipients = recipient.email;
}
var transporter = nodemailer.createTransport({
service: 'Mandrill',
auth: {
@ -459,7 +464,7 @@ function commentSave(comment, Context, res, next) {
}
});
var mailOptions = {
to: data.originalStoryAuthorEmail + ',' + recipient.email,
to: recipients,
from: 'Team@freecodecamp.com',
subject: associatedStory.author.username + " replied to your post on Camper News",
text: [
@ -474,31 +479,6 @@ function commentSave(comment, Context, res, next) {
return err;
}
});
} else {
var transporter = nodemailer.createTransport({
service: 'Mandrill',
auth: {
user: secrets.mandrill.user,
pass: secrets.mandrill.password
}
});
var mailOptions = {
to: recipient.email,
from: 'Team@freecodecamp.com',
subject: associatedStory.author.username + " replied to your post on Camper News",
text: [
"Just a quick heads-up: " + associatedStory.author.username + " replied to you on Camper News.",
"You can keep this conversation going.",
"Just head back to the discussion here: http://freecodecamp.com/stories/" + comment.originalStoryLink,
'- the Free Code Camp Volunteer Team'
].join('\n')
};
transporter.sendMail(mailOptions, function (err) {
if (err) {
return err;
}
});
}
});
});
} catch (e) {

View File

@ -1,16 +0,0 @@
var mongoose = require('mongoose');
var secrets = require('../config/secrets');
var nonprofitInterestSchema = new mongoose.Schema({
nonprofitId:
name: {
type: String,
unique: false
},
description: {
type: Array,
unique: false
}
});
module.exports = mongoose.model('Wiki', wikiSchema);

View File

@ -329,7 +329,7 @@
"</ul>",
"<p>Install a bit torrent client, then &thinsp;<a href=\"http://mgnet.me/ZOQk0rd\">download our virtual machine image</a>.</p>",
"<p>Please note that even though Bit Torrent is often used to download content illegally, all the content on our image is open source and perfectly legal to redistribute.</p>",
"<p>Once you've downloaded the file, &thinsp;<a href=\"https://www.virtualbox.org/wiki/Downloads\">download VirtualBox &thinsp;</a>and follow &thinsp;<a href=\"http://techathlon.com/how-to-run-a-vmdk-file-in-oracle-virtualbox/\">this tutorial &thinsp;</a>to open the image in VirtualBox. You'll want to assign the virtual machine at least two gigabytes of ram.</p>",
"<p>Once you've downloaded the file, &thinsp;<a href=\"https://www.virtualbox.org/field-guide/Downloads\">download VirtualBox &thinsp;</a>and follow &thinsp;<a href=\"http://techathlon.com/how-to-run-a-vmdk-file-in-oracle-virtualbox/\">this tutorial &thinsp;</a>to open the image in VirtualBox. You'll want to assign the virtual machine at least two gigabytes of ram.</p>",
"<p>Now you have your own Linux development environment. You can shut it down when you're not using it and it will save its state. Please continue to seed the file in bit torrent so that other campers can download it as well. Enjoy!</p>",
"<h2>Hosting Apps</h2>",
"<p>Unless your stakeholder has an existing modern host (AWS, Digital Ocean), you'll need to transition them over to a new platform. We believe Heroku is the best choice for a vast majority of web projects. It's free, easy to use, and has both browser and command line interfaces. It's owned by Salesforce and used by a ton of companies, so it's accountable and unlikely to go away.</p>",
@ -449,7 +449,7 @@
"<h4>",
" <ol>",
" <li>Complete this form: &thinsp;<a href=\"http://goo.gl/forms/f61dLt67t8\" target=\"_blank\">http://goo.gl/forms/f61dLt67t8</a>.</li>",
" <li>Read this document, which will answer many questions you may have about our nonprofit projects: &thinsp;<a href=\"/wiki/guide-to-our-nonprofit-projects\" target=\"_blank\">http://freecodecamp.com/wiki/guide-to-our-nonprofit-projects</a>.</li>",
" <li>Read this document, which will answer many questions you may have about our nonprofit projects: &thinsp;<a href=\"/field-guide/guide-to-our-nonprofit-projects\" target=\"_blank\">http://freecodecamp.com/field-guide/guide-to-our-nonprofit-projects</a>.</li>",
" <li>We'll send you an invite to our Nonprofit Projects Trello board. Once we do, go there and add yourself to at least 3 nonprofit projects that interest you.</li>",
" <li>Finish any unfinished Bonfire challenges. These challenges serve as the Free Code Camp \"exit test\". You must complete these before you can start working on nonprofit projects. If you completed CoderByte or CodeWars challenges instead of Bonfire, email us and we'll take a look:&thinsp;<a href=\"mailto:team@freecodecamp.com\">team@freecodecamp.com</a>.</li>",
" </ol>",

View File

@ -27,7 +27,7 @@ block content
#show-all-dialog.modal(tabindex='-1')
.modal-dialog.animated.fadeInUp.fast-animation
.modal-content
.modal-header.all-list-header Wiki Articles
.modal-header.all-list-header Field Guide Articles
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body
include ../partials/field-guide