Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions shared/chat/blocking/block-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as C from '@/constants'
import * as React from 'react'
import * as Kb from '@/common-adapters'
import * as T from '@/constants/types'
import * as S from '@/constants/strings'
import * as Chat from '@/stores/chat'
import {useTeamsState} from '@/stores/teams'
import {useUsersState} from '@/stores/users'
Expand Down Expand Up @@ -140,23 +142,30 @@ const Container = function BlockModal(ownProps: OwnProps) {

const navigateUp = C.useRouterState(s => s.dispatch.navigateUp)
const leaveTeam = useTeamsState(s => s.dispatch.leaveTeam)
const reportUserRPC = C.useRPC(T.RPCGen.userReportUserRpcPromise)
const setUserBlocksRPC = C.useRPC(T.RPCGen.userSetUserBlocksRpcPromise)
const leaveTeamAndBlock = (teamname: string) => {
leaveTeam(teamname, true, 'chat')
}
const getBlockState = useUsersState(s => s.dispatch.getBlockState)
const _reportUser = useUsersState(s => s.dispatch.reportUser)
const refreshBlocksFor = getBlockState
const reportUser = (username: string, conversationIDKey: string | undefined, report: ReportSettings) => {
_reportUser({
comment: report.extraNotes,
conversationIDKey,
includeTranscript: report.includeTranscript && !!conversationIDKey,
reason: report.reason,
username,
})
reportUserRPC(
[
{
comment: report.extraNotes,
convID: conversationIDKey,
includeTranscript: report.includeTranscript && !!conversationIDKey,
reason: report.reason,
username,
},
S.waitingKeyUsersReportUser,
],
() => {},
() => {}
)
}
const setConversationStatus = Chat.useChatContext(s => s.dispatch.blockConversation)
const _setUserBlocks = useUsersState(s => s.dispatch.setUserBlocks)
const setUserBlocks = (newBlocks: NewBlocksMap) => {
// Convert our state block array to action payload.
const blocks = [...newBlocks.entries()]
Expand All @@ -169,7 +178,7 @@ const Container = function BlockModal(ownProps: OwnProps) {
username,
}))
if (blocks.length) {
_setUserBlocks(blocks)
setUserBlocksRPC([{blocks}, S.waitingKeyUsersSetUserBlocks], () => {}, () => {})
}
}

Expand Down
68 changes: 0 additions & 68 deletions shared/stores/tests/wallets.test.ts

This file was deleted.

32 changes: 0 additions & 32 deletions shared/stores/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,8 @@ export type State = Store & {
getBio: (username: string) => void
getBlockState: (usernames: ReadonlyArray<string>) => void
onEngineIncomingImpl: (action: EngineGen.Actions) => void
reportUser: (p: {
username: string
reason: string
comment: string
includeTranscript: boolean
conversationIDKey?: string
}) => void
resetState: () => void
replace: (infoMap: State['infoMap'], blockMap?: State['blockMap']) => void
setUserBlocks: (blocks: ReadonlyArray<T.RPCGen.UserBlockArg>) => void
updates: (infos: ReadonlyArray<{name: string; info: Partial<T.Users.UserInfo>}>) => void
}
}
Expand Down Expand Up @@ -107,31 +99,7 @@ export const useUsersState = Z.createZustand<State>('users', (set, get) => {
}
})
},
reportUser: p => {
const {conversationIDKey, username, reason, comment, includeTranscript} = p
const f = async () => {
await T.RPCGen.userReportUserRpcPromise(
{
comment,
convID: conversationIDKey,
includeTranscript,
reason,
username,
},
S.waitingKeyUsersReportUser
)
}
ignorePromise(f())
},
resetState: Z.defaultReset,
setUserBlocks: blocks => {
const f = async () => {
if (blocks.length) {
await T.RPCGen.userSetUserBlocksRpcPromise({blocks}, S.waitingKeyUsersSetUserBlocks)
}
}
ignorePromise(f())
},
updates: infos => {
set(s => {
for (const {name, info: i} of infos) {
Expand Down
77 changes: 0 additions & 77 deletions shared/stores/wallets.tsx

This file was deleted.

Loading