* Global threads * Added translations * User avatar stack * In-Channel experience * Misc Fixes * Fixed fetchPostThread & added observer * using the observable for participants & check fix * Test case fix * Fix tablet view thread screen switching * No back button for tablets * folders for thread options only if needed * Using the existing observable * Users stack refactor fix * Reusing the user component * Refactor fix * Fixes double loaders when empty threads * Feedback * Moved some post options to common post options * Combined follow/unfollow functions * Feedback fixes * Addressing Feedback * Merge fix * Threads button component moved * Addressing feedbackk * Not rendering message when it's empty, removed unwanted Props exports * Addressing feedbac * Updated snapshot * Added emoji to removemarkdown component * Moved MD rendering into the component Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: koox00 <3829551+koox00@users.noreply.github.com>
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider';
|
|
import withObservables from '@nozbe/with-observables';
|
|
import {AppStateStatus} from 'react-native';
|
|
|
|
import {observeCurrentTeamId} from '@queries/servers/system';
|
|
import {queryThreadsInTeam} from '@queries/servers/thread';
|
|
import {observeTeammateNameDisplay} from '@queries/servers/user';
|
|
|
|
import ThreadsList from './threads_list';
|
|
|
|
import type {WithDatabaseArgs} from '@typings/database/database';
|
|
|
|
type Props = {
|
|
tab: GlobalThreadsTab;
|
|
teamId: string;
|
|
forceQueryAfterAppState: AppStateStatus;
|
|
} & WithDatabaseArgs;
|
|
|
|
const withTeamId = withObservables([], ({database}: WithDatabaseArgs) => ({
|
|
teamId: observeCurrentTeamId(database),
|
|
}));
|
|
|
|
const enhanced = withObservables(['tab', 'teamId', 'forceQueryAfterAppState'], ({database, tab, teamId}: Props) => {
|
|
const getOnlyUnreads = tab !== 'all';
|
|
|
|
return {
|
|
unreadsCount: queryThreadsInTeam(database, teamId, true).observeCount(false),
|
|
teammateNameDisplay: observeTeammateNameDisplay(database),
|
|
threads: queryThreadsInTeam(database, teamId, getOnlyUnreads, false, true, true).observe(),
|
|
};
|
|
});
|
|
|
|
export default withDatabase(withTeamId(enhanced(ThreadsList)));
|