logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

filter.js (863B)


  1. export const filterNavigation = (list = [], { hasChats, hasAnnouncements, isFederating, isPrivate, currentUser }) => {
  2. return list.filter(({ criteria, anon, anonRoute }) => {
  3. const set = new Set(criteria || [])
  4. if (!isFederating && set.has('federating')) return false
  5. if (!currentUser && isPrivate && set.has('!private')) return false
  6. if (!currentUser && !(anon || anonRoute)) return false
  7. if ((!currentUser || !currentUser.locked) && set.has('lockedUser')) return false
  8. if (!hasChats && set.has('chats')) return false
  9. if (!hasAnnouncements && set.has('announcements')) return false
  10. return true
  11. })
  12. }
  13. export const getListEntries = state => state.lists.allLists.map(list => ({
  14. name: 'list-' + list.id,
  15. routeObject: { name: 'lists-timeline', params: { id: list.id } },
  16. labelRaw: list.title,
  17. iconLetter: list.title[0]
  18. }))