Skip to content

Commit 4d19f6d

Browse files
WIP
1 parent fcf218e commit 4d19f6d

5 files changed

Lines changed: 9 additions & 48 deletions

File tree

shared/chat/inbox-search/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,14 @@ const OpenTeamRow = (p: OpenTeamProps) => {
381381
const [hovering, setHovering] = React.useState(false)
382382
const {name, description, memberCount, publicAdmins, inTeam, isSelected} = p
383383
const showingDueToSelect = React.useRef(false)
384-
const {joinTeam, showTeamByName} = useTeamsState(
384+
const {showTeamByName} = useTeamsState(
385385
C.useShallow(s => ({
386-
joinTeam: s.dispatch.joinTeam,
387386
showTeamByName: s.dispatch.showTeamByName,
388387
}))
389388
)
390389

391390
const clearModals = C.Router2.clearModals
391+
const navigateAppend = C.Router2.navigateAppend
392392
const makePopup = (p: Kb.Popup2Parms) => {
393393
const {attachTo, hidePopup} = p
394394
return (
@@ -402,7 +402,7 @@ const OpenTeamRow = (p: OpenTeamProps) => {
402402
position="right center"
403403
onChat={undefined}
404404
onHidden={hidePopup}
405-
onJoinTeam={() => joinTeam(name)}
405+
onJoinTeam={() => navigateAppend({name: 'teamJoinTeamDialog', params: {initialTeamname: name}})}
406406
onViewTeam={() => {
407407
clearModals()
408408
showTeamByName(name)

shared/common-adapters/markdown/maybe-mention/team.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ const TeamMention = (ownProps: OwnProps) => {
3939
const previewConversation = Chat.useChatState(s => s.dispatch.previewConversation)
4040
const showTeamByName = useTeamsState(s => s.dispatch.showTeamByName)
4141
const clearModals = C.Router2.clearModals
42+
const navigateAppend = C.Router2.navigateAppend
4243
const _onViewTeam = (teamname: string) => {
4344
clearModals()
4445
showTeamByName(teamname)
4546
}
46-
const joinTeam = useTeamsState(s => s.dispatch.joinTeam)
47-
const onJoinTeam = joinTeam
47+
const onJoinTeam = (teamname: string) =>
48+
navigateAppend({name: 'teamJoinTeamDialog', params: {initialTeamname: teamname}})
4849

4950
const convID = _convID ? T.Chat.stringToConversationIDKey(_convID) : undefined
5051
const onChat = convID

shared/common-adapters/team-with-popup.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ const ConnectedTeamWithPopup = (ownProps: OwnProps) => {
114114
memberCount: meta.memberCount,
115115
teamID,
116116
}
117-
const joinTeam = Teams.useTeamsState(s => s.dispatch.joinTeam)
118-
const _onJoinTeam = joinTeam
119117
const clearModals = C.Router2.clearModals
120118
const navigateAppend = C.Router2.navigateAppend
121119
const _onViewTeam = (teamID: T.Teams.TeamID) => {
@@ -129,7 +127,7 @@ const ConnectedTeamWithPopup = (ownProps: OwnProps) => {
129127
isMember: stateProps.isMember,
130128
isOpen: stateProps.isOpen,
131129
memberCount: stateProps.memberCount,
132-
onJoinTeam: () => _onJoinTeam(ownProps.teamName),
130+
onJoinTeam: () => navigateAppend({name: 'teamJoinTeamDialog', params: {initialTeamname: ownProps.teamName}}),
133131
onViewTeam: () => _onViewTeam(stateProps.teamID),
134132
prefix: ownProps.prefix,
135133
shouldLoadTeam: ownProps.shouldLoadTeam,

shared/profile/user/teams/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ const Container = (ownProps: OwnProps) => {
1919
_roles: s.teamRoleMap.roles,
2020
_teamNameToID: s.teamNameToID,
2121
_youAreInTeams: s.teamnames.size > 0,
22-
joinTeam: s.dispatch.joinTeam,
2322
showTeamByName: s.dispatch.showTeamByName,
2423
}))
2524
)
26-
const {joinTeam, showTeamByName, _roles} = teamsState
25+
const {showTeamByName, _roles} = teamsState
2726
const {_teamNameToID, _youAreInTeams} = teamsState
2827
const teamShowcase = d.teamShowcase || noTeams
2928
const {clearModals, navigateAppend} = C.Router2
3029
const _onEdit = () => {
3130
navigateAppend('profileShowcaseTeamOffer')
3231
}
33-
const onJoinTeam = joinTeam
32+
const onJoinTeam = (teamname: string) => navigateAppend({name: 'teamJoinTeamDialog', params: {initialTeamname: teamname}})
3433
const onViewTeam = (teamname: string) => {
3534
clearModals()
3635
showTeamByName(teamname)

shared/stores/teams.tsx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@ export type State = Store & {
896896
fullName: string,
897897
loadingKey?: string
898898
) => void
899-
joinTeam: (teamname: string) => void
900899
launchNewTeamWizardOrModal: (subteamOf?: T.Teams.TeamID) => void
901900
leaveTeam: (teamname: string, permanent: boolean, context: 'teams' | 'chat') => void
902901
loadTeam: (teamID: T.Teams.TeamID, _subscribe?: boolean) => void
@@ -1692,42 +1691,6 @@ export const useTeamsState = Z.createZustand<State>('teams', (set, get) => {
16921691
}
16931692
ignorePromise(f())
16941693
},
1695-
joinTeam: teamname => {
1696-
const f = async () => {
1697-
let handedOffToInvite = false
1698-
try {
1699-
await T.RPCGen.teamsTeamAcceptInviteOrRequestAccessRpcListener({
1700-
customResponseIncomingCallMap: {
1701-
'keybase.1.teamsUi.confirmInviteLinkAccept': (params, response) => {
1702-
handedOffToInvite = true
1703-
navigateAppend(
1704-
{
1705-
name: 'teamInviteLinkJoin',
1706-
params: {
1707-
inviteDetails: params.details,
1708-
inviteKey: teamname,
1709-
},
1710-
},
1711-
true
1712-
)
1713-
response.result(false)
1714-
},
1715-
},
1716-
incomingCallMap: {},
1717-
params: {tokenOrName: teamname},
1718-
waitingKey: S.waitingKeyTeamsJoinTeam,
1719-
})
1720-
} catch (error) {
1721-
if (handedOffToInvite) {
1722-
return
1723-
}
1724-
if (error instanceof RPCError) {
1725-
logger.info(error.message)
1726-
}
1727-
}
1728-
}
1729-
ignorePromise(f())
1730-
},
17311694
launchNewTeamWizardOrModal: subteamOf => {
17321695
set(s => {
17331696
s.newTeamWizard = T.castDraft({

0 commit comments

Comments
 (0)