Update types, fork copy for convo vs message

This commit is contained in:
Eric Bailey
2025-10-15 18:04:10 -05:00
parent 00cb2b4754
commit 0ca18d53ba
6 changed files with 35 additions and 17 deletions
+7 -3
View File
@@ -15,11 +15,11 @@ import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import * as ContextMenu from '#/components/ContextMenu'
import {type TriggerProps} from '#/components/ContextMenu/types'
import {ReportDialog} from '#/components/dms/ReportDialog'
import {BubbleQuestion_Stroke2_Corner0_Rounded as Translate} from '#/components/icons/Bubble'
import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash'
import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/Warning'
import {ReportDialog} from '#/components/moderation/ReportDialog'
import * as Prompt from '#/components/Prompt'
import {usePromptControl} from '#/components/Prompt'
import {EmojiReactionPicker} from './EmojiReactionPicker'
@@ -171,9 +171,13 @@ export let MessageContextMenu = ({
</ContextMenu.Root>
<ReportDialog
currentScreen="conversation"
params={{type: 'convoMessage', convoId: convo.convo.id, message}}
// currentScreen="conversation"
control={reportControl}
subject={{
view: 'message',
convoId: convo.convo.id,
message,
}}
/>
<Prompt.Basic
@@ -85,7 +85,7 @@ export function useSubmitReportMutation() {
}
break
}
case 'chatMessage': {
case 'convoMessage': {
report = {
reasonType,
reason: state.details,
+14 -4
View File
@@ -38,10 +38,20 @@ export function useCopyForSubject(subject: ParsedReportSubject) {
subtitle: _(msg`Why should this starter pack be reviewed?`),
}
}
case 'chatMessage': {
return {
title: _(msg`Report this message`),
subtitle: _(msg`Why should this message be reviewed?`),
case 'convoMessage': {
switch (subject.view) {
case 'convo': {
return {
title: _(msg`Report this conversation`),
subtitle: _(msg`Why should this conversation be reviewed?`),
}
}
case 'message': {
return {
title: _(msg`Report this message`),
subtitle: _(msg`Why should this message be reviewed?`),
}
}
}
}
}
@@ -124,7 +124,7 @@ function Inner(props: ReportDialogProps) {
if (subjectTypes === undefined) return true
if (props.subject.type === 'account') {
return subjectTypes.includes('account')
} else if (props.subject.type === 'chatMessage') {
} else if (props.subject.type === 'convoMessage') {
return subjectTypes.includes('chat')
} else {
return subjectTypes.includes('record')
@@ -134,7 +134,7 @@ function Inner(props: ReportDialogProps) {
const collections: string[] | undefined = l.subjectCollections
if (collections === undefined) return true
// all chat collections accepted, since only Bluesky handles chats
if (props.subject.type === 'chatMessage') return true
if (props.subject.type === 'convoMessage') return true
return collections.includes(props.subject.nsid)
})
.filter(l => {
@@ -8,6 +8,12 @@ import {
import type * as Dialog from '#/components/Dialog'
export type ReportSubjectConvo = {
view: 'convo' | 'message'
convoId: string
message: ChatBskyConvoDefs.MessageView
}
export type ReportSubject =
| $Typed<AppBskyActorDefs.ProfileViewBasic>
| $Typed<AppBskyActorDefs.ProfileView>
@@ -16,7 +22,7 @@ export type ReportSubject =
| $Typed<AppBskyFeedDefs.GeneratorView>
| $Typed<AppBskyGraphDefs.StarterPackView>
| $Typed<AppBskyFeedDefs.PostView>
| {convoId: string; message: ChatBskyConvoDefs.MessageView}
| ReportSubjectConvo
export type ParsedReportSubject =
| {
@@ -55,11 +61,9 @@ export type ParsedReportSubject =
did: string
nsid: string
}
| {
type: 'chatMessage'
convoId: string
message: ChatBskyConvoDefs.MessageView
}
| ({
type: 'convoMessage'
} & ReportSubjectConvo)
export type ReportDialogProps = {
control: Dialog.DialogOuterProps['control']
@@ -18,7 +18,7 @@ export function parseReportSubject(
if ('convoId' in subject) {
return {
type: 'chatMessage',
type: 'convoMessage',
...subject,
}
}