Skip to content

Commit

Permalink
Only admin that fetches social profile query
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jul 12, 2024
1 parent dcbfd42 commit 03d8412
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/chats/ChatItem/ChatItemMenus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MetadataModal from '@/components/modals/MetadataModal'
import ModerationModal from '@/components/moderation/ModerationModal'
import { sendEventWithRef } from '@/components/referral/analytics'
import useAuthorizedForModeration from '@/hooks/useAuthorizedForModeration'
import useIsModerationAdmin from '@/hooks/useIsModerationAdmin'
import useIsOwnerOfPost from '@/hooks/useIsOwnerOfPost'
import useRerender from '@/hooks/useRerender'
import useToastError from '@/hooks/useToastError'
Expand Down Expand Up @@ -77,9 +78,11 @@ export default function ChatItemMenus({
const { data: post } = getPostQuery.useQuery(messageId)
const ownerId = post?.struct.ownerId ?? ''
const { ref, inView } = useInView({ triggerOnce: true })

const isAdmin = useIsModerationAdmin()
const { data: socialProfile, isLoading: loadingSocialProfile } =
getSocialProfileQuery.useQuery(ownerId, {
enabled: inView,
enabled: inView && isAdmin,
})
const { mutate: approveUser } = useApproveUser()

Expand Down

0 comments on commit 03d8412

Please sign in to comment.