mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Task sort payment fixes (#9104)
* Added sorting to dated filter * Validated payment data type
This commit is contained in:
@@ -159,6 +159,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Task from './task';
|
import Task from './task';
|
||||||
|
import sortBy from 'lodash/sortBy';
|
||||||
import { mapState, mapActions } from 'client/libs/store';
|
import { mapState, mapActions } from 'client/libs/store';
|
||||||
import { shouldDo } from 'common/script/cron';
|
import { shouldDo } from 'common/script/cron';
|
||||||
import inAppRewards from 'common/script/libs/inAppRewards';
|
import inAppRewards from 'common/script/libs/inAppRewards';
|
||||||
@@ -203,7 +204,7 @@ export default {
|
|||||||
label: 'todos',
|
label: 'todos',
|
||||||
filters: [
|
filters: [
|
||||||
{label: 'remaining', filter: t => !t.completed, default: true}, // active
|
{label: 'remaining', filter: t => !t.completed, default: true}, // active
|
||||||
{label: 'scheduled', filter: t => !t.completed && t.date},
|
{label: 'scheduled', filter: t => !t.completed && t.date, sort: t => t.date},
|
||||||
{label: 'complete2', filter: t => t.completed},
|
{label: 'complete2', filter: t => t.completed},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -316,6 +317,10 @@ export default {
|
|||||||
this.loadCompletedTodos();
|
this.loadCompletedTodos();
|
||||||
}
|
}
|
||||||
this.activeFilters[type] = filter;
|
this.activeFilters[type] = filter;
|
||||||
|
|
||||||
|
if (filter.sort) {
|
||||||
|
this.tasks[`${type}s`] = sortBy(this.tasks[`${type}s`], filter.sort);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setColumnBackgroundVisibility () {
|
setColumnBackgroundVisibility () {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ api.verifyGemPurchase = async function verifyGemPurchase (user, receipt, signatu
|
|||||||
let isValidated = iap.isValidated(googleRes);
|
let isValidated = iap.isValidated(googleRes);
|
||||||
if (!isValidated) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT);
|
if (!isValidated) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT);
|
||||||
|
|
||||||
let receiptObj = JSON.parse(testObj.data); // passed as a string
|
let receiptObj = typeof testObj.data === 'string' ? JSON.parse(testObj.data) : testObj.data; // passed as a string
|
||||||
let token = receiptObj.token || receiptObj.purchaseToken;
|
let token = receiptObj.token || receiptObj.purchaseToken;
|
||||||
|
|
||||||
let existingReceipt = await IapPurchaseReceipt.findOne({
|
let existingReceipt = await IapPurchaseReceipt.findOne({
|
||||||
@@ -106,7 +106,7 @@ api.subscribe = async function subscribe (sku, user, receipt, signature, headers
|
|||||||
signature,
|
signature,
|
||||||
};
|
};
|
||||||
|
|
||||||
let receiptObj = JSON.parse(receipt); // passed as a string
|
let receiptObj = typeof receipt === 'string' ? JSON.parse(receipt) : receipt; // passed as a string
|
||||||
let token = receiptObj.token || receiptObj.purchaseToken;
|
let token = receiptObj.token || receiptObj.purchaseToken;
|
||||||
|
|
||||||
let existingUser = await User.findOne({
|
let existingUser = await User.findOne({
|
||||||
|
|||||||
Reference in New Issue
Block a user