From 736c1ffb8ea380b141d963811ad2f5fd13d976e3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 15:25:37 +0300 Subject: [PATCH 01/13] small changes --- src/api/public.js | 4 ++-- .../timeline_fetcher/timeline_fetcher.service.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/public.js b/src/api/public.js index 5cfd529cd..e5f2cc340 100644 --- a/src/api/public.js +++ b/src/api/public.js @@ -274,10 +274,10 @@ export const fetchStatusHistory = ({ status, credentials }) => promisedRequest({ url: MASTODON_STATUS_HISTORY_URL(status.id), credentials, - }).then(({ data }) => { + }).then(({ data, ...rest }) => { return [...data].reverse().map((item) => { item.originalStatus = status - return parseStatus(item) + return { ...rest, data: parseStatus(item) } }) }) diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index efa06258d..d65897966 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -36,11 +36,11 @@ const fetchAndUpdate = ({ timeline = 'friends', older = false, showImmediately = false, - userId = false, - listId = false, - statusId = false, - bookmarkFolderId = false, - tag = false, + userId, + listId, + statusId, + bookmarkFolderId, + tag, maxId, sinceId, }) => { From 7fc0765dc9c084df68a84630637c690a5419f045 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 15:31:46 +0300 Subject: [PATCH 02/13] fix empty timeline bug --- src/services/timeline_fetcher/timeline_fetcher.service.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index d65897966..da2f59a09 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -52,7 +52,8 @@ const fetchAndUpdate = ({ const loggedIn = !!rootState.users.currentUser if (older) { - args.maxId = maxId || timelineData.minId + // When minId = 0 we need to fetch without maxId param + args.maxId = maxId || timelineData.minId || null } else { if (sinceId === undefined) { args.sinceId = timelineData.maxId From d449701b84394f7aa3c4857c801fff3aaa1ef045 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 15:48:30 +0300 Subject: [PATCH 03/13] post status form error handling --- src/components/post_status_form/post_status_form.js | 5 ----- src/services/errors/errors.js | 5 +++-- src/services/status_poster/status_poster.service.js | 5 ----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 7eb129430..c564355f3 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -635,11 +635,6 @@ const PostStatusForm = { // Don't apply preview if not loading, because it means // user has closed the preview manually. if (!this.previewLoading) return - if (!data.error) { - this.preview = data - } else { - this.preview = { error: data.error } - } }) .catch((error) => { this.preview = { error } diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js index 41829eb19..12d32c12b 100644 --- a/src/services/errors/errors.js +++ b/src/services/errors/errors.js @@ -13,8 +13,9 @@ function humanizeErrors(errors) { export function StatusCodeError(statusCode, body, options, response) { this.name = 'StatusCodeError' this.statusCode = statusCode - this.message = - statusCode + ' - ' + (JSON && JSON.stringify ? JSON.stringify(body) : body) + this.details = JSON && JSON.stringify ? JSON.stringify(body) : body + this.errorData = body.error + this.message = statusCode + ' - ' + body.error.error || body.error this.error = body // legacy attribute this.options = options this.response = response diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index 7fa67e338..2d6ec9313 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -49,11 +49,6 @@ const postStatus = ({ return data }) - .catch((err) => { - return { - error: err.message, - } - }) } const editStatus = ({ From bf86f03a0aa5dcc5a3251d7a9618118fd11ce5a4 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 16:13:30 +0300 Subject: [PATCH 04/13] fix revoking tokens --- src/api/helpers.js | 2 ++ src/stores/oauth_tokens.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/helpers.js b/src/api/helpers.js index 687ed9628..8d5d1f5e9 100644 --- a/src/api/helpers.js +++ b/src/api/helpers.js @@ -106,6 +106,8 @@ export const promisedRequest = async ({ .get('content-type') .split(';') .map((x) => x.toLowerCase().trim()) + const contentLength = parseInt(response.headers.get('content-length')) + if (contentLength === 0) return null switch (contentType) { case 'text/plain': diff --git a/src/stores/oauth_tokens.js b/src/stores/oauth_tokens.js index bb9bbccbf..afbbb5f46 100644 --- a/src/stores/oauth_tokens.js +++ b/src/stores/oauth_tokens.js @@ -12,7 +12,7 @@ export const useOAuthTokensStore = defineStore('oauthTokens', { fetchTokens() { fetchOAuthTokens({ credentials: useOAuthStore().token, - }).then((tokens) => { + }).then(({ data: tokens }) => { this.swapTokens(tokens) }) }, From 1313e55d988d3cb354800e917c5d9d502567bfab Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 16:19:53 +0300 Subject: [PATCH 05/13] fix voting --- src/stores/polls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/polls.js b/src/stores/polls.js index f2eafacfb..1a1e8e332 100644 --- a/src/stores/polls.js +++ b/src/stores/polls.js @@ -60,7 +60,7 @@ export const usePollsStore = defineStore('polls', { pollId, choices, credentials: useOAuthStore().token, - }).then((poll) => { + }).then(({ data: poll }) => { this.mergeOrAddPoll(poll) return poll }) From 6c4f6dcd05210ba72a655af8183d41bb26843822 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 16:39:08 +0300 Subject: [PATCH 06/13] mfa fixes --- src/components/login_form/login_form.js | 2 +- .../settings_modal/tabs/security_tab/mfa.js | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index d1164c562..a00db03cf 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -63,7 +63,7 @@ const LoginForm = { }) }) .catch((error) => { - if (error === 'mfa_required') { + if (error.errorData?.error === 'mfa_required') { this.requireMFA({ settings: error }) } else if (error.identifier === 'password_reset_required') { this.$router.push({ diff --git a/src/components/settings_modal/tabs/security_tab/mfa.js b/src/components/settings_modal/tabs/security_tab/mfa.js index 12c464719..b5c68120b 100644 --- a/src/components/settings_modal/tabs/security_tab/mfa.js +++ b/src/components/settings_modal/tabs/security_tab/mfa.js @@ -95,7 +95,7 @@ const Mfa = { return generateMfaBackupCodes({ credentials: useOAuthStore().token, - }).then((res) => { + }).then(({ data: res }) => { this.backupCodes.codes = res.codes this.backupCodes.inProgress = false }) @@ -122,7 +122,7 @@ const Mfa = { this.setupState.setupOTPState = 'prepare' mfaSetupOTP({ credentials: useOAuthStore().token, - }).then((res) => { + }).then(({ data: res }) => { this.otpSettings = res this.setupState.setupOTPState = 'confirm' }) @@ -135,11 +135,9 @@ const Mfa = { password: this.currentPassword, credentials: useOAuthStore().token, }).then((res) => { - if (res.error) { - this.error = res.error - return - } this.completeSetup() + }).catch((error) => { + this.error = error }) }, @@ -161,7 +159,7 @@ const Mfa = { // fetch settings from server async fetchSettings() { - const result = await settingsMFA({ + const { data: result } = await settingsMFA({ credentials: useOAuthStore().token, }) if (result.error) return From a39d3b1b56c821791208c85289c2162bf3336dc2 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 19:44:44 +0300 Subject: [PATCH 07/13] missing { data } extraction --- .../bookmark_folder_edit/bookmark_folder_edit.js | 2 +- src/components/chat/chat.js | 7 ++++--- .../remote_user_resolver/remote_user_resolver.js | 2 +- src/components/settings_modal/tabs/appearance_tab.js | 2 +- src/components/settings_modal/tabs/composing_tab.js | 2 +- .../settings_modal/tabs/data_import_export_tab.js | 10 +++++----- src/components/settings_modal/tabs/general_tab.js | 2 +- .../settings_modal/tabs/mutes_and_blocks_tab.js | 4 ++-- src/components/settings_modal/tabs/profile_tab.js | 2 +- .../settings_modal/tabs/security_tab/mfa_totp.js | 2 +- .../settings_modal/tabs/security_tab/security_tab.js | 10 +++++----- src/components/user_card/user_card.js | 2 +- src/components/who_to_follow/who_to_follow.js | 4 ++-- .../who_to_follow_panel/who_to_follow_panel.js | 4 ++-- src/modules/profileConfig.js | 4 ++-- .../follow_request_fetcher.service.js | 2 +- src/stores/admin_settings.js | 2 +- src/stores/emoji.js | 10 +--------- src/stores/instance.js | 3 ++- src/stores/lists.js | 8 +++++--- src/stores/oauth_tokens.js | 4 ++-- src/stores/polls.js | 2 +- src/stores/user_highlight.js | 2 +- 23 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/components/bookmark_folder_edit/bookmark_folder_edit.js b/src/components/bookmark_folder_edit/bookmark_folder_edit.js index 748070495..ae5aebedd 100644 --- a/src/components/bookmark_folder_edit/bookmark_folder_edit.js +++ b/src/components/bookmark_folder_edit/bookmark_folder_edit.js @@ -27,7 +27,7 @@ const BookmarkFolderEdit = { fetchBookmarkFolders({ credentials: useOAuthStore().token, - }).then((folders) => { + }).then(({ data: folders }) => { const folder = folders.find((folder) => folder.id === this.id) if (!folder) return diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js index b03bc0256..68306acbe 100644 --- a/src/components/chat/chat.js +++ b/src/components/chat/chat.js @@ -278,7 +278,7 @@ const Chat = { maxId, sinceId, credentials: useOAuthStore().token, - }).then((messages) => { + }).then(({ data: messages }) => { // Clear the current chat in case we're recovering from a ws connection loss. if (isFirstFetch) { chatService.clear(chatMessageService) @@ -310,10 +310,11 @@ const Chat = { let chat = this.findOpenedChatByRecipientId(this.recipientId) if (!chat) { try { - chat = await getOrCreateChat({ + const { data } = await getOrCreateChat({ accountId: this.recipientId, credentials: useOAuthStore().token, }) + chat = data } catch (e) { console.error('Error creating or getting a chat', e) this.errorLoadingChat = true @@ -383,7 +384,7 @@ const Chat = { params, credentials: useOAuthStore().token, }) - .then((data) => { + .then(({ data }) => { this.$store.dispatch('addChatMessages', { chatId: this.currentChat.id, updateMaxId: false, diff --git a/src/components/remote_user_resolver/remote_user_resolver.js b/src/components/remote_user_resolver/remote_user_resolver.js index b44629fcf..75304fe52 100644 --- a/src/components/remote_user_resolver/remote_user_resolver.js +++ b/src/components/remote_user_resolver/remote_user_resolver.js @@ -16,7 +16,7 @@ const RemoteUserResolver = { id, credentials: useOAuthStore().token, }) - .then((externalUser) => { + .then(({ data: externalUser }) => { if (externalUser.error) { this.error = true } else { diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js index 5dbd79de4..c11579e53 100644 --- a/src/components/settings_modal/tabs/appearance_tab.js +++ b/src/components/settings_modal/tabs/appearance_tab.js @@ -490,7 +490,7 @@ const AppearanceTab = { background, credentials: useOAuthStore().token, }) - .then((data) => { + .then(({ data }) => { this.$store.commit('addNewUsers', [data]) this.$store.commit('setCurrentUser', data) this.backgroundPreview = null diff --git a/src/components/settings_modal/tabs/composing_tab.js b/src/components/settings_modal/tabs/composing_tab.js index 3a2384832..1586c87bf 100644 --- a/src/components/settings_modal/tabs/composing_tab.js +++ b/src/components/settings_modal/tabs/composing_tab.js @@ -169,7 +169,7 @@ const ComposingTab = { updateProfile({ params, credentials: useOAuthStore().token, - }).then((user) => { + }).then(({ data: user }) => { this.$store.commit('addNewUsers', [user]) this.$store.commit('setCurrentUser', user) }) 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 a89657658..4554f4a1f 100644 --- a/src/components/settings_modal/tabs/data_import_export_tab.js +++ b/src/components/settings_modal/tabs/data_import_export_tab.js @@ -64,7 +64,7 @@ const DataImportExportTab = { return importFollows({ file, credentials: useOAuthStore().token, - }).then((status) => { + }).then(({ data: status }) => { if (!status) { throw new Error('failed') } @@ -74,7 +74,7 @@ const DataImportExportTab = { return importBlocks({ file, credentials: useOAuthStore().token, - }).then((status) => { + }).then(({ data: status }) => { if (!status) { throw new Error('failed') } @@ -84,13 +84,13 @@ const DataImportExportTab = { return importMutes({ file, credentials: useOAuthStore().token, - }).then((status) => { + }).then(({ data: status }) => { if (!status) { throw new Error('failed') } }) }, - generateExportableUsersContent(users) { + generateExportableUsersContent({ data: users }) { // Get addresses return users .map((user) => { @@ -121,7 +121,7 @@ const DataImportExportTab = { listBackups({ credentials: useOAuthStore().token, }) - .then((res) => { + .then(({ data: res }) => { this.backups = res this.listBackupsError = false }) diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index e40bb993e..bed6f6500 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -63,7 +63,7 @@ const GeneralTab = { updateProfile({ params, credentials: useOAuthStore().token, - }).then((user) => { + }).then(({ data: user }) => { this.$store.commit('addNewUsers', [user]) this.$store.commit('setCurrentUser', user) }) diff --git a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js index cb945012f..781412249 100644 --- a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js +++ b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js @@ -60,7 +60,7 @@ const MutesAndBlocks = { return importFollows({ file, credentials: useOAuthStore().token, - }).then((status) => { + }).then(({ data: status }) => { if (!status) { throw new Error('failed') } @@ -70,7 +70,7 @@ const MutesAndBlocks = { return importBlocks({ file, credentials: useOAuthStore().token, - }).then((status) => { + }).then(({ data: status }) => { if (!status) { throw new Error('failed') } diff --git a/src/components/settings_modal/tabs/profile_tab.js b/src/components/settings_modal/tabs/profile_tab.js index d30a82bf9..844e223c9 100644 --- a/src/components/settings_modal/tabs/profile_tab.js +++ b/src/components/settings_modal/tabs/profile_tab.js @@ -43,7 +43,7 @@ const ProfileTab = { params, credentials: useOAuthStore().token, }) - .then((user) => { + .then(({ data: user }) => { this.$store.commit('addNewUsers', [user]) this.$store.commit('setCurrentUser', user) }) diff --git a/src/components/settings_modal/tabs/security_tab/mfa_totp.js b/src/components/settings_modal/tabs/security_tab/mfa_totp.js index a22e88070..bbe06c217 100644 --- a/src/components/settings_modal/tabs/security_tab/mfa_totp.js +++ b/src/components/settings_modal/tabs/security_tab/mfa_totp.js @@ -40,7 +40,7 @@ export default { mfaDisableOTP({ password: this.currentPassword, credentials: useOAuthStore().token, - }).then((res) => { + }).then(({ data: res }) => { this.inProgress = false if (res.error) { this.error = res.error 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 30a8b580e..45876f848 100644 --- a/src/components/settings_modal/tabs/security_tab/security_tab.js +++ b/src/components/settings_modal/tabs/security_tab/security_tab.js @@ -78,7 +78,7 @@ const SecurityTab = { deleteAccount({ credentials: useOAuthStore().token, password: this.deleteAccountConfirmPasswordInput, - }).then((res) => { + }).then(({ data: res }) => { if (res.status === 'success') { this.$store.dispatch('logout') this.$router.push({ name: 'root' }) @@ -94,7 +94,7 @@ const SecurityTab = { newPasswordConfirmation: this.changePasswordInputs[2], credentials: useOAuthStore().token, } - changePassword(params).then((res) => { + changePassword(params).then(({ data: res }) => { if (res.status === 'success') { this.changedPassword = true this.changePasswordError = false @@ -111,7 +111,7 @@ const SecurityTab = { password: this.changeEmailPassword, credentials: useOAuthStore().token, } - changeEmail(params).then((res) => { + changeEmail(params).then(({ data: res }) => { if (res.status === 'success') { this.changedEmail = true this.changeEmailError = false @@ -127,7 +127,7 @@ const SecurityTab = { password: this.moveAccountPassword, credentials: useOAuthStore().token, } - moveAccount(params).then((res) => { + moveAccount(params).then(({ data: res }) => { if (res.status === 'success') { this.movedAccount = true this.moveAccountError = false @@ -163,7 +163,7 @@ const SecurityTab = { listAliases({ credentials: useOAuthStore().token, }) - .then((res) => { + .then(({ data: res }) => { this.aliases = res.aliases this.listAliasesError = false }) diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 2f10c5ebc..70fb057af 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -600,7 +600,7 @@ export default { } updateProfile({ params }) - .then((user) => { + .then(({ data: user }) => { this.newFields.splice(this.newFields.length) merge(this.newFields, user.fields) this.$store.commit('addNewUsers', [user]) diff --git a/src/components/who_to_follow/who_to_follow.js b/src/components/who_to_follow/who_to_follow.js index 3c0b53b0d..6f00b3e5e 100644 --- a/src/components/who_to_follow/who_to_follow.js +++ b/src/components/who_to_follow/who_to_follow.js @@ -23,7 +23,7 @@ const WhoToFollow = { fetchUser({ id, credentials: useOAuthStore().token, - }).then((externalUser) => { + }).then(({ data: externalUser }) => { if (!externalUser.error) { this.$store.commit('addNewUsers', [externalUser]) this.users.push(externalUser) @@ -34,7 +34,7 @@ const WhoToFollow = { getWhoToFollow() { const credentials = useOAuthStore().token if (credentials) { - suggestions({ credentials }).then((reply) => { + suggestions({ credentials }).then(({ data: reply }) => { this.showWhoToFollow(reply) }) } diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js index 32f9dc918..7a65ba39d 100644 --- a/src/components/who_to_follow_panel/who_to_follow_panel.js +++ b/src/components/who_to_follow_panel/who_to_follow_panel.js @@ -21,7 +21,7 @@ function showWhoToFollow(panel, reply) { fetchUser({ id: name, credentials: useOAuthStore().token, - }).then((externalUser) => { + }).then(({ data: externalUser }) => { if (!externalUser.error) { panel.$store.commit('addNewUsers', [externalUser]) toFollow.id = externalUser.id @@ -36,7 +36,7 @@ function getWhoToFollow(panel) { panel.usersToFollow.forEach((toFollow) => { toFollow.name = 'Loading...' }) - suggestions({ credentials }).then((reply) => { + suggestions({ credentials }).then(({ data: reply }) => { showWhoToFollow(panel, reply) }) } diff --git a/src/modules/profileConfig.js b/src/modules/profileConfig.js index 80f881a25..3fca7d6a8 100644 --- a/src/modules/profileConfig.js +++ b/src/modules/profileConfig.js @@ -10,7 +10,7 @@ const defaultApi = ({ rootState, commit }, { path, value }) => { return updateProfile({ params, credentials: useOAuthStore().token, - }).then((result) => { + }).then(({ data: result }) => { commit('addNewUsers', [result]) commit('setCurrentUser', result) }) @@ -22,7 +22,7 @@ const notificationsApi = ({ rootState, commit }, { path, value, oldValue }) => { return updateNotificationSettings({ settings, credentials: useOAuthStore().token, - }).then((result) => { + }).then(({ data: result }) => { if (result.status === 'success') { commit('confirmProfileOption', { name, value }) } else { diff --git a/src/services/follow_request_fetcher/follow_request_fetcher.service.js b/src/services/follow_request_fetcher/follow_request_fetcher.service.js index ecb6cb7dd..e49206fcd 100644 --- a/src/services/follow_request_fetcher/follow_request_fetcher.service.js +++ b/src/services/follow_request_fetcher/follow_request_fetcher.service.js @@ -4,7 +4,7 @@ import { promiseInterval } from 'src/services/promise_interval/promise_interval. const fetchAndUpdate = ({ store, credentials }) => { return fetchFollowRequests({ credentials }) .then( - (requests) => { + ({ data: requests }) => { store.commit('setFollowRequests', requests) store.commit('addNewUsers', requests) }, diff --git a/src/stores/admin_settings.js b/src/stores/admin_settings.js index 9c9e69d8b..06bcab9ae 100644 --- a/src/stores/admin_settings.js +++ b/src/stores/admin_settings.js @@ -601,7 +601,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', { }).then(({ data }) => data) }, deleteEmojiPack({ name }) { - return createEmojiPack({ + return deleteEmojiPack({ name, credentials: useOAuthStore().token, }).then(({ data }) => data) diff --git a/src/stores/emoji.js b/src/stores/emoji.js index 6ea8d1032..3316f8328 100644 --- a/src/stores/emoji.js +++ b/src/stores/emoji.js @@ -192,7 +192,7 @@ export const useEmojiStore = defineStore('emoji', { listEmojiPacks({ ...params, credentials: useOAuthStore().token, - }), + }).then(({ data }) => data), ) this.adminPacksLocalLoading = false }, @@ -210,10 +210,6 @@ export const useEmojiStore = defineStore('emoji', { pageSize: 0, }) .then((data) => { - if (data.error !== undefined) { - return Promise.reject(data.error) - } - const promises = [] for (let i = 0; i < Math.ceil(data.count / pageSize); i++) { @@ -223,10 +219,6 @@ export const useEmojiStore = defineStore('emoji', { page: i, pageSize, }).then((pageData) => { - if (pageData.error !== undefined) { - return Promise.reject(pageData.error) - } - return pageData.packs }), ) diff --git a/src/stores/instance.js b/src/stores/instance.js index 08bcde1ae..ea3419e80 100644 --- a/src/stores/instance.js +++ b/src/stores/instance.js @@ -211,9 +211,10 @@ export const useInstanceStore = defineStore('instance', { }, async getKnownDomains() { try { - this.knownDomains = await fetchKnownDomains({ + const { data } = await fetchKnownDomains({ credentials: window.vuex.state.users.currentUser.credentials, }) + this.knownDomains = data } catch (e) { console.warn("Can't load known domains\n", e) } diff --git a/src/stores/lists.js b/src/stores/lists.js index 6bafbde7a..7634f1061 100644 --- a/src/stores/lists.js +++ b/src/stores/lists.js @@ -54,7 +54,7 @@ export const useListsStore = defineStore('lists', { return await createList({ title, credentials: useOAuthStore().token, - }).then((list) => { + }).then(({ data: list }) => { this.setList({ listId: list.id, title }) return list }) @@ -63,13 +63,15 @@ export const useListsStore = defineStore('lists', { return await getList({ listId, credentials: useOAuthStore().token, - }).then((list) => this.setList({ listId: list.id, title: list.title })) + }).then(({ data: list }) => + this.setList({ listId: list.id, title: list.title }), + ) }, async fetchListAccounts({ listId }) { return await getListAccounts({ listId, credentials: useOAuthStore().token, - }).then((accountIds) => { + }).then(({ data: accountIds }) => { if (!this.allListsObject[listId]) { this.allListsObject[listId] = { accountIds: [] } } diff --git a/src/stores/oauth_tokens.js b/src/stores/oauth_tokens.js index afbbb5f46..10aa371f9 100644 --- a/src/stores/oauth_tokens.js +++ b/src/stores/oauth_tokens.js @@ -20,8 +20,8 @@ export const useOAuthTokensStore = defineStore('oauthTokens', { revokeOAuthToken({ id, credentials: useOAuthStore().token, - }).then((response) => { - if (response.status === 201) { + }).then(({ status }) => { + if (status === 201) { this.swapTokens(this.tokens.filter((token) => token.id !== id)) } }) diff --git a/src/stores/polls.js b/src/stores/polls.js index 1a1e8e332..e2f4b0ab2 100644 --- a/src/stores/polls.js +++ b/src/stores/polls.js @@ -27,7 +27,7 @@ export const usePollsStore = defineStore('polls', { fetchPoll({ pollId, credentials: useOAuthStore().token, - }).then((poll) => { + }).then(({ data: poll }) => { setTimeout(() => { if (this.trackedPolls[pollId]) { this.updateTrackedPoll(pollId) diff --git a/src/stores/user_highlight.js b/src/stores/user_highlight.js index ca334f579..b056ca808 100644 --- a/src/stores/user_highlight.js +++ b/src/stores/user_highlight.js @@ -350,7 +350,7 @@ export const useUserHighlightStore = defineStore('user_highlight', { updateProfileJSON({ params, credentials: useOAuthStore().token, - }).then((user) => { + }).then(({ data: user }) => { this.initUserHighlight(user) this.dirty = false }) From a294de1248214b0b392925fab04bae07d91aded3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 19:53:36 +0300 Subject: [PATCH 08/13] fix lookup --- src/api/public.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/public.js b/src/api/public.js index e5f2cc340..8ea94c803 100644 --- a/src/api/public.js +++ b/src/api/public.js @@ -122,7 +122,7 @@ const MASTODON_STATUS_CONTEXT_URL = (id) => `/api/v1/statuses/${id}/context` const MASTODON_STATUS_SOURCE_URL = (id) => `/api/v1/statuses/${id}/source` const MASTODON_STATUS_HISTORY_URL = (id) => `/api/v1/statuses/${id}/history` const MASTODON_USER_URL = '/api/v1/accounts' -const MASTODON_USER_LOOKUP_URL = '/api/v1/accounts/lookup' +const MASTODON_USER_LOOKUP_URL = ({ acct }) => `/api/v1/accounts/lookup${paramsString({ acct })}` const MASTODON_POLL_URL = (id = '') => `/api/v1/polls/${id}` const MASTODON_STATUS_FAVORITEDBY_URL = (id) => `/api/v1/statuses/${id}/favourited_by` @@ -194,9 +194,8 @@ export const fetchUser = ({ id, credentials }) => export const fetchUserByName = ({ name, credentials }) => promisedRequest({ - url: MASTODON_USER_LOOKUP_URL, + url: MASTODON_USER_LOOKUP_URL({ acct: name }), credentials, - params: { acct: name }, }) .then(({ data }) => data.id) .catch((error) => { From d10f1c72c7fa074f207b9594ae2218cb94cedac1 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 20:07:58 +0300 Subject: [PATCH 09/13] don't do statuscodeerror if error isn't related to non-ok statuscode --- src/api/helpers.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/api/helpers.js b/src/api/helpers.js index 8d5d1f5e9..c9e2ed921 100644 --- a/src/api/helpers.js +++ b/src/api/helpers.js @@ -132,8 +132,7 @@ export const promisedRequest = async ({ ) } } catch (error) { - throw new StatusCodeError( - response.status, + throw new Error( error, { url, options }, response, From 10070155829e373cc095cb864428a692da5009ff Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 20:15:35 +0300 Subject: [PATCH 10/13] fix includeTypes --- src/api/public.js | 5 ++--- .../timeline_fetcher/timeline_fetcher.service.js | 12 ++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/api/public.js b/src/api/public.js index 8ea94c803..4ef226972 100644 --- a/src/api/public.js +++ b/src/api/public.js @@ -312,6 +312,7 @@ export const fetchTimeline = ({ notifications: MASTODON_USER_NOTIFICATIONS_URL, } + const urlFunc = timelineUrls[timeline] const twoArgs = new Set([ 'user', @@ -345,8 +346,6 @@ export const fetchTimeline = ({ const isNotifications = timeline === 'notifications' - const urlFunc = timelineUrls[timeline] - if (timeline === 'media') { params.onlyMedia = true } @@ -363,7 +362,7 @@ export const fetchTimeline = ({ params.folderId = bookmarkFolderId } - if (isNotifications && includeTypes.size > 0) { + if (isNotifications && includeTypes.length > 0) { params.includeTypes = includeTypes } diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index da2f59a09..ff75ea704 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -79,14 +79,6 @@ const fetchAndUpdate = ({ return fetchTimeline(args) .then((response) => { - if (response.errors) { - if (timeline === 'favorites') { - useInstanceCapabilitiesStore().pleromaPublicFavouritesAvailable = false - return - } - throw new Error(`${response.status} ${response.statusText}`) - } - const { data: statuses, pagination } = response if ( !older && @@ -108,6 +100,10 @@ const fetchAndUpdate = ({ return { statuses, pagination } }) .catch((error) => { + if (error.statusCode === 403 && timeline === 'favorites') { + useInstanceCapabilitiesStore().pleromaPublicFavouritesAvailable = false + return + } useInterfaceStore().pushGlobalNotice({ level: 'error', messageKey: 'timeline.error', From f8a895123329d318ed6c370cdefe347725412359 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 20:18:59 +0300 Subject: [PATCH 11/13] notificatiosn error handling --- src/services/errors/errors.js | 3 +- .../notifications_fetcher.service.js | 28 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js index 12d32c12b..546554cf1 100644 --- a/src/services/errors/errors.js +++ b/src/services/errors/errors.js @@ -13,9 +13,10 @@ function humanizeErrors(errors) { export function StatusCodeError(statusCode, body, options, response) { this.name = 'StatusCodeError' this.statusCode = statusCode + this.statusText = body.error.error || body.error this.details = JSON && JSON.stringify ? JSON.stringify(body) : body this.errorData = body.error - this.message = statusCode + ' - ' + body.error.error || body.error + this.message = statusCode + ' - ' + statusText this.error = body // legacy attribute this.options = options this.response = response diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index bb94599eb..f787b92e4 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -83,27 +83,23 @@ const fetchAndUpdate = ({ store, credentials, older = false, sinceId }) => { const fetchNotifications = ({ store, args, older }) => { return fetchTimeline(args) .then((response) => { - if (response.errors) { - if ( - response.status === 400 && - response.statusText.includes('Invalid value for enum') - ) { - response.statusText - .matchAll(/(\w+) - Invalid value for enum./g) - .toArray() - .map((x) => x[1]) - .forEach((x) => mastoApiNotificationTypes.delete(x)) - return fetchNotifications({ store, args, older }) - } else { - throw new Error(`${response.status} ${response.statusText}`) - } - } - const notifications = response.data update({ store, notifications, older }) return notifications }) .catch((error) => { + if ( + error.statusCode === 400 && + error.statusText.includes('Invalid value for enum') + ) { + error.statusText + .matchAll(/(\w+) - Invalid value for enum./g) + .toArray() + .map((x) => x[1]) + .forEach((x) => mastoApiNotificationTypes.delete(x)) + return fetchNotifications({ store, args, older }) + } + useInterfaceStore().pushGlobalNotice({ level: 'error', messageKey: 'notifications.error', From f1ac6fab6150495e8a5ac07c59bcee0824748131 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 20:19:34 +0300 Subject: [PATCH 12/13] lint --- src/components/settings_modal/tabs/security_tab/mfa.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/settings_modal/tabs/security_tab/mfa.js b/src/components/settings_modal/tabs/security_tab/mfa.js index b5c68120b..20c28419d 100644 --- a/src/components/settings_modal/tabs/security_tab/mfa.js +++ b/src/components/settings_modal/tabs/security_tab/mfa.js @@ -134,11 +134,13 @@ const Mfa = { token: this.otpConfirmToken, password: this.currentPassword, credentials: useOAuthStore().token, - }).then((res) => { - this.completeSetup() - }).catch((error) => { - this.error = error }) + .then(() => { + this.completeSetup() + }) + .catch((error) => { + this.error = error + }) }, completeSetup() { From 00de60eec4b66f469dc3c1a7feb15b687bd53d7d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 22 Jun 2026 20:19:54 +0300 Subject: [PATCH 13/13] small refactor+lint in poster --- .../status_poster/status_poster.service.js | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index 2d6ec9313..c2ec2d30a 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -36,19 +36,16 @@ const postStatus = ({ poll, preview, idempotencyKey, - }) - .then(({ data }) => { - if (preview) return data - - store.dispatch('addNewStatuses', { - statuses: [data], - timeline: 'friends', - showImmediately: true, - noIdUpdate: true, // To prevent missing notices on next pull. - }) - - return data + }).then(({ data }) => { + if (!preview) store.dispatch('addNewStatuses', { + statuses: [data], + timeline: 'friends', + showImmediately: true, + noIdUpdate: true, // To prevent missing notices on next pull. }) + + return data + }) } const editStatus = ({