forked from Ivasoft/mattermost-mobile
* edit screen - in progress * edit screen - in progress * edit post screen - post input - in progress * edit post screen - post input - in progress * edit post screen - post input - in progress * edit post screen - post input - in progress * edit post screen - post error component - in progress * edit post screen - post error component - in progress * edit post screen -emitEditing - in progress * edit post screen - in progress * edit post screen - in progress * edit post screen - in progress * able to edit post * edit post screen - in progress * edit post screen - in progress * edit post screen - in progress * edit post screen - in progress * updated errorLine * corrections * edit post screen - in progress * edit post screen - in progress * edit post screen - in progress * properly closes modal on tablets * starts with Save button set to false * refactored onTextSelectionChange * added useTheme to ErrorTextComponent * passing canEdit and hasFilesAttached * passing canEdit and hasFilesAttached * fix API call * change canEdit to canDelete * nearly there * displays alert * maxPostSize * autocomplete - fixing layout * autocomplete - fixing layout * autocomplete - work in progress * autocomplete - work in progress * clean up delete * fixing autocomplete * code fix * added server error message * update i18n * removed comment * code fix * fix bug on empty post message * post input top corrections * post draft limit * code corrections as per review * removed theme from useEffect * update edit_post - delete call * refactor PostInputRef to EditPostInputRef * autocomplete position fix and feedback addressed * Navigation title & subtitle fonts / navigation button builder * ux feedback * delay focus of edit input by 20 frames * properly dismiss the PostOptions screen this comes from the fix for the BottomSheet screen * using device info to check for physical keyboard * autocomplete with keyboard closed Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
33 lines
1.2 KiB
TypeScript
33 lines
1.2 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 {switchMap} from 'rxjs/operators';
|
|
|
|
import {MM_TABLES, SYSTEM_IDENTIFIERS} from '@constants/database';
|
|
import {MAX_MESSAGE_LENGTH_FALLBACK} from '@constants/post_draft';
|
|
|
|
import EditPost from './edit_post';
|
|
|
|
import type {WithDatabaseArgs} from '@typings/database/database';
|
|
import type PostModel from '@typings/database/models/servers/post';
|
|
import type SystemModel from '@typings/database/models/servers/system';
|
|
|
|
const enhance = withObservables([], ({database, post}: WithDatabaseArgs & { post: PostModel}) => {
|
|
const maxPostSize = database.get<SystemModel>(MM_TABLES.SERVER.SYSTEM).findAndObserve(SYSTEM_IDENTIFIERS.CONFIG).pipe(
|
|
switchMap(({value}) => of$(parseInt(value.MaxPostSize || '0', 10) || MAX_MESSAGE_LENGTH_FALLBACK)),
|
|
|
|
);
|
|
|
|
const hasFilesAttached = post.files.observe().pipe(switchMap((files) => of$(files?.length > 0)));
|
|
|
|
return {
|
|
maxPostSize,
|
|
hasFilesAttached,
|
|
};
|
|
});
|
|
|
|
export default withDatabase(enhance(EditPost));
|