From 869e7cfe0f65d4888481d8db2c762aa30104b23d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 14 Aug 2026 19:10:57 +0300 Subject: [PATCH] fix mutes and blocks --- src/components/list/list.js | 7 ++++--- .../tabs/mutes_and_blocks_tab.js | 16 ++++++++-------- src/stores/users.js | 18 +++++++----------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/components/list/list.js b/src/components/list/list.js index c7b924258..20b7c5a78 100644 --- a/src/components/list/list.js +++ b/src/components/list/list.js @@ -98,12 +98,13 @@ const List = { this.fetchFunction(this.page) .then((result) => { + console.log(result) this.loading = false - this.bottomedOut = isEmpty(result.items) + this.bottomedOut = isEmpty(result) if (this.externalItems) return this.page += 1 - this.total = result.count - this.items.push(...result.items) + this.total = result.length + this.items.push(...result) }) .catch((error) => { this.loading = false 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 9158d8a1d..e7884992e 100644 --- a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js +++ b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js @@ -44,18 +44,18 @@ const MutesAndBlocks = { return useUsersStore().currentUser }, blocks() { - return get(useUsersStore().currentUser, 'blockIds', []) + return get(this.user, 'blockIds', []) }, mutes() { - return get(useUsersStore().currentUser, 'muteIds', []) + return get(this.user, 'muteIds', []) }, domains() { - return get(useUsersStore().currentUser, 'domainMutes', []) + return get(this.user, 'domainMutes', []) }, }, methods: { fetchItems(group) { - return () => this.$store.dispatch('fetch' + group, this.userId) + return () => useUsersStore()['fetch' + group](this.userId) }, importFollows(file) { return importFollows({ @@ -111,16 +111,16 @@ const MutesAndBlocks = { .then((users) => map(users, 'id')) }, blockUsers(ids) { - return this.$store.dispatch('blockUsers', ids) + return useUsersStore().blockUsers(ids) }, unblockUsers(ids) { - return this.$store.dispatch('unblockUsers', ids) + return useUsersStore().unblockUsers(ids) }, muteUsers(ids) { - return this.$store.dispatch('muteUsers', ids) + return useUsersStore().muteUsers(ids) }, unmuteUsers(ids) { - return this.$store.dispatch('unmuteUsers', ids) + return useUsersStore().unmuteUsers(ids) }, filterUnMutedDomains(urls) { return urls.filter((url) => !this.user.domainMutes.includes(url)) diff --git a/src/stores/users.js b/src/stores/users.js index e95b31034..1702e4f80 100644 --- a/src/stores/users.js +++ b/src/stores/users.js @@ -241,9 +241,7 @@ export const useUsersStore = defineStore('users', { this.currentUser.blockIds = blockIds }, addBlockId(blockId) { - if (this.currentUser.blockIds.includes(blockId)) { - this.currentUser.blockIds.push(blockId) - } + this.currentUser.blockIds.add(blockId) }, setBlockIdsMaxId(blockIdsMaxId) { this.currentUser.blockIdsMaxId = blockIdsMaxId @@ -255,9 +253,7 @@ export const useUsersStore = defineStore('users', { this.currentUser.muteIdsMaxId = muteIdsMaxId }, addMuteId(muteId) { - if (this.currentUser.muteIds.includes(muteId)) { - this.currentUser.muteIds.push(muteId) - } + this.currentUser.muteIds.add(muteId) }, saveDomainMutes(domainMutes) { this.currentUser.domainMutes = domainMutes @@ -412,7 +408,7 @@ export const useUsersStore = defineStore('users', { }).then((result) => { const { data: blocks } = result if (reset) { - this.saveBlockIds(blocks.map(({ id }) => id)) + this.saveBlockIds(new Set(blocks.map(({ id }) => id))) } else { blocks.forEach(({ id }) => this.addBlockId(id)) } @@ -476,7 +472,7 @@ export const useUsersStore = defineStore('users', { }).then((result) => { const { data: mutes } = result if (reset) { - this.saveMuteIds(mutes.map(({ id }) => id)) + this.saveMuteIds(new Set(mutes.map(({ id }) => id))) } else { mutes.forEach(({ id }) => this.addMuteId(id)) } @@ -680,9 +676,9 @@ export const useUsersStore = defineStore('users', { .then(({ data: user, ...rest }) => { // user.credentials = userCredentials user.credentials = accessToken - user.blockIds = [] - user.muteIds = [] - user.domainMutes = [] + user.blockIds = new Set() + user.muteIds = new Set() + user.domainMutes = new Set() this.setCurrentUser(user) useSyncConfigStore()