Merge pull request #293 from sharelatex/ja-allow-sl-login-to-v2

Show different message if user comes from SL instead of OL v2
This commit is contained in:
James Allen
2018-01-31 10:23:22 +00:00
committed by GitHub
5 changed files with 45 additions and 21 deletions
@@ -157,7 +157,7 @@ module.exports = ProjectController =
hasSubscription: (cb)->
LimitationsManager.userHasSubscriptionOrIsGroupMember currentUser, cb
user: (cb) ->
User.findById user_id, "featureSwitches", cb
User.findById user_id, "featureSwitches overleaf", cb
}, (err, results)->
if err?
logger.err err:err, "error getting data for project list page"
@@ -93,6 +93,10 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
req.externalAuthenticationSystemUsed = Features.externalAuthenticationSystemUsed
res.locals.externalAuthenticationSystemUsed = Features.externalAuthenticationSystemUsed
req.hasFeature = res.locals.hasFeature = Features.hasFeature
res.locals.userIsFromOLv1 = (user) ->
user.overleaf?.id?
res.locals.userIsFromSL = (user) ->
!user.overleaf?.id?
next()
webRouter.use (req, res, next)->
@@ -12,5 +12,7 @@ module.exports = Features =
return not Features.externalAuthenticationSystemUsed()
when 'github-sync'
return Settings.enableGithubSync
when 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf?
else
throw new Error("unknown feature: #{feature}")
+10 -5
View File
@@ -64,13 +64,18 @@ block content
aside.project-list-sidebar.col-md-2.col-xs-3
include ./list/side-bar
if isShowingV1Projects && settings.overleaf && settings.overleaf.host
if hasFeature('v1-return-message')
.project-list-sidebar-v2-pane.col-md-2.col-xs-3
span Welcome to the Overleaf v2 alpha! #[a(href="https://www.overleaf.com/help/342-overleaf-v2-faq") Find out more].
span To tag or rename your v1 projects, please go back to Overleaf v1.
a.project-list-sidebar-v1-link(
href=settings.overleaf.host + "/dash?prefer-v1-dash=1"
) Go back to v1
if userIsFromOLv1(user)
span To tag or rename your v1 projects, please go back to Overleaf v1.
a.project-list-sidebar-v1-link(
href=settings.overleaf.host + "/dash?prefer-v1-dash=1"
) Go back to v1
if userIsFromSL(user)
a.project-list-sidebar-v1-link(
href=settings.accountMerge.sharelatexHost
) Go back to ShareLaTeX
.project-list-main.col-md-10.col-xs-9
include ./list/notifications