From 176da2bbe53e540239c9781776968d8ce59127ed Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Sun, 12 Sep 2021 13:50:16 -0400 Subject: Add frontend ui for aliases and migration Ref: migrate-ui --- .../tabs/security_tab/security_tab.js | 51 +++++++++++- .../tabs/security_tab/security_tab.vue | 96 ++++++++++++++++++++++ 2 files changed, 146 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.js b/src/components/settings_modal/tabs/security_tab/security_tab.js index 65d20fc0..3f326f74 100644 --- a/src/components/settings_modal/tabs/security_tab/security_tab.js +++ b/src/components/settings_modal/tabs/security_tab/security_tab.js @@ -15,11 +15,20 @@ const SecurityTab = { deleteAccountError: false, changePasswordInputs: [ '', '', '' ], changedPassword: false, - changePasswordError: false + changePasswordError: false, + moveAccountTarget: '', + moveAccountPassword: '', + movedAccount: false, + moveAccountError: false, + aliases: [], + addAliasTarget: '', + addedAlias: false, + addAliasError: false } }, created () { this.$store.dispatch('fetchTokens') + this.fetchAliases() }, components: { ProgressButton, @@ -92,6 +101,46 @@ const SecurityTab = { } }) }, + moveAccount () { + const params = { + targetAccount: this.moveAccountTarget, + password: this.moveAccountPassword + } + this.$store.state.api.backendInteractor.moveAccount(params) + .then((res) => { + if (res.status === 'success') { + this.movedAccount = true + this.moveAccountError = false + } else { + this.movedAccount = false + this.moveAccountError = res.error + } + }) + }, + removeAlias (alias) { + this.$store.state.api.backendInteractor.deleteAlias({ alias }) + .then(() => this.fetchAliases()) + }, + addAlias () { + this.$store.state.api.backendInteractor.addAlias({ alias: this.addAliasTarget }) + .then((res) => { + this.addedAlias = true + this.addAliasError = false + this.addAliasTarget = '' + }) + .catch((error) => { + this.addedAlias = false + this.addAliasError = error + }) + .then(() => this.fetchAliases()) + }, + fetchAliases () { + this.$store.state.api.backendInteractor.listAliases() + .catch(() => {}) + .then((res) => { + this.aliases = res.aliases + }) + }, logout () { this.$store.dispatch('logout') this.$router.replace('/') diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.vue b/src/components/settings_modal/tabs/security_tab/security_tab.vue index 275d4616..c6c4fa1a 100644 --- a/src/components/settings_modal/tabs/security_tab/security_tab.vue +++ b/src/components/settings_modal/tabs/security_tab/security_tab.vue @@ -103,6 +103,102 @@ + +
+

{{ $t('settings.account_alias') }}

+ + + + + + + + + + + + +
{{ $t('settings.account_alias_table_head') }} +
{{ alias }} + +
+
+ + + foo@example.org + + + +
+ +

+ {{ $t('settings.added_alias') }} +

+ +
+ +
+

{{ $t('settings.move_account') }}

+

{{ $t('settings.move_account_notes') }}

+
+ + + foo@example.org + + + +
+
+

{{ $t('settings.current_password') }}

+ +
+ +

+ {{ $t('settings.moved_account') }} +

+ +
+

{{ $t('settings.delete_account') }}

-- cgit v1.2.3-70-g09d2 From cd9c026042f045037ff9c4f71bda2eb5dde8f3df Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 24 Mar 2022 16:55:39 -0400 Subject: Log errors when listing aliases --- .../settings_modal/tabs/security_tab/security_tab.js | 6 +++++- .../settings_modal/tabs/security_tab/security_tab.vue | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.js b/src/components/settings_modal/tabs/security_tab/security_tab.js index 3f326f74..fc732936 100644 --- a/src/components/settings_modal/tabs/security_tab/security_tab.js +++ b/src/components/settings_modal/tabs/security_tab/security_tab.js @@ -21,6 +21,7 @@ const SecurityTab = { movedAccount: false, moveAccountError: false, aliases: [], + listAliasesError: false, addAliasTarget: '', addedAlias: false, addAliasError: false @@ -136,9 +137,12 @@ const SecurityTab = { }, fetchAliases () { this.$store.state.api.backendInteractor.listAliases() - .catch(() => {}) .then((res) => { this.aliases = res.aliases + this.listAliasesError = false + }) + .catch((error) => { + this.listAliasesError = error.error }) }, logout () { diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.vue b/src/components/settings_modal/tabs/security_tab/security_tab.vue index c6c4fa1a..c74a0c67 100644 --- a/src/components/settings_modal/tabs/security_tab/security_tab.vue +++ b/src/components/settings_modal/tabs/security_tab/security_tab.vue @@ -130,6 +130,18 @@ +

+ {{ $t('settings.list_aliases_error', { error }) }} + +
Date: Mon, 9 May 2022 00:38:25 -0400 Subject: Add backup UI --- .../settings_modal/tabs/data_import_export_tab.js | 29 +++++++++- .../settings_modal/tabs/data_import_export_tab.vue | 61 ++++++++++++++++++++++ src/services/api/api.service.js | 22 ++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/settings_modal/tabs/data_import_export_tab.js b/src/components/settings_modal/tabs/data_import_export_tab.js index f4b736d2..4895733c 100644 --- a/src/components/settings_modal/tabs/data_import_export_tab.js +++ b/src/components/settings_modal/tabs/data_import_export_tab.js @@ -7,11 +7,16 @@ const DataImportExportTab = { data () { return { activeTab: 'profile', - newDomainToMute: '' + newDomainToMute: '', + listBackupsError: false, + addBackupError: false, + addedBackup: false, + backups: [] } }, created () { this.$store.dispatch('fetchTokens') + this.fetchBackups() }, components: { Importer, @@ -72,6 +77,28 @@ const DataImportExportTab = { } return user.screen_name }).join('\n') + }, + addBackup () { + this.$store.state.api.backendInteractor.addBackup() + .then((res) => { + this.addedBackup = true + this.addBackupError = false + }) + .catch((error) => { + this.addedBackup = false + this.addBackupError = error + }) + .then(() => this.fetchBackups()) + }, + fetchBackups () { + this.$store.state.api.backendInteractor.listBackups() + .then((res) => { + this.backups = res + this.listBackupsError = false + }) + .catch((error) => { + this.listBackupsError = error.error + }) } } } diff --git a/src/components/settings_modal/tabs/data_import_export_tab.vue b/src/components/settings_modal/tabs/data_import_export_tab.vue index a406077d..06548390 100644 --- a/src/components/settings_modal/tabs/data_import_export_tab.vue +++ b/src/components/settings_modal/tabs/data_import_export_tab.vue @@ -53,6 +53,67 @@ :export-button-label="$t('settings.mute_export_button')" />
+
+

