From ef0cba713d1befdb0a07b0a49d7cf0d5c1f11238 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Wed, 13 May 2026 11:14:12 +0400 Subject: [PATCH] fix reply form quote config access --- .../post_status_form/post_status_form.js | 2 +- .../status_action_buttons.js | 2 +- .../specs/components/post_status_form.spec.js | 61 +++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 test/unit/specs/components/post_status_form.spec.js diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index d08a8b9c2..a1ca37a2e 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -380,7 +380,7 @@ const PostStatusForm = { if ( !this.quotingAvailable || !this.isReply || - !this.$store.getters.mergedConfig.quoteReply + !useMergedConfigStore().mergedConfig.quoteReply ) { return false } diff --git a/src/components/status_action_buttons/status_action_buttons.js b/src/components/status_action_buttons/status_action_buttons.js index 9938e6382..74aeb6025 100644 --- a/src/components/status_action_buttons/status_action_buttons.js +++ b/src/components/status_action_buttons/status_action_buttons.js @@ -16,7 +16,7 @@ library.add(faEllipsisH) const StatusActionButtons = { props: ['status', 'replying'], - emits: ['toggleReplying', 'interacted'], + emits: ['toggleReplying', 'interacted', 'onSuccess', 'onError'], data() { return { showPin: false, diff --git a/test/unit/specs/components/post_status_form.spec.js b/test/unit/specs/components/post_status_form.spec.js new file mode 100644 index 000000000..8f3d6d80f --- /dev/null +++ b/test/unit/specs/components/post_status_form.spec.js @@ -0,0 +1,61 @@ +import { createTestingPinia } from '@pinia/testing' +import { mount } from '@vue/test-utils' +import { setActivePinia } from 'pinia' + +import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' +import { mountOpts } from '../../../fixtures/setup_test' + +import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' + +const currentUser = { + id: 'current-user', + default_scope: 'public', + locked: false, +} + +const repliedUser = { + id: 'replied-user', + screen_name: 'replied', +} + +const repliedStatus = { + id: 'status-1', + visibility: 'public', + user: repliedUser, +} + +const replyMountOpts = () => + mountOpts({ + props: { + replyTo: repliedStatus.id, + repliedUser, + attentions: [], + copyMessageScope: repliedStatus.visibility, + disableDraft: true, + }, + afterStore(store) { + store.state.users.currentUser = currentUser + store.state.statuses.allStatusesObject = { + [repliedStatus.id]: repliedStatus, + } + }, + }) + +describe('PostStatusForm', () => { + beforeEach(() => { + setActivePinia(createTestingPinia()) + }) + + it('initializes a reply form when quoteReply is unset', () => { + useInstanceCapabilitiesStore().quotingAvailable = true + + const wrapper = mount(PostStatusForm, replyMountOpts()) + + expect(wrapper.vm.newStatus.type).to.equal('reply') + expect(wrapper.vm.newStatus.quote).to.eql({ + id: '', + url: '', + thread: false, + }) + }) +})