mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix isPinned : check if pinnedItems-array exists
This commit is contained in:
@@ -2,8 +2,8 @@ module.exports = function isPinned (user, item) {
|
|||||||
if (user === null)
|
if (user === null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const isUnpinned = user.unpinnedItems.findIndex(unpinned => unpinned.path === item.path) > -1;
|
const isItemUnpinned = user.unpinnedItems !== undefined && user.unpinnedItems.findIndex(unpinned => unpinned.path === item.path) > -1;
|
||||||
const pinnedItem = user.pinnedItems.findIndex(pinned => pinned.path === item.path) > -1;
|
const isItemPinned = user.pinnedItems !== undefined && user.pinnedItems.findIndex(pinned => pinned.path === item.path) > -1;
|
||||||
|
|
||||||
return pinnedItem && !isUnpinned;
|
return isItemPinned && !isItemUnpinned;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user