Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
MM-14897: Converts set retrieval functions into selectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkraft committed May 14, 2019
1 parent a3ebe5d commit 20c387d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/selectors/entities/groups.js
Expand Up @@ -46,15 +46,19 @@ export function getGroupMembers(state, id) {
return groupMemberData.members;
}

function getTeamGroupIDSet(state, teamID) {
var arr = state.entities.teams.groupsAssociatedToTeam[teamID] || [];
return new Set(arr);
}
const teamGroupIDs = (state, teamID) => state.entities.teams.groupsAssociatedToTeam[teamID] || [];

function getChannelGroupIDSet(state, channelID) {
var arr = state.entities.channels.groupsAssociatedToChannel[channelID] || [];
return new Set(arr);
}
const channelGroupIDs = (state, channelID) => state.entities.channels.groupsAssociatedToChannel[channelID] || [];

const getTeamGroupIDSet = createSelector(
teamGroupIDs,
(teamIDs) => new Set(teamIDs),
);

const getChannelGroupIDSet = createSelector(
channelGroupIDs,
(channelIDs) => new Set(channelIDs),
);

export const getGroupsNotAssociatedToTeam = createSelector(
getAllGroups,
Expand Down

0 comments on commit 20c387d

Please sign in to comment.