diff --git a/config/secrets.js b/config/secrets.js index 2ea3cdef28..ed369d9766 100644 --- a/config/secrets.js +++ b/config/secrets.js @@ -13,10 +13,6 @@ module.exports = { key: process.env.BLOGGER_KEY }, - slack: { - key: process.env.SLACK_KEY - }, - mandrill: { user: process.env.MANDRILL_USER, password: process.env.MANDRILL_PASSWORD diff --git a/public/js/main_0.0.2.js b/public/js/main_0.0.2.js index 65ec9f170c..98ea7c23ed 100644 --- a/public/js/main_0.0.2.js +++ b/public/js/main_0.0.2.js @@ -16,67 +16,11 @@ $(document).ready(function() { 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() { $('#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') }); - $('#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() { var checklistElementId = $(this).attr('id'); if(!!localStorage[checklistElementId]) { @@ -150,10 +94,6 @@ $(document).ready(function() { $('#help-modal').modal('show'); }); - $('#trigger-help-editorless-modal').on('click', function() { - $('#help-editorless-modal').modal('show'); - }); - $('#trigger-issue-modal').on('click', function() { $('#issue-modal').modal('show'); }); diff --git a/server/boot/randomAPIs.js b/server/boot/randomAPIs.js index 7dd89b1b4f..c0092b558d 100644 --- a/server/boot/randomAPIs.js +++ b/server/boot/randomAPIs.js @@ -2,10 +2,8 @@ var Rx = require('rx'), Twit = require('twit'), async = require('async'), moment = require('moment'), - Slack = require('node-slack'), request = require('request'), debug = require('debug')('freecc:cntr:resources'), - constantStrings = require('../utils/constantStrings.json'), bootcampJson = require('../utils/bootcamps.json'), secrets = require('../../config/secrets'); @@ -24,8 +22,6 @@ module.exports = function(app) { router.get('/api/trello', trelloCalls); router.get('/api/codepen/twitter/:screenName', twitter); router.get('/sitemap.xml', sitemap); - router.post('/get-help', getHelp); - router.post('/get-pair', getPair); router.get('/chat', chat); router.get('/coding-bootcamp-cost-calculator', bootcampCalculator); router.get('/coding-bootcamp-cost-calculator.json', bootcampCalculatorJson); @@ -39,72 +35,9 @@ module.exports = function(app) { router.get('/unsubscribe/:email', unsubscribe); router.get('/unsubscribed', unsubscribed); router.get('/cats.json', getCats); - router.get('/api/slack', slackInvite); 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 ' + - 'email us.' - }); - 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) { // sends out random tweets about javascript 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) { var appUrl = 'http://www.freecodecamp.com'; 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) { res.render('resources/calculator', { title: 'Coding Bootcamp Cost Calculator', @@ -338,6 +211,10 @@ module.exports = function(app) { res.send(bootcampJson); } + function chat(req, res) { + res.redirect('https://gitter.im/FreeCodeCamp/FreeCodeCamp'); + } + function jobsForm(req, res) { res.render('resources/jobs-form', { title: 'Employer Partnership Form for Job Postings,' + diff --git a/server/views/coursewares/showBonfire.jade b/server/views/coursewares/showBonfire.jade index c28f20e322..1eae48b09e 100644 --- a/server/views/coursewares/showBonfire.jade +++ b/server/views/coursewares/showBonfire.jade @@ -84,14 +84,9 @@ block content label.negative-10.btn.btn-primary.btn-block#submitButton i.fa.fa-play |   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 .btn-group.input-group.btn-group-justified - label.btn.btn-success#trigger-help-modal - i.fa.fa-refresh - |   Reset - label.btn.btn-success#trigger-help-modal + label.btn.btn-success#resetButton i.fa.fa-refresh |   Reset label.btn.btn-success#trigger-help-modal diff --git a/server/views/coursewares/showHTML.jade b/server/views/coursewares/showHTML.jade index 2ebc64d0dd..755fb92b6d 100644 --- a/server/views/coursewares/showHTML.jade +++ b/server/views/coursewares/showHTML.jade @@ -33,8 +33,6 @@ block content label.btn.btn-primary.btn-block.negative-10#next-courseware-button .ion-checkmark-circled |   Go to my next challenge (ctrl + enter) - - if (user.sentSlackInvite) .button-spacer .btn-group.input-group.btn-group-justified label.btn.btn-success#trigger-help-modal diff --git a/server/views/coursewares/showJS.jade b/server/views/coursewares/showJS.jade index 58737351ac..369e810061 100644 --- a/server/views/coursewares/showJS.jade +++ b/server/views/coursewares/showJS.jade @@ -35,18 +35,17 @@ block content span.ion-arrow-up-b | Less information #submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter) - if (user && user.sentSlackInvite) - .button-spacer - .btn-group.input-group.btn-group-justified - label.btn.btn-success#trigger-help-modal - i.fa.fa-medkit - |   Help - label.btn.btn-success#trigger-pair-modal - i.fa.fa-user-plus - |   Pair - label.btn.btn-success#trigger-issue-modal - i.fa.fa-bug - |   Bug + .button-spacer + .btn-group.input-group.btn-group-justified + label.btn.btn-success#trigger-help-modal + i.fa.fa-medkit + |   Help + label.btn.btn-success#trigger-pair-modal + i.fa.fa-user-plus + |   Pair + label.btn.btn-success#trigger-issue-modal + i.fa.fa-bug + |   Bug .spacer form.code .form-group.codeMirrorView diff --git a/server/views/coursewares/showVideo.jade b/server/views/coursewares/showVideo.jade index 4e9d82a6ec..ae3e049c90 100644 --- a/server/views/coursewares/showVideo.jade +++ b/server/views/coursewares/showVideo.jade @@ -21,14 +21,13 @@ block content script. var userLoggedIn = true; .button-spacer - if (user.sentSlackInvite) - .btn-group.input-group.btn-group-justified - .btn.btn-success.btn-big#trigger-help-editorless-modal - i.fa.fa-medkit - |   Get help - .btn.btn-success.btn-big#trigger-issue-modal - i.fa.fa-bug - |   Report a bug + .btn-group.input-group.btn-group-justified + .btn.btn-success.btn-big#trigger-help-modal-modal + i.fa.fa-medkit + |   Get help + .btn.btn-success.btn-big#trigger-issue-modal + i.fa.fa-bug + |   Report a bug .button-spacer else a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress diff --git a/server/views/coursewares/showZiplineOrBasejump.jade b/server/views/coursewares/showZiplineOrBasejump.jade index ae72c47528..6bd38d9737 100644 --- a/server/views/coursewares/showZiplineOrBasejump.jade +++ b/server/views/coursewares/showZiplineOrBasejump.jade @@ -18,18 +18,17 @@ block content br if (user) a.btn.btn-primary.btn-big.btn-block#completed-zipline-or-basejump I've completed this challenge (ctrl + enter) - if (user.sentSlackInvite) - .button-spacer - .btn-group.input-group.btn-group-justified - .btn.btn-success.btn-big#trigger-help-editorless-modal - i.fa.fa-medkit - |   Help - .btn.btn-success.btn-big#trigger-pair-modal - i.fa.fa-user-plus - |   Pair - .btn.btn-success.btn-big#trigger-issue-modal - i.fa.fa-bug - |   Bug + .button-spacer + .btn-group.input-group.btn-group-justified + .btn.btn-success.btn-big#trigger-help-modal + i.fa.fa-medkit + |   Help + .btn.btn-success.btn-big#trigger-pair-modal + i.fa.fa-user-plus + |   Pair + .btn.btn-success.btn-big#trigger-issue-modal + i.fa.fa-bug + |   Bug .button-spacer script. var userLoggedIn = true; diff --git a/server/views/partials/challenge-modals.jade b/server/views/partials/challenge-modals.jade index 5270e77cd4..ba8dc1becd 100644 --- a/server/views/partials/challenge-modals.jade +++ b/server/views/partials/challenge-modals.jade @@ -4,12 +4,12 @@ .modal-header.challenge-list-header Ready to pair program? a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × .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   a(href='/field-guide/how-do-i-install-screenhero' target='_blank') Screen Hero | . 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 #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 | . 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(name='_csrf', value=_csrf) Ask for help - 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   - 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 + h3 This will take you to our help room. + 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 diff --git a/server/views/partials/navbar.jade b/server/views/partials/navbar.jade index 317ce661d1..0316cbe202 100644 --- a/server/views/partials/navbar.jade +++ b/server/views/partials/navbar.jade @@ -13,12 +13,8 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height a(href='/challenges') Learn li a(href='/map') Map - if (user && user.sentSlackInvite) - li - a(href='/chat', target='_blank') Chat - else - li - a(href='/challenges/waypoint-join-our-chat-room') Chat + li + a(href='gitter.im/FreeCodeCamp/FreeCodeCamp', target='_blank') Chat li a(href='/stories') News li