mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
refine beta opt-in workflow.
This commit is contained in:
parent
20485cbfed
commit
90dac348ff
3 changed files with 6 additions and 3 deletions
|
@ -14,7 +14,7 @@ module.exports = BetaProgramController =
|
||||||
BetaProgramHandler.optIn user_id, (err) ->
|
BetaProgramHandler.optIn user_id, (err) ->
|
||||||
if err
|
if err
|
||||||
return next(err)
|
return next(err)
|
||||||
return res.redirect "/"
|
return res.redirect "/beta/opt-in"
|
||||||
|
|
||||||
optInPage: (req, res, next)->
|
optInPage: (req, res, next)->
|
||||||
user_id = req.session?.user?._id
|
user_id = req.session?.user?._id
|
||||||
|
|
|
@ -18,11 +18,13 @@ block content
|
||||||
.col-md-12
|
.col-md-12
|
||||||
if user.betaProgram
|
if user.betaProgram
|
||||||
p #{translate("beta_program_already_participating")}
|
p #{translate("beta_program_already_participating")}
|
||||||
|
.form-group
|
||||||
|
a(href="/project").btn.btn-info #{translate("back_to_your_projects")}
|
||||||
else
|
else
|
||||||
form(method="post", action="/beta/opt-in", novalidate)
|
form(method="post", action="/beta/opt-in", novalidate)
|
||||||
.form-group
|
.form-group
|
||||||
input(type="hidden", name="_csrf", value=csrfToken)
|
input(type="hidden", name="_csrf", value=csrfToken)
|
||||||
button.btn.btn-lg.btn-primary(
|
button.btn.btn-primary(
|
||||||
type="submit"
|
type="submit"
|
||||||
)
|
)
|
||||||
span #{translate("beta_program_opt_in_action")}
|
span #{translate("beta_program_opt_in_action")}
|
||||||
|
|
|
@ -44,9 +44,10 @@ describe "BetaProgramController", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@BetaProgramHandler.optIn.callsArgWith(1, null)
|
@BetaProgramHandler.optIn.callsArgWith(1, null)
|
||||||
|
|
||||||
it "should redirect to '/'", () ->
|
it "should redirect to '/beta/opt-in'", () ->
|
||||||
@BetaProgramController.optIn @req, @res, @next
|
@BetaProgramController.optIn @req, @res, @next
|
||||||
@res.redirect.callCount.should.equal 1
|
@res.redirect.callCount.should.equal 1
|
||||||
|
@res.redirect.firstCall.args[0].should.equal "/beta/opt-in"
|
||||||
|
|
||||||
it "should not call next with an error", () ->
|
it "should not call next with an error", () ->
|
||||||
@BetaProgramController.optIn @req, @res, @next
|
@BetaProgramController.optIn @req, @res, @next
|
||||||
|
|
Loading…
Reference in a new issue