mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
misc fixes - sep 17 (#9045)
* not locking pre-owned gear - pin removed gear on revive * fix createAnimal (check for function) - hide pet-popover while dragging food * fix dragging popover text color * fix drop toasts * selectMembersModal: load members on item change
This commit is contained in:
@@ -10,6 +10,19 @@ const officialPinnedItems = content.officialPinnedItems;
|
||||
|
||||
import updateStore from '../libs/updateStore';
|
||||
|
||||
function addPinnedGear (user, type, path) {
|
||||
const foundIndex = user.pinnedItems.findIndex(pinnedItem => {
|
||||
return pinnedItem.path === path;
|
||||
});
|
||||
|
||||
if (foundIndex === -1) {
|
||||
user.pinnedItems.push({
|
||||
type,
|
||||
path,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addPinnedGearByClass (user) {
|
||||
if (user.flags.classSelected) {
|
||||
let newPinnedItems = updateStore(user);
|
||||
@@ -17,16 +30,7 @@ function addPinnedGearByClass (user) {
|
||||
for (let item of newPinnedItems) {
|
||||
let itemInfo = getItemInfo(user, 'marketGear', item);
|
||||
|
||||
const foundIndex = user.pinnedItems.findIndex(pinnedItem => {
|
||||
return pinnedItem.path === itemInfo.path;
|
||||
});
|
||||
|
||||
if (foundIndex === -1) {
|
||||
user.pinnedItems.push({
|
||||
type: 'marketGear',
|
||||
path: itemInfo.path,
|
||||
});
|
||||
}
|
||||
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,6 +128,7 @@ function togglePinnedItem (user, {item, type, path}, req = {}) {
|
||||
|
||||
module.exports = {
|
||||
addPinnedGearByClass,
|
||||
addPinnedGear,
|
||||
removePinnedGearByClass,
|
||||
removePinnedGearAddPossibleNewOnes,
|
||||
togglePinnedItem,
|
||||
|
||||
Reference in New Issue
Block a user