Skip to content

Commit

Permalink
Subteams data on the team member page (keybase#22623)
Browse files Browse the repository at this point in the history
* subteams not in

* in teams too

* make testable, fix bugs

* danny feedback

* eslint

* stories

* jzila feedback
  • Loading branch information
aaazalea authored Mar 3, 2020
1 parent 30c4a8a commit e6a7137
Show file tree
Hide file tree
Showing 5 changed files with 424 additions and 54 deletions.
20 changes: 20 additions & 0 deletions shared/constants/teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,26 @@ export const getCanPerform = (state: TypedState, teamname: Types.Teamname): Type
export const getCanPerformByID = (state: TypedState, teamID: Types.TeamID): Types.TeamOperations =>
deriveCanPerform(state.teams.teamRoleMap.roles.get(teamID))

export const getSubteamsInNotIn = (state: TypedState, teamID: Types.TeamID, username: string) => {
const subteamsAll = getTeamDetails(state, teamID).subteams
let subteamsNotIn: Array<Types.TeamMeta> = []
let subteamsIn: Array<Types.TeamMeta> = []
subteamsAll.forEach(subteamID => {
const subteamDetails = getTeamDetails(state, subteamID)
const subteamMeta = getTeamMeta(state, subteamID)
const memberInSubteam = subteamDetails.members.has(username)
if (memberInSubteam) {
subteamsIn.push(subteamMeta)
} else {
subteamsNotIn.push(subteamMeta)
}
})
return {
subteamsIn,
subteamsNotIn,
}
}

// Don't allow version to roll back
export const ratchetTeamVersion = (newVersion: Types.TeamVersion, oldVersion?: Types.TeamVersion) =>
oldVersion
Expand Down
Loading

0 comments on commit e6a7137

Please sign in to comment.