mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-04 04:59:40 +00:00
10 lines
318 B
JavaScript
10 lines
318 B
JavaScript
|
|
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;
|
||
|
|
|
||
|
|
return pinnedItem && !isUnpinned;
|
||
|
|
};
|