[MM-57076] Stop removing local drafts when calling removeDraft for servers with synced drafts (#26481)

* [MM-57076] Stop removing local drafts when calling `removeDraft` for servers with synced drafts

* Fix tests
Этот коммит содержится в:
Devin Binnie
2024-03-16 13:55:56 -04:00
коммит произвёл GitHub
родитель 69fc0d6f7f
Коммит 9dc5572f53
2 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@@ -164,6 +164,19 @@ describe('draft actions', () => {
describe('removeDraft', () => {
it('calls setGlobalItem action correctly', async () => {
store = mockStore({
...initialState,
entities: {
...initialState.entities,
general: {
...initialState.entities.general,
config: {
...initialState.entities.general.config,
AllowSyncedDrafts: 'false',
},
},
},
});
await store.dispatch(removeDraft(key, channelId));
const testStore = mockStore(initialState);

Просмотреть файл

@@ -105,9 +105,6 @@ export function removeDraft(key: string, channelId: string, rootId = ''): Action
// set draft to empty to re-render the component
await dispatch(setGlobalItem(key, {message: '', fileInfos: [], uploadsInProgress: []}));
// remove draft from storage
await dispatch(removeGlobalItem(key));
if (syncedDraftsAreAllowedAndEnabled(state)) {
const connectionId = getConnectionId(getState());
@@ -119,6 +116,9 @@ export function removeDraft(key: string, channelId: string, rootId = ''): Action
error,
};
}
} else {
// only remove draft from storage for local drafts
await dispatch(removeGlobalItem(key));
}
return {data: true};
};