diff --git a/src/stores/reports.js b/src/stores/reports.js index 2d9819442..f502e9f43 100644 --- a/src/stores/reports.js +++ b/src/stores/reports.js @@ -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]) diff --git a/src/stores/statuses.js b/src/stores/statuses.js index 8a5938211..ceb51ceb6 100644 --- a/src/stores/statuses.js +++ b/src/stores/statuses.js @@ -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)