Merge branch 'master' into ja-fix-cursor-on-resize

This commit is contained in:
James Allen 2017-02-07 15:27:01 +01:00
commit c1a2779d9e
7 changed files with 41 additions and 17 deletions

View file

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

View file

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

View file

@ -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}") || {}

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -451,6 +451,8 @@
resize: vertical;
color: @rp-type-darkgrey;
margin-top: 3px;
overflow-x: hidden;
min-height: 3em;
}
.rp-icon-delete {

View file

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