{{ $t('settings.account_backup') }}

+

{{ $t('settings.account_backup_description') }}

+ + + + + + + + + + + + + +
{{ $t('settings.account_backup_table_head') }}
{{ backup.inserted_at }} + + {{ $t('settings.download_backup') }} + + + {{ $t('settings.backup_not_ready') }} + +
+
+ {{ $t('settings.list_backups_error', { error }) }} + +
+ +

+ {{ $t('settings.added_backup') }} +

+ +
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 436b8b0a..d2df353a 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -87,6 +87,7 @@ const PLEROMA_CHAT_URL = id => `/api/v1/pleroma/chats/by-account-id/${id}` const PLEROMA_CHAT_MESSAGES_URL = id => `/api/v1/pleroma/chats/${id}/messages` const PLEROMA_CHAT_READ_URL = id => `/api/v1/pleroma/chats/${id}/read` const PLEROMA_DELETE_CHAT_MESSAGE_URL = (chatId, messageId) => `/api/v1/pleroma/chats/${chatId}/messages/${messageId}` +const PLEROMA_BACKUP_URL = '/api/v1/pleroma/backups' const oldfetch = window.fetch @@ -868,6 +869,25 @@ const fetchBlocks = ({ credentials }) => { .then((users) => users.map(parseUser)) } +const addBackup = ({ credentials }) => { + return promisedRequest({ + url: PLEROMA_BACKUP_URL, + method: 'POST', + credentials + }) +} + +const listBackups = ({ credentials }) => { + return promisedRequest({ + url: PLEROMA_BACKUP_URL, + method: 'GET', + credentials, + params: { + _cacheBooster: (new Date()).getTime() + } + }) +} + const fetchOAuthTokens = ({ credentials }) => { const url = '/api/oauth_tokens.json' @@ -1325,6 +1345,8 @@ const apiService = { generateMfaBackupCodes, mfaSetupOTP, mfaConfirmOTP, + addBackup, + listBackups, fetchFollowRequests, approveUser, denyUser, -- cgit v1.2.3-70-g09d2 From 653a762c21270bc74fd4da8bf49ec1c7d8f69df2 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Mon, 9 May 2022 00:40:39 -0400 Subject: Make lint happy --- src/components/settings_modal/tabs/data_import_export_tab.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/settings_modal/tabs/data_import_export_tab.vue b/src/components/settings_modal/tabs/data_import_export_tab.vue index 06548390..e3b7f407 100644 --- a/src/components/settings_modal/tabs/data_import_export_tab.vue +++ b/src/components/settings_modal/tabs/data_import_export_tab.vue @@ -60,7 +60,7 @@ {{ $t('settings.account_backup_table_head') }} - + -- cgit v1.2.3-70-g09d2 From 9b5fe24ca455af5420a326e78878ca7b35b5bf66 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 7 Jun 2022 16:52:03 +0300 Subject: restore notifications page, fix z-index issues --- src/App.vue | 2 +- src/boot/routes.js | 2 +- src/components/notifications/notifications.js | 4 +++- src/components/notifications/notifications.vue | 2 +- src/components/timeline/timeline.scss | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/components') diff --git a/src/App.vue b/src/App.vue index 5b448972..21f6f686 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,7 +9,7 @@ /> - +
{ { name: 'password-reset', path: '/password-reset', component: PasswordReset, props: true }, { name: 'registration-token', path: '/registration/:token', component: Registration }, { name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute }, - { name: 'notifications', path: '/:username/notifications', component: Notifications, beforeEnter: validateAuthenticatedRoute }, + { name: 'notifications', path: '/:username/notifications', component: Notifications, props: () => ({ disableTeleport: true }), beforeEnter: validateAuthenticatedRoute }, { name: 'login', path: '/login', component: AuthForm }, { name: 'shout-panel', path: '/shout-panel', component: ShoutPanel, props: () => ({ floating: false }) }, { name: 'oauth-callback', path: '/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) }, diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index fb2579a5..82aa1489 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -27,7 +27,9 @@ const Notifications = { // meant for "Interactions" timeline minimalMode: Boolean, // Custom filter mode, an array of strings, possible values 'mention', 'repeat', 'like', 'follow', used to override global filter for use in "Interactions" timeline - filterMode: Array + filterMode: Array, + // Disable teleporting (i.e. for /users/user/notifications) + disableTeleport: Boolean }, data () { return { diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 794ef51d..b46c06aa 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -1,5 +1,5 @@ diff --git a/src/services/date_utils/date_utils.js b/src/services/date_utils/date_utils.js index 32e13bca..677c184c 100644 --- a/src/services/date_utils/date_utils.js +++ b/src/services/date_utils/date_utils.js @@ -10,31 +10,29 @@ export const relativeTime = (date, nowThreshold = 1) => { if (typeof date === 'string') date = Date.parse(date) const round = Date.now() > date ? Math.floor : Math.ceil const d = Math.abs(Date.now() - date) - let r = { num: round(d / YEAR), key: 'time.years' } + let r = { num: round(d / YEAR), key: 'time.unit.years' } if (d < nowThreshold * SECOND) { r.num = 0 r.key = 'time.now' } else if (d < MINUTE) { r.num = round(d / SECOND) - r.key = 'time.seconds' + r.key = 'time.unit.seconds' } else if (d < HOUR) { r.num = round(d / MINUTE) - r.key = 'time.minutes' + r.key = 'time.unit.minutes' } else if (d < DAY) { r.num = round(d / HOUR) - r.key = 'time.hours' + r.key = 'time.unit.hours' } else if (d < WEEK) { r.num = round(d / DAY) - r.key = 'time.days' + r.key = 'time.unit.days' } else if (d < MONTH) { r.num = round(d / WEEK) - r.key = 'time.weeks' + r.key = 'time.unit.weeks' } else if (d < YEAR) { r.num = round(d / MONTH) - r.key = 'time.months' + r.key = 'time.unit.months' } - // Remove plural form when singular - if (r.num === 1) r.key = r.key.slice(0, -1) return r } -- cgit v1.2.3-70-g09d2 From 31571361d378db5a42a2c955060637782d546fb3 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Sat, 11 Jun 2022 18:17:28 -0400 Subject: Fix top bar input text colour --- src/components/desktop_nav/desktop_nav.scss | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/components') diff --git a/src/components/desktop_nav/desktop_nav.scss b/src/components/desktop_nav/desktop_nav.scss index 0ca9802e..eddd9707 100644 --- a/src/components/desktop_nav/desktop_nav.scss +++ b/src/components/desktop_nav/desktop_nav.scss @@ -3,6 +3,10 @@ .DesktopNav { width: 100%; + input { + color: var(--inputTopbarText, var(--inputText)); + } + a { color: var(--topBarLink, $fallback--link); } -- cgit v1.2.3-70-g09d2 From 9c8738ff22a0563b16b19e57e8042c65c4a0b7e2 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Sun, 12 Jun 2022 13:38:12 +0200 Subject: EmojiPicker: Workaround to search immediately on mobile See https://github.com/vuejs/vue/pull/9814 --- src/components/emoji_picker/emoji_picker.js | 5 +++-- src/components/emoji_picker/emoji_picker.vue | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 6b589079..bd5c2e39 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -6,6 +6,7 @@ import { faStickyNote, faSmileBeam } from '@fortawesome/free-solid-svg-icons' +import { trim } from 'lodash' library.add( faBoxOpen, @@ -176,7 +177,7 @@ const EmojiPicker = { filteredEmoji () { return filterByKeyword( this.$store.state.instance.customEmoji || [], - this.keyword + trim(this.keyword) ) }, customEmojiBuffer () { @@ -197,7 +198,7 @@ const EmojiPicker = { id: 'standard', text: this.$t('emoji.unicode'), icon: 'box-open', - emojis: filterByKeyword(standardEmojis, this.keyword) + emojis: filterByKeyword(standardEmojis, trim(this.keyword)) } ] }, diff --git a/src/components/emoji_picker/emoji_picker.vue b/src/components/emoji_picker/emoji_picker.vue index 3262a3d9..a7269120 100644 --- a/src/components/emoji_picker/emoji_picker.vue +++ b/src/components/emoji_picker/emoji_picker.vue @@ -47,6 +47,7 @@ type="text" class="form-control" :placeholder="$t('emoji.search_emoji')" + @input="$event.target.composing = false" >
Date: Sun, 12 Jun 2022 13:48:21 +0200 Subject: ReactButton: Workaround for android composition mode --- src/components/react_button/react_button.js | 3 ++- src/components/react_button/react_button.vue | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index ce82c90d..e6f9dbff 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -1,6 +1,7 @@ import Popover from '../popover/popover.vue' import { library } from '@fortawesome/fontawesome-svg-core' import { faSmileBeam } from '@fortawesome/free-regular-svg-icons' +import { trim } from 'lodash' library.add(faSmileBeam) @@ -43,7 +44,7 @@ const ReactButton = { }, emojis () { if (this.filterWord !== '') { - const filterWordLowercase = this.filterWord.toLowerCase() + const filterWordLowercase = trim(this.filterWord.toLowerCase()) let orderedEmojiList = [] for (const emoji of this.$store.state.instance.emoji) { if (emoji.replacement === this.filterWord) return [emoji] diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue index 7f35b7b5..8a4b4d3b 100644 --- a/src/components/react_button/react_button.vue +++ b/src/components/react_button/react_button.vue @@ -12,6 +12,7 @@
-- cgit v1.2.3-70-g09d2