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:
abigley 2022-01-21 16:10:50 -05:00 committed by GitHub
parent f01c352969
commit d11810677c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -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,

View file

@ -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);
}
}