fix reports

This commit is contained in:
Henry Jameson 2026-08-26 18:12:17 +03:00
commit a44b60dbc8
2 changed files with 4 additions and 3 deletions

View file

@ -19,8 +19,9 @@ export const useReportsStore = defineStore('reports', {
actions: {
openUserReportingModal({ userId, statusIds = [] }) {
const preTickedIds = new Set(statusIds)
// There shouldn't be a case where this is undefined
const userAllStatusesIds = useStatusesStore().statusesPerUser.get(userId)
// There could be a case (i.e. user is only ever mentioned in someone else's post -> user popover)
// where user has no known posts
const userAllStatusesIds = useStatusesStore().statusesPerUser.get(userId) ?? new Set()
// Set constructor should take care of duplicated IDs and order,
// later duplicated IDs will be dropped in favor of earlier
const sortedIds = new Set([...preTickedIds, ...userAllStatusesIds])

View file

@ -534,7 +534,7 @@ export const useStatusesStore = defineStore('statuses', {
// For when blocking a user
wipeUserStatuses(userId) {
const removed = this.statusesPerUser.get(userId)
const removed = this.statusesPerUser.get(userId) ?? new Set()
removed.forEach((statusId) => {
const status = this.allStatuses.get(statusId)
this.allStatuses.delete(statusId)