From 1a1320b561a8a13f33ea10d3864aac745b8c08e4 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 26 Jan 2017 11:59:55 +0000 Subject: [PATCH 1/7] Avoid shrinking the expandable text area. --- .../public/coffee/directives/expandableTextArea.coffee | 10 +++++----- .../public/stylesheets/app/editor/review-panel.less | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/web/public/coffee/directives/expandableTextArea.coffee b/services/web/public/coffee/directives/expandableTextArea.coffee index 8f646c10a7..58f8ce13ae 100644 --- a/services/web/public/coffee/directives/expandableTextArea.coffee +++ b/services/web/public/coffee/directives/expandableTextArea.coffee @@ -5,12 +5,12 @@ 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() != "" + el.css("height", fitHeight) scope.$watch (() -> el.val()), resetHeight - resetHeight() - - \ No newline at end of file diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index da9fa7eb43..86bdedfff1 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -451,6 +451,7 @@ resize: vertical; color: @rp-type-darkgrey; margin-top: 3px; + overflow-x: hidden; } .rp-icon-delete { From 6304c213bdce77ea6ae80ea93371c8df33d39013 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 26 Jan 2017 12:00:11 +0000 Subject: [PATCH 2/7] Add a min-height to the review panel text areas. --- services/web/public/stylesheets/app/editor/review-panel.less | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index 86bdedfff1..1bac7faf6f 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -452,6 +452,7 @@ color: @rp-type-darkgrey; margin-top: 3px; overflow-x: hidden; + min-height: 3em; } .rp-icon-delete { From ce89714a48d9fa6e5ebbbb8626107d6fea1f44bd Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 26 Jan 2017 14:35:01 +0000 Subject: [PATCH 3/7] Emit event when textarea resizes; capture it in the review panel and trigger reflow. --- .../web/public/coffee/directives/expandableTextArea.coffee | 1 + .../ide/review-panel/controllers/ReviewPanelController.coffee | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/services/web/public/coffee/directives/expandableTextArea.coffee b/services/web/public/coffee/directives/expandableTextArea.coffee index 58f8ce13ae..d0bfa9cb99 100644 --- a/services/web/public/coffee/directives/expandableTextArea.coffee +++ b/services/web/public/coffee/directives/expandableTextArea.coffee @@ -9,6 +9,7 @@ define [ 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 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 5dc2cd3715..1a1a37cf21 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") From 27c48f3790df32bd3a99ba3225759d60e515adda Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 3 Feb 2017 14:17:09 +0100 Subject: [PATCH 4/7] Clear selection after creating a comment --- .../aceEditor/cursor-position/CursorPositionManager.coffee | 3 +++ .../ide/review-panel/controllers/ReviewPanelController.coffee | 1 + 2 files changed, 4 insertions(+) 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..40be0ed372 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -306,6 +306,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 } From a32ec78a54f3598b24fe95038b2e0a1396349017 Mon Sep 17 00:00:00 2001 From: Joe Green Date: Mon, 6 Feb 2017 11:59:32 +0000 Subject: [PATCH 5/7] added about image for jg --- services/web/public/img/about/joe_green.jpg | Bin 0 -> 9566 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 services/web/public/img/about/joe_green.jpg 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 0000000000000000000000000000000000000000..0b730673d0a06e38c2c7e665f979217889a86b07 GIT binary patch literal 9566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C>zRNB z)m`wh8~N+4X!N%`)+^W9X3RbZudaa3tUz3^Ke7g<=ffr}T1Vpv!R2ZJZdVU5ttX(Q zpW6exA87b2Cbejp*`rnHLcBL;Ta1WB$1T}V&VX}8Ul#JVhg%YfBHJ@=r_J76N#)U$ zd%-%;{KxnWMiZvZIUhWNCkv>oJHEX0VDPZZY2fGOqtY*J1Lu(X+cI$!pynnynq!W9 ze;GYv|K&`r#>CRIFQnbxwXcJy3!7R1S(N~e+Fr(RDRK0NTlbB1f9n4Boo2TN5!0dA?RA-BBDlMe i)ZoGAan~HpnK$$289d^=W+#3$`QzA})4??5$A1BKz Date: Mon, 6 Feb 2017 14:58:54 +0000 Subject: [PATCH 6/7] fix the set-password form for new (admin-created) users --- .../PasswordResetController.coffee | 7 ++++- .../PasswordResetControllerTests.coffee | 31 ++++++++++++------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee index ec5371f0f2..452193aeb4 100644 --- a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee +++ b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee @@ -53,7 +53,12 @@ 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.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/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", -> From 6a161b4071055ed050cf3d59f930a9fe55a7c064 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 6 Feb 2017 16:35:52 +0000 Subject: [PATCH 7/7] remove commented out code --- .../coffee/Features/PasswordReset/PasswordResetController.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee index 452193aeb4..618e9e0a7d 100644 --- a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee +++ b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee @@ -53,7 +53,6 @@ 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"