remove slack completely and update help and pair actions

This commit is contained in:
Quincy Larson
2015-06-20 18:40:43 -07:00
parent 5212173c61
commit a0f4f91ec1
10 changed files with 40 additions and 255 deletions

View File

@ -13,10 +13,6 @@ module.exports = {
key: process.env.BLOGGER_KEY key: process.env.BLOGGER_KEY
}, },
slack: {
key: process.env.SLACK_KEY
},
mandrill: { mandrill: {
user: process.env.MANDRILL_USER, user: process.env.MANDRILL_USER,
password: process.env.MANDRILL_PASSWORD password: process.env.MANDRILL_PASSWORD

View File

@ -16,67 +16,11 @@ $(document).ready(function() {
setCSRFToken($('meta[name="csrf-token"]').attr('content')); setCSRFToken($('meta[name="csrf-token"]').attr('content'));
$('#i-want-help').on('click', function() {
$('#help-modal').modal('hide');
var editorValue = editor.getValue();
var currentLocation = window.location.href;
$.post(
'/get-help',
{
payload: {
code: editorValue,
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://freecodecamp.slack.com/messages/help/', '_blank')
}
}
);
});
$('#i-want-help-editorless').on('click', function() {
$('#help-editorless-modal').modal('hide');
var currentLocation = window.location.href;
$.post(
'/get-help',
{
payload: {
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://freecodecamp.slack.com/messages/help/', '_blank')
}
}
);
});
$('#report-issue').on('click', function() { $('#report-issue').on('click', function() {
$('#issue-modal').modal('hide'); $('#issue-modal').modal('hide');
window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screen shots if possible.', '_blank') window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screen shots if possible.', '_blank')
}); });
$('#i-want-to-pair').on('click', function() {
$('#pair-modal').modal('hide');
var currentLocation = window.location.href;
$.post(
'/get-pair',
{
payload: {
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://freecodecamp.slack.com/messages/letspair/', '_blank')
}
}
);
});
$('.checklist-element').each(function() { $('.checklist-element').each(function() {
var checklistElementId = $(this).attr('id'); var checklistElementId = $(this).attr('id');
if(!!localStorage[checklistElementId]) { if(!!localStorage[checklistElementId]) {
@ -150,10 +94,6 @@ $(document).ready(function() {
$('#help-modal').modal('show'); $('#help-modal').modal('show');
}); });
$('#trigger-help-editorless-modal').on('click', function() {
$('#help-editorless-modal').modal('show');
});
$('#trigger-issue-modal').on('click', function() { $('#trigger-issue-modal').on('click', function() {
$('#issue-modal').modal('show'); $('#issue-modal').modal('show');
}); });

View File

@ -2,10 +2,8 @@ var Rx = require('rx'),
Twit = require('twit'), Twit = require('twit'),
async = require('async'), async = require('async'),
moment = require('moment'), moment = require('moment'),
Slack = require('node-slack'),
request = require('request'), request = require('request'),
debug = require('debug')('freecc:cntr:resources'), debug = require('debug')('freecc:cntr:resources'),
constantStrings = require('../utils/constantStrings.json'), constantStrings = require('../utils/constantStrings.json'),
bootcampJson = require('../utils/bootcamps.json'), bootcampJson = require('../utils/bootcamps.json'),
secrets = require('../../config/secrets'); secrets = require('../../config/secrets');
@ -24,8 +22,6 @@ module.exports = function(app) {
router.get('/api/trello', trelloCalls); router.get('/api/trello', trelloCalls);
router.get('/api/codepen/twitter/:screenName', twitter); router.get('/api/codepen/twitter/:screenName', twitter);
router.get('/sitemap.xml', sitemap); router.get('/sitemap.xml', sitemap);
router.post('/get-help', getHelp);
router.post('/get-pair', getPair);
router.get('/chat', chat); router.get('/chat', chat);
router.get('/coding-bootcamp-cost-calculator', bootcampCalculator); router.get('/coding-bootcamp-cost-calculator', bootcampCalculator);
router.get('/coding-bootcamp-cost-calculator.json', bootcampCalculatorJson); router.get('/coding-bootcamp-cost-calculator.json', bootcampCalculatorJson);
@ -39,72 +35,9 @@ module.exports = function(app) {
router.get('/unsubscribe/:email', unsubscribe); router.get('/unsubscribe/:email', unsubscribe);
router.get('/unsubscribed', unsubscribed); router.get('/unsubscribed', unsubscribed);
router.get('/cats.json', getCats); router.get('/cats.json', getCats);
router.get('/api/slack', slackInvite);
app.use(router); app.use(router);
function slackInvite(req, res, next) {
if (req.user) {
if (req.user.email) {
var invite = {
'email': req.user.email,
'token': process.env.SLACK_KEY,
'set_active': true
};
var headers = {
'User-Agent': 'Node Browser/0.0.1',
'Content-Type': 'application/x-www-form-urlencoded'
};
var options = {
url: 'https://freecodecamp.slack.com/api/users.admin.invite',
method: 'POST',
headers: headers,
form: invite
};
request(options, function (error, response) {
if (!error && response.statusCode === 200) {
req.flash('success', {
msg: 'We\'ve successfully requested an invite for you.' +
' Please check your email and follow the ' +
'instructions from Slack.'
});
req.user.sentSlackInvite = true;
req.user.save(function(err) {
if (err) {
return next(err);
}
return res.redirect('back');
});
} else {
req.flash('errors', {
msg: 'The invitation email did not go through for some reason.' +
' Please try again or <a href=\'mailto:team@' +
'freecodecamp.com?subject=' +
'slack%20invite%20failed%20to%20send\'>' +
'email us</a>.'
});
return res.redirect('back');
}
});
} else {
req.flash('notice', {
msg: 'Before we can send your Slack invite, we need your email ' +
'address. Please update your profile information here.'
});
return res.redirect('/account');
}
} else {
req.flash('notice', {
msg: 'You need to sign in to Free Code Camp before ' +
'we can send you a Slack invite.'
});
return res.redirect('/account');
}
}
function twitter(req, res, next) { function twitter(req, res, next) {
// sends out random tweets about javascript // sends out random tweets about javascript
var T = new Twit({ var T = new Twit({
@ -134,56 +67,6 @@ module.exports = function(app) {
); );
} }
function getHelp(req, res) {
var userName = req.user.username;
var code = req.body.payload.code ? '\n```\n' +
req.body.payload.code + '\n```\n'
: '';
var challenge = req.body.payload.challenge;
slack.send({
text: '*@' + userName + '* wants help with ' + challenge + '. ' +
code + 'Hey, *@' + userName + '*, if no one helps you right ' +
'away, try typing out your problem in detail to me. Like this: ' +
'http://en.wikipedia.org/wiki/Rubber_duck_debugging',
channel: '#help',
username: 'Debuggy the Rubber Duck',
'icon_url': 'https://pbs.twimg.com/profile_images/' +
'3609875545/569237541c920fa78d78902069615caf.jpeg'
});
return res.sendStatus(200);
}
function getPair(req, res) {
var userName = req.user.username;
var challenge = req.body.payload.challenge;
slack.send({
text: [
'Anyone want to pair with *@',
userName,
'* on ',
challenge,
'?\nMake sure you install Screen Hero here: ',
'http://freecodecamp.com/field-guide/how-do-i-install-screenhero\n',
'Then start your pair program session with *@',
userName,
'* by typing \"/hero @',
userName,
'\" into Slack.\n And *@',
userName,
'*, be sure to launch Screen Hero, then keep coding. ',
'Another camper may pair with you soon.'
].join(''),
channel: '#letspair',
username: 'Companion Cube',
'icon_url':
'https://lh3.googleusercontent.com/-f6xDPDV2rPE/AAAAAAAAAAI/' +
'AAAAAAAAAAA/mdlESXQu11Q/photo.jpg'
});
return res.sendStatus(200);
}
function sitemap(req, res, next) { function sitemap(req, res, next) {
var appUrl = 'http://www.freecodecamp.com'; var appUrl = 'http://www.freecodecamp.com';
var now = moment(new Date()).format('YYYY-MM-DD'); var now = moment(new Date()).format('YYYY-MM-DD');
@ -317,16 +200,6 @@ module.exports = function(app) {
); );
} }
function chat(req, res) {
if (req.user && req.user.progressTimestamps.length > 5) {
res.redirect('http://freecodecamp.slack.com');
} else {
res.render('resources/chat', {
title: 'Watch us code live on Twitch.tv'
});
}
}
function bootcampCalculator(req, res) { function bootcampCalculator(req, res) {
res.render('resources/calculator', { res.render('resources/calculator', {
title: 'Coding Bootcamp Cost Calculator', title: 'Coding Bootcamp Cost Calculator',
@ -338,6 +211,10 @@ module.exports = function(app) {
res.send(bootcampJson); res.send(bootcampJson);
} }
function chat(req, res) {
res.redirect('https://gitter.im/FreeCodeCamp/FreeCodeCamp');
}
function jobsForm(req, res) { function jobsForm(req, res) {
res.render('resources/jobs-form', { res.render('resources/jobs-form', {
title: 'Employer Partnership Form for Job Postings,' + title: 'Employer Partnership Form for Job Postings,' +

View File

@ -84,14 +84,9 @@ block content
label.negative-10.btn.btn-primary.btn-block#submitButton label.negative-10.btn.btn-primary.btn-block#submitButton
i.fa.fa-play i.fa.fa-play
| &nbsp; Run code (ctrl + enter) | &nbsp; Run code (ctrl + enter)
#resetButton.btn.btn-danger.btn-big.btn-block(data-toggle='modal', data-target='#reset-modal', data-backdrop='true') Reset Code
if (user && user.sentSlackInvite)
.button-spacer .button-spacer
.btn-group.input-group.btn-group-justified .btn-group.input-group.btn-group-justified
label.btn.btn-success#trigger-help-modal label.btn.btn-success#resetButton
i.fa.fa-refresh
| &nbsp; Reset
label.btn.btn-success#trigger-help-modal
i.fa.fa-refresh i.fa.fa-refresh
| &nbsp; Reset | &nbsp; Reset
label.btn.btn-success#trigger-help-modal label.btn.btn-success#trigger-help-modal

View File

@ -33,8 +33,6 @@ block content
label.btn.btn-primary.btn-block.negative-10#next-courseware-button label.btn.btn-primary.btn-block.negative-10#next-courseware-button
.ion-checkmark-circled .ion-checkmark-circled
| &nbsp; Go to my next challenge (ctrl + enter) | &nbsp; Go to my next challenge (ctrl + enter)
if (user.sentSlackInvite)
.button-spacer .button-spacer
.btn-group.input-group.btn-group-justified .btn-group.input-group.btn-group-justified
label.btn.btn-success#trigger-help-modal label.btn.btn-success#trigger-help-modal

View File

@ -35,18 +35,17 @@ block content
span.ion-arrow-up-b span.ion-arrow-up-b
| Less information | Less information
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter) #submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
if (user && user.sentSlackInvite) .button-spacer
.button-spacer .btn-group.input-group.btn-group-justified
.btn-group.input-group.btn-group-justified label.btn.btn-success#trigger-help-modal
label.btn.btn-success#trigger-help-modal i.fa.fa-medkit
i.fa.fa-medkit | &nbsp; Help
| &nbsp; Help label.btn.btn-success#trigger-pair-modal
label.btn.btn-success#trigger-pair-modal i.fa.fa-user-plus
i.fa.fa-user-plus | &nbsp; Pair
| &nbsp; Pair label.btn.btn-success#trigger-issue-modal
label.btn.btn-success#trigger-issue-modal i.fa.fa-bug
i.fa.fa-bug | &nbsp; Bug
| &nbsp; Bug
.spacer .spacer
form.code form.code
.form-group.codeMirrorView .form-group.codeMirrorView

View File

@ -21,14 +21,13 @@ block content
script. script.
var userLoggedIn = true; var userLoggedIn = true;
.button-spacer .button-spacer
if (user.sentSlackInvite) .btn-group.input-group.btn-group-justified
.btn-group.input-group.btn-group-justified .btn.btn-success.btn-big#trigger-help-modal-modal
.btn.btn-success.btn-big#trigger-help-editorless-modal i.fa.fa-medkit
i.fa.fa-medkit | &nbsp; Get help
| &nbsp; Get help .btn.btn-success.btn-big#trigger-issue-modal
.btn.btn-success.btn-big#trigger-issue-modal i.fa.fa-bug
i.fa.fa-bug | &nbsp; Report a bug
| &nbsp; Report a bug
.button-spacer .button-spacer
else else
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress

View File

@ -18,18 +18,17 @@ block content
br br
if (user) if (user)
a.btn.btn-primary.btn-big.btn-block#completed-zipline-or-basejump I've completed this challenge (ctrl + enter) a.btn.btn-primary.btn-big.btn-block#completed-zipline-or-basejump I've completed this challenge (ctrl + enter)
if (user.sentSlackInvite) .button-spacer
.button-spacer .btn-group.input-group.btn-group-justified
.btn-group.input-group.btn-group-justified .btn.btn-success.btn-big#trigger-help-modal
.btn.btn-success.btn-big#trigger-help-editorless-modal i.fa.fa-medkit
i.fa.fa-medkit | &nbsp; Help
| &nbsp; Help .btn.btn-success.btn-big#trigger-pair-modal
.btn.btn-success.btn-big#trigger-pair-modal i.fa.fa-user-plus
i.fa.fa-user-plus | &nbsp; Pair
| &nbsp; Pair .btn.btn-success.btn-big#trigger-issue-modal
.btn.btn-success.btn-big#trigger-issue-modal i.fa.fa-bug
i.fa.fa-bug | &nbsp; Bug
| &nbsp; Bug
.button-spacer .button-spacer
script. script.
var userLoggedIn = true; var userLoggedIn = true;

View File

@ -4,12 +4,12 @@
.modal-header.challenge-list-header Ready to pair program? .modal-header.challenge-list-header Ready to pair program?
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body.text-center .modal-body.text-center
h3 This will create a pair programming request. h3 This will take you to our pair programming room where you can request a pair.
h3 You'll need &thinsp; h3 You'll need &thinsp;
a(href='/field-guide/how-do-i-install-screenhero' target='_blank') Screen Hero a(href='/field-guide/how-do-i-install-screenhero' target='_blank') Screen Hero
| . | .
h3 Other campers may then message you about pair programming. h3 Other campers may then message you about pair programming.
a.btn.btn-lg.btn-primary.btn-block#i-want-to-pair(name='_csrf', value=_csrf) Create my pair request a.btn.btn-lg.btn-primary.btn-block(href='https://gitter.im/FreeCodeCamp/LetsPair', data-dismiss='modal', aria-hidden='true' target='_blank') Take me to the pair programming room
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
#issue-modal.modal(tabindex='-1') #issue-modal.modal(tabindex='-1')
@ -33,20 +33,6 @@
a(href='/field-guide/how-do-i-get-help-when-i-get-stuck' target='_blank') RSAP a(href='/field-guide/how-do-i-get-help-when-i-get-stuck' target='_blank') RSAP
| . | .
h3 If you've already read the errors and searched Google, you should ask for help. h3 If you've already read the errors and searched Google, you should ask for help.
h3 This will open a help request in our Help chat room. h3 This will take you to our help room.
a.btn.btn-lg.btn-primary.btn-block#i-want-help(name='_csrf', value=_csrf) Ask for help a.btn.btn-lg.btn-primary.btn-block(href='https://gitter.im/FreeCodeCamp/LetsPair', data-dismiss='modal', aria-hidden='true' target='_blank') Take me to the help room
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
#help-editorless-modal.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation
.modal-content
.modal-header.challenge-list-header Need some help?
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body.text-center
h3 Remember to use &thinsp;
a(href='/field-guide/how-do-i-get-help-when-i-get-stuck' target='_blank') RSAP
| .
h3 If you've already read the errors and searched Google, you should ask for help.
h3 This will open a help request in our Help chat room.
a.btn.btn-lg.btn-primary.btn-block#i-want-help-editorless(name='_csrf', value=_csrf) Ask for help
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel

View File

@ -13,12 +13,8 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
a(href='/challenges') Learn a(href='/challenges') Learn
li li
a(href='/map') Map a(href='/map') Map
if (user && user.sentSlackInvite) li
li a(href='gitter.im/FreeCodeCamp/FreeCodeCamp', target='_blank') Chat
a(href='/chat', target='_blank') Chat
else
li
a(href='/challenges/waypoint-join-our-chat-room') Chat
li li
a(href='/stories') News a(href='/stories') News
li li