Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/composables/useGetMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {

import Axios from '@nextcloud/axios'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import { computed, inject, onBeforeUnmount, provide, ref, watch } from 'vue'
import { START_LOCATION, useRoute } from 'vue-router'
import { useStore } from 'vuex'
Expand Down Expand Up @@ -628,6 +629,13 @@ export function useGetMessagesProvider() {
return
}

// Patch for federated conversations: disable unsupported file shares
if (conversation.value?.remoteServer && Object.keys(message.messageParameters ?? {}).some((key) => key.startsWith('file'))
&& [MESSAGE.TYPE.COMMENT, MESSAGE.TYPE.VOICE_MESSAGE, MESSAGE.TYPE.RECORD_VIDEO, MESSAGE.TYPE.RECORD_AUDIO].includes(message.messageType)) {
message.message = '*' + t('spreed', 'File shares are currently not supported in federated conversations') + '*'
delete message.messageParameters.file
}

chatStore.processChatBlocks(token, [message], { mergeBy: chatStore.getLastKnownId(token) })
store.dispatch('processMessage', { token, message, fromRealtime: true })
}
Expand Down
11 changes: 6 additions & 5 deletions src/store/conversationsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,12 @@ const actions = {
chatExtrasStore.removeParentIdToReply(token)
const reactionsStore = useReactionsStore()
reactionsStore.purgeReactionsStore(token)
const sharedItemsStore = useSharedItemsStore()
sharedItemsStore.purgeSharedItemsStore(token)
context.dispatch('purgeMessagesStore', token)
return response
context.dispatch('processMessage', { token, message: response.data.ocs.data })
context.dispatch('updateLastReadMessage', {
token,
id: response.data.ocs.data.id,
updateVisually: true,
})
} catch (error) {
console.error(t('spreed', 'Error while clearing conversation history'), error)
}
Expand Down Expand Up @@ -820,7 +822,6 @@ const actions = {
if ((lastMessage.actorType !== ATTENDEE.ACTOR_TYPE.BOTS
|| lastMessage.actorId === ATTENDEE.CHANGELOG_BOT_ID)
&& lastMessage.systemMessage !== 'reaction'
&& lastMessage.systemMessage !== 'poll_voted'
&& lastMessage.systemMessage !== 'reaction_deleted'
&& lastMessage.systemMessage !== 'reaction_revoked'
&& lastMessage.systemMessage !== 'message_deleted'
Expand Down
7 changes: 6 additions & 1 deletion src/store/messagesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ const actions = {
token,
pollId: message.messageParameters.poll.id,
})

const conversation = context.getters.conversation(token)
if (conversation?.lastMessage?.id && message.id > conversation.lastMessage.id) {
context.dispatch('updateConversationLastMessage', { token, lastMessage: message })
}
// Quit processing
context.commit('addMessage', { token, message })
return
Expand Down Expand Up @@ -588,7 +593,7 @@ const actions = {
if (message.systemMessage === MESSAGE.SYSTEM_TYPE.HISTORY_CLEARED) {
sharedItemsStore.purgeSharedItemsStore(token, message.id)
chatExtrasStore.clearThreads(token, message.id)
context.commit('clearMessagesHistory', {
context.dispatch('clearMessagesHistory', {
token,
id: message.id,
})
Expand Down
Loading