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/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/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/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index ac687386f8..320952f746 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -33,6 +33,10 @@ define [ $scope.$on "layout:pdf:resize", (event, state) -> $scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed) + $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 +310,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 da9fa7eb43..1bac7faf6f 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", ->