Skip to content

Commit df22c70

Browse files
committed
fix(chat-relay): do not relay file shares to federated conversations
Signed-off-by: Maksim Sukharev <[email protected]>
1 parent d65f611 commit df22c70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/composables/useGetMessages.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717

1818
import Axios from '@nextcloud/axios'
1919
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
20+
import { t } from '@nextcloud/l10n'
2021
import { computed, inject, onBeforeUnmount, provide, ref, watch } from 'vue'
2122
import { START_LOCATION, useRoute } from 'vue-router'
2223
import { useStore } from 'vuex'
@@ -631,6 +632,13 @@ export function useGetMessagesProvider() {
631632
return
632633
}
633634

635+
// Patch for federated conversations: disable unsupported file shares
636+
if (conversation.value?.remoteServer && Object.keys(message.messageParameters ?? {}).some((key) => key.startsWith('file'))
637+
&& [MESSAGE.TYPE.COMMENT, MESSAGE.TYPE.VOICE_MESSAGE, MESSAGE.TYPE.RECORD_VIDEO, MESSAGE.TYPE.RECORD_AUDIO].includes(message.messageType)) {
638+
message.message = t('spreed', 'File shares are currently not supported in federated conversations')
639+
delete message.messageParameters.file
640+
}
641+
634642
chatStore.processChatBlocks(token, [message], { mergeBy: chatStore.getLastKnownId(token) })
635643
store.dispatch('processMessage', { token, message, fromRealtime: true })
636644
}

0 commit comments

Comments
 (0)