diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 08f538ed4a..b4bae7d2ec 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -776,6 +776,17 @@ const ProjectController = { } SubscriptionLocator.getUsersSubscription(userId, cb) }, + userIsMemberOfGroupSubscription(cb) { + if (sessionUser == null) { + return cb(null, false) + } + LimitationsManager.userIsMemberOfGroupSubscription( + sessionUser, + (error, isMember) => { + cb(error, isMember) + } + ) + }, activate(cb) { InactiveProjectManager.reactivateProjectIfRequired(projectId, cb) }, @@ -906,6 +917,7 @@ const ProjectController = { userHasInstitutionLicence, learnedWords, subscription, + userIsMemberOfGroupSubscription, isTokenMember, brandVariation, newSourceEditorAssignment, @@ -1023,6 +1035,7 @@ const ProjectController = { 'persistent-upgrade' && userId && !subscription && + !userIsMemberOfGroupSubscription && !userHasInstitutionLicence const template = diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js index 7e79d277d8..bf82626182 100644 --- a/services/web/test/unit/src/Project/ProjectControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectControllerTests.js @@ -55,7 +55,12 @@ describe('ProjectController', function () { .callsArgWith(2, null, { _id: this.project_id }), } this.SubscriptionLocator = { getUsersSubscription: sinon.stub() } - this.LimitationsManager = { hasPaidSubscription: sinon.stub() } + this.LimitationsManager = { + hasPaidSubscription: sinon.stub(), + userIsMemberOfGroupSubscription: sinon + .stub() + .callsArgWith(1, null, false), + } this.TagsHandler = { getAllTags: sinon.stub() } this.NotificationsHandler = { getUserNotifications: sinon.stub() } this.UserModel = { findById: sinon.stub(), updateOne: sinon.stub() } @@ -1527,7 +1532,7 @@ describe('ProjectController', function () { } this.ProjectController.loadEditor(this.req, this.res) }) - it('should not show for a user with a subscription', function (done) { + it('should not show for a user with a personal subscription', function (done) { this.SubscriptionLocator.getUsersSubscription = sinon .stub() .callsArgWith(1, null, {}) @@ -1537,6 +1542,16 @@ describe('ProjectController', function () { } this.ProjectController.loadEditor(this.req, this.res) }) + it('should not show for a user who is a member of a group subscription', function (done) { + this.LimitationsManager.userIsMemberOfGroupSubscription = sinon + .stub() + .callsArgWith(1, null, true) + this.res.render = (pageName, opts) => { + expect(opts.showHeaderUpgradePrompt).to.equal(false) + done() + } + this.ProjectController.loadEditor(this.req, this.res) + }) it('should not show for a user with an affiliated paid university', function (done) { this.InstitutionsFeatures.hasLicence = sinon .stub()