Skip to content

Commit

Permalink
Fix: Undefined error when using own mode for sync (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed Sep 12, 2023
1 parent a4b8076 commit 7de845f
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,19 @@ export class SynchronizeLemmyComponent implements OnInit {
throw new Error(`Unsupported mode: ${mode}`);
}

let foreignInstanceBlacklist = await this.getCensuresByInstances(sourceFrom) ?? [];
if (this.form.controls.filterByReasons.value && this.form.controls.reasonsFilter.value) {
const reasons = this.form.controls.reasonsFilter.value!;
foreignInstanceBlacklist = foreignInstanceBlacklist.filter(
instance => NormalizedInstanceDetailResponse.fromInstanceDetail(instance).unmergedCensureReasons.filter(
reason => reasons.includes(reason),
).length,
);
let foreignInstanceBlacklist: InstanceDetailResponse[] = [];
if (sourceFrom.length) {
foreignInstanceBlacklist = await this.getCensuresByInstances(sourceFrom) ?? [];
if (this.form.controls.filterByReasons.value && this.form.controls.reasonsFilter.value) {
const reasons = this.form.controls.reasonsFilter.value!;
foreignInstanceBlacklist = foreignInstanceBlacklist.filter(
instance => NormalizedInstanceDetailResponse.fromInstanceDetail(instance).unmergedCensureReasons.filter(
reason => reasons.includes(reason),
).length,
);
}
}


return [...this.cache[myInstance]!, ...foreignInstanceBlacklist];
})();

Expand Down

0 comments on commit 7de845f

Please sign in to comment.