Files
mattermost-mobile/app/screens/thread/index.tsx
Anurag Shivarathri 5b44676985 [MM-39708] Gekidou Thread Screen (#6015)
* Thread screen

* misc

* Added snapshot for ThreadOverview

* Updated snapshot

* Misc

* Updated snapshot and ts fixes

* Made thread as a modal, fixes post list not closing on tablet

* Removed unsued variables

* Putting back the empty space before the root post (inverse list footer)

* Changed input text

* Removed empty footer space

* Misc fixes

* Disables new messages line for thread

* Loading threads before opening modal & BottomSheet componentId fix

* Moved merge navigation options to switchToThread

* Moved LeftButton to switch to thread

* Removed Q.and

* Misc fixes

* Added task id for pagination

* Removed useMemo, Q.and

* move thread close button as a prop

* Remove title font styles to use default

* Misc changes

* Misc fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2022-03-10 10:45:30 -03:00

31 lines
1001 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Q} from '@nozbe/watermelondb';
import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider';
import withObservables from '@nozbe/with-observables';
import {of as of$} from 'rxjs';
import {switchMap} from 'rxjs/operators';
import {Database} from '@constants';
import Thread from './thread';
import type {WithDatabaseArgs} from '@typings/database/database';
import type PostModel from '@typings/database/models/servers/post';
const {MM_TABLES} = Database;
const {SERVER: {POST}} = MM_TABLES;
const enhanced = withObservables(['rootId'], ({database, rootId}: WithDatabaseArgs & {rootId: string}) => {
return {
rootPost: database.get<PostModel>(POST).query(
Q.where('id', rootId),
).observe().pipe(
switchMap((posts) => posts[0]?.observe() || of$(undefined)),
),
};
});
export default withDatabase(enhanced(Thread));