mattermost-mobile/app/components/post_with_channel_info/index.ts
Daniel Espino García 66a37b7032
Show saved posts in search and recent mentions lists (#7326)
* Show saved posts in search and recent mentions lists

* Add missing space
2023-05-11 08:16:11 -04:00

28 lines
1 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 {of as of$} from 'rxjs';
import {observePostSaved} from '@queries/servers/post';
import {observeIsCRTEnabled} from '@queries/servers/thread';
import PostWithChannelInfo from './post_with_channel_info';
import type {WithDatabaseArgs} from '@typings/database/database';
import type PostModel from '@typings/database/models/servers/post';
type OwnProps = {
post: PostModel;
skipSavedPostsHighlight?: boolean;
} & WithDatabaseArgs;
const enhance = withObservables(['post', 'skipSavedPostsHighlight'], ({database, post, skipSavedPostsHighlight}: OwnProps) => {
return {
isCRTEnabled: observeIsCRTEnabled(database),
isSaved: skipSavedPostsHighlight ? of$(false) : observePostSaved(database, post.id),
};
});
export default withDatabase(enhance(PostWithChannelInfo));