diff options
author | Kate <26026535+provokateurin@users.noreply.github.com> | 2024-06-24 09:48:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 09:48:32 +0200 |
commit | 03a3e631112d6f7ff9903521cf031fdf5478d79c (patch) | |
tree | c4386a11feddfa4a370bb57cbdff7473a9bf4401 /src | |
parent | f4d27ca853e242db1ecb3b4392d7a966be1ac759 (diff) | |
parent | f3a2217cc8e5f6e06af1310766c0d9422b98c1d1 (diff) |
Merge pull request #12575 from nextcloud/fix/message-buttons-bar/hide-reply-no-chat-permission
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: { |