[ReviewDB] hide blocked users (#1626)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Manti 2023-08-10 03:28:46 +03:00 committed by GitHub
parent 8b6c8bc0ec
commit c96a1a9998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -19,7 +19,7 @@
import { classes } from "@utils/misc";
import { useAwaiter, useForceUpdater } from "@utils/react";
import { findByPropsLazy } from "@webpack";
import { Forms, React, UserStore } from "@webpack/common";
import { Forms, React, RelationshipStore, UserStore } from "@webpack/common";
import type { KeyboardEvent } from "react";
import { Review } from "../entities";
@ -60,6 +60,9 @@ export default function ReviewsView({
fallbackValue: null,
deps: [refetchSignal, signal, page],
onSuccess: data => {
if (settings.store.hideBlockedUsers)
data!.reviews = data!.reviews?.filter(r => !RelationshipStore.isBlocked(r.sender.discordID));
scrollToTop?.();
onFetchReviews(data!);
}

View file

@ -48,6 +48,11 @@ export const settings = definePluginSettings({
description: "Hide timestamps on reviews",
default: false,
},
hideBlockedUsers: {
type: OptionType.BOOLEAN,
description: "Hide reviews from blocked users",
default: true,
},
website: {
type: OptionType.COMPONENT,
description: "ReviewDB website",