diff options
author | provokateurin <kate@provokateurin.de> | 2024-06-24 07:53:49 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-06-24 07:58:36 +0200 |
commit | f3a2217cc8e5f6e06af1310766c0d9422b98c1d1 (patch) | |
tree | 69e50462c3cf38f338b383c364e82da0a26d96e7 /src | |
parent | 2621e5f10e6f68cfb79dc22ceeaa71d44e7a3855 (diff) |
fix(MessageButtonsBar): Hide reply button if participant has no chat permission
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'src')
2 files changed, 27 insertions, 3 deletions
diff --git a/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.spec.js b/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.spec.js index 00f7ccf00..5119c12c8 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.spec.js +++ b/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.spec.js @@ -14,7 +14,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import MessageButtonsBar from './../MessageButtonsBar/MessageButtonsBar.vue' import * as useMessageInfoModule from '../../../../../composables/useMessageInfo.js' -import { CONVERSATION, ATTENDEE } from '../../../../../constants.js' +import { CONVERSATION, ATTENDEE, PARTICIPANT } from '../../../../../constants.js' import storeConfig from '../../../../../store/storeConfig.js' import { useIntegrationsStore } from '../../../../../stores/integrations.js' import { findNcActionButton, findNcButton } from '../../../../../test-helpers.js' @@ -41,6 +41,7 @@ describe('MessageButtonsBar.vue', () => { lastCommonReadMessage: 0, type: CONVERSATION.TYPE.GROUP, readOnly: CONVERSATION.STATE.READ_WRITE, + permissions: PARTICIPANT.PERMISSIONS.CHAT, } testStoreConfig = cloneDeep(storeConfig) @@ -149,6 +150,25 @@ describe('MessageButtonsBar.vue', () => { const replyButton = findNcButton(wrapper, 'Reply') expect(replyButton.exists()).toBe(false) }) + + test('hides reply button when no chat permission', async () => { + conversationProps.permissions = 0 + store = new Store(testStoreConfig) + + const wrapper = shallowMount(MessageButtonsBar, { + localVue, + store, + stubs: { + NcActionButton, + NcButton, + }, + propsData: messageProps, + provide: injected, + }) + + const replyButton = findNcButton(wrapper, 'Reply') + expect(replyButton.exists()).toBe(false) + }) }) describe('private reply action', () => { diff --git a/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.vue b/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.vue index b141f88c0..2d8364934 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageButtonsBar.vue @@ -16,7 +16,7 @@ <EmoticonOutline :size="20" /> </template> </NcButton> - <NcButton v-if="message.isReplyable && !isConversationReadOnly" + <NcButton v-if="canReply" type="tertiary" :aria-label="t('spreed', 'Reply')" :title="t('spreed', 'Reply')" @@ -288,7 +288,7 @@ import NcEmojiPicker from '@nextcloud/vue/dist/Components/NcEmojiPicker.js' import { emojiSearch } from '@nextcloud/vue/dist/Functions/emoji.js' import { useMessageInfo } from '../../../../../composables/useMessageInfo.js' -import { CONVERSATION, ATTENDEE } from '../../../../../constants.js' +import { CONVERSATION, ATTENDEE, PARTICIPANT } from '../../../../../constants.js' import { hasTalkFeature } from '../../../../../services/CapabilitiesManager.ts' import { getMessageReminder, removeMessageReminder, setMessageReminder } from '../../../../../services/remindersService.js' import { useIntegrationsStore } from '../../../../../stores/integrations.js' @@ -550,6 +550,10 @@ export default { actor: this.message.lastEditActorDisplayName, }) }, + + canReply() { + return this.message.isReplyable && !this.isConversationReadOnly && (this.conversation.permissions & PARTICIPANT.PERMISSIONS.CHAT) !== 0 + } }, watch: { |