mattermost-mobile/app/screens/edit_post/index.tsx
Rajat Dabade b5969fdfb4
Edit mode when no text and no attachment on save calls delete post (#8984)
* Edit mode when no text and no attachment on save calls delete post

* Removed the hasAttachment and isPost props to use shouldDirectlyReact props
2025-07-14 17:55:27 +05:30

28 lines
1.1 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
import {DEFAULT_SERVER_MAX_FILE_SIZE, MAX_MESSAGE_LENGTH_FALLBACK} from '@constants/post_draft';
import {observeCanUploadFiles} from '@queries/servers/security';
import {observeConfigIntValue, observeMaxFileCount} from '@queries/servers/system';
import EditPost from './edit_post';
import type {WithDatabaseArgs} from '@typings/database/database';
const enhance = withObservables([], ({database}: WithDatabaseArgs) => {
const maxPostSize = observeConfigIntValue(database, 'MaxPostSize', MAX_MESSAGE_LENGTH_FALLBACK);
const canUploadFiles = observeCanUploadFiles(database);
const maxFileSize = observeConfigIntValue(database, 'MaxFileSize', DEFAULT_SERVER_MAX_FILE_SIZE);
const maxFileCount = observeMaxFileCount(database);
return {
maxPostSize,
canUploadFiles,
maxFileSize,
maxFileCount,
};
});
export default withDatabase(enhance(EditPost));