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:
@ -8,7 +8,7 @@ export default function SocialSettings({
|
|||||||
isLinkedIn
|
isLinkedIn
|
||||||
}) {
|
}) {
|
||||||
const githubCopy = isGithubCool ?
|
const githubCopy = isGithubCool ?
|
||||||
'Update my portfolio from GitHub' :
|
'Update my profile from GitHub' :
|
||||||
'Link my GitHub to unlock my portfolio';
|
'Link my GitHub to unlock my portfolio';
|
||||||
const buttons = [
|
const buttons = [
|
||||||
<Button
|
<Button
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { defaultProfileImage } from '../../common/utils/constantStrings.json';
|
import { defaultProfileImage } from '../../common/utils/constantStrings.json';
|
||||||
import supportedLanguages from '../../common/utils/supported-languages';
|
import supportedLanguages from '../../common/utils/supported-languages';
|
||||||
|
import dedent from 'dedent';
|
||||||
|
|
||||||
const message =
|
const message =
|
||||||
'Learn to Code and Help Nonprofits';
|
'Learn to Code and Help Nonprofits';
|
||||||
@ -33,9 +34,22 @@ module.exports = function(app) {
|
|||||||
if (!supportedLanguages[req._urlLang]) {
|
if (!supportedLanguages[req._urlLang]) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
const referer = req.headers.referer;
|
||||||
|
|
||||||
if (req.user) {
|
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 });
|
return res.render('home', { title: message });
|
||||||
|
Reference in New Issue
Block a user