* Extract common observers to queries * Separate also queries and more agressive refactoring * Use query to avoid throws from findAndObserve * Fix minor error * Address feedback * Address feedback * Address feedback * Fix model types * Address feedback
23 lines
802 B
TypeScript
23 lines
802 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider';
|
|
import enhance from '@nozbe/with-observables';
|
|
|
|
import {observeConfigBooleanValue} from '@queries/servers/system';
|
|
|
|
import Avatar from './avatar';
|
|
|
|
import type {WithDatabaseArgs} from '@typings/database/database';
|
|
import type PostModel from '@typings/database/models/servers/post';
|
|
|
|
const withPost = enhance(['post'], ({database, post}: {post: PostModel} & WithDatabaseArgs) => {
|
|
const enablePostIconOverride = observeConfigBooleanValue(database, 'EnablePostIconOverride');
|
|
|
|
return {
|
|
author: post.author.observe(),
|
|
enablePostIconOverride,
|
|
};
|
|
});
|
|
|
|
export default withDatabase(withPost(Avatar));
|