fix mutes and blocks

This commit is contained in:
Henry Jameson 2026-08-14 19:10:57 +03:00
commit 869e7cfe0f
3 changed files with 19 additions and 22 deletions

View file

@ -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

View file

@ -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))

View file

@ -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()