Handle reports on profile vs content

This commit is contained in:
Eric Bailey
2024-02-15 10:37:34 -06:00
parent b52beefa27
commit b73f9710f9
4 changed files with 82 additions and 38 deletions
+13 -5
View File
@@ -58,6 +58,9 @@ import {LabelInfo} from '../util/moderation/LabelInfo'
import {useProfileShadow} from 'state/cache/profile-shadow'
import * as ModerationServiceCard from '#/components/ModerationServiceCard'
import {getModerationServiceTitle} from '#/lib/moderation'
import {useOpenGlobalDialog} from '#/components/dialogs'
import {ReportDialog} from '#/components/dialogs/ReportDialog'
import {NEW_REPORT_DIALOG_ENABLED} from '#/lib/build-flags'
import {useTheme} from '#/alf'
@@ -119,6 +122,7 @@ let ProfileHeader = ({
() => moderateProfile(profile, moderationOpts),
[profile, moderationOpts],
)
const openDialog = useOpenGlobalDialog()
const invalidateProfileQuery = React.useCallback(() => {
queryClient.invalidateQueries({
@@ -280,11 +284,15 @@ let ProfileHeader = ({
const onPressReportAccount = React.useCallback(() => {
track('ProfileHeader:ReportAccountButtonClicked')
openModal({
name: 'report',
did: profile.did,
})
}, [track, openModal, profile])
if (NEW_REPORT_DIALOG_ENABLED) {
openDialog(ReportDialog, {type: 'profile', did: profile.did})
} else {
openModal({
name: 'report',
did: profile.did,
})
}
}, [track, openModal, profile, openDialog])
const isMe = React.useMemo(
() => currentAccount?.did === profile.did,
+5 -1
View File
@@ -214,7 +214,11 @@ let PostDropdownBtn = ({
label: _(msg`Report post`),
onPress() {
if (NEW_REPORT_DIALOG_ENABLED) {
openDialog(ReportDialog, {type: 'post', uri: postUri, cid: postCid})
openDialog(ReportDialog, {
type: 'content',
uri: postUri,
cid: postCid,
})
} else {
openModal({
name: 'report',