diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-06-10 09:14:28 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-06-10 09:24:40 +0200 |
commit | d79b5ed73e9f70b90858e549610a313c7f2bfcc1 (patch) | |
tree | c8862145dc30cd6da728710a9056736ec616a418 /src | |
parent | af34776927361b6b89c229a8448545c30ce83259 (diff) |
Don't trigger leave event when deleting conversation
When deleting a conversation, the route change would implicitly trigger
a leave request which ran in parallel to the conversation deletion one,
causing random issues in some systems like the latter returning a 404
instead of proceeding with the deletion.
This fix removes the route change on deletion. The new behavior will
implicitly redirect to the "not-found" page since the session does not
exist any more. The latter behavior is now aligned with the "Leave
conversation" action which also redirects to "not-found" page.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/LeftSidebar/ConversationsList/Conversation.spec.js | 24 | ||||
-rw-r--r-- | src/components/LeftSidebar/ConversationsList/Conversation.vue | 7 |
2 files changed, 0 insertions, 31 deletions
diff --git a/src/components/LeftSidebar/ConversationsList/Conversation.spec.js b/src/components/LeftSidebar/ConversationsList/Conversation.spec.js index ac0b53062..0488f0388 100644 --- a/src/components/LeftSidebar/ConversationsList/Conversation.spec.js +++ b/src/components/LeftSidebar/ConversationsList/Conversation.spec.js @@ -475,30 +475,6 @@ describe('Conversation.vue', () => { expect(updateTokenAction).not.toHaveBeenCalled() }) - test('redirects when deleting current conversation', async() => { - const actionHandler = jest.fn().mockResolvedValueOnce() - const updateTokenAction = jest.fn() - testStoreConfig.modules.conversationsStore.actions.deleteConversationFromServer = actionHandler - testStoreConfig.modules.tokenStore.getters.getToken = jest.fn().mockReturnValue(() => TOKEN) - testStoreConfig.modules.tokenStore.actions.updateToken = updateTokenAction - - OC.dialogs.confirm = jest.fn() - - const action = shallowMountAndGetAction('Delete conversation') - expect(action.exists()).toBe(true) - - await action.find('button').trigger('click') - - expect(OC.dialogs.confirm).toHaveBeenCalled() - - // call callback directly - OC.dialogs.confirm.mock.calls[0][2](true) - - expect(actionHandler).toHaveBeenCalledWith(expect.anything(), { token: TOKEN }) - expect($router.push).toHaveBeenCalled() - expect(updateTokenAction).toHaveBeenCalledWith(expect.anything(), '') - }) - test('does not delete conversation when not confirmed', async() => { const actionHandler = jest.fn().mockResolvedValueOnce() const updateTokenAction = jest.fn() diff --git a/src/components/LeftSidebar/ConversationsList/Conversation.vue b/src/components/LeftSidebar/ConversationsList/Conversation.vue index f7256af6d..0ba879a5b 100644 --- a/src/components/LeftSidebar/ConversationsList/Conversation.vue +++ b/src/components/LeftSidebar/ConversationsList/Conversation.vue @@ -342,13 +342,6 @@ export default { return } - // TODO: verify if this is already happening automatically after deletion, - // just like when leaving a conversation - if (this.item.token === this.$store.getters.getToken()) { - this.$router.push({ name: 'root', params: { skipLeaveWarning: true } }) - this.$store.dispatch('updateToken', '') - } - try { await this.$store.dispatch('deleteConversationFromServer', { token: this.item.token }) } catch (error) { |