Parcourir la source

Show different message if user comes from SL rather than OL v2

James Allen il y a 8 ans
Parent
commit
3ed805a65a

+ 1 - 1
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -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"

+ 4 - 0
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -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)->

+ 10 - 5
services/web/app/views/project/list.pug

@@ -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 settings.accountMerge && settings.overleaf
 						.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.accountMerge.betaHost + "/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