Просмотр исходного кода

Merge branch 'master' into sk-passport

# Conflicts:
#	app/coffee/Features/Authorization/AuthorizationMiddlewear.coffee
Shane Kilkelly 10 лет назад
Родитель
Сommit
97a6ac0f00

+ 7 - 3
services/web/app/coffee/Features/Authorization/AuthorizationMiddlewear.coffee

@@ -97,12 +97,16 @@ module.exports = AuthorizationMiddlewear =
 		return callback(null, user_id)
 
 	redirectToRestricted: (req, res, next) ->
-		res.redirect "/restricted"
+		res.redirect "/restricted?from=#{encodeURIComponent(req.url)}"
 
 	restricted : (req, res, next)->
 		if AuthenticationController.isUserLoggedIn(req)
 			res.render 'user/restricted',
 				title:'restricted'
 		else
-			logger.log "user not logged in and trying to access #{req.url}, being redirected to login"
-			res.redirect '/register'
+			from = req.query.from
+			logger.log {from: from}, "redirecting to login"
+			redirect_to = "/login"
+			if from?
+				redirect_to += "?redir=#{encodeURIComponent(from)}"
+			res.redirect redirect_to

+ 1 - 1
services/web/app/coffee/Features/Email/EmailBuilder.coffee

@@ -26,7 +26,7 @@ templates.canceledSubscription =
 	compiledTemplate: _.template '''
 <p>Hi <%= first_name %>,</p>
 
-<p>I'm sorry to see you cancelled your ShareLaTeX premium account. Would you mind giving me some advice on what the site is lacking at the moment via <a href="https://sharelatex.typeform.com/to/F7OzIY">this survey</a>?</p>
+<p>I'm sorry to see you cancelled your ShareLaTeX premium account. Would you mind giving me some advice on what the site is lacking at the moment via <a href="https://sharelatex.typeform.com/to/f5lBiZ">this survey</a>?</p>
 
 <p>Thank you in advance.</p>
 

+ 3 - 1
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -122,7 +122,9 @@ module.exports = (app, webRouter, apiRouter)->
 		res.locals.translate = (key, vars = {}) ->
 			vars.appName = Settings.appName
 			req.i18n.translate(key, vars)
-		res.locals.currentUrl = req.originalUrl
+		# Don't include the query string parameters, otherwise Google
+		# treats ?nocdn=true as the canonical version
+		res.locals.currentUrl = Url.parse(req.originalUrl).pathname
 		next()
 
 	webRouter.use (req, res, next)->

+ 1 - 1
services/web/app/views/layout.jade

@@ -57,7 +57,7 @@ html(itemscope, itemtype='http://schema.org/Product')
 			var noCdnKey = "nocdn=true"
 			var cdnBlocked = typeof jQuery === 'undefined'
 			var noCdnAlreadyInUrl = window.location.href.indexOf(noCdnKey) != -1 //prevent loops
-			if (cdnBlocked && !noCdnAlreadyInUrl) {
+			if (cdnBlocked && !noCdnAlreadyInUrl && navigator.userAgent.indexOf("Googlebot") == -1) {
 				window.location.search += '&'+noCdnKey;
 			}
 		script(src=buildJsPath("libs/angular-1.3.15.min.js", {fingerprint:false}))

+ 4 - 0
services/web/app/views/project/editor/left-menu.jade

@@ -197,6 +197,10 @@ script(type='text/ng-template', id='wordCountModalTemplate')
 			)
 		div(ng-if="!status.loading")
 			.container-fluid
+				.row(ng-show='data.messages.length > 0')
+					.col-xs-12
+						.alert.alert-danger
+							p(style="white-space: pre-wrap") {{data.messages}}
 				.row
 					.col-xs-4
 						.pull-right #{translate("total_words")} :

+ 2 - 2
services/web/app/views/project/list/project-list.jade

@@ -8,7 +8,7 @@
 				input.form-control.col-md-7.col-xs-12(
 					placeholder="#{translate('search_projects')}…",
 					autofocus='autofocus',
-					ng-model="searchText",
+					ng-model="searchText.value",
 					focus-on='search:clear',
 					ng-keyup="searchProjects()"
 				)
@@ -16,7 +16,7 @@
 				i.fa.fa-times.form-control-feedback(
 					ng-click="clearSearchText()",
 					style="cursor: pointer;",
-					ng-show="searchText.length > 0"
+					ng-show="searchText.value.length > 0"
 				)
 			//- i.fa.fa-remove
 

+ 1 - 1
services/web/app/views/project/list/side-bar.jade

@@ -155,6 +155,6 @@
 							| #{translate("or_unlock_features_bonus")} 
 							a(href="/user/bonus") #{translate("sharing_sl")} .
 script.
-	window.userHasNoSubscription = #{settings.enableSubscriptions && !hasSubscription}
+	window.userHasNoSubscription = #{!!(settings.enableSubscriptions && !hasSubscription)}
 
 

+ 1 - 1
services/web/config/settings.defaults.coffee

@@ -155,7 +155,7 @@ module.exports = settings =
 		collaborators: -1
 		dropbox: true
 		versioning: true
-		compileTimeout: 60
+		compileTimeout: 180
 		compileGroup: "standard"
 		references: true
 		templates: true

+ 2 - 1
services/web/public/coffee/ide/pdf/controllers/PdfController.coffee

@@ -74,7 +74,8 @@ define [
 			$scope.pdf.renderingError = true
 
 		# abort compile if syntax checks fail
-		$scope.stop_on_validation_error = localStorage("stop_on_validation_error:#{$scope.project_id}") or ide.$scope?.user?.betaProgram
+		$scope.stop_on_validation_error = localStorage("stop_on_validation_error:#{$scope.project_id}")
+		$scope.stop_on_validation_error ?= true # turn on for all users by default
 		$scope.$watch "stop_on_validation_error", (new_value, old_value) ->
 			if new_value? and old_value != new_value
 				localStorage("stop_on_validation_error:#{$scope.project_id}", new_value)

+ 1 - 1
services/web/public/coffee/ide/share/controllers/ShareProjectModalController.coffee

@@ -19,7 +19,7 @@ define [
 			, 200
 
 		INFINITE_COLLABORATORS = -1
-		$scope.$watch "project.members.length", (noOfMembers) ->
+		$scope.$watch "(project.members.length + project.invites.length)", (noOfMembers) ->
 			allowedNoOfMembers = $scope.project.features.collaborators
 			$scope.canAddCollaborators = noOfMembers < allowedNoOfMembers or allowedNoOfMembers == INFINITE_COLLABORATORS
 

+ 5 - 3
services/web/public/coffee/main/project-list/project-list.coffee

@@ -11,6 +11,8 @@ define [
 		$scope.filter = "all"
 		$scope.predicate = "lastUpdated"
 		$scope.reverse = true
+		$scope.searchText = 
+			value : ""
 
 		if $scope.projects.length == 0
 			$timeout () ->
@@ -69,7 +71,7 @@ define [
 			$scope.updateVisibleProjects()
 
 		$scope.clearSearchText = () ->
-			$scope.searchText = ""
+			$scope.searchText.value = ""
 			$scope.filter = "all"
 			$scope.$emit "search:clear"
 			$scope.updateVisibleProjects()
@@ -96,8 +98,8 @@ define [
 			for project in $scope.projects
 				visible = true
 				# Only show if it matches any search text
-				if $scope.searchText? and $scope.searchText != ""
-					if !project.name.toLowerCase().match($scope.searchText.toLowerCase())
+				if $scope.searchText.value? and $scope.searchText.value != ""
+					if !project.name.toLowerCase().match($scope.searchText.value.toLowerCase())
 						visible = false
 				# Only show if it matches the selected tag
 				if $scope.filter == "tag" and selectedTag? and project.id not in selectedTag.project_ids