From 332d4f187515fca8f02638503ff640b4b8e0947f Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Thu, 9 Apr 2015 17:50:10 -0700 Subject: [PATCH] refactor story.js mailer and remove some cruft --- controllers/story.js | 32 ++++++-------------------------- models/NonprofitInterest.js | 16 ---------------- seed_data/field-guides.json | 4 ++-- views/field-guide/show.jade | 2 +- 4 files changed, 9 insertions(+), 45 deletions(-) delete mode 100644 models/NonprofitInterest.js diff --git a/controllers/story.js b/controllers/story.js index 15c14b97cf..b7f7511bba 100644 --- a/controllers/story.js +++ b/controllers/story.js @@ -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) { diff --git a/models/NonprofitInterest.js b/models/NonprofitInterest.js deleted file mode 100644 index 44a3fd9b6d..0000000000 --- a/models/NonprofitInterest.js +++ /dev/null @@ -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); diff --git a/seed_data/field-guides.json b/seed_data/field-guides.json index 1ca02b4be0..4ffdffa058 100644 --- a/seed_data/field-guides.json +++ b/seed_data/field-guides.json @@ -329,7 +329,7 @@ "", "

Install a bit torrent client, then  download our virtual machine image.

", "

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.

", - "

Once you've downloaded the file,  download VirtualBox  and follow  this tutorial  to open the image in VirtualBox. You'll want to assign the virtual machine at least two gigabytes of ram.

", + "

Once you've downloaded the file,  download VirtualBox  and follow  this tutorial  to open the image in VirtualBox. You'll want to assign the virtual machine at least two gigabytes of ram.

", "

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!

", "

Hosting Apps

", "

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.

", @@ -449,7 +449,7 @@ "

", "
    ", "
  1. Complete this form:  http://goo.gl/forms/f61dLt67t8.
  2. ", - "
  3. Read this document, which will answer many questions you may have about our nonprofit projects:  http://freecodecamp.com/wiki/guide-to-our-nonprofit-projects.
  4. ", + "
  5. Read this document, which will answer many questions you may have about our nonprofit projects:  http://freecodecamp.com/field-guide/guide-to-our-nonprofit-projects.
  6. ", "
  7. 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.
  8. ", "
  9. 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: team@freecodecamp.com.
  10. ", "
", diff --git a/views/field-guide/show.jade b/views/field-guide/show.jade index 5a568642dc..ea20ce564f 100644 --- a/views/field-guide/show.jade +++ b/views/field-guide/show.jade @@ -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