ignore groups in aa
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {useAnimatedRef} from 'react-native-reanimated'
|
||||
import {type ChatBskyActorGetStatus, type ChatBskyConvoDefs} from '@atproto/api'
|
||||
import {type ChatBskyActorGetStatus, ChatBskyConvoDefs} from '@atproto/api'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
import {useFocusEffect, useIsFocused} from '@react-navigation/native'
|
||||
import {type NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||
@@ -475,7 +475,10 @@ export function Header({
|
||||
convo =>
|
||||
!leftConvos.includes(convo.id) &&
|
||||
!convo.muted &&
|
||||
convo.members.every(member => member.handle !== 'missing.invalid'),
|
||||
convo.members.every(member => member.handle !== 'missing.invalid') &&
|
||||
(ChatBskyConvoDefs.isGroupConvo(convo.kind)
|
||||
? !aa.flags.groupChatDisabled
|
||||
: true),
|
||||
) ?? []
|
||||
|
||||
const openChatControl = useCallback(() => {
|
||||
|
||||
@@ -21,6 +21,7 @@ import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
import {parseConvoView} from '#/components/dms/util'
|
||||
import {useAgeAssurance} from '#/ageAssurance'
|
||||
import {type AgeAssuranceFlags} from '#/ageAssurance/types'
|
||||
import * as bsky from '#/types/bsky'
|
||||
import {RQKEY as CONVO_KEY} from './conversation'
|
||||
import {useLeftConvos} from './leave-conversation'
|
||||
@@ -679,6 +680,7 @@ export function useUnreadMessageCount() {
|
||||
const {currentAccount} = useSession()
|
||||
const {accepted, request} = useListConvos()
|
||||
const moderationOpts = useModerationOpts()
|
||||
const aa = useAgeAssurance()
|
||||
|
||||
return useMemo<{
|
||||
count: number
|
||||
@@ -690,12 +692,14 @@ export function useUnreadMessageCount() {
|
||||
currentAccount?.did,
|
||||
currentConvoId,
|
||||
moderationOpts,
|
||||
aa.flags,
|
||||
)
|
||||
const requestCount = calculateCount(
|
||||
request,
|
||||
currentAccount?.did,
|
||||
currentConvoId,
|
||||
moderationOpts,
|
||||
aa.flags,
|
||||
)
|
||||
if (acceptedCount > 0) {
|
||||
const total = acceptedCount + Math.min(requestCount, 1)
|
||||
@@ -726,6 +730,7 @@ function calculateCount(
|
||||
currentAccountDid: string | undefined,
|
||||
currentConvoId: string | undefined,
|
||||
moderationOpts: ModerationOpts | undefined,
|
||||
flags: AgeAssuranceFlags,
|
||||
) {
|
||||
return (
|
||||
convos
|
||||
@@ -735,6 +740,8 @@ function calculateCount(
|
||||
|
||||
if (!convo || !moderationOpts) return acc
|
||||
|
||||
if (convo.kind === 'group' && flags.groupChatDisabled) return acc
|
||||
|
||||
const shouldIgnore =
|
||||
convo.view.muted ||
|
||||
!convo.primaryMember ||
|
||||
|
||||
Reference in New Issue
Block a user