[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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
69fc0d6f7f
Коммит
9dc5572f53
@@ -164,6 +164,19 @@ describe('draft actions', () => {
|
|||||||
|
|
||||||
describe('removeDraft', () => {
|
describe('removeDraft', () => {
|
||||||
it('calls setGlobalItem action correctly', async () => {
|
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));
|
await store.dispatch(removeDraft(key, channelId));
|
||||||
|
|
||||||
const testStore = mockStore(initialState);
|
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
|
// set draft to empty to re-render the component
|
||||||
await dispatch(setGlobalItem(key, {message: '', fileInfos: [], uploadsInProgress: []}));
|
await dispatch(setGlobalItem(key, {message: '', fileInfos: [], uploadsInProgress: []}));
|
||||||
|
|
||||||
// remove draft from storage
|
|
||||||
await dispatch(removeGlobalItem(key));
|
|
||||||
|
|
||||||
if (syncedDraftsAreAllowedAndEnabled(state)) {
|
if (syncedDraftsAreAllowedAndEnabled(state)) {
|
||||||
const connectionId = getConnectionId(getState());
|
const connectionId = getConnectionId(getState());
|
||||||
|
|
||||||
@@ -119,6 +116,9 @@ export function removeDraft(key: string, channelId: string, rootId = ''): Action
|
|||||||
error,
|
error,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// only remove draft from storage for local drafts
|
||||||
|
await dispatch(removeGlobalItem(key));
|
||||||
}
|
}
|
||||||
return {data: true};
|
return {data: true};
|
||||||
};
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user