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