mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
refresh gear overview (#10971)
* refresh bought seasonal gear * just "subscribe" to the _v change instead of returning the value * subscribe in vue instead of lib
This commit is contained in:
@@ -388,7 +388,9 @@
|
||||
},
|
||||
|
||||
seasonal () {
|
||||
// vue subscriptions, don't remove
|
||||
let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line
|
||||
const myUserVersion = this.user._v; // eslint-disable-line
|
||||
|
||||
let seasonal = shops.getSeasonalShop(this.user);
|
||||
|
||||
|
||||
@@ -85,30 +85,16 @@ function removePinnedGearByClass (user) {
|
||||
}
|
||||
|
||||
function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
|
||||
let currentPinnedItems = selectGearToPin(user);
|
||||
let removeAndAddAllItems = false;
|
||||
|
||||
for (let item of currentPinnedItems) {
|
||||
let itemInfo = getItemInfo(user, 'marketGear', item);
|
||||
|
||||
if (itemInfo.path === itemPath) {
|
||||
removeAndAddAllItems = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
removeItemByPath(user, itemPath);
|
||||
|
||||
if (removeAndAddAllItems) {
|
||||
// an item of the users current "new" gear was bought
|
||||
// remove the old pinned gear items and add the new gear back
|
||||
removePinnedGearByClass(user);
|
||||
user.items.gear.owned[newItemKey] = true;
|
||||
addPinnedGearByClass(user);
|
||||
} else {
|
||||
// just change the new gear to owned
|
||||
user.items.gear.owned[newItemKey] = true;
|
||||
}
|
||||
// an item of the users current "new" gear was bought
|
||||
// remove the old pinned gear items and add the new gear back
|
||||
removePinnedGearByClass(user);
|
||||
user.items.gear.owned[newItemKey] = true;
|
||||
addPinnedGearByClass(user);
|
||||
|
||||
// update the version, so that vue can refresh the seasonal shop
|
||||
user._v++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user