mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-15 08:22:17 +00:00
Fixed issue with mystery sets, pets, and mounts staying pinned in the rewards column after purchasing. Added logic to look up item info and remove from pinned list by path. (#13701)
This commit is contained in:
parent
f01c352969
commit
d11810677c
2 changed files with 15 additions and 0 deletions
|
|
@ -8,6 +8,8 @@ import {
|
|||
NotFound,
|
||||
} from '../../libs/errors';
|
||||
import errorMessage from '../../libs/errorMessage';
|
||||
import { removeItemByPath } from '../pinnedGearUtils';
|
||||
import getItemInfo from '../../libs/getItemInfo';
|
||||
|
||||
export default function buyMysterySet (user, req = {}, analytics) {
|
||||
const key = get(req, 'params.key');
|
||||
|
|
@ -28,6 +30,9 @@ export default function buyMysterySet (user, req = {}, analytics) {
|
|||
user.items.gear.owned[item.key] = true;
|
||||
});
|
||||
|
||||
const itemInfo = getItemInfo(user, 'mystery_set', mysterySet);
|
||||
removeItemByPath(user, itemInfo.path);
|
||||
|
||||
if (analytics) {
|
||||
analytics.track('buy', {
|
||||
uuid: user._id,
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ export default function purchaseHourglass (user, req = {}, analytics, quantity =
|
|||
[key]: 5,
|
||||
};
|
||||
if (user.markModified) user.markModified('items.pets');
|
||||
const itemInfo = getItemInfo(user, 'timeTravelersStable', {
|
||||
key,
|
||||
type,
|
||||
});
|
||||
removeItemByPath(user, itemInfo.path);
|
||||
}
|
||||
|
||||
if (type === 'mounts') {
|
||||
|
|
@ -79,6 +84,11 @@ export default function purchaseHourglass (user, req = {}, analytics, quantity =
|
|||
[key]: true,
|
||||
};
|
||||
if (user.markModified) user.markModified('items.mounts');
|
||||
const itemInfo = getItemInfo(user, 'timeTravelersStable', {
|
||||
key,
|
||||
type,
|
||||
});
|
||||
removeItemByPath(user, itemInfo.path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue