From 914df47a35691bf3db5947b36273dbe1daec4929 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 13 Mar 2026 10:47:31 +0200 Subject: [PATCH 1/4] migration --- src/modules/old_default_config_state.js | 129 ++++++++++++++++++++++++ src/stores/sync_config.js | 27 +++-- 2 files changed, 146 insertions(+), 10 deletions(-) create mode 100644 src/modules/old_default_config_state.js diff --git a/src/modules/old_default_config_state.js b/src/modules/old_default_config_state.js new file mode 100644 index 000000000..dcb1da1fe --- /dev/null +++ b/src/modules/old_default_config_state.js @@ -0,0 +1,129 @@ +// this is a snapshot of config keys used prior to sync config. +// used to migrate from old config. +export const defaultStateKeys = [ +'expertLevel', +'hideISP', +'hideInstanceWallpaper', +'hideShoutbox', +'hideMutedPosts', +'hideMutedThreads', +'hideWordFilteredPosts', +'muteBotStatuses', +'muteSensitiveStatuses', +'collapseMessageWithSubject', +'padEmoji', +'hideAttachments', +'hideAttachmentsInConv', +'hideScrobbles', +'hideScrobblesAfter', +'maxThumbnails', +'hideNsfw', +'preloadImage', +'loopVideo', +'loopVideoSilentOnly', +'streaming', +'emojiReactionsOnTimeline', +'alwaysShowNewPostButton', +'autohideFloatingPostButton', +'pauseOnUnfocused', +'stopGifs', +'replyVisibility', +'thirdColumnMode', +'notificationVisibility', +'notificationNative', +'webPushNotifications', +'webPushAlwaysShowNotifications', +'interfaceLanguage', +'hideScopeNotice', +'useStreamingApi', +'sidebarRight', +'scopeCopy', +'subjectLineBehavior', +'alwaysShowSubjectInput', +'postContentType', +'minimalScopesMode', +'hideFilteredStatuses', +'modalOnRepeat', +'modalOnUnfollow', +'modalOnBlock', +'modalOnMute', +'modalOnMuteConversation', +'modalOnMuteDomain', +'modalOnDelete', +'modalOnLogout', +'modalOnApproveFollow', +'modalOnDenyFollow', +'modalOnRemoveUserFromFollowers', +'onMuteDefaultAction', +'onBlockDefaultAction', +'modalMobileCenter', +'playVideosInModal', +'useOneClickNsfw', +'useContainFit', +'disableStickyHeaders', +'showScrollbars', +'userPopoverAvatarAction', +'userPopoverOverlay', +'userCardLeftJustify', +'userCardHidePersonalMarks', +'sidebarColumnWidth', +'contentColumnWidth', +'notifsColumnWidth', +'themeEditorMinWidth', +'emojiReactionsScale', +'textSize', +'emojiSize', +'navbarSize', +'panelHeaderSize', +'forcedRoundness', +'navbarColumnStretch', +'greentext', +'mentionLinkDisplay', +'mentionLinkShowTooltip', +'mentionLinkShowAvatar', +'mentionLinkFadeDomain', +'mentionLinkShowYous', +'mentionLinkBoldenYou', +'hidePostStats', +'hideBotIndication', +'hideUserStats', +'virtualScrolling', +'sensitiveByDefault', +'conversationDisplay', +'conversationTreeAdvanced', +'conversationOtherRepliesButton', +'conversationTreeFadeAncestors', +'showExtraNotifications', +'showExtraNotificationsTip', +'showChatsInExtraNotifications', +'showAnnouncementsInExtraNotifications', +'showFollowRequestsInExtraNotifications', +'maxDepthInThread', +'autocompleteSelect', +'closingDrawerMarksAsSeen', +'unseenAtTop', +'ignoreInactionableSeen', +'unsavedPostAction', +'autoSaveDraft', +'useAbsoluteTimeFormat', +'absoluteTimeFormatMinAge', +'absoluteTime12h', +'imageCompression', +'alwaysUseJpeg', +'theme', + +'colors', + +'customTheme', +'customThemeSource', + +'style', +'styleCustomData', +'palette', +'paletteCustomData', +'themeDebug', +'forceThemeRecompilation', +'theme3hacks', +// 'muteWords', // mutes migrated separately +// 'highlight', // highlight migration is done separately +] diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index d0915e8aa..674f84f9a 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -20,7 +20,9 @@ import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/updat import { useInstanceStore } from 'src/stores/instance.js' import { useLocalConfigStore } from 'src/stores/local_config.js' -import { defaultState as configDefaultState } from 'src/modules/default_config_state' +import { defaultState as configDefaultState } from 'src/modules/default_config_state.js' +import { defaultStateKeys } from 'src/modules/old_default_config_state.js' +import { storage } from 'src/lib/storage.js' export const VERSION = 2 export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically @@ -411,16 +413,21 @@ export const _resetPrefs = ( return totalPrefs } -export const _doMigrations = (cache, live) => { - const data = cache ?? live +export const _doMigrations = async (data) => { + console.log('TEST', data._version) if (data._version < VERSION) { console.debug( 'Data has older version, seeing if there any migrations that can be applied', ) - // no migrations right now since we only have one version - console.debug('No migrations found') + if (data._version === 1) { + // Migrate old config to sync config + const vuexState = await storage.getItem('vuex-lz') + defaultStateKeys.forEach(key => { + this.setPreference({ path: `simple.${key}`, value: vuexState.config[key] }) + }) + } } if (data._version > VERSION) { @@ -442,7 +449,7 @@ export const _doMigrations = (cache, live) => { } } - return cache + return data } export const useSyncConfigStore = defineStore('sync_config', { @@ -602,8 +609,7 @@ export const useSyncConfigStore = defineStore('sync_config', { }) this.flagStorage.reset = COMMAND_WIPE_JOURNAL_AND_STORAGE }, - initSyncConfig(userData) { - console.log(userData) + async initSyncConfig(userData) { const live = userData.storage this.raw = live let cache = this.cache @@ -630,8 +636,8 @@ export const useSyncConfigStore = defineStore('sync_config', { }) } - recent = recent && _doMigrations(recent) - stale = stale && _doMigrations(stale) + recent = recent && await _doMigrations(recent) + stale = stale && await _doMigrations(stale) if (!needUpload && recent && stale) { console.debug('Checking if data needs merging...') @@ -671,6 +677,7 @@ export const useSyncConfigStore = defineStore('sync_config', { } this.flagStorage = this.cache.flagStorage this.prefsStorage = this.cache.prefsStorage + this.pushSyncConfig() }, pushSyncConfig({ force = false } = {}) { const needPush = this.dirty || force From a7b2a9a82318553d06f3c971695ed27c79eec3dd Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 13 Mar 2026 10:54:16 +0200 Subject: [PATCH 2/4] please bear with us --- src/components/update_notification/update_notification.js | 2 +- src/components/update_notification/update_notification.vue | 2 +- src/i18n/en.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/update_notification/update_notification.js b/src/components/update_notification/update_notification.js index f9084e54d..f4eacbefe 100644 --- a/src/components/update_notification/update_notification.js +++ b/src/components/update_notification/update_notification.js @@ -11,7 +11,7 @@ import { faTimes } from '@fortawesome/free-solid-svg-icons' library.add(faTimes) -export const CURRENT_UPDATE_COUNTER = 1 +export const CURRENT_UPDATE_COUNTER = 2 const pleromaTan = '/static/pleromatan_apology.png' const pleromaTanFox = '/static/pleromatan_apology_fox.png' diff --git a/src/components/update_notification/update_notification.vue b/src/components/update_notification/update_notification.vue index a35c70f86..8b2691c35 100644 --- a/src/components/update_notification/update_notification.vue +++ b/src/components/update_notification/update_notification.vue @@ -27,7 +27,7 @@

