Merge pull request #2705 from nextcloud/fix-getting-messages-in-messageslist-in-talk-sidebar

Fix getting messages in MessagesList in Talk sidebar
This commit is contained in:
Daniel Calviño Sánchez 2020-01-09 20:51:58 +01:00 коммит произвёл GitHub
Родитель ed5a5e9ccb d594bb84b6
Коммит f0b1297060
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 26 добавлений и 9 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -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,

Просмотреть файл

@ -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