diff --git a/server/routes/user.js b/server/routes/user.js index 0898994e..d25a16f9 100644 --- a/server/routes/user.js +++ b/server/routes/user.js @@ -439,7 +439,7 @@ router.get('/user/social/:provider', handleErrorAsync(async (req, res) => { if (!req.session.socialRedirect) { return '/' + config.user.route; } - const host = buildLocaleList(config.locale)[req.session.socialRedirect].url; + const host = buildLocaleList(config.locale, true)[req.session.socialRedirect].url; delete req.session.socialRedirect; return `${host}/api/user/social-redirect-callback/${encodeURIComponent(token)}`; diff --git a/src/helpers.js b/src/helpers.js index fbc578be..9f217f02 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -149,10 +149,10 @@ export const isTroll = (body) => { return ['cipeusz', 'feminazi', 'bruksela', 'zboczeń'].some(t => body.indexOf(t) > -1); } -export const buildLocaleList = (current) => { +export const buildLocaleList = (current, includeUnpublished = false) => { return buildDict(function* () { for (let [code, name, url, published] of locales) { - if (published || current === code) { + if (published || current === code || includeUnpublished) { yield [code, {name, url, published}]; } }