mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 12:48:52 +00:00
fix isPinned : check if pinnedItems-array exists
This commit is contained in:
parent
a86166742f
commit
748ce8a23f
1 changed files with 3 additions and 3 deletions
|
|
@ -2,8 +2,8 @@ module.exports = function isPinned (user, item) {
|
|||
if (user === null)
|
||||
return false;
|
||||
|
||||
const isUnpinned = user.unpinnedItems.findIndex(unpinned => unpinned.path === item.path) > -1;
|
||||
const pinnedItem = user.pinnedItems.findIndex(pinned => pinned.path === item.path) > -1;
|
||||
const isItemUnpinned = user.unpinnedItems !== undefined && user.unpinnedItems.findIndex(unpinned => unpinned.path === item.path) > -1;
|
||||
const isItemPinned = user.pinnedItems !== undefined && user.pinnedItems.findIndex(pinned => pinned.path === item.path) > -1;
|
||||
|
||||
return pinnedItem && !isUnpinned;
|
||||
return isItemPinned && !isItemUnpinned;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue