logo

pleroma-fe

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

filter.js (1303B)


  1. export const filterNavigation = (list = [], { hasChats, hasAnnouncements, isFederating, isPrivate, currentUser, supportsBookmarkFolders }) => {
  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. if (supportsBookmarkFolders && set.has('!supportsBookmarkFolders')) return false
  11. return true
  12. })
  13. }
  14. export const getListEntries = state => state.lists.allLists.map(list => ({
  15. name: 'list-' + list.id,
  16. routeObject: { name: 'lists-timeline', params: { id: list.id } },
  17. labelRaw: list.title,
  18. iconLetter: list.title[0]
  19. }))
  20. export const getBookmarkFolderEntries = state => state.bookmarkFolders.allFolders.map(folder => ({
  21. name: 'bookmark-folder-' + folder.id,
  22. routeObject: { name: 'bookmark-folder', params: { id: folder.id } },
  23. labelRaw: folder.name,
  24. iconEmoji: folder.emoji,
  25. iconEmojiUrl: folder.emoji_url,
  26. iconLetter: folder.name[0]
  27. }))