From adc3b17fe0ba149386d83ee85f908578609bd676 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 13 Jan 2021 21:29:12 +0200 Subject: add success global notice style/level --- src/components/global_notice_list/global_notice_list.vue | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/components') diff --git a/src/components/global_notice_list/global_notice_list.vue b/src/components/global_notice_list/global_notice_list.vue index 049e23db..a45f4586 100644 --- a/src/components/global_notice_list/global_notice_list.vue +++ b/src/components/global_notice_list/global_notice_list.vue @@ -71,6 +71,14 @@ } } + .global-success { + background-color: var(--alertPopupSuccess, $fallback--cGreen); + color: var(--alertPopupSuccessText, $fallback--text); + .svg-inline--fa { + color: var(--alertPopupSuccessText, $fallback--text); + } + } + .global-info { background-color: var(--alertPopupNeutral, $fallback--fg); color: var(--alertPopupNeutralText, $fallback--text); -- cgit v1.2.3-70-g09d2 From 9a8bc245a6f76f1a41da9d05408dadc36625ffe9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 13 Jan 2021 22:17:10 +0200 Subject: fixed few-posts TLs when streaming is enabled --- CHANGELOG.md | 1 + src/components/notifications/notifications.js | 5 ----- src/modules/api.js | 13 +++++++++++++ src/modules/users.js | 2 ++ .../backend_interactor_service.js | 12 ++++++++++-- .../notifications_fetcher/notifications_fetcher.service.js | 6 ++++-- src/services/timeline_fetcher/timeline_fetcher.service.js | 9 +++++++-- 7 files changed, 37 insertions(+), 11 deletions(-) (limited to 'src/components') diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b9c7f68..4d0ca7d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fixed local dev mode having non-functional websockets in some cases - Show notices for websocket events (errors, abnormal closures, reconnections) - Fix not being able to re-enable websocket until page refresh +- Fix annoying issue where timeline might have few posts when streaming is enabled ## [2.2.2] - 2020-12-22 ### Added diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 49258563..d6bd6375 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -35,11 +35,6 @@ const Notifications = { seenToDisplayCount: DEFAULT_SEEN_TO_DISPLAY_COUNT } }, - created () { - const store = this.$store - const credentials = store.state.users.currentUser.credentials - notificationsFetcher.fetchAndUpdate({ store, credentials }) - }, computed: { mainClass () { return this.minimalMode ? '' : 'panel panel-default' diff --git a/src/modules/api.js b/src/modules/api.js index 2be0f236..b482637d 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -188,6 +188,13 @@ const api = { if (!fetcher) return store.commit('removeFetcher', { fetcherName: timeline, fetcher }) }, + fetchTimeline (store, timeline, { ...rest }) { + store.state.backendInteractor.fetchTimeline({ + store, + timeline, + ...rest + }) + }, // Notifications startFetchingNotifications (store) { @@ -200,6 +207,12 @@ const api = { if (!fetcher) return store.commit('removeFetcher', { fetcherName: 'notifications', fetcher }) }, + fetchNotifications (store, { ...rest }) { + store.state.backendInteractor.fetchNotifications({ + store, + ...rest + }) + }, // Follow requests startFetchingFollowRequests (store) { diff --git a/src/modules/users.js b/src/modules/users.js index 655db4c7..ac52be1f 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -547,6 +547,8 @@ const users = { } if (store.getters.mergedConfig.useStreamingApi) { + store.dispatch('fetchTimeline', 'friends', { since: null }) + store.dispatch('fetchNotifications', { since: null }) store.dispatch('enableMastoSockets').catch((error) => { console.error('Failed initializing MastoAPI Streaming socket', error) startPolling() diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 45e6bd0e..4a40f5b5 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -1,17 +1,25 @@ import apiService, { getMastodonSocketURI, ProcessedWS } from '../api/api.service.js' -import timelineFetcherService from '../timeline_fetcher/timeline_fetcher.service.js' +import timelineFetcher from '../timeline_fetcher/timeline_fetcher.service.js' import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js' import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service' const backendInteractorService = credentials => ({ startFetchingTimeline ({ timeline, store, userId = false, tag }) { - return timelineFetcherService.startFetching({ timeline, store, credentials, userId, tag }) + return timelineFetcher.startFetching({ timeline, store, credentials, userId, tag }) + }, + + fetchTimeline (args) { + return timelineFetcher.fetchAndUpdate({ ...args, credentials }) }, startFetchingNotifications ({ store }) { return notificationsFetcher.startFetching({ store, credentials }) }, + fetchNotifications (args) { + return notificationsFetcher.fetchAndUpdate({ ...args, credentials }) + }, + startFetchingFollowRequests ({ store }) { return followRequestFetcher.startFetching({ store, credentials }) }, diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index beeb167c..f83f871e 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -5,7 +5,7 @@ const update = ({ store, notifications, older }) => { store.dispatch('addNewNotifications', { notifications, older }) } -const fetchAndUpdate = ({ store, credentials, older = false }) => { +const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const args = { credentials } const { getters } = store const rootState = store.rootState || store.state @@ -22,8 +22,10 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => { return fetchNotifications({ store, args, older }) } else { // fetch new notifications - if (timelineData.maxId !== Number.POSITIVE_INFINITY) { + if (since === undefined && timelineData.maxId !== Number.POSITIVE_INFINITY) { args['since'] = timelineData.maxId + } else if (since !== null) { + args['since'] = since } const result = fetchNotifications({ store, args, older }) diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index 921df3ed..46bba41a 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -23,7 +23,8 @@ const fetchAndUpdate = ({ showImmediately = false, userId = false, tag = false, - until + until, + since }) => { const args = { timeline, credentials } const rootState = store.rootState || store.state @@ -35,7 +36,11 @@ const fetchAndUpdate = ({ if (older) { args['until'] = until || timelineData.minId } else { - args['since'] = timelineData.maxId + if (since === undefined) { + args['since'] = timelineData.maxId + } else if (since !== null) { + args['since'] = since + } } args['userId'] = userId -- cgit v1.2.3-70-g09d2 From 98cb9abac773e8fbce94eafea1025919b6f26360 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 22 Feb 2021 16:24:04 +0200 Subject: Add timeline menu toggle to nav panel --- CHANGELOG.md | 2 + src/components/nav_panel/nav_panel.js | 36 ++++++----- src/components/nav_panel/nav_panel.vue | 70 ++++++++++++++++++---- src/components/timeline_menu/timeline_menu.js | 31 ++-------- src/components/timeline_menu/timeline_menu.vue | 48 +-------------- .../timeline_menu/timeline_menu_content.js | 29 +++++++++ .../timeline_menu/timeline_menu_content.vue | 66 ++++++++++++++++++++ src/i18n/en.json | 1 + 8 files changed, 183 insertions(+), 100 deletions(-) create mode 100644 src/components/timeline_menu/timeline_menu_content.js create mode 100644 src/components/timeline_menu/timeline_menu_content.vue (limited to 'src/components') diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4be7da..15e63d00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Display 'people voted' instead of 'votes' for multi-choice polls +- Changed the "Timelines" link in side panel to toggle show all timeline options inside the panel +- Renamed "Timeline" to "Home Timeline" to be more clear ## [2.2.3] - 2021-01-18 ### Added diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 81d49cc2..37bcb409 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -1,4 +1,4 @@ -import { timelineNames } from '../timeline_menu/timeline_menu.js' +import TimelineMenuContent from '../timeline_menu/timeline_menu_content.vue' import { mapState, mapGetters } from 'vuex' import { library } from '@fortawesome/fontawesome-svg-core' @@ -7,10 +7,12 @@ import { faGlobe, faBookmark, faEnvelope, - faHome, + faChevronDown, + faChevronUp, faComments, faBell, - faInfoCircle + faInfoCircle, + faStream } from '@fortawesome/free-solid-svg-icons' library.add( @@ -18,10 +20,12 @@ library.add( faGlobe, faBookmark, faEnvelope, - faHome, + faChevronDown, + faChevronUp, faComments, faBell, - faInfoCircle + faInfoCircle, + faStream ) const NavPanel = { @@ -30,16 +34,20 @@ const NavPanel = { this.$store.dispatch('startFetchingFollowRequests') } }, + components: { + TimelineMenuContent + }, + data () { + return { + showTimelines: false + } + }, + methods: { + toggleTimelines () { + this.showTimelines = !this.showTimelines + } + }, computed: { - onTimelineRoute () { - return !!timelineNames()[this.$route.name] - }, - timelinesRoute () { - if (this.$store.state.interface.lastTimeline) { - return this.$store.state.interface.lastTimeline - } - return this.currentUser ? 'friends' : 'public-timeline' - }, ...mapState({ currentUser: state => state.users.currentUser, followRequestCount: state => state.api.followRequests.length, diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 0c83d0fe..7ae7b1d6 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -3,19 +3,33 @@
  • - {{ $t("nav.timelines") }} - + + +
    + +
  • - +
  • - +
  • - +
  • - + i18n key mapping, exported and not in the computed // because nav panel benefits from the same information. export const timelineNames = () => { return { - 'friends': 'nav.timeline', + 'friends': 'nav.home_timeline', 'bookmarks': 'nav.bookmarks', 'dms': 'nav.dms', 'public-timeline': 'nav.public_tl', @@ -33,7 +21,8 @@ export const timelineNames = () => { const TimelineMenu = { components: { - Popover + Popover, + TimelineMenuContent }, data () { return { @@ -41,9 +30,6 @@ const TimelineMenu = { } }, created () { - if (this.currentUser && this.currentUser.locked) { - this.$store.dispatch('startFetchingFollowRequests') - } if (timelineNames()[this.$route.name]) { this.$store.dispatch('setLastTimeline', this.$route.name) } @@ -75,13 +61,6 @@ const TimelineMenu = { const i18nkey = timelineNames()[this.$route.name] return i18nkey ? this.$t(i18nkey) : route } - }, - computed: { - ...mapState({ - currentUser: state => state.users.currentUser, - privateMode: state => state.instance.private, - federating: state => state.instance.federating - }) } } diff --git a/src/components/timeline_menu/timeline_menu.vue b/src/components/timeline_menu/timeline_menu.vue index 3c86842b..22dc3432 100644 --- a/src/components/timeline_menu/timeline_menu.vue +++ b/src/components/timeline_menu/timeline_menu.vue @@ -13,53 +13,7 @@ slot="content" class="timeline-menu-popover panel panel-default" > -
      -
    • - - {{ $t("nav.timeline") }} - -
    • -
    • - - {{ $t("nav.bookmarks") }} - -
    • -
    • - - {{ $t("nav.dms") }} - -
    • -
    • - - {{ $t("nav.public_tl") }} - -
    • -
    • - - {{ $t("nav.twkn") }} - -
    • -
    +
state.users.currentUser, + privateMode: state => state.instance.private, + federating: state => state.instance.federating + }) + } +} + +export default TimelineMenuContent diff --git a/src/components/timeline_menu/timeline_menu_content.vue b/src/components/timeline_menu/timeline_menu_content.vue new file mode 100644 index 00000000..bed1b679 --- /dev/null +++ b/src/components/timeline_menu/timeline_menu_content.vue @@ -0,0 +1,66 @@ + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index 4cc2af0e..45280eff 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -124,6 +124,7 @@ "dms": "Direct Messages", "public_tl": "Public Timeline", "timeline": "Timeline", + "home_timeline": "Home Timeline", "twkn": "Known Network", "bookmarks": "Bookmarks", "user_search": "User Search", -- cgit v1.2.3-70-g09d2 From f6af4c43f656d1990da00bc773c15ebbbc57e71d Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 1 Mar 2021 16:21:35 +0200 Subject: add quick filters for notifications2 --- .../notifications/notification_filters.vue | 121 +++++++++++++++++++++ src/components/notifications/notifications.js | 8 +- src/components/notifications/notifications.vue | 1 + src/components/timeline/timeline_quick_settings.js | 4 +- .../timeline/timeline_quick_settings.vue | 8 +- src/modules/config.js | 2 +- 6 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 src/components/notifications/notification_filters.vue (limited to 'src/components') diff --git a/src/components/notifications/notification_filters.vue b/src/components/notifications/notification_filters.vue new file mode 100644 index 00000000..95b2513b --- /dev/null +++ b/src/components/notifications/notification_filters.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 49258563..a9bf2931 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -1,5 +1,6 @@ import { mapGetters } from 'vuex' import Notification from '../notification/notification.vue' +import NotificationFilters from './notification_filters.vue' import notificationsFetcher from '../../services/notifications_fetcher/notifications_fetcher.service.js' import { notificationsFromStore, @@ -17,6 +18,10 @@ library.add( const DEFAULT_SEEN_TO_DISPLAY_COUNT = 30 const Notifications = { + components: { + Notification, + NotificationFilters + }, props: { // Disables display of panel header noHeading: Boolean, @@ -70,9 +75,6 @@ const Notifications = { }, ...mapGetters(['unreadChatCount']) }, - components: { - Notification - }, watch: { unseenCountTitle (count) { if (count > 0) { diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 725d1ad4..12097b85 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -22,6 +22,7 @@ > {{ $t('notifications.read') }} +
diff --git a/src/services/export_import/export_import.js b/src/services/export_import/export_import.js new file mode 100644 index 00000000..0bf9eadc --- /dev/null +++ b/src/services/export_import/export_import.js @@ -0,0 +1,57 @@ +export const newExporter = ({ + filename = 'data', + getExportedObject +}) => ({ + exportData () { + const stringified = JSON.stringify(getExportedObject(), null, 2) // Pretty-print and indent with 2 spaces + + // Create an invisible link with a data url and simulate a click + const e = document.createElement('a') + e.setAttribute('download', `${filename}.json`) + e.setAttribute('href', 'data:application/json;base64,' + window.btoa(stringified)) + e.style.display = 'none' + + document.body.appendChild(e) + e.click() + document.body.removeChild(e) + } +}) + +export const newImporter = ({ + onImport, + onImportFailure, + validator = () => true +}) => ({ + importData () { + const filePicker = document.createElement('input') + filePicker.setAttribute('type', 'file') + filePicker.setAttribute('accept', '.json') + console.log(1) + + filePicker.addEventListener('change', event => { + if (event.target.files[0]) { + // eslint-disable-next-line no-undef + const reader = new FileReader() + reader.onload = ({ target }) => { + try { + const parsed = JSON.parse(target.result) + const validationResult = validator(parsed) + if (validationResult === true) { + onImport(parsed) + } else { + onImportFailure({ validationResult }) + } + } catch (error) { + onImportFailure({ error }) + } + } + console.log(2) + reader.readAsText(event.target.files[0]) + } + }) + + document.body.appendChild(filePicker) + filePicker.click() + document.body.removeChild(filePicker) + } +}) -- cgit v1.2.3-70-g09d2 From dda95543e82ff21ca03c96f3366735a9ec43c0e6 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 8 Mar 2021 19:53:30 +0200 Subject: implemented import/export for themes --- src/components/settings_modal/settings_modal.js | 80 ++++++++++++++++++++++++ src/components/settings_modal/settings_modal.vue | 70 ++++++++++++++++++++- src/i18n/en.json | 5 ++ src/modules/config.js | 5 ++ 4 files changed, 158 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index f0d49c91..7f6ccccb 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -2,10 +2,52 @@ import Modal from 'src/components/modal/modal.vue' import PanelLoading from 'src/components/panel_loading/panel_loading.vue' import AsyncComponentError from 'src/components/async_component_error/async_component_error.vue' import getResettableAsyncComponent from 'src/services/resettable_async_component.js' +import Popover from '../popover/popover.vue' +import { library } from '@fortawesome/fontawesome-svg-core' +import { cloneDeep } from 'lodash' +import { + newImporter, + newExporter +} from 'src/services/export_import/export_import.js' +import { + faTimes, + faFileUpload, + faFileDownload, + faChevronDown +} from '@fortawesome/free-solid-svg-icons' +import { + faWindowMinimize +} from '@fortawesome/free-regular-svg-icons' + +library.add( + faTimes, + faWindowMinimize, + faFileUpload, + faFileDownload, + faChevronDown +) const SettingsModal = { + data () { + return { + dataImporter: newImporter({ + validator: this.importValidator, + onImport: this.onImport, + onImportFailure: this.onImportFailure + }), + dataThemeExporter: newExporter({ + filename: 'pleromafe_settings.full', + getExportedObject: () => this.generateExport(true) + }), + dataExporter: newExporter({ + filename: 'pleromafe_settings', + getExportedObject: () => this.generateExport() + }) + } + }, components: { Modal, + Popover, SettingsModalContent: getResettableAsyncComponent( () => import('./settings_modal_content.vue'), { @@ -21,6 +63,44 @@ const SettingsModal = { }, peekModal () { this.$store.dispatch('togglePeekSettingsModal') + }, + importValidator (data) { + return data._pleroma_settings_version[0] === 1 + }, + onImportFailure () { + this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_settings_imported', level: 'error' }) + }, + onImport (data) { + this.$store.dispatch('loadSettings', data) + }, + restore () { + console.log(this.dataImporter) + this.dataImporter.importData() + }, + backup () { + this.dataExporter.exportData() + }, + backupWithTheme () { + this.dataThemeExporter.exportData() + }, + generateExport (theme = false) { + const { config } = this.$store.state + let sample = config + if (!theme) { + const ignoreList = new Set([ + 'customTheme', + 'customThemeSource', + 'colors' + ]) + sample = Object.fromEntries( + Object + .entries(sample) + .filter(([key]) => !ignoreList.has(key)) + ) + } + const clone = cloneDeep(sample) + clone._pleroma_settings_version = [1, 0] + return clone } }, computed: { diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue index 552ca41f..a142bcd1 100644 --- a/src/components/settings_modal/settings_modal.vue +++ b/src/components/settings_modal/settings_modal.vue @@ -32,19 +32,85 @@
+
diff --git a/src/i18n/en.json b/src/i18n/en.json index 2aefebc9..049d3d11 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -357,6 +357,7 @@ "interface": "Interface", "interfaceLanguage": "Interface language", "invalid_theme_imported": "The selected file is not a supported Pleroma theme. No changes to your theme were made.", + "invalid_settings_imported": "The selected file is not a supported Pleroma settings backup. No changes were made.", "limited_availability": "Unavailable in your browser", "links": "Links", "lock_account_description": "Restrict your account to approved followers only", @@ -364,6 +365,10 @@ "loop_video_silent_only": "Loop only videos without sound (i.e. Mastodon's \"gifs\")", "mutes_tab": "Mutes", "play_videos_in_modal": "Play videos in a popup frame", + "backup_restore": "Settings backup", + "backup_settings": "Backup settings to file", + "backup_settings_theme": "Backup settings and theme to file", + "restore_settings": "Restore settings from file", "profile_fields": { "label": "Profile metadata", "add_field": "Add Field", diff --git a/src/modules/config.js b/src/modules/config.js index eca58c12..ec3b4c43 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -110,6 +110,11 @@ const config = { } }, actions: { + loadSettings ({ dispatch }, data) { + Object.keys(this.state.config).forEach( + name => dispatch('setOption', { name, value: data[name] }) + ) + }, setHighlight ({ commit, dispatch }, { user, color, type }) { commit('setHighlight', { user, color, type }) }, -- cgit v1.2.3-70-g09d2 From 395e12cbc6e22459508023daabba87b62a65050e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 8 Mar 2021 21:00:43 +0200 Subject: better error/warnings --- src/components/settings_modal/settings_modal.js | 54 ++++++++++++++++++++++-- src/components/settings_modal/settings_modal.vue | 8 ++-- src/i18n/en.json | 17 +++++--- 3 files changed, 66 insertions(+), 13 deletions(-) (limited to 'src/components') diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index 7f6ccccb..f88184ca 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -19,6 +19,9 @@ import { faWindowMinimize } from '@fortawesome/free-regular-svg-icons' +const PLEROMAFE_SETTINGS_MAJOR_VERSION = 1 +const PLEROMAFE_SETTINGS_MINOR_VERSION = 0 + library.add( faTimes, faWindowMinimize, @@ -65,12 +68,52 @@ const SettingsModal = { this.$store.dispatch('togglePeekSettingsModal') }, importValidator (data) { - return data._pleroma_settings_version[0] === 1 + if (!Array.isArray(data._pleroma_settings_version)) { + return { + messageKey: 'settings.file_import_export.invalid_file' + } + } + + const [major, minor] = data._pleroma_settings_version + + if (major > PLEROMAFE_SETTINGS_MAJOR_VERSION) { + return { + messageKey: 'settings.file_export_import.errors.file_too_new', + messageArgs: { + fileMajor: major, + feMajor: PLEROMAFE_SETTINGS_MAJOR_VERSION + } + } + } + + if (major < PLEROMAFE_SETTINGS_MAJOR_VERSION) { + return { + messageKey: 'settings.file_export_import.errors.file_too_old', + messageArgs: { + fileMajor: major, + feMajor: PLEROMAFE_SETTINGS_MAJOR_VERSION + } + } + } + + if (minor > PLEROMAFE_SETTINGS_MINOR_VERSION) { + this.$store.dispatch('pushGlobalNotice', { + level: 'warning', + messageKey: 'settings.file_export_import.errors.file_slightly_new', + }) + } + + return true }, - onImportFailure () { - this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_settings_imported', level: 'error' }) + onImportFailure (result) { + if (result.error) { + this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_settings_imported', level: 'error' }) + } else { + this.$store.dispatch('pushGlobalNotice', { ...result.validationResult, level: 'error' }) + } }, onImport (data) { + if (data) this.$store.dispatch('loadSettings', data) }, restore () { @@ -99,7 +142,10 @@ const SettingsModal = { ) } const clone = cloneDeep(sample) - clone._pleroma_settings_version = [1, 0] + clone._pleroma_settings_version = [ + PLEROMAFE_SETTINGS_MAJOR_VERSION, + PLEROMAFE_SETTINGS_MINOR_VERSION + ] return clone } }, diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue index a142bcd1..c37608e2 100644 --- a/src/components/settings_modal/settings_modal.vue +++ b/src/components/settings_modal/settings_modal.vue @@ -67,7 +67,7 @@ class="btn button-default" :title="$t('general.close')" > - {{ $t("settings.backup_restore") }} + {{ $t("settings.file_export_import.backup_restore") }} @@ -85,7 +85,7 @@ {{ $t("settings.backup_settings") }} + />{{ $t("settings.file_export_import.backup_settings") }}
diff --git a/src/i18n/en.json b/src/i18n/en.json index 049d3d11..1c7fe943 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -357,7 +357,6 @@ "interface": "Interface", "interfaceLanguage": "Interface language", "invalid_theme_imported": "The selected file is not a supported Pleroma theme. No changes to your theme were made.", - "invalid_settings_imported": "The selected file is not a supported Pleroma settings backup. No changes were made.", "limited_availability": "Unavailable in your browser", "links": "Links", "lock_account_description": "Restrict your account to approved followers only", @@ -365,10 +364,18 @@ "loop_video_silent_only": "Loop only videos without sound (i.e. Mastodon's \"gifs\")", "mutes_tab": "Mutes", "play_videos_in_modal": "Play videos in a popup frame", - "backup_restore": "Settings backup", - "backup_settings": "Backup settings to file", - "backup_settings_theme": "Backup settings and theme to file", - "restore_settings": "Restore settings from file", + "file_export_import": { + "backup_restore": "Settings backup", + "backup_settings": "Backup settings to file", + "backup_settings_theme": "Backup settings and theme to file", + "restore_settings": "Restore settings from file", + "errors": { + "invalid_file": "The selected file is not a supported Pleroma settings backup. No changes were made.", + "file_too_new": "Incompatile major version: {fileMajor}, this PleromaFE (settings ver {feMajor}) is too old to handle it", + "file_too_old": "Incompatile major version: {fileMajor}, file version is too old and not supported (min. set. ver. {feMajor})", + "file_slightly_new": "File minor version is different, some settings might not load" + } + }, "profile_fields": { "label": "Profile metadata", "add_field": "Add Field", -- cgit v1.2.3-70-g09d2 From 914b4eb5938f00284afff3c210dcafa94e48f510 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 8 Mar 2021 21:03:55 +0200 Subject: lint --- src/components/settings_modal/settings_modal.js | 5 ++--- src/components/settings_modal/settings_modal.vue | 8 ++++---- src/components/settings_modal/tabs/theme_tab/theme_tab.vue | 10 ++++++++-- 3 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src/components') diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index f88184ca..7010e4aa 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -99,7 +99,7 @@ const SettingsModal = { if (minor > PLEROMAFE_SETTINGS_MINOR_VERSION) { this.$store.dispatch('pushGlobalNotice', { level: 'warning', - messageKey: 'settings.file_export_import.errors.file_slightly_new', + messageKey: 'settings.file_export_import.errors.file_slightly_new' }) } @@ -113,8 +113,7 @@ const SettingsModal = { } }, onImport (data) { - if (data) - this.$store.dispatch('loadSettings', data) + if (data) { this.$store.dispatch('loadSettings', data) } }, restore () { console.log(this.dataImporter) diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue index c37608e2..c7da5433 100644 --- a/src/components/settings_modal/settings_modal.vue +++ b/src/components/settings_modal/settings_modal.vue @@ -31,8 +31,8 @@ - -- cgit v1.2.3-70-g09d2 From 3d95ea6acbd47cabee519b2450647512ac2d5b46 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 8 Mar 2021 21:56:20 +0200 Subject: cleanup + fix --- src/components/settings_modal/settings_modal.js | 1 - src/modules/config.js | 4 ++-- src/services/export_import/export_import.js | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src/components') diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index 7010e4aa..04043483 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -116,7 +116,6 @@ const SettingsModal = { if (data) { this.$store.dispatch('loadSettings', data) } }, restore () { - console.log(this.dataImporter) this.dataImporter.importData() }, backup () { diff --git a/src/modules/config.js b/src/modules/config.js index 352adf20..b0fc98f5 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -111,7 +111,7 @@ const config = { }, actions: { loadSettings ({ dispatch }, data) { - const knownKeys = new Set(Object.keys(this.state.config)) + const knownKeys = new Set(Object.keys(defaultState)) const presentKeys = new Set(Object.keys(data)) const intersection = new Set() for (let elem of presentKeys) { @@ -120,7 +120,7 @@ const config = { } } - Object.keys(intersection).forEach( + intersection.forEach( name => dispatch('setOption', { name, value: data[name] }) ) }, diff --git a/src/services/export_import/export_import.js b/src/services/export_import/export_import.js index 0bf9eadc..ac67cf9c 100644 --- a/src/services/export_import/export_import.js +++ b/src/services/export_import/export_import.js @@ -26,7 +26,6 @@ export const newImporter = ({ const filePicker = document.createElement('input') filePicker.setAttribute('type', 'file') filePicker.setAttribute('accept', '.json') - console.log(1) filePicker.addEventListener('change', event => { if (event.target.files[0]) { @@ -45,7 +44,6 @@ export const newImporter = ({ onImportFailure({ error }) } } - console.log(2) reader.readAsText(event.target.files[0]) } }) -- cgit v1.2.3-70-g09d2 From 5c064ccf553ffcd3286ad1b3305633c5c4c4c0c4 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 11 Mar 2021 15:14:30 +0200 Subject: fix some css problems + tiny bit cleaning up --- src/App.scss | 5 +++- src/components/notifications/notifications.scss | 7 ++++-- src/components/notifications/notifications.vue | 6 ++--- src/components/timeline/timeline.scss | 31 +++++++++++++++++++++++++ src/components/timeline/timeline.vue | 30 +----------------------- 5 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 src/components/timeline/timeline.scss (limited to 'src/components') diff --git a/src/App.scss b/src/App.scss index a3b2a08e..da0cfca7 100644 --- a/src/App.scss +++ b/src/App.scss @@ -547,7 +547,10 @@ main-router { border-radius: var(--panelRadius, $fallback--panelRadius); } -.panel-footer { +/* TODO Should remove timeline-footer from here when we refactor panels into + * separate component and utilize slots + */ +.panel-footer, .timeline-footer { display: flex; border-radius: 0 0 $fallback--panelRadius $fallback--panelRadius; border-radius: 0 0 var(--panelRadius, $fallback--panelRadius) var(--panelRadius, $fallback--panelRadius); diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss index 682ae127..2bb627a8 100644 --- a/src/components/notifications/notifications.scss +++ b/src/components/notifications/notifications.scss @@ -1,6 +1,6 @@ @import '../../_variables.scss'; -.notifications { +.Notifications { &:not(.minimal) { // a bit of a hack to allow scrolling below notifications padding-bottom: 15em; @@ -11,6 +11,10 @@ color: var(--text, $fallback--text); } + .notifications-footer { + border: none; + } + .notification { position: relative; @@ -82,7 +86,6 @@ } } - .follow-text, .move-text { padding: 0.5em 0; overflow-wrap: break-word; diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index eb951f18..dc663ce2 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -1,7 +1,7 @@ -- cgit v1.2.3-70-g09d2