- {{ $t('update.big_update_content') }} + {{ $t('update.big_update_content2') }}

Date: Fri, 13 Mar 2026 11:16:45 +0200 Subject: [PATCH 3/4] fix pleroma-tan being stabbed by panel-footer --- .../update_notification.scss | 33 +++++++++++-- .../update_notification.vue | 48 +++++++++---------- src/i18n/en.json | 6 ++- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/src/components/update_notification/update_notification.scss b/src/components/update_notification/update_notification.scss index 23ca3ba2e..3c154eb33 100644 --- a/src/components/update_notification/update_notification.scss +++ b/src/components/update_notification/update_notification.scss @@ -6,6 +6,7 @@ --__top-fringe: 15em; // how much pleroma-tan should stick her head above --__bottom-fringe: 80em; // just reserving as much as we can, number is mostly irrelevant --__right-fringe: 8em; + --__panel-background: rgb(0,255,255 / 80%); font-size: 15px; position: relative; @@ -18,6 +19,29 @@ padding-left: 1em; } + .footer-buttons { + --panel-heading-height-padding: calc(var(--panel-header-height) * 0.2); + --__panel-heading-gap: calc(var(--panel-header-height) * 0.1565); + --__panel-heading-height: var(--panel-header-height); + --__panel-heading-height-inner: calc(var(--__panel-heading-height) - 2 * var(--panel-heading-height-padding, 0)); + + box-sizing: border-box; + position: absolute; + bottom: 0; + left: 0; + right: 0; + display: grid; + z-index: 20; + grid-auto-flow: column; + grid-template-columns: auto; + grid-auto-columns: auto; + grid-column-gap: var(--__panel-heading-gap); + padding: var(--panel-heading-height-padding); + height: var(--__panel-heading-height); + line-height: var(--__panel-heading-height-inner); + font-size: calc(var(--panelHeaderSize) / 3.2); + } + @media all and (width <= 800px) { /* For mobile, the modal takes 100% of the available screen. This ensures the minimized modal is always 50px above the browser @@ -50,10 +74,13 @@ } .panel-footer { - z-index: 22; + z-index: 10; position: relative; border-width: 0; - grid-template-columns: auto; + + .button-default { + z-index: 2; + } } .pleroma-tan { @@ -76,7 +103,7 @@ } .spacer-bottom { - min-height: var(--__bottom-fringe); + min-height: calc(var(--__bottom-fringe) + var(--panel-header-height)); } .extra-info-group { diff --git a/src/components/update_notification/update_notification.vue b/src/components/update_notification/update_notification.vue index 8b2691c35..56976f016 100644 --- a/src/components/update_notification/update_notification.vue +++ b/src/components/update_notification/update_notification.vue @@ -35,14 +35,14 @@ > - diff --git a/src/i18n/en.json b/src/i18n/en.json index 6e15c5f65..70c099932 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1857,9 +1857,11 @@ "update": { "big_update_title": "Please bear with us", "big_update_content": "We haven't had a release in a while, so things might look and feel different than what you're used to.", - "big_update_content2": "We implemented synchronized settings! This means (nearly) all your settings are now properly synchronized between devices and sessions. We try to migrate settings from old config but migration is performed only once, so some settings might be incorrect. Let us know if you don't want certain setting synchronized.", - "update_bugs": "Please report any issues and bugs on {pleromaGitlab}, as we have changed a lot, and although we test thoroughly and use development versions ourselves, we may have missed some things. We welcome your feedback and suggestions on issues you might encounter, or how to improve Pleroma and Pleroma-FE.", + "big_update_content2": "We implemented synchronized settings! This means (nearly) all your settings are now properly synchronized between devices and sessions. We try to migrate settings from old config but migration is performed only once, so some settings might be incorrect.", + "update_bugs": "Please report any issues and bugs on {pleromaForgejo}, as we have changed a lot, and although we test thoroughly and use development versions ourselves, we may have missed some things. We welcome your feedback and suggestions on issues you might encounter, or how to improve Pleroma and Pleroma-FE.", + "update_bugs2": "Let us know if you don't want certain setting synchronized on {pleromaForgejo}.", "update_bugs_gitlab": "Pleroma GitLab", + "update_bugs_forgejo": "Pleroma Forgejo", "update_changelog": "For more details on what's changed, see {theFullChangelog}.", "update_changelog_here": "the full changelog", "art_by": "Art by {linkToArtist}" From da49b0d009aa88cffb667bc3ea397bfd2d3b0323 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 13 Mar 2026 11:52:15 +0200 Subject: [PATCH 4/4] highlight sync --- src/stores/user_highlight.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/stores/user_highlight.js b/src/stores/user_highlight.js index df9274bdf..ca3994f6b 100644 --- a/src/stores/user_highlight.js +++ b/src/stores/user_highlight.js @@ -12,6 +12,7 @@ import { } from 'lodash' import { defineStore } from 'pinia' import { toRaw } from 'vue' +import { storage } from 'src/lib/storage.js' import { defaultState as configDefaultState } from 'src/modules/default_config_state' @@ -169,7 +170,6 @@ export const _mergePrefs = (recent, stale) => { `journal contains entry to edit internal (starts with _) field '${user}', something is incorrect here, ignoring.`, ) } - console.log(resultOutput) switch (operation) { case 'set': resultOutput.highlight[user] = args[0] @@ -180,7 +180,6 @@ export const _mergePrefs = (recent, stale) => { default: return console.error(`Unknown journal operation: '${operation}'`) } - console.log(resultOutput) }) return { ...resultOutput, _journal: totalJournal } } @@ -219,9 +218,7 @@ export const useUserHighlightStore = defineStore('user_highlight', { ...oldValue, ...value, } - console.log(oldValue, newValue, value) this.highlight[user] = newValue - console.log(this.highlight) this.highlight._journal = [ ...this.highlight._journal, { operation: 'set', user, args: [newValue], timestamp: Date.now() }, @@ -262,7 +259,7 @@ export const useUserHighlightStore = defineStore('user_highlight', { this.raw.highlight._journal = [] this.pushSyncConfig() }, - initUserHighlight(userData) { + async initUserHighlight(userData) { const live = userData.user_highlight this.raw = live let cache = this.cache @@ -275,6 +272,18 @@ export const useUserHighlightStore = defineStore('user_highlight', { let { recent, stale, needUpload } = _getRecentData(cache, live) + const vuexState = await storage.getItem('vuex-lz') + const { highlight } = vuexState.config + Object.entries(highlight).forEach(([user, value]) => { + if ((highlight[user]._migrated || 0) < 1) { + vuexState.config.highlight[user]._migrated = 1 + this.set({ user, value }) + console.log(user, value, this.highlight[user]) + } + }) + storage.setItem('vuex-lz', vuexState) + this.pushHighlight() + const userNew = userData.created_at > NEW_USER_DATE let dirty = false