feat(server.certs): Remove team email

This commit is contained in:
Timo
2017-08-26 00:27:05 +02:00
committed by Berkeley Martinez
parent 251131aceb
commit a051d4d443
2 changed files with 14 additions and 51 deletions

View File

@ -1,10 +1,10 @@
import _ from 'lodash';
import moment from 'moment';
import loopback from 'loopback';
import path from 'path';
import dedent from 'dedent';
import { Observable } from 'rx';
import debug from 'debug';
import { isEmail } from 'validator';
import {
ifNoUser401,
@ -33,13 +33,6 @@ const renderCertifedEmail = loopback.template(path.join(
'emails',
'certified.ejs'
));
const renderNotifyEmail = loopback.template(path.join(
__dirname,
'..',
'views',
'emails',
'a-new-user.ejs'
));
const sendMessageToNonUser = ifNoUserSend(
'must be logged in to complete.'
);
@ -63,12 +56,6 @@ function getIdsForCert$(id, Challenge) {
.shareReplay();
}
// getFormatedDate(challengeMap: Object, challengeId: String) => String, throws
function getFormatedDate(challengeMap, challengeId) {
return moment(challengeMap[challengeId].completedDate)
.format('MMMM D, YYYY');
}
// sendCertifiedEmail(
// {
// email: String,
@ -92,51 +79,25 @@ function sendCertifiedEmail(
send$
) {
if (
!isEmail(email) ||
!isFrontEndCert ||
!isBackEndCert ||
!isDataVisCert
) {
return Observable.just(false);
}
let frontEndDate;
let backEndDate;
let dataVisDate;
try {
frontEndDate = getFormatedDate(challengeMap, frontEndChallengeId);
backEndDate = getFormatedDate(challengeMap, backEndChallengeId);
dataVisDate = getFormatedDate(challengeMap, dataVisChallengeId);
} catch (err) {
return Observable.throw(err);
}
const notifyTeam = {
type: 'email',
to: 'michael@freecodecamp.org',
from: 'team@freecodecamp.org',
subject: 'A new user has arrived!',
text: renderNotifyEmail({
username,
name,
frontEndDate,
dataVisDate,
backEndDate
})
};
const notifyUser = {
type: 'email',
to: email,
from: 'michael@freecodecamp.org',
subject: 'Congratulation on gaining your third certification!',
from: 'quincy@freecodecamp.org',
subject: dedent`Congratulations on completing all of the
freeCodeCamp certificates!`,
text: renderCertifedEmail({
username,
name
})
};
return Observable.combineLatest(
send$(notifyTeam),
send$(notifyUser),
() => true
);
return send$(notifyUser).map(() => true);
}
export default function certificate(app) {

View File

@ -1,13 +1,15 @@
Hi <%= name || username %>,
Congratulations on recently completing all three freeCodeCamp certifications. But you have not yet finished freeCodeCamp. The most important part still remains: the nonprofit projects.
Congratulations on completing all of the freeCodeCamp certificates!
These will help you contextualize and apply the raw skills you've picked up. You'll practice by building full stack JavaScript apps that real people will use. And in the end, you'll have code in production that you can showcase in your portfolio. This will be critical to your job search.
All of your certificates are now live at at: https://www.freecodecamp.org/<%= username %>
Please fill this out immediately: http://bit.ly/20VwLg0
Please tell me a bit more about you and your near-term goals.
Once you fill this out we will get back to you as quickly as possible to get you started.
Are you interested in contributing to our open source projects used by nonprofits?
Best,
Also, check out https://www.freecodecamp.org/contribute/ for some fun, convenient ways you can contribute to the community.
Michael - nonprofit guy @ freeCodeCamp
Happy coding,
- Quincy Larson, teacher at freeCodeCamp