diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue index a765c9cee8..ff0d723938 100644 --- a/src/FilesSidebarTabApp.vue +++ b/src/FilesSidebarTabApp.vue @@ -163,7 +163,12 @@ export default { methods: { async joinConversation() { - await this.getFileConversation() + try { + await this.getFileConversation() + } catch (error) { + console.debug('Could not get file conversation. Is it a file and shared?') + return + } await joinConversation(this.token) @@ -231,7 +236,7 @@ export default { if (Axios.isCancel(exception)) { console.debug('The request has been canceled', exception) } else { - console.debug(exception) + throw exception } } }, @@ -294,7 +299,11 @@ export default { // FileInfo it is necessary to query the server. // FIXME If the file is shared this will create the conversation // if it does not exist yet. - this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false + try { + this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false + } catch (error) { + this.isTalkSidebarSupportedForFile = false + } return } @@ -318,7 +327,11 @@ export default { // FileInfo it is necessary to query the server. // FIXME If the file is shared this will create the conversation // if it does not exist yet. - this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false + try { + this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false + } catch (error) { + this.isTalkSidebarSupportedForFile = false + } return } diff --git a/src/mainFilesSidebarLoader.js b/src/mainFilesSidebarLoader.js index 545e77a72e..55b3241311 100644 --- a/src/mainFilesSidebarLoader.js +++ b/src/mainFilesSidebarLoader.js @@ -29,10 +29,14 @@ const isEnabled = function(fileInfo) { return true } + const token = OCA.Talk.store.getters.getToken() + // If the Talk tab can not be displayed then the current conversation is // left; this must be done here because "setFileInfo" will not get // called with the new file if the tab can not be displayed. - leaveConversation(OCA.Talk.store.getters.getToken()) + if (token) { + leaveConversation(token) + } OCA.Talk.store.dispatch('updateTokenAndFileIdForToken', { newToken: null, diff --git a/src/services/filesIntegrationServices.js b/src/services/filesIntegrationServices.js index 15e5aace61..36826897d4 100644 --- a/src/services/filesIntegrationServices.js +++ b/src/services/filesIntegrationServices.js @@ -31,12 +31,8 @@ import { generateOcsUrl } from '@nextcloud/router' * @returns {String} the conversation token */ const getFileConversation = async function({ fileId }, options) { - try { - const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + `file/${fileId}`) - return response - } catch (error) { - console.debug('Error while getting the token: ', error) - } + const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + `file/${fileId}`) + return response } /**