Merge pull request #10005 from overleaf/em-revert-get-best-subscription

Revert "pass requester data when fetching best subscription"

GitOrigin-RevId: 7d66ef9d1c136cd729b648266117f42dd38e06b6
This commit is contained in:
Eric Mc Sween 2022-10-17 12:22:39 -04:00 committed by Copybot
parent 2aaeea68a9
commit 8f63e21026
3 changed files with 4 additions and 9 deletions

View file

@ -478,7 +478,6 @@ const ProjectController = {
}
SubscriptionViewModelBuilder.getBestSubscription(
{ _id: userId },
{ id: userId, ip: req.ip },
(err, subscription) => {
if (err) {
// do not fail loading the project list when fetching the best subscription fails

View file

@ -340,7 +340,7 @@ function buildUsersSubscriptionViewModel(user, callback) {
* @param {{_id: string}} user
* @returns {Promise<Subscription>}
*/
async function getBestSubscription(user, requesterData = {}) {
async function getBestSubscription(user) {
let [
individualSubscription,
memberGroupSubscriptions,
@ -361,8 +361,7 @@ async function getBestSubscription(user, requesterData = {}) {
)
await SubscriptionUpdater.promises.updateSubscriptionFromRecurly(
recurlySubscription,
individualSubscription,
requesterData
individualSubscription
)
individualSubscription =
await SubscriptionLocator.promises.getUsersSubscription(user)

View file

@ -229,11 +229,9 @@ describe('SubscriptionViewModelBuilder', function () {
})
.resolves(this.recurlySubscription)
const requesterData = { id: this.user._id, ip: '1.2.3.4' }
const usersBestSubscription =
await this.SubscriptionViewModelBuilder.promises.getBestSubscription(
this.user,
requesterData
this.user
)
sinon.assert.calledWith(
@ -244,8 +242,7 @@ describe('SubscriptionViewModelBuilder', function () {
sinon.assert.calledWith(
this.SubscriptionUpdater.promises.updateSubscriptionFromRecurly,
this.recurlySubscription,
this.individualSubscriptionWithoutRecurly,
requesterData
this.individualSubscriptionWithoutRecurly
)
assert.deepEqual(usersBestSubscription, {
type: 'individual',