diff --git a/changelog.d/reply-quote-config.fix b/changelog.d/reply-quote-config.fix deleted file mode 100644 index b6ac4e5e9..000000000 --- a/changelog.d/reply-quote-config.fix +++ /dev/null @@ -1 +0,0 @@ -Fix reply form crash when quote-reply settings are unavailable diff --git a/src/boot/after_store.js b/src/boot/after_store.js index e18cfa788..678a5e7d1 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -175,16 +175,14 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { if (source === 'name') return if (INSTANCE_IDENTIY_EXTERNAL.has(source)) return useInstanceStore().set({ - value: - config[source] ?? INSTANCE_IDENTITY_DEFAULT_DEFINITIONS[source].default, + value: config[source] ?? INSTANCE_IDENTITY_DEFAULT_DEFINITIONS[source].default, path: `instanceIdentity.${source}`, }) }) Object.keys(INSTANCE_DEFAULT_CONFIG_DEFINITIONS).forEach((source) => useInstanceStore().set({ - value: - config[source] ?? INSTANCE_DEFAULT_CONFIG_DEFINITIONS[source].default, + value: config[source] ?? INSTANCE_DEFAULT_CONFIG_DEFINITIONS[source].default, path: `prefsStorage.${source}`, }), ) diff --git a/src/components/about/about.js b/src/components/about/about.js index e6a1067fe..dc6733491 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -27,11 +27,7 @@ const About = { frontendVersionLink() { return pleromaFeCommitUrl + this.frontendVersion }, - ...mapState(useInstanceStore, [ - 'backendVersion', - 'backendRepository', - 'frontendVersion', - ]), + ...mapState(useInstanceStore, ['backendVersion', 'backendRepository', 'frontendVersion']), showInstanceSpecificPanel() { return ( useInstanceStore().instanceIdentity.showInstanceSpecificPanel && diff --git a/src/components/about/about.vue b/src/components/about/about.vue index f7bc0d00d..df395c7dd 100644 --- a/src/components/about/about.vue +++ b/src/components/about/about.vue @@ -7,9 +7,7 @@
-
- {{ $t('settings.version.title') }} -
+
{{ $t('settings.version.title') }}
diff --git a/src/components/basic_user_card/basic_user_card.js b/src/components/basic_user_card/basic_user_card.js index 722d459f3..a42293cc1 100644 --- a/src/components/basic_user_card/basic_user_card.js +++ b/src/components/basic_user_card/basic_user_card.js @@ -29,7 +29,7 @@ const BasicUserCard = { allowNonSquareEmoji() { return useMergedConfigStore().mergedConfig.nonSquareEmoji }, - }, + } } export default BasicUserCard diff --git a/src/components/chat_title/chat_title.js b/src/components/chat_title/chat_title.js index 54a31a6fe..7ec4c81f1 100644 --- a/src/components/chat_title/chat_title.js +++ b/src/components/chat_title/chat_title.js @@ -3,8 +3,6 @@ import { defineAsyncComponent } from 'vue' import RichContent from 'src/components/rich_content/rich_content.jsx' import UserAvatar from '../user_avatar/user_avatar.vue' -import { useMergedConfigStore } from 'src/stores/merged_config.js' - export default { name: 'ChatTitle', components: { diff --git a/src/components/color_input/color_input.vue b/src/components/color_input/color_input.vue index 07aed6b81..6f236d35f 100644 --- a/src/components/color_input/color_input.vue +++ b/src/components/color_input/color_input.vue @@ -88,7 +88,6 @@ export default { label: { required: false, type: String, - default: '', }, // use unstyled, uh, style unstyled: { diff --git a/src/components/drafts/drafts.js b/src/components/drafts/drafts.js index 87c22138b..01a50759a 100644 --- a/src/components/drafts/drafts.js +++ b/src/components/drafts/drafts.js @@ -1,6 +1,6 @@ -import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue' import Draft from 'src/components/draft/draft.vue' import List from 'src/components/list/list.vue' +import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue' const Drafts = { components: { @@ -10,7 +10,7 @@ const Drafts = { }, data() { return { - showingConfirmDialog: false, + showingConfirmDialog: false } }, computed: { @@ -23,14 +23,12 @@ const Drafts = { this.showingConfirmDialog = true }, doAbandonAll() { - this.$store - .dispatch('abandonAllDrafts') - .then(() => this.hideConfirmDialog()) + this.$store.dispatch('abandonAllDrafts').then(() => this.hideConfirmDialog()) }, hideConfirmDialog() { this.showingConfirmDialog = false }, - }, + } } export default Drafts diff --git a/src/components/emoji_input/emoji_input.vue b/src/components/emoji_input/emoji_input.vue index 526f646ab..b362db32f 100644 --- a/src/components/emoji_input/emoji_input.vue +++ b/src/components/emoji_input/emoji_input.vue @@ -2,7 +2,7 @@
{ - const peek = attachments[i + 1] + const peek = attachments[i+1] const nextEnd = peek == null const nextWide = !nextEnd && !displayTypes.has(peek?.type) @@ -68,23 +68,12 @@ const Gallery = { } const maxPerRow = 3 - const currentRow = acc[acc.length - 1] - const previousRow = acc[acc.length - 2] - - if (currentRow.items.length >= maxPerRow) { - if (nextWide || nextEnd) { - if (previousRow?.items.length > 1) { - currentRow.items.push(attachment) - return [...acc, { items: [] }] - } else { - const last = currentRow.items.splice(-1)[0] - return [...acc, { items: [last, attachment] }] - } - } else { - return [...acc, { items: [attachment] }] - } + const currentRow = acc[acc.length - 1].items + if ((nextWide || nextEnd) && currentRow.length >= maxPerRow) { + const last = currentRow.splice(-1)[0] + return [...acc, { items: [last, attachment] }] } else { - currentRow.items.push(attachment) + currentRow.push(attachment) } return acc }, diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js index b2048984d..d77a0a839 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.js +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -1,6 +1,5 @@ import { get } from 'lodash' import { mapState } from 'pinia' - import { useInstanceStore } from 'src/stores/instance.js' /** @@ -22,11 +21,16 @@ 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) => diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 1e9c624f4..805b46745 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -211,11 +211,7 @@ const PostStatusForm = { poll: {}, hasPoll: false, hasQuote: false, - quote: { - id: '', - url: '', - thread: false, - }, + quote: {}, mediaDescriptions: {}, visibility: scope, contentType, @@ -234,11 +230,7 @@ const PostStatusForm = { poll: this.statusPoll || {}, hasPoll: false, hasQuote: false, - quote: { - id: '', - url: '', - thread: false, - }, + quote: {}, mediaDescriptions: this.statusMediaDescriptions || {}, visibility: this.statusScope || scope, contentType: statusContentType, @@ -386,13 +378,12 @@ const PostStatusForm = { this.newStatus.hasQuote = value this.newStatus.quote.thread = value this.newStatus.quote.id = value ? this.replyTo : '' - }, + } }, defaultQuotable() { if ( !this.quotingAvailable || - !this.isReply || - !useMergedConfigStore().mergedConfig.quoteReply + !this.isReply ) { return false } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index d37d0a90f..3d5e27d77 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -264,10 +264,10 @@ /> diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index fc17a529f..95ab102c6 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -328,13 +328,7 @@ export default { // slots updated -> rerender -> emit -> update up the tree -> rerender -> ... // at least until vue3? const result = ( - + {this.collapse ? pass2.map((x) => { if (!Array.isArray(x)) return x.replace(/\n/g, ' ') diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue index a53be93c3..3a6434e9e 100644 --- a/src/components/settings_modal/helpers/number_setting.vue +++ b/src/components/settings_modal/helpers/number_setting.vue @@ -9,13 +9,13 @@ class="setting-label" :class="{ 'faint': shouldBeDisabled }" > - - - {{ ' ' }} - + + + {{ ' ' }} + diff --git a/src/components/settings_modal/tabs/developer_tab.js b/src/components/settings_modal/tabs/developer_tab.js index 9a6258638..7558785f5 100644 --- a/src/components/settings_modal/tabs/developer_tab.js +++ b/src/components/settings_modal/tabs/developer_tab.js @@ -1,5 +1,4 @@ import { mapState } from 'pinia' - import BooleanSetting from '../helpers/boolean_setting.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' @@ -18,11 +17,7 @@ const VersionTab = { frontendVersionLink() { return pleromaFeCommitUrl + this.frontendVersion }, - ...mapState(useInstanceStore, [ - 'backendVersion', - 'backendRepository', - 'frontendVersion', - ]), + ...mapState(useInstanceStore, ['backendVersion', 'backendRepository', 'frontendVersion']), ...SharedComputedObject(), }, methods: { diff --git a/src/components/status_action_buttons/status_action_buttons.js b/src/components/status_action_buttons/status_action_buttons.js index 8bdd87277..6962cce1b 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', 'onSuccess', 'onError'], + emits: ['toggleReplying'], data() { return { showPin: false, diff --git a/src/components/status_action_buttons/status_action_buttons.vue b/src/components/status_action_buttons/status_action_buttons.vue index 3837e6ae5..6c0fab542 100644 --- a/src/components/status_action_buttons/status_action_buttons.vue +++ b/src/components/status_action_buttons/status_action_buttons.vue @@ -3,7 +3,7 @@ + > {{ isKnownTag ? $t('user_card.tags.' + tag) : tag }} diff --git a/src/components/user_list_popover/user_list_popover.js b/src/components/user_list_popover/user_list_popover.js index 6f79939da..8f8b09fb5 100644 --- a/src/components/user_list_popover/user_list_popover.js +++ b/src/components/user_list_popover/user_list_popover.js @@ -3,11 +3,11 @@ import { defineAsyncComponent } from 'vue' import RichContent from 'src/components/rich_content/rich_content.jsx' import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue' -import { useMergedConfigStore } from 'src/stores/merged_config.js' - import { library } from '@fortawesome/fontawesome-svg-core' import { faCircleNotch } from '@fortawesome/free-solid-svg-icons' +import { useMergedConfigStore } from 'src/stores/merged_config.js' + library.add(faCircleNotch) const UserListPopover = { diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 17d69f49b..5ae5b81a4 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -10,9 +10,9 @@ import List from '../list/list.vue' import Timeline from '../timeline/timeline.vue' import UserCard from '../user_card/user_card.vue' +import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' -import { useMergedConfigStore } from 'src/stores/merged_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faCircleNotch } from '@fortawesome/free-solid-svg-icons' diff --git a/src/modules/drafts.js b/src/modules/drafts.js index 3cde4f574..42bb3b313 100644 --- a/src/modules/drafts.js +++ b/src/modules/drafts.js @@ -44,7 +44,7 @@ const saveDraftToStorage = async (draft) => { const deleteDraftFromStorage = async (ids) => { const currentData = await getStorageData() - ids.forEach((id) => { + ids.forEach(id => { delete currentData[id] }) await storage.setItem(storageKey, currentData) diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index 921600094..1fbaf2a2c 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -81,10 +81,7 @@ 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( diff --git a/src/services/status_parser/status_parser.js b/src/services/status_parser/status_parser.js index a011fe265..c6ceb1f0a 100644 --- a/src/services/status_parser/status_parser.js +++ b/src/services/status_parser/status_parser.js @@ -10,15 +10,7 @@ export const muteFilterHits = (muteFilters, status) => { return muteFilters .toSorted((a, b) => b.order - a.order) .map((filter) => { - const { - hide, - expires, - name, - value, - type, - enabled, - caseSensitive = false, - } = filter + const { hide, expires, name, value, type, enabled, caseSensitive = false } = filter if (!enabled) return false if (value === '') return false if (expires !== null && expires < Date.now()) return false @@ -26,7 +18,9 @@ export const muteFilterHits = (muteFilters, status) => { case 'word': { let match = false if (caseSensitive) { - match = statusText.includes(value) || statusSummary.includes(value) + match = + statusText.includes(value) || + statusSummary.includes(value) } else { const lowercaseValue = value.toLowerCase() match = @@ -62,9 +56,7 @@ export const muteFilterHits = (muteFilters, status) => { match = poster.toLowerCase().includes(lowercaseValue) || replyToUser.toLowerCase().includes(lowercaseValue) || - mentions.some((mention) => - mention.toLowerCase().includes(lowercaseValue), - ) + mentions.some((mention) => mention.toLowerCase().includes(lowercaseValue)) } if (match) { return { hide, name } diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js index 62666d5f8..7babbaf32 100644 --- a/src/services/theme_data/theme_data_3.service.js +++ b/src/services/theme_data/theme_data_3.service.js @@ -499,7 +499,10 @@ export const init = ({ }), ) const lastVariantRule = variantRules[variantRules.length - 1] - const lastVariantSelector = ruleToSelector(lastVariantRule, true) + const lastVariantSelector = ruleToSelector( + lastVariantRule, + true, + ) if (lastVariantRule && lastVariantSelector !== selector) { inheritRule = lastVariantRule diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index 1caa2b030..722dd7f16 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -14,8 +14,8 @@ import { uniqWith, unset, } from 'lodash' -import { defineStore } from 'pinia' import { v4 as uuidv4 } from 'uuid' +import { defineStore } from 'pinia' import { toRaw } from 'vue' import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js' @@ -684,6 +684,8 @@ 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 diff --git a/src/stores/user_highlight.js b/src/stores/user_highlight.js index f41c41628..5ca13b6a9 100644 --- a/src/stores/user_highlight.js +++ b/src/stores/user_highlight.js @@ -292,10 +292,7 @@ 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( diff --git a/test/unit/specs/components/gallery.spec.js b/test/unit/specs/components/gallery.spec.js index d4c466586..367bab0b4 100644 --- a/test/unit/specs/components/gallery.spec.js +++ b/test/unit/specs/components/gallery.spec.js @@ -129,7 +129,7 @@ describe('Gallery', () => { ]) }) - it('mixed attachments 1', () => { + it('mixed attachments', () => { local = { attachments: [ { type: 'audio' }, @@ -138,6 +138,7 @@ describe('Gallery', () => { { type: 'image' }, { type: 'image' }, { type: 'image' }, + { type: 'image' }, ], } @@ -150,17 +151,17 @@ describe('Gallery', () => { { type: 'image' }, { type: 'image' }, { type: 'image' }, + { type: 'image' }, ], }, ]) - }) - it('mixed attachments 2', () => { local = { attachments: [ { type: 'image' }, { type: 'image' }, { type: 'image' }, + { type: 'image' }, { type: 'audio' }, { type: 'image' }, { type: 'audio' }, @@ -171,13 +172,12 @@ describe('Gallery', () => { { items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }], }, + { items: [{ type: 'image' }] }, { audio: true, items: [{ type: 'audio' }] }, { items: [{ type: 'image' }] }, { audio: true, items: [{ type: 'audio' }] }, ]) - }) - it('7 images', () => { local = { attachments: [ { type: 'image' }, @@ -205,9 +205,7 @@ describe('Gallery', () => { ], }, ]) - }) - it('8 images', () => { local = { attachments: [ { type: 'image' }, @@ -232,54 +230,6 @@ describe('Gallery', () => { ]) }) - it('4 images + audio + image + 4 images', () => { - local = { - attachments: [ - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - { type: 'audio' }, - { type: 'image' }, - { type: 'audio' }, - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - ], - } - - expect(Gallery.computed.rows.call(local)).to.eql([ - { - items: [ - { type: 'image' }, - { type: 'image' }, - ], - }, - { - items: [ - { type: 'image' }, - { type: 'image' }, - ], - }, - { audio: true, items: [{ type: 'audio' }] }, - { items: [{ type: 'image' }] }, - { audio: true, items: [{ type: 'audio' }] }, - { - items: [ - { type: 'image' }, - { type: 'image' }, - ], - }, - { - items: [ - { type: 'image' }, - { type: 'image' }, - ], - }, - ]) - }) - it('does not do grouping when grid is set', () => { const attachments = [ { type: 'audio' }, diff --git a/test/unit/specs/components/post_status_form.spec.js b/test/unit/specs/components/post_status_form.spec.js deleted file mode 100644 index 8f3d6d80f..000000000 --- a/test/unit/specs/components/post_status_form.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -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, - }) - }) -}) diff --git a/test/unit/specs/stores/sync_config.spec.js b/test/unit/specs/stores/sync_config.spec.js index a045aa18a..4a502f626 100644 --- a/test/unit/specs/stores/sync_config.spec.js +++ b/test/unit/specs/stores/sync_config.spec.js @@ -232,8 +232,7 @@ describe('The SyncConfig store', () => { expect(store.prefsStorage._journal.length).to.eql(2) }) - // TODO We need a proper test for object-based stores - it.skip('should remove depth = 3 set/unset entries from journal', () => { + it('should remove depth = 3 set/unset entries from journal', () => { const store = useSyncConfigStore() // PushSyncConfig is very simple but uses vuex to push data store.pushSyncConfig = () => {