From 0edd2b5fe779f3cb0a85f63fb8cd20c73805787c Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 22 Jun 2018 14:05:48 +0100 Subject: [PATCH] Fix check for hasSubscription --- .../Features/Project/ProjectController.coffee | 2 +- .../coffee/Project/ProjectControllerTests.coffee | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Project/ProjectController.coffee b/services/web/app/coffee/Features/Project/ProjectController.coffee index 1b7051e39a..e2c71a956e 100644 --- a/services/web/app/coffee/Features/Project/ProjectController.coffee +++ b/services/web/app/coffee/Features/Project/ProjectController.coffee @@ -214,7 +214,7 @@ module.exports = ProjectController = tags: tags notifications: notifications or [] user: user - hasSubscription: results.hasSubscription[0] + hasSubscription: results.hasSubscription isShowingV1Projects: results.v1Projects? warnings: warnings } diff --git a/services/web/test/unit/coffee/Project/ProjectControllerTests.coffee b/services/web/test/unit/coffee/Project/ProjectControllerTests.coffee index 8de7c6aed1..bfd67e42d2 100644 --- a/services/web/test/unit/coffee/Project/ProjectControllerTests.coffee +++ b/services/web/test/unit/coffee/Project/ProjectControllerTests.coffee @@ -305,6 +305,20 @@ describe "ProjectController", -> done() @ProjectController.projectListPage @req, @res + it 'should send hasSubscription == false when no subscription', (done) -> + @res.render = (pageName, opts)=> + opts.hasSubscription.should.equal false + done() + @ProjectController.projectListPage @req, @res + + it 'should send hasSubscription == true when there is a subscription', (done) -> + @LimitationsManager.userHasSubscriptionOrIsGroupMember = sinon.stub().callsArgWith(1, null, true) + @res.render = (pageName, opts)=> + opts.hasSubscription.should.equal true + done() + @ProjectController.projectListPage @req, @res + + describe 'front widget', (done) -> beforeEach -> @settings.overleaf =