Merge branch 'release' into develop

This commit is contained in:
SabreCat
2022-11-18 15:29:06 -06:00
5 changed files with 2 additions and 25 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "habitica",
"version": "4.249.3",
"version": "4.249.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.249.3",
"version": "4.249.4",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.19.6",

View File

@@ -417,7 +417,6 @@ describe('Apple Payments', () => {
it('errors when a user is using the same subscription', async () => {
user = new User();
user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
await user.save();
payments.createSubscription.restore();
@@ -431,8 +430,6 @@ describe('Apple Payments', () => {
}]);
await applePayments.subscribe(sku, user, receipt, headers, nextPaymentProcessing);
user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
await user.save();
await expect(applePayments.subscribe(sku, user, receipt, headers, nextPaymentProcessing))
.to.eventually.be.rejected.and.to.eql({

View File

@@ -370,10 +370,6 @@ describe('payments/index', () => {
});
context('Purchasing a subscription for self', () => {
beforeEach(() => {
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
});
it('creates a subscription', async () => {
expect(user.purchased.plan.planId).to.not.exist;
@@ -400,7 +396,6 @@ describe('payments/index', () => {
user.purchased.plan = plan;
user.purchased.plan.dateTerminated = moment(new Date()).add(2, 'months');
expect(user.purchased.plan.extraMonths).to.eql(0);
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
await api.createSubscription(data);
@@ -411,7 +406,6 @@ describe('payments/index', () => {
user.purchased.plan = plan;
user.purchased.plan.dateTerminated = moment(new Date()).subtract(2, 'months');
expect(user.purchased.plan.extraMonths).to.eql(0);
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
await api.createSubscription(data);
@@ -421,7 +415,6 @@ describe('payments/index', () => {
it('does not reset Gold-to-Gems cap on additional subscription', async () => {
user.purchased.plan = plan;
user.purchased.plan.gemsBought = 10;
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
await api.createSubscription(data);
@@ -558,10 +551,6 @@ describe('payments/index', () => {
});
context('Block subscription perks', () => {
beforeEach(() => {
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
});
it('adds block months to plan.consecutive.offset', async () => {
await api.createSubscription(data);
@@ -598,7 +587,6 @@ describe('payments/index', () => {
data.sub.key = 'basic_12mo';
await api.createSubscription(data);
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
await api.createSubscription(data);
expect(user.purchased.plan.consecutive.gemCapExtra).to.eql(25);
@@ -765,7 +753,6 @@ describe('payments/index', () => {
now: mayMysteryItemTimeframe,
toFake: ['Date'],
});
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
});
afterEach(() => {

View File

@@ -16,7 +16,6 @@ import { // eslint-disable-line import/no-cycle
import {
NotAuthorized,
NotFound,
TooManyRequests,
} from '../errors';
import shared from '../../../common';
import { sendNotification as sendPushNotification } from '../pushNotifications'; // eslint-disable-line import/no-cycle
@@ -92,12 +91,6 @@ async function prepareSubscriptionValues (data) {
let emailType = 'subscription-begins';
let recipientIsSubscribed = recipient.isSubscribed();
if (data.user && !data.gift && !data.groupId && data.customerId !== 'group-plan') {
if (moment().diff(data.user.purchased.plan.dateUpdated, 'minutes') < 3) {
throw new TooManyRequests('Subscription already processed, likely duplicate request');
}
}
// If we are buying a group subscription
if (data.groupId) {
const groupFields = basicGroupFields.concat(' purchased');