Skip to content

Commit a0cb2b6

Browse files
authored
Key chat manage channels modal by ID (keybase#21817)
* key chatManageChannels by id * eslint * jacob feedback * tsc
1 parent 3d94f21 commit a0cb2b6

26 files changed

Lines changed: 283 additions & 234 deletions

File tree

‎shared/actions/chat2/index.tsx‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import * as Saga from '../../util/saga'
1717
import * as TeamsGen from '../teams-gen'
1818
import * as Types from '../../constants/types/chat2'
1919
import * as FsTypes from '../../constants/types/fs'
20+
import * as TeamsTypes from '../../constants/types/teams'
2021
import * as WalletTypes from '../../constants/types/wallets'
2122
import * as Tabs from '../../constants/tabs'
2223
import * as UsersGen from '../users-gen'
@@ -845,9 +846,13 @@ const onChatThreadStale = (
845846
return actions
846847
}
847848

848-
const onChatShowManageChannels = (action: EngineGen.Chat1ChatUiChatShowManageChannelsPayload) => {
849+
const onChatShowManageChannels = (
850+
state: Container.TypedState,
851+
action: EngineGen.Chat1ChatUiChatShowManageChannelsPayload
852+
) => {
849853
const {teamname} = action.payload.params
850-
return RouteTreeGen.createNavigateAppend({path: [{props: {teamname}, selected: 'chatManageChannels'}]})
854+
const teamID = state.teams.teamNameToID.get(teamname) ?? TeamsTypes.noTeamID
855+
return RouteTreeGen.createNavigateAppend({path: [{props: {teamID}, selected: 'chatManageChannels'}]})
851856
}
852857

853858
const onNewChatActivity = (
@@ -2337,13 +2342,14 @@ const deleteMessageHistory = async (
23372342
function* loadChannelInfos(state: Container.TypedState, action: Chat2Gen.SelectConversationPayload) {
23382343
const {conversationIDKey} = action.payload
23392344
const meta = Constants.getMeta(state, conversationIDKey)
2340-
const teamname = meta.teamname
2341-
if (!teamname) {
2345+
const teamID = meta.teamID
2346+
// If this is an impteam, there are no channel infos to load.
2347+
if (!meta.teamname) {
23422348
return
23432349
}
2344-
if (!TeamsConstants.hasChannelInfos(state, teamname)) {
2350+
if (!TeamsConstants.hasChannelInfos(state, teamID)) {
23452351
yield Saga.delay(4000)
2346-
yield Saga.put(TeamsGen.createGetChannels({teamname}))
2352+
yield Saga.put(TeamsGen.createGetChannels({teamID}))
23472353
}
23482354
}
23492355

@@ -3683,7 +3689,7 @@ function* chat2Saga() {
36833689
yield* Saga.chainAction2(EngineGen.chat1NotifyChatNewChatActivity, onNewChatActivity)
36843690
yield* Saga.chainAction(EngineGen.chat1ChatUiChatGiphySearchResults, onGiphyResults)
36853691
yield* Saga.chainAction(EngineGen.chat1ChatUiChatGiphyToggleResultWindow, onGiphyToggleWindow)
3686-
yield* Saga.chainAction(EngineGen.chat1ChatUiChatShowManageChannels, onChatShowManageChannels)
3692+
yield* Saga.chainAction2(EngineGen.chat1ChatUiChatShowManageChannels, onChatShowManageChannels)
36873693
yield* Saga.chainAction(EngineGen.chat1ChatUiChatCoinFlipStatus, onChatCoinFlipStatus)
36883694
yield* Saga.chainAction(EngineGen.chat1ChatUiChatCommandMarkdown, onChatCommandMarkdown)
36893695
yield* Saga.chainAction(EngineGen.chat1ChatUiChatCommandStatus, onChatCommandStatus)

‎shared/actions/json/teams.json‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"teamname": "string"
2828
},
2929
"createChannel": {
30-
"teamname": "string",
30+
"teamID": "Types.TeamID",
3131
"channelname": "string",
3232
"description": "string | null"
3333
},
@@ -43,11 +43,11 @@
4343
"getChannelInfo": {
4444
"_description": "Fetches the channel information for a single channel in a team from the server.",
4545
"conversationIDKey": "ChatTypes.ConversationIDKey",
46-
"teamname": "string"
46+
"teamID": "Types.TeamID"
4747
},
4848
"getChannels": {
4949
"_description": "Fetches the channel information for all channels in a team from the server. Should only be called for components that need the full list.",
50-
"teamname": "string"
50+
"teamID": "Types.TeamID"
5151
},
5252
"getTeams": {
5353
"_description": "Load team list if we are stale. _subscribe is for use by teams/subscriber only.",
@@ -75,19 +75,19 @@
7575
"teamname": "string"
7676
},
7777
"addTeamWithChosenChannels": {
78-
"teamname": "string"
78+
"teamID": "Types.TeamID"
7979
},
8080
"saveChannelMembership": {
81-
"teamname": "string",
81+
"teamID": "Types.TeamID",
8282
"oldChannelState": "Types.ChannelMembershipState",
8383
"newChannelState": "Types.ChannelMembershipState"
8484
},
8585
"addParticipant": {
86-
"teamname": "string",
86+
"teamID": "Types.TeamID",
8787
"conversationIDKey": "ChatTypes.ConversationIDKey"
8888
},
8989
"removeParticipant": {
90-
"teamname": "string",
90+
"teamID": "Types.TeamID",
9191
"conversationIDKey": "ChatTypes.ConversationIDKey"
9292
},
9393
"deleteTeam": {
@@ -171,7 +171,7 @@
171171
"error": "string"
172172
},
173173
"setTeamsWithChosenChannels": {
174-
"teamsWithChosenChannels": "Set<Types.Teamname>"
174+
"teamsWithChosenChannels": "Set<Types.TeamID>"
175175
},
176176
"setTeamCreationError": {
177177
"error": "string"
@@ -216,12 +216,12 @@
216216
"publicity": "Types._PublicitySettings"
217217
},
218218
"setTeamChannelInfo": {
219-
"teamname": "string",
219+
"teamID": "Types.TeamID",
220220
"conversationIDKey": "ChatTypes.ConversationIDKey",
221221
"channelInfo": "Types.ChannelInfo"
222222
},
223223
"setTeamChannels": {
224-
"teamname": "string",
224+
"teamID": "Types.TeamID",
225225
"channelInfos": "Map<ChatTypes.ConversationIDKey, Types.ChannelInfo>"
226226
},
227227
"setTeamInfo": {
@@ -244,31 +244,31 @@
244244
"setTeamSawChatBanner": {},
245245
"setTeamSawSubteamsBanner": {},
246246
"updateChannelName": {
247-
"teamname": "Types.Teamname",
247+
"teamID": "Types.TeamID",
248248
"conversationIDKey": "ChatTypes.ConversationIDKey",
249249
"newChannelName": "string"
250250
},
251251
"setUpdatedChannelName": {
252-
"teamname": "Types.Teamname",
252+
"teamID": "Types.TeamID",
253253
"conversationIDKey": "ChatTypes.ConversationIDKey",
254254
"newChannelName": "string"
255255
},
256256
"updateTopic": {
257-
"teamname": "Types.Teamname",
257+
"teamID": "Types.TeamID",
258258
"conversationIDKey": "ChatTypes.ConversationIDKey",
259259
"newTopic": "string"
260260
},
261261
"setUpdatedTopic": {
262-
"teamname": "Types.Teamname",
262+
"teamID": "Types.TeamID",
263263
"conversationIDKey": "ChatTypes.ConversationIDKey",
264264
"newTopic": "string"
265265
},
266266
"deleteChannelConfirmed": {
267-
"teamname": "Types.Teamname",
267+
"teamID": "Types.TeamID",
268268
"conversationIDKey": "ChatTypes.ConversationIDKey"
269269
},
270270
"deleteChannelInfo": {
271-
"teamname": "Types.Teamname",
271+
"teamID": "Types.TeamID",
272272
"conversationIDKey": "ChatTypes.ConversationIDKey"
273273
},
274274
"checkRequestedAccess": {

‎shared/actions/teams-gen.tsx‎

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)