Merge pull request 'Fix reply form quote config access' (#3496) from fix/reply-form-quote-config into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma-fe/pulls/3496
This commit is contained in:
commit
cb638d57e8
8 changed files with 76 additions and 14 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
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { get } from 'lodash'
|
||||
import { mapState } from 'pinia'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
||||
/**
|
||||
|
|
@ -21,16 +22,11 @@ const MRFTransparencyPanel = {
|
|||
computed: {
|
||||
...mapState(useInstanceStore, {
|
||||
federationPolicy: (state) => state.federationPolicy,
|
||||
mrfPolicies: (state) =>
|
||||
get(state, 'federationPolicy.mrf_policies', []),
|
||||
mrfPolicies: (state) => get(state, 'federationPolicy.mrf_policies', []),
|
||||
quarantineInstances: (state) =>
|
||||
toInstanceReasonObject(
|
||||
get(state, 'federationPolicy.quarantined_instances', []),
|
||||
get(
|
||||
state,
|
||||
'federationPolicy.quarantined_instances_info',
|
||||
[],
|
||||
),
|
||||
get(state, 'federationPolicy.quarantined_instances_info', []),
|
||||
'quarantined_instances',
|
||||
),
|
||||
acceptInstances: (state) =>
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ const PostStatusForm = {
|
|||
if (
|
||||
!this.quotingAvailable ||
|
||||
!this.isReply ||
|
||||
!this.$store.getters.mergedConfig.quoteReply
|
||||
!useMergedConfigStore().mergedConfig.quoteReply
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ library.add(faEllipsisH)
|
|||
|
||||
const StatusActionButtons = {
|
||||
props: ['status', 'replying'],
|
||||
emits: ['toggleReplying', 'interacted'],
|
||||
emits: ['toggleReplying', 'interacted', 'onSuccess', 'onError'],
|
||||
data() {
|
||||
return {
|
||||
showPin: false,
|
||||
|
|
|
|||
|
|
@ -81,7 +81,10 @@ export const maybeShowNotification = (
|
|||
|
||||
if (notification.seen) return
|
||||
if (!visibleTypes(notificationVisibility).includes(notification.type)) return
|
||||
if (notification.type === 'mention' && isMutedNotification(muteFilters, notification))
|
||||
if (
|
||||
notification.type === 'mention' &&
|
||||
isMutedNotification(muteFilters, notification)
|
||||
)
|
||||
return
|
||||
|
||||
const notificationObject = prepareNotificationObject(
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import {
|
|||
uniqWith,
|
||||
unset,
|
||||
} from 'lodash'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { defineStore } from 'pinia'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { toRaw } from 'vue'
|
||||
|
||||
import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js'
|
||||
|
|
@ -684,8 +684,6 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
|||
`Already migrated Values: ${[...migratedEntries].join() || '[none]'}`,
|
||||
)
|
||||
|
||||
const { configMigration } = useSyncConfigStore().flagStorage
|
||||
|
||||
Object.entries(oldDefaultConfigSync).forEach(([key, value]) => {
|
||||
const oldValue = config[key]
|
||||
const defaultValue = value
|
||||
|
|
|
|||
|
|
@ -292,7 +292,10 @@ export const useUserHighlightStore = defineStore('user_highlight', {
|
|||
)
|
||||
}
|
||||
})
|
||||
storage.setItem('vuex-lz', { ...vuexState, config: { ...config, highlight } })
|
||||
storage.setItem('vuex-lz', {
|
||||
...vuexState,
|
||||
config: { ...config, highlight },
|
||||
})
|
||||
|
||||
if (recent === null) {
|
||||
console.debug(
|
||||
|
|
|
|||
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