diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -36,6 +36,7 @@ threadPermissions, threadTypes, type SidebarInfo, + threadTypeIsCommunityRoot, } from '../types/thread-types'; import { dateString, dateFromString } from '../utils/date-utils'; import { values } from '../utils/objects'; @@ -57,6 +58,22 @@ threadInfoFromRawThreadInfo, ); +const communintyThreadSelector: ( + state: BaseAppState<*>, +) => $ReadOnlyArray = createSelector( + threadInfoSelector, + (threadInfos: { +[id: string]: ThreadInfo }) => { + const result = []; + for (const threadID in threadInfos) { + const threadInfo = threadInfos[threadID]; + if (threadTypeIsCommunityRoot(threadInfo.type)) { + result.push(threadInfo); + } + } + return result; + }, +); + const canBeOnScreenThreadInfos: ( state: BaseAppState<*>, ) => $ReadOnlyArray = createSelector( @@ -398,6 +415,7 @@ export { ancestorThreadInfos, threadInfoSelector, + communintyThreadSelector, onScreenThreadInfos, onScreenEntryEditableThreadInfos, entryInfoSelector,