diff --git a/services/web/app/src/Features/Subscription/RecurlyWrapper.js b/services/web/app/src/Features/Subscription/RecurlyWrapper.js index 92755e7d94..f8110ce0f4 100644 --- a/services/web/app/src/Features/Subscription/RecurlyWrapper.js +++ b/services/web/app/src/Features/Subscription/RecurlyWrapper.js @@ -439,9 +439,9 @@ const RecurlyWrapper = { apiRequest(options, callback) { options.url = RecurlyWrapper.apiUrl + '/' + options.url options.headers = { - Authorization: `Basic ${new Buffer(Settings.apis.recurly.apiKey).toString( - 'base64' - )}`, + Authorization: `Basic ${Buffer.from( + Settings.apis.recurly.apiKey + ).toString('base64')}`, Accept: 'application/xml', 'Content-Type': 'application/xml; charset=utf-8', 'X-Api-Version': Settings.apis.recurly.apiVersion, diff --git a/services/web/scripts/regenerate_duplicate_referral_ids.js b/services/web/scripts/regenerate_duplicate_referral_ids.js index 46295fd704..b64d614a9e 100644 --- a/services/web/scripts/regenerate_duplicate_referral_ids.js +++ b/services/web/scripts/regenerate_duplicate_referral_ids.js @@ -70,11 +70,16 @@ async function processBatch(_, users) { await rewriteDuplicates(uniqueReferalIdsInBatch) return } - const nMatching = await db.users.count( - { referal_id: { $in: uniqueReferalIdsInBatch } }, - { readPreference: ReadPreference.SECONDARY } - ) - if (nMatching !== uniqueReferalIdsInBatch.length) { + const matches = await db.users + .find( + { referal_id: { $in: uniqueReferalIdsInBatch } }, + { + readPreference: ReadPreference.SECONDARY, + projection: { _id: true }, + } + ) + .toArray() + if (matches.length !== uniqueReferalIdsInBatch.length) { if (VERBOSE_LOGGING) { console.log('Got duplicates from running count.') } diff --git a/services/web/test/acceptance/src/ApiClsiTests.js b/services/web/test/acceptance/src/ApiClsiTests.js index 0fb47acca9..599a8cea4b 100644 --- a/services/web/test/acceptance/src/ApiClsiTests.js +++ b/services/web/test/acceptance/src/ApiClsiTests.js @@ -16,7 +16,7 @@ const { expect } = require('chai') const request = require('./helpers/request') const Settings = require('@overleaf/settings') -const auth = new Buffer('sharelatex:password').toString('base64') +const auth = Buffer.from('sharelatex:password').toString('base64') const authed_request = request.defaults({ headers: { Authorization: `Basic ${auth}`, diff --git a/services/web/test/acceptance/src/RegenerateDuplicateReferralIdsTests.js b/services/web/test/acceptance/src/RegenerateDuplicateReferralIdsTests.js index c612c9c2cb..5a0d564af5 100644 --- a/services/web/test/acceptance/src/RegenerateDuplicateReferralIdsTests.js +++ b/services/web/test/acceptance/src/RegenerateDuplicateReferralIdsTests.js @@ -108,10 +108,7 @@ describe('RegenerateDuplicateReferralIds', function () { it('should do the correct operations', function () { let { stderr: stdErr, stdout: stdOut } = result - stdErr = stdErr - .split('\n') - .filter(line => !line.includes('DeprecationWarning')) - .filter(filterOutput) + stdErr = stdErr.split('\n').filter(filterOutput) stdOut = stdOut.split('\n').filter(filterOutput) expect(stdErr).to.deep.equal([ `Completed batch ending ${firstBatch[BATCH_SIZE - 1]}`,