diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-01-09 22:51:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 22:51:58 +0300 |
commit | f0b1297060f10d50365b03ebe9eb5810cc980eef (patch) | |
tree | c894748865ee78fd48060d1829911e0a7e531856 /src | |
parent | ed5a5e9ccb60f061ebe2546a72d76d8b42a4efb0 (diff) | |
parent | d594bb84b623e8668e3b30813c6ae61dda86919e (diff) |
Merge pull request #2705 from nextcloud/fix-getting-messages-in-messageslist-in-talk-sidebar
Fix getting messages in MessagesList in Talk sidebar
Diffstat (limited to 'src')
-rw-r--r-- | src/FilesSidebarTabApp.vue | 24 | ||||
-rw-r--r-- | src/mainChatTab.js | 2 | ||||
-rw-r--r-- | src/services/participantsService.js | 9 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue index 5a83b4bc6..f0f8d843a 100644 --- a/src/FilesSidebarTabApp.vue +++ b/src/FilesSidebarTabApp.vue @@ -50,6 +50,7 @@ <script> import { getFileConversation } from './services/filesIntegrationServices' +import { fetchConversation } from './services/conversationsService' import { joinConversation, leaveConversation } from './services/participantsService' import CancelableRequest from './utils/cancelableRequest' import { getCurrentUser } from '@nextcloud/auth' @@ -126,7 +127,15 @@ export default { async joinConversation() { await this.getFileConversation() - joinConversation(this.token) + await joinConversation(this.token) + + // The current participant (which is automatically set when fetching + // the current conversation) is needed for the MessagesList to start + // getting the messages. No need to wait for it, but fetching the + // conversation needs to be done once the user has joined the + // conversation (otherwise only limited data would be received if + // the user was not a participant of the conversation yet). + this.fetchCurrentConversation() }, leaveConversation() { @@ -161,6 +170,15 @@ export default { } }, + async fetchCurrentConversation() { + if (!this.token) { + return + } + + const response = await fetchConversation(this.token) + this.$store.dispatch('addConversation', response.data.ocs.data) + }, + /** * Sets whether the Talk sidebar is supported for the file or not. * @@ -302,10 +320,6 @@ export default { } .chatView { - /* The chat view shares its parent with the call button, so the default - * "height: 100%" needs to be unset. */ - height: unset; - overflow: hidden; } </style> diff --git a/src/mainChatTab.js b/src/mainChatTab.js index 955ebcd6d..bb523704b 100644 --- a/src/mainChatTab.js +++ b/src/mainChatTab.js @@ -36,6 +36,7 @@ import { getRequestToken } from '@nextcloud/auth' // Directives import contenteditableDirective from 'vue-contenteditable-directive' import { translate, translatePlural } from '@nextcloud/l10n' +import vuescroll from 'vue-scroll' // CSP config for webpack dynamic chunk loading // eslint-disable-next-line @@ -55,6 +56,7 @@ Vue.prototype.OCA = OCA Vue.use(contenteditableDirective) Vue.use(Vuex) +Vue.use(vuescroll, { debounce: 600 }) const newTab = () => new Vue({ store, diff --git a/src/services/participantsService.js b/src/services/participantsService.js index a63c93dcf..6c1906352 100644 --- a/src/services/participantsService.js +++ b/src/services/participantsService.js @@ -35,9 +35,9 @@ const joinConversation = async(token) => { try { const signaling = await getSignaling() - signaling.joinRoom(token).then(() => { - EventBus.$emit('joinedConversation') - }) + await signaling.joinRoom(token) + + EventBus.$emit('joinedConversation') // FIXME Signaling should not handle joining a conversation // const response = await axios.post(generateOcsUrl('apps/spreed/api/v1', 2) + `room/${token}/participants/active`) @@ -56,7 +56,8 @@ const leaveConversation = async function(token) { try { const signaling = await getSignaling() - signaling.leaveRoom(token) + await signaling.leaveRoom(token) + // FIXME Signaling should not handle leaving a conversation // const response = await axios.delete(generateOcsUrl('apps/spreed/api/v1', 2) + `room/${token}/participants/active`) // return response |