Skip to content

Commit

Permalink
Merge b3d3d5d into ed8bd84
Browse files Browse the repository at this point in the history
  • Loading branch information
negue committed Jan 31, 2019
2 parents ed8bd84 + b3d3d5d commit c93c5b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
4 changes: 4 additions & 0 deletions website/common/script/libs/shops.js
Expand Up @@ -417,6 +417,8 @@ shops.getSeasonalGearBySet = function getSeasonalGearBySet (user, set, officialP
shops.getSeasonalShop = function getSeasonalShop (user, language) {
let officialPinnedItems = getOfficialPinnedItems(user);

const myUserVersion = user._v;

let resObject = {
identifier: 'seasonalShop',
text: i18n.t('seasonalShop'),
Expand All @@ -428,6 +430,8 @@ shops.getSeasonalShop = function getSeasonalShop (user, language) {
text: i18n.t(seasonalShopConfig.featuredSet),
items: shops.getSeasonalGearBySet(user, seasonalShopConfig.featuredSet, officialPinnedItems, language, true),
},
// return / subscribe to user._V, to let vue refresh the seasonal shop overview
_v: myUserVersion,
};

return resObject;
Expand Down
30 changes: 8 additions & 22 deletions website/common/script/ops/pinnedGearUtils.js
Expand Up @@ -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++;
}

/**
Expand Down

0 comments on commit c93c5b3

Please sign in to comment.