diff --git a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee index ec5371f0f2..618e9e0a7d 100644 --- a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee +++ b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee @@ -53,7 +53,11 @@ module.exports = if req.body.login_after UserGetter.getUser user_id, {email: 1}, (err, user) -> return next(err) if err? - AuthenticationController.doLogin {email:user.email, password: password}, req, res, next + AuthenticationController.afterLoginSessionSetup req, user, (err) -> + if err? + logger.err {err, email: user.email}, "Error setting up session after setting password" + return next(err) + res.json {redir: AuthenticationController._getRedirectFromSession(req) || "/project"} else res.sendStatus 200 else diff --git a/services/web/app/views/translations/translation_message.pug b/services/web/app/views/translations/translation_message.pug index 225ad3ea2c..635a8c9265 100644 --- a/services/web/app/views/translations/translation_message.pug +++ b/services/web/app/views/translations/translation_message.pug @@ -2,7 +2,7 @@ span(ng-controller="TranslationsPopupController", ng-cloak) .translations-message(ng-hide="hidei18nNotification") a(href=recomendSubdomain.url+currentUrl) !{translate("click_here_to_view_sl_in_lng", {lngName:"" + translate(recomendSubdomain.lngCode) + ""})} - img(src=buildImgPath("flags/24/#{recomendSubdomain.lngCode}.png")) + img(src=buildImgPath("flags/24/" + recomendSubdomain.lngCode + ".png")) button(ng-click="dismiss()").close.pull-right span(aria-hidden="true") × span.sr-only #{translate("close")} \ No newline at end of file diff --git a/services/web/public/coffee/directives/expandableTextArea.coffee b/services/web/public/coffee/directives/expandableTextArea.coffee index 8f646c10a7..d0bfa9cb99 100644 --- a/services/web/public/coffee/directives/expandableTextArea.coffee +++ b/services/web/public/coffee/directives/expandableTextArea.coffee @@ -5,12 +5,13 @@ define [ restrict: "A" link: (scope, el) -> resetHeight = () -> - el.css("height", "auto") - el.css("height", el.prop("scrollHeight")) + curHeight = el.outerHeight() + fitHeight = el.prop("scrollHeight") + + if fitHeight > curHeight and el.val() != "" + scope.$emit "expandable-text-area:resize" + el.css("height", fitHeight) scope.$watch (() -> el.val()), resetHeight - resetHeight() - - \ No newline at end of file diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index 93775fd78f..9205cb7b87 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -167,10 +167,22 @@ define [ if arg == "/" ace.require("ace/ext/searchbox").Search(editor, true) + getCursorScreenPosition = () -> + session = editor.getSession() + cursorPosition = session.selection.getCursor() + sessionPos = session.documentToScreenPosition(cursorPosition.row, cursorPosition.column) + screenPos = editor.renderer.textToScreenCoordinates(sessionPos.row, sessionPos.column) + return sessionPos.row * editor.renderer.lineHeight - session.getScrollTop() + if attrs.resizeOn? for event in attrs.resizeOn.split(",") scope.$on event, () -> + previousScreenPosition = getCursorScreenPosition() editor.resize() + # Put cursor back to same vertical position on screen + newScreenPosition = getCursorScreenPosition() + session = editor.getSession() + session.setScrollTop(session.getScrollTop() + newScreenPosition - previousScreenPosition) scope.$watch "theme", (value) -> editor.setTheme("ace/theme/#{value}") diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/cursor-position/CursorPositionManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/cursor-position/CursorPositionManager.coffee index b8a3d43819..119aa471e1 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/cursor-position/CursorPositionManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/cursor-position/CursorPositionManager.coffee @@ -37,6 +37,9 @@ define [ @gotoOffset(offset) , 10 # Hack: Must happen after @gotoStoredPosition + @$scope.$on "#{@$scope.name}:clearSelection", (e) => + @editor.selection.clearSelection() + storeScrollTopPosition: (session) -> if @doc_id? docPosition = @localStorage("doc.position.#{@doc_id}") || {} diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee index 470909a9ed..5014559562 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee @@ -12,6 +12,9 @@ define [ class HighlightedWordManager constructor: (@editor) -> + @reset() + + reset: () -> @highlights = rows: [] addHighlight: (highlight) -> @@ -21,7 +24,7 @@ define [ highlight.row, highlight.column, highlight.row, highlight.column + highlight.word.length ) - highlight.markerId = @editor.getSession().addMarker range, "spelling-highlight", null, true + highlight.markerId = @editor.getSession().addMarker range, "spelling-highlight", 'text', false @highlights.rows[highlight.row] ||= [] @highlights.rows[highlight.row].push highlight diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee index e84ce1d785..759b1d2b70 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee @@ -22,6 +22,10 @@ define [ @closeContextMenu() @editor.on "changeSession", (e) => + @highlightedWordManager.reset() + if @inProgressRequest? + @inProgressRequest.abort() + if @$scope.spellCheckEnabled and @$scope.spellCheckLanguage and @$scope.spellCheckLanguage != "" @runSpellCheckSoon(200) @@ -183,7 +187,8 @@ define [ if not words.length displayResult highlights else - @apiRequest "/check", {language: language, words: words}, (error, result) => + @inProgressRequest = @apiRequest "/check", {language: language, words: words}, (error, result) => + delete @inProgressRequest if error? or !result? or !result.misspellings? return null mispelled = [] @@ -240,4 +245,4 @@ define [ callback null, data error: (xhr, status, error) -> callback error - $.ajax options + return $.ajax options diff --git a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index e7290e3ad4..119f8f48b1 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -29,9 +29,15 @@ define [ $scope.$on "layout:pdf:linked", (event, state) -> $scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed) + $scope.$broadcast "review-panel:layout" $scope.$on "layout:pdf:resize", (event, state) -> $scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed) + $scope.$broadcast "review-panel:layout" + + $scope.$on "expandable-text-area:resize", (event) -> + $timeout () -> + $scope.$broadcast "review-panel:layout" $scope.$watch "ui.pdfLayout", (layout) -> $scope.reviewPanel.layoutToLeft = (layout == "flat") @@ -306,6 +312,7 @@ define [ $http.post("/project/#{$scope.project_id}/thread/#{thread_id}/messages", {content, _csrf: window.csrfToken}) .error (error) -> ide.showGenericMessageModal("Error submitting comment", "Sorry, there was a problem submitting your comment") + $scope.$broadcast "editor:clearSelection" $timeout () -> $scope.$broadcast "review-panel:layout" event_tracking.sendMB "rp-new-comment", { size: content.length } diff --git a/services/web/public/img/about/joe_green.jpg b/services/web/public/img/about/joe_green.jpg new file mode 100644 index 0000000000..0b730673d0 Binary files /dev/null and b/services/web/public/img/about/joe_green.jpg differ diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index 419a154853..0239b4b73d 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -451,6 +451,8 @@ resize: vertical; color: @rp-type-darkgrey; margin-top: 3px; + overflow-x: hidden; + min-height: 3em; } .rp-icon-delete { diff --git a/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee b/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee index 89c6479734..d11507361c 100644 --- a/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee @@ -145,18 +145,27 @@ describe "PasswordResetController", -> done() @PasswordResetController.setNewUserPassword @req, @res - it "should login user if login_after is set", (done) -> - @UserGetter.getUser = sinon.stub().callsArgWith(2, null, { email: "joe@example.com" }) - @PasswordResetHandler.setNewUserPassword.callsArgWith(2, null, true, @user_id = "user-id-123") - @req.body.login_after = "true" - @AuthenticationController.doLogin = (options, req, res, next)=> - @UserGetter.getUser.calledWith(@user_id).should.equal true - expect(options).to.deep.equal { - email: "joe@example.com", - password: @password - } + describe 'when login_after is set', -> + + beforeEach -> + @UserGetter.getUser = sinon.stub().callsArgWith(2, null, { email: "joe@example.com" }) + @PasswordResetHandler.setNewUserPassword.callsArgWith(2, null, true, @user_id = "user-id-123") + @req.body.login_after = "true" + @res.json = sinon.stub() + @AuthenticationController.afterLoginSessionSetup = sinon.stub().callsArgWith(2, null) + @AuthenticationController._getRedirectFromSession = sinon.stub().returns('/some/path') + + it "should login user if login_after is set", (done) -> + @PasswordResetController.setNewUserPassword @req, @res + @AuthenticationController.afterLoginSessionSetup.callCount.should.equal 1 + @AuthenticationController.afterLoginSessionSetup.calledWith( + @req, + {email: 'joe@example.com'} + ).should.equal true + @AuthenticationController._getRedirectFromSession.callCount.should.equal 1 + @res.json.callCount.should.equal 1 + @res.json.calledWith({redir: '/some/path'}).should.equal true done() - @PasswordResetController.setNewUserPassword @req, @res describe "renderSetPasswordForm", ->