Merge remote-tracking branch 'upstream/staging' into staging

This commit is contained in:
terakilobyte
2015-05-01 07:52:50 -04:00
7 changed files with 62 additions and 20 deletions

10
app.js
View File

@ -520,6 +520,16 @@ app.post(
storyController.upvote storyController.upvote
); );
app.get(
'/unsubscribe/:email',
resourcesController.unsubscribe
);
app.get(
'/unsubscribed',
resourcesController.unsubscribed
);
app.all('/account', passportConf.isAuthenticated); app.all('/account', passportConf.isAuthenticated);
app.get('/account/api', userController.getAccountAngular); app.get('/account/api', userController.getAccountAngular);

View File

@ -185,6 +185,31 @@ module.exports = {
}); });
}, },
unsubscribe: function unsubscribe(req, res) {
User.findOne({email: req.params.email}, function(err, user) {
if (user) {
if (err) {
return next(err);
}
user.sendMonthlyEmail = false;
user.save(function () {
if (err) {
return next(err);
}
res.redirect('/unsubscribed');
});
} else {
res.redirect('/unsubscribed');
}
});
},
unsubscribed: function unsubscribed(req, res) {
res.render('resources/unsubscribed', {
title: "You have been unsubscribed"
});
},
githubCalls: function(req, res) { githubCalls: function(req, res) {
var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 };
request('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(err, status1, pulls) { request('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(err, status1, pulls) {

View File

@ -141,6 +141,7 @@ var userSchema = new mongoose.Schema({
}, },
needsMigration: { type: Boolean, default: true }, needsMigration: { type: Boolean, default: true },
finishedWaypoints: { type: Boolean, default: false }, finishedWaypoints: { type: Boolean, default: false },
sendMonthlyEmail: { type: Boolean, default: true },
challengesHash: {} challengesHash: {}
}); });

View File

@ -260,7 +260,7 @@
}, },
{ {
"_id": "bd7159d9c442eddfaeb5bdef", "_id": "bd7159d9c442eddfaeb5bdef",
"name": "What does Register mean?", "name": "Global Mac Keyboard Shortcuts",
"description": [ "description": [
"<div class=\"col-xs-12 col-sm-10 col-sm-offset-1\">", "<div class=\"col-xs-12 col-sm-10 col-sm-offset-1\">",
"<h2 class='text-center'></h2>", "<h2 class='text-center'></h2>",

View File

@ -112,21 +112,21 @@ block content
a(href="/nonprofits/directory") Browse our nonprofit projects a(href="/nonprofits/directory") Browse our nonprofit projects
p * Complete all Waypoints, Bonfires, Ziplines and Basejumps to be assigned your first nonprofit project p * Complete all Waypoints, Bonfires, Ziplines and Basejumps to be assigned your first nonprofit project
//#announcementModal.modal(tabindex='-1') #announcementModal.modal(tabindex='-1')
// .modal-dialog .modal-dialog.animated.fadeInUp.fast-animation
// .modal-content .modal-content
// .modal-header.challenge-list-header We've updated our curriculum .modal-header.challenge-list-header Join our Saturday Summit!
// a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
// .modal-body .modal-body
// h3.text-left We now have a 1,600 hour curriculum and tons of new challenges. Read more about it h3.text-left Saturday at Noon EDT: We'll live-stream our Saturday Summit on Twitch.tv. Join us as our community turns 200 days old. We'll have Nonprofit Project demos from 6 of our campers. &thinsp;
// a(href='http://blog.freecodecamp.com', target='_blank') here a(href='http://www.freecodecamp.com/twitch', target='_blank') Add it to your calendar here
// | . | .
// a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://blog.freecodecamp.com/', target='_blank') Take me to the blog post. a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://twitch.tv/freecodecamp', target='_blank') Follow us on Twitch.tv
// a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up! a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up!
//script. script.
// $(document).ready(function () { $(document).ready(function () {
// if (!localStorage || !localStorage.newCurriculum) { if (!localStorage || !localStorage.day200) {
// $('#announcementModal').modal('show'); $('#announcementModal').modal('show');
// localStorage.campWideMeeting = "true"; localStorage.day200 = "true";
// } }
// }); });

View File

@ -67,7 +67,7 @@ block content
$('#complete-courseware-dialog').bind('keypress', modalControlEnterHandler); $('#complete-courseware-dialog').bind('keypress', modalControlEnterHandler);
- if (user.progressTimestamps.length > 2) - if (user.progressTimestamps.length > 2)
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Bonfire:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript" target="_blank") a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Challenge:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript" target="_blank")
i.fa.fa-twitter &thinsp; i.fa.fa-twitter &thinsp;
= phrase = phrase
- else - else

View File

@ -0,0 +1,6 @@
extends ../layout
block content
.panel.panel-info
.panel-body.text-center
h1 You have successfully been unsubscribed.
h2 Whatever you do, keep coding! :)