Merge remote-tracking branch 'origin/develop' into small-fixes-and-improvements
This commit is contained in:
commit
f21d1dbac8
4 changed files with 68 additions and 2 deletions
1
changelog.d/reply-quote-config.fix
Normal file
1
changelog.d/reply-quote-config.fix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Fix reply form crash when quote-reply settings are unavailable
|
||||||
|
|
@ -381,7 +381,11 @@ const PostStatusForm = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultQuotable() {
|
defaultQuotable() {
|
||||||
if (!this.quotingAvailable || !this.isReply) {
|
if (
|
||||||
|
!this.quotingAvailable ||
|
||||||
|
!this.isReply ||
|
||||||
|
!useMergedConfigStore().mergedConfig.quoteReply
|
||||||
|
) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ library.add(faEllipsisH)
|
||||||
|
|
||||||
const StatusActionButtons = {
|
const StatusActionButtons = {
|
||||||
props: ['status', 'replying'],
|
props: ['status', 'replying'],
|
||||||
emits: ['toggleReplying'],
|
emits: ['toggleReplying', 'onSuccess', 'onError'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showPin: false,
|
showPin: false,
|
||||||
|
|
|
||||||
61
test/unit/specs/components/post_status_form.spec.js
Normal file
61
test/unit/specs/components/post_status_form.spec.js
Normal file
|
|
@ -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,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue