diff --git a/src/components/NewMessage/NewMessage.vue b/src/components/NewMessage/NewMessage.vue index 48476cb3a01..181cda13bc7 100644 --- a/src/components/NewMessage/NewMessage.vue +++ b/src/components/NewMessage/NewMessage.vue @@ -235,6 +235,8 @@ import { parseSpecialSymbols } from '../../utils/textParse.ts' const disableKeyboardShortcuts = OCP.Accessibility.disableKeyboardShortcuts() const supportTypingStatus = getCapabilities()?.spreed?.config?.chat?.['typing-privacy'] !== undefined const canEditMessage = getCapabilities()?.spreed?.features?.includes('edit-messages') +const attachmentsAllowed = getCapabilities()?.spreed?.config?.attachments?.allowed +const supportFederationV1 = getCapabilities()?.spreed?.features?.includes('federation-v1') export default { name: 'NewMessage', @@ -407,17 +409,18 @@ export default { canShareFiles() { return !this.currentUserIsGuest + && (!supportFederationV1 || !this.conversation.remoteServer) }, canUploadFiles() { - return getCapabilities()?.spreed?.config?.attachments?.allowed + return attachmentsAllowed && this.canShareFiles && this.$store.getters.getAttachmentFolderFreeSpace() !== 0 - && this.canShareFiles }, canCreatePoll() { return !this.isOneToOne && !this.noChatPermission && this.conversation.type !== CONVERSATION.TYPE.NOTE_TO_SELF + && (!supportFederationV1 || !this.conversation.remoteServer) }, currentConversationIsJoined() { diff --git a/src/components/RightSidebar/RightSidebar.vue b/src/components/RightSidebar/RightSidebar.vue index 8c9db391173..69435e85180 100644 --- a/src/components/RightSidebar/RightSidebar.vue +++ b/src/components/RightSidebar/RightSidebar.vue @@ -65,7 +65,7 @@ :main-conversation="mainConversation" :is-active="activeTab === 'breakout-rooms'" /> - @@ -87,7 +87,7 @@ - type !== null) return axios.get(generateOcsUrl('core/autocomplete/get'), { diff --git a/src/services/conversationsService.spec.js b/src/services/conversationsService.spec.js index 8d2bfa8fc5b..00c577a8aa6 100644 --- a/src/services/conversationsService.spec.js +++ b/src/services/conversationsService.spec.js @@ -1,5 +1,4 @@ import axios from '@nextcloud/axios' -import { loadState } from '@nextcloud/initial-state' import { generateOcsUrl } from '@nextcloud/router' import { searchPossibleConversations } from './conversationsService.js' @@ -9,22 +8,16 @@ jest.mock('@nextcloud/axios', () => ({ get: jest.fn(), })) -describe('conversationsService', () => { - let loadStateSettings - - beforeEach(() => { - loadStateSettings = { - federation_enabled: false, - } - - loadState.mockImplementation((app, key) => { - if (app === 'spreed') { - return loadStateSettings[key] - } - return null - }) - }) +jest.mock('@nextcloud/capabilities', () => ({ + getCapabilities: jest.fn(() => ({ + spreed: { + features: ['federation-v1'], + config: { federation: { enabled: true, 'outgoing-enabled': true } }, + }, + })) +})) +describe('conversationsService', () => { afterEach(() => { // cleaning up the mess left behind the previous test jest.clearAllMocks() @@ -71,10 +64,6 @@ describe('conversationsService', () => { }) test('searchPossibleConversations with other share types', () => { - loadStateSettings = { - federation_enabled: true, - } - testSearchPossibleConversations( 'conversation-token', false,