diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue
index 6c3d9359e0b..04164ece51e 100644
--- a/src/FilesSidebarTabApp.vue
+++ b/src/FilesSidebarTabApp.vue
@@ -19,26 +19,297 @@
- along with this program. If not, see .
-->
-
Talk tab coming soon
+
+
+
+
Conversations are not available for folders
+
+
+
+
+
+
+
{{ t('spreed', 'Discuss this file') }}
+
{{ t('spreed', 'Share this file with others to discuss it') }}
+
+
+
+
+
{{ t('spreed', 'Discuss this file') }}
+
+
+
+
+
+
+
diff --git a/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue b/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue
index 09c8c895618..9cb39c440ce 100644
--- a/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue
+++ b/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue
@@ -84,7 +84,7 @@ export default {
* Focuses the contenteditable div input
*/
focusInput() {
- if (this.$route.name === 'conversation') {
+ if (this.$route && this.$route.name === 'conversation') {
const contentEditable = this.$refs.contentEditable
// This is a hack but it's the only way I've found to focus a contenteditable div
setTimeout(function() {
diff --git a/src/services/filesIntegrationServices.js b/src/services/filesIntegrationServices.js
new file mode 100644
index 00000000000..70a69d79d12
--- /dev/null
+++ b/src/services/filesIntegrationServices.js
@@ -0,0 +1,44 @@
+/**
+ * @copyright Copyright (c) 2019 Marco Ambrosini
+ *
+ * @author Marco Ambrosini
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+import axios from '@nextcloud/axios'
+import { generateOcsUrl } from '@nextcloud/router'
+
+/**
+ * Gets the conversation token for a given file id
+ *
+ * @param {Object} .fileId the id of the file
+ * @param {Object} options unused
+ * @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)
+ }
+}
+
+export {
+ getFileConversation,
+}
diff --git a/src/store/tokenStore.js b/src/store/tokenStore.js
index 86df24dbc67..585129d6747 100644
--- a/src/store/tokenStore.js
+++ b/src/store/tokenStore.js
@@ -22,12 +22,16 @@
const state = {
token: '',
+ fileIdForToken: null,
}
const getters = {
getToken: (state) => () => {
return state.token
},
+ getFileIdForToken: (state) => () => {
+ return state.fileIdForToken
+ },
}
const mutations = {
@@ -40,6 +44,18 @@ const mutations = {
updateToken(state, newToken) {
state.token = newToken
},
+
+ /**
+ * Updates the file ID for the current token
+ *
+ * @param {object} state current store state
+ * @param {string} newToken The token of the active conversation
+ * @param {int} newFileId The file ID of the active conversation
+ */
+ updateTokenAndFileIdForToken(state, { newToken, newFileId }) {
+ state.token = newToken
+ state.fileIdForToken = newFileId
+ },
}
const actions = {
@@ -53,6 +69,17 @@ const actions = {
updateToken(context, newToken) {
context.commit('updateToken', newToken)
},
+
+ /**
+ * Updates the file ID for the current token
+ *
+ * @param {object} context default store context
+ * @param {string} newToken The token of the active conversation
+ * @param {int} newFileId The file ID of the active conversation
+ */
+ updateTokenAndFileIdForToken(context, { newToken, newFileId }) {
+ context.commit('updateTokenAndFileIdForToken', { newToken, newFileId })
+ },
}
export default { state, mutations, getters, actions }
diff --git a/src/views/FilesSidebarTab.vue b/src/views/FilesSidebarTab.vue
index 55b90183621..b5ac5c6a22c 100644
--- a/src/views/FilesSidebarTab.vue
+++ b/src/views/FilesSidebarTab.vue
@@ -79,13 +79,12 @@ export default {
},
mounted() {
try {
+ OCA.Talk.fileInfo = this.fileInfo
this.tab = OCA.Talk.newTab()
this.tab.$mount('#talk-tab-mount')
- OCA.Talk.fileInfo = this.fileInfo
} catch (error) {
console.error('Unable to mount Chat tab', error)
}
- console.info(this.fileInfo)
},
beforeDestroy() {
try {
@@ -97,3 +96,12 @@ export default {
},
}
+
+