Browse Source
Only leave and join real conversations
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/2965/head
Joas Schilling
6 years ago
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
3 changed files with
24 additions and
11 deletions
-
src/FilesSidebarTabApp.vue
-
src/mainFilesSidebarLoader.js
-
src/services/filesIntegrationServices.js
|
|
@ -163,7 +163,12 @@ export default { |
|
|
|
|
|
|
|
methods: { |
|
|
|
async joinConversation() { |
|
|
|
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. |
|
|
|
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. |
|
|
|
try { |
|
|
|
this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false |
|
|
|
} catch (error) { |
|
|
|
this.isTalkSidebarSupportedForFile = false |
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
@ -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, |
|
|
|
|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|