mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Fix
- Rewrite exports of debuffPotion functions
- Force clear debuffPotions in setDebuffPotionItems to make the same behavior as in develop branch
- Change class of debuffPotion items to shop_{key}
- Resolve lint warnings
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import getDebuffPotionItems from './getDebuffPotionItems';
|
||||
|
||||
function clearDebuffPotion (user) {
|
||||
return user.pinnedItems.filter(item => item.type !== 'debuffPotion');
|
||||
}
|
||||
|
||||
|
||||
export default function setDebuffPotionItems (user) {
|
||||
user.pinnedItems = clearDebuffPotion(user);
|
||||
|
||||
module.exports = function setDebuffPotionItems (user) {
|
||||
const debuffPotionItems = getDebuffPotionItems(user);
|
||||
|
||||
if (debuffPotionItems.length) {
|
||||
@@ -18,13 +24,7 @@ module.exports = function setDebuffPotionItems (user) {
|
||||
if (!isUserHaveDebuffInPinnedItems) {
|
||||
user.pinnedItems.push(...debuffPotionItems);
|
||||
}
|
||||
} else {
|
||||
user.pinnedItems = user.pinnedItems.filter(item => {
|
||||
return item.type !== 'debuffPotion';
|
||||
});
|
||||
}
|
||||
|
||||
return user;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user