2022-08-11 20:56:30 +02:00
|
|
|
export const filterNavigation = (list = [], { hasChats, isFederating, isPrivate, currentUser }) => {
|
|
|
|
return list.filter(({ criteria, anon, anonRoute }) => {
|
|
|
|
const set = new Set(criteria || [])
|
|
|
|
if (!isFederating && set.has('federating')) return false
|
|
|
|
if (isPrivate && set.has('!private')) return false
|
|
|
|
if (!currentUser && !(anon || anonRoute)) return false
|
|
|
|
if ((!currentUser || !currentUser.locked) && set.has('lockedUser')) return false
|
|
|
|
if (!hasChats && set.has('chats')) return false
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
}
|
2022-08-15 19:34:45 +02:00
|
|
|
|
2022-08-15 22:31:05 +02:00
|
|
|
export const getListEntries = state => console.log(state.lists) || state.lists.allLists.map(list => ({
|
2022-08-15 19:34:45 +02:00
|
|
|
name: 'list-' + list.id,
|
|
|
|
routeObject: { name: 'lists-timeline', params: { id: list.id } },
|
|
|
|
labelRaw: list.title,
|
|
|
|
iconLetter: list.title[0]
|
|
|
|
}))
|