From 7717fea599bcfd53fbb263c27183c3ad0fa25b5b Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Sat, 3 Dec 2022 21:37:13 +0200 Subject: [PATCH] fix Mark as unread a post on non-crt (#6824) --- app/screens/post_options/options/mark_unread_option/index.ts | 2 ++ .../options/mark_unread_option/mark_unread_option.tsx | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/screens/post_options/options/mark_unread_option/index.ts b/app/screens/post_options/options/mark_unread_option/index.ts index 64275cab8f..e3c315ef50 100644 --- a/app/screens/post_options/options/mark_unread_option/index.ts +++ b/app/screens/post_options/options/mark_unread_option/index.ts @@ -5,6 +5,7 @@ import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider'; import withObservables from '@nozbe/with-observables'; import {observeCurrentTeamId} from '@queries/servers/system'; +import {observeIsCRTEnabled} from '@queries/servers/thread'; import MarkAsUnreadOption from './mark_unread_option'; @@ -13,6 +14,7 @@ import type {WithDatabaseArgs} from '@typings/database/database'; const enhanced = withObservables([], ({database}: WithDatabaseArgs) => { return { teamId: observeCurrentTeamId(database), + isCRTEnabled: observeIsCRTEnabled(database), }; }); diff --git a/app/screens/post_options/options/mark_unread_option/mark_unread_option.tsx b/app/screens/post_options/options/mark_unread_option/mark_unread_option.tsx index 547671e1c9..cc3b0a6cf2 100644 --- a/app/screens/post_options/options/mark_unread_option/mark_unread_option.tsx +++ b/app/screens/post_options/options/mark_unread_option/mark_unread_option.tsx @@ -14,17 +14,18 @@ import {dismissBottomSheet} from '@screens/navigation'; import type PostModel from '@typings/database/models/servers/post'; type Props = { + isCRTEnabled: boolean; sourceScreen: typeof Screens[keyof typeof Screens]; post: PostModel; teamId: string; } -const MarkAsUnreadOption = ({sourceScreen, post, teamId}: Props) => { +const MarkAsUnreadOption = ({isCRTEnabled, sourceScreen, post, teamId}: Props) => { const serverUrl = useServerUrl(); const onPress = useCallback(async () => { await dismissBottomSheet(Screens.POST_OPTIONS); - if (sourceScreen === Screens.THREAD) { + if (sourceScreen === Screens.THREAD && isCRTEnabled) { const threadId = post.rootId || post.id; markThreadAsUnread(serverUrl, teamId, threadId, post.id); } else {