marked locked chat in dim style

This commit is contained in:
Samuel Newman
2026-04-25 12:08:12 +03:00
parent 1904840d91
commit 2582b8ee9d
@@ -124,7 +124,7 @@ function DirectChatItem({
return ( return (
<BaseChatItem <BaseChatItem
convo={convo.view} convo={convo}
avatar={ avatar={
<PreviewableUserAvatar <PreviewableUserAvatar
profile={profile} profile={profile}
@@ -183,7 +183,7 @@ function GroupChatItem({
return ( return (
<BaseChatItem <BaseChatItem
convo={convo.view} convo={convo}
avatar={<AvatarBubbles profiles={convo.members} size={52} />} avatar={<AvatarBubbles profiles={convo.members} size={52} />}
title={chatName} title={chatName}
accessibilityHint={l`Go to the group chat named "${chatName}"`} accessibilityHint={l`Go to the group chat named "${chatName}"`}
@@ -213,7 +213,7 @@ function BaseChatItem({
postAlerts, postAlerts,
children, children,
}: { }: {
convo: ChatBskyConvoDefs.ConvoView convo: ConvoWithDetails
avatar: React.ReactNode avatar: React.ReactNode
title: string title: string
subtitle?: string subtitle?: string
@@ -238,7 +238,13 @@ function BaseChatItem({
const playHaptic = useHaptics() const playHaptic = useHaptics()
const queryClient = useQueryClient() const queryClient = useQueryClient()
const hasUnread = convo.unreadCount > 0 && !isDeletedAccount const hasUnread =
convo.view.unreadCount > 0 &&
!isDeletedAccount &&
!(
convo.kind === 'group' &&
convo.details.lockStatus === 'locked-permanently'
)
const blockInfo = useMemo(() => { const blockInfo = useMemo(() => {
if (!primaryProfileModeration) return {listBlocks: [], userBlock: undefined} if (!primaryProfileModeration) return {listBlocks: [], userBlock: undefined}
@@ -252,7 +258,11 @@ function BaseChatItem({
} }
}, [primaryProfileModeration]) }, [primaryProfileModeration])
const isDimStyle = convo.muted || isBlockedAccount || isDeletedAccount const isDimStyle =
convo.view.muted ||
isBlockedAccount ||
isDeletedAccount ||
(convo.kind === 'group' && convo.details.lockStatus !== 'unlocked')
const {lastMessage, lastMessageSentAt, latestReportableMessage} = const {lastMessage, lastMessageSentAt, latestReportableMessage} =
useMemo(() => { useMemo(() => {
@@ -263,8 +273,8 @@ function BaseChatItem({
let latestReportableMessage: ChatBskyConvoDefs.MessageView | undefined let latestReportableMessage: ChatBskyConvoDefs.MessageView | undefined
// Deleted message // Deleted message
if (ChatBskyConvoDefs.isDeletedMessageView(convo.lastMessage)) { if (ChatBskyConvoDefs.isDeletedMessageView(convo.view.lastMessage)) {
lastMessageSentAt = convo.lastMessage.sentAt lastMessageSentAt = convo.view.lastMessage.sentAt
lastMessage = isDeletedAccount lastMessage = isDeletedAccount
? l`Conversation deleted` ? l`Conversation deleted`
@@ -272,9 +282,9 @@ function BaseChatItem({
} }
// Message // Message
if (ChatBskyConvoDefs.isMessageView(convo.lastMessage)) { if (ChatBskyConvoDefs.isMessageView(convo.view.lastMessage)) {
const info = getMessageInfo({ const info = getMessageInfo({
convo, convo: convo.view,
currentAccountDid: currentAccount?.did, currentAccountDid: currentAccount?.did,
i18n, i18n,
}) })
@@ -286,9 +296,9 @@ function BaseChatItem({
} }
// Reaction // Reaction
if (ChatBskyConvoDefs.isMessageAndReactionView(convo.lastReaction)) { if (ChatBskyConvoDefs.isMessageAndReactionView(convo.view.lastReaction)) {
const info = getReactionInfo({ const info = getReactionInfo({
convo, convo: convo.view,
currentAccountDid: currentAccount?.did, currentAccountDid: currentAccount?.did,
i18n, i18n,
}) })
@@ -303,14 +313,14 @@ function BaseChatItem({
} }
// System message // System message
if (ChatBskyConvoDefs.isSystemMessageView(convo.lastMessage)) { if (ChatBskyConvoDefs.isSystemMessageView(convo.view.lastMessage)) {
const info = getSystemMessageInfo( const info = getSystemMessageInfo(
convo.lastMessage.data, convo.view.lastMessage.data,
new Map(convo.members.map(m => [m.did, m])), new Map(convo.view.members.map(m => [m.did, m])),
) )
if (info) { if (info) {
lastMessage = i18n._(info.message) lastMessage = i18n._(info.message)
lastMessageSentAt = convo.lastMessage.sentAt lastMessageSentAt = convo.view.lastMessage.sentAt
} }
} }
@@ -338,11 +348,11 @@ function BaseChatItem({
const onPress = useCallback( const onPress = useCallback(
(e: GestureResponderEvent) => { (e: GestureResponderEvent) => {
for (const member of convo.members) { for (const member of convo.view.members) {
unstableCacheProfileView(queryClient, member) unstableCacheProfileView(queryClient, member)
} }
precacheConvoQuery(queryClient, convo) precacheConvoQuery(queryClient, convo)
void decrementBadgeCount(convo.unreadCount) void decrementBadgeCount(convo.view.unreadCount)
if (isDeletedAccount) { if (isDeletedAccount) {
e.preventDefault() e.preventDefault()
menuControl.open() menuControl.open()
@@ -365,7 +375,7 @@ function BaseChatItem({
icon: EnvelopeOpen, icon: EnvelopeOpen,
action: () => { action: () => {
markAsRead({ markAsRead({
convoId: convo.id, convoId: convo.view.id,
}) })
}, },
} }
@@ -408,7 +418,7 @@ function BaseChatItem({
</View> </View>
<Link <Link
to={`/messages/${convo.id}`} to={`/messages/${convo.view.id}`}
label={title} label={title}
accessibilityHint={accessibilityHint} accessibilityHint={accessibilityHint}
accessibilityActions={ accessibilityActions={
@@ -425,7 +435,7 @@ function BaseChatItem({
] ]
: undefined : undefined
} }
onPressIn={() => precacheConvoQuery(queryClient, convo)} onPressIn={() => precacheConvoQuery(queryClient, convo.view)}
onPress={onPress} onPress={onPress}
onLongPress={showMenu && IS_NATIVE ? onLongPress : undefined} onLongPress={showMenu && IS_NATIVE ? onLongPress : undefined}
onAccessibilityAction={showMenu ? onLongPress : undefined}> onAccessibilityAction={showMenu ? onLongPress : undefined}>
@@ -486,7 +496,7 @@ function BaseChatItem({
</TimeElapsed> </TimeElapsed>
</View> </View>
)} )}
{(convo.muted || isBlockedAccount) && ( {(convo.view.muted || isBlockedAccount) && (
<Text <Text
style={[ style={[
a.text_sm, a.text_sm,
@@ -559,11 +569,11 @@ function BaseChatItem({
{/* TODO: Allow showing menu for groups where the owner has left! */} {/* TODO: Allow showing menu for groups where the owner has left! */}
{showMenu && primaryProfile && ( {showMenu && primaryProfile && (
<ConvoMenu <ConvoMenu
convo={convo} convo={convo.view}
profile={primaryProfile} profile={primaryProfile}
control={menuControl} control={menuControl}
currentScreen="list" currentScreen="list"
showMarkAsRead={convo.unreadCount > 0} showMarkAsRead={convo.view.unreadCount > 0}
hideTrigger={IS_NATIVE} hideTrigger={IS_NATIVE}
blockInfo={blockInfo} blockInfo={blockInfo}
style={[ style={[
@@ -583,7 +593,7 @@ function BaseChatItem({
<LeaveConvoPrompt <LeaveConvoPrompt
control={leaveConvoControl} control={leaveConvoControl}
convoId={convo.id} convoId={convo.view.id}
currentScreen="list" currentScreen="list"
/> />
</View> </View>