Merge pull request #10757 from craigstroman/fix/update-profile-from-GitHub

Updating profile from GitHub should show a notification and redirect …
This commit is contained in:
Quincy Larson
2016-09-16 00:33:41 -07:00
committed by GitHub
2 changed files with 16 additions and 2 deletions

View File

@ -8,7 +8,7 @@ export default function SocialSettings({
isLinkedIn
}) {
const githubCopy = isGithubCool ?
'Update my portfolio from GitHub' :
'Update my profile from GitHub' :
'Link my GitHub to unlock my portfolio';
const buttons = [
<Button

View File

@ -1,5 +1,6 @@
import { defaultProfileImage } from '../../common/utils/constantStrings.json';
import supportedLanguages from '../../common/utils/supported-languages';
import dedent from 'dedent';
const message =
'Learn to Code and Help Nonprofits';
@ -33,9 +34,22 @@ module.exports = function(app) {
if (!supportedLanguages[req._urlLang]) {
return next();
}
const referer = req.headers.referer;
if (req.user) {
return res.redirect('/challenges/current-challenge');
if ((referer.indexOf('/settings') >= 1) && (req.user.isGithubCool)) {
const msg = dedent`
We've updated your profile based
on your your GitHub account.
`;
const username = req.user.username;
req.flash('info', { msg: msg});
return res.redirect(`/${username}`);
} else {
return res.redirect('/challenges/current-challenge');
}
}
return res.render('home', { title: message });