diff --git a/packages/xpub-faraday/config/authsome-helpers.js b/packages/xpub-faraday/config/authsome-helpers.js index 14747802b05be75524902f75530e5b3ded3fee6b..1f885f1b2d421e5fd996f2c37de90f2ba8aa659d 100644 --- a/packages/xpub-faraday/config/authsome-helpers.js +++ b/packages/xpub-faraday/config/authsome-helpers.js @@ -4,10 +4,8 @@ const logger = require('@pubsweet/logger') const statuses = config.get('statuses') -const keysToOmit = ['email', 'id'] const publicStatusesPermissions = ['author', 'reviewer'] const authorAllowedStatuses = ['revisionRequested', 'rejected', 'accepted'] -const authorCanViewHENameStatuses = ['rejected', 'accepted'] const parseAuthorsData = (coll, matchingCollPerm) => { if (['reviewer'].includes(matchingCollPerm.permission)) { diff --git a/packages/xpub-faraday/tests/config/authsome-helpers.test.js b/packages/xpub-faraday/tests/config/authsome-helpers.test.js index ced5b1e955140c07bfa275ae1736d1e34edc909a..0e51ce6aed419d58cda2bf016f2bbc09d821e8b5 100644 --- a/packages/xpub-faraday/tests/config/authsome-helpers.test.js +++ b/packages/xpub-faraday/tests/config/authsome-helpers.test.js @@ -9,90 +9,6 @@ describe('Authsome Helpers', () => { testFixtures = cloneDeep(fixturesService.fixtures) models = fixturesService.Model.build(testFixtures) }) - it('stripeCollection - should return collection', () => { - const { collection } = testFixtures.collections - const result = ah.stripeCollectionByRole({ collection }) - expect(result).toBeTruthy() - }) - it('stripeFragment - should return fragment', () => { - const { fragment } = testFixtures.fragments - const result = ah.stripeFragmentByRole({ fragment }) - expect(result).toBeTruthy() - }) - - it('stripeCollection - author should not see accepted HE name before recommendation made', () => { - const { collection } = testFixtures.collections - collection.status = 'underReview' - collection.handlingEditor = { - ...collection.handlingEditor, - isAccepted: true, - } - - const role = 'author' - const result = ah.stripeCollectionByRole({ collection, role }) - const { handlingEditor = {} } = result - - expect(handlingEditor.email).toBeFalsy() - expect(handlingEditor.name).toEqual('Assigned') - }) - - it('stripeCollection - author should not see Assigned until HE accepted ', () => { - const { collection } = testFixtures.collections - collection.status = 'underReview' - collection.handlingEditor = { - ...collection.handlingEditor, - isAccepted: false, - } - - const role = 'author' - const result = ah.stripeCollectionByRole({ collection, role }) - const { handlingEditor = {} } = result - - expect(handlingEditor).toBeFalsy() - expect(handlingEditor.name).not.toEqual('Assigned') - }) - - it('stripeCollection - author should see HE name after recommendation made', () => { - const { collection } = testFixtures.collections - collection.status = 'revisionRequested' - - const role = 'author' - const result = ah.stripeCollectionByRole({ collection, role }) - const { handlingEditor = {} } = result - - expect(handlingEditor.name).not.toEqual('Assigned') - }) - - it('stripeCollection - other user than author should see HE name before recommendation made', () => { - const { collection } = testFixtures.collections - collection.status = 'underReview' - - const role = 'admin' - const result = ah.stripeCollectionByRole({ collection, role }) - const { handlingEditor = {} } = result - - expect(handlingEditor.name).not.toEqual('Assigned') - }) - - it('stripeCollection - other user than author should see HE name after recommendation made', () => { - const { collection } = testFixtures.collections - collection.status = 'revisionRequested' - - const role = 'admin' - const result = ah.stripeCollectionByRole({ collection, role }) - const { handlingEditor = {} } = result - - expect(handlingEditor.name).not.toEqual('Assigned') - }) - - it('stripeCollection - returns if collection does not have HE', () => { - const { collection } = testFixtures.collections - delete collection.handlingEditor - - const role = 'admin' - const result = ah.stripeCollectionByRole({ collection, role }) - expect(result.handlingEditor).toBeFalsy() - }) describe('stripeFragmentByRole', () => { it('reviewer should not see authors email', () => {