diff --git a/src/plugins/reviewDB/components/ReviewComponent.tsx b/src/plugins/reviewDB/components/ReviewComponent.tsx
index 07bcdb28..57924001 100644
--- a/src/plugins/reviewDB/components/ReviewComponent.tsx
+++ b/src/plugins/reviewDB/components/ReviewComponent.tsx
@@ -20,7 +20,7 @@ import { openUserProfile } from "@utils/discord";
import { classes } from "@utils/misc";
import { LazyComponent } from "@utils/react";
import { filters, findBulk } from "@webpack";
-import { Alerts, moment, Parser, Timestamp, UserStore } from "@webpack/common";
+import { Alerts, moment, Parser, Timestamp } from "@webpack/common";
import { Review, ReviewType } from "../entities";
import { deleteReview, reportReview } from "../reviewDbApi";
@@ -30,7 +30,7 @@ import { DeleteButton, ReportButton } from "./MessageButton";
import ReviewBadge from "./ReviewBadge";
export default LazyComponent(() => {
- // this is terrible, blame ven
+ // this is terrible, blame mantika
const p = filters.byProps;
const [
{ cozyMessage, buttons, message, buttonsInner, groupStart },
@@ -48,7 +48,7 @@ export default LazyComponent(() => {
const dateFormat = new Intl.DateTimeFormat();
- return function ReviewComponent({ review, refetch }: { review: Review; refetch(): void; }) {
+ return function ReviewComponent({ review, refetch, profileId }: { review: Review; refetch(): void; profileId: string; }) {
function openModal() {
openUserProfile(review.sender.discordID);
}
@@ -135,7 +135,7 @@ export default LazyComponent(() => {
- {canDeleteReview(review, UserStore.getCurrentUser().id) && (
+ {canDeleteReview(profileId, review) && (
)}
diff --git a/src/plugins/reviewDB/components/ReviewsView.tsx b/src/plugins/reviewDB/components/ReviewsView.tsx
index e5bc426d..5eb370f4 100644
--- a/src/plugins/reviewDB/components/ReviewsView.tsx
+++ b/src/plugins/reviewDB/components/ReviewsView.tsx
@@ -79,6 +79,7 @@ export default function ReviewsView({
refetch={refetch}
reviews={reviewData!.reviews}
hideOwnReview={hideOwnReview}
+ profileId={discordId}
/>
{showInput && (
@@ -93,7 +94,7 @@ export default function ReviewsView({
);
}
-function ReviewList({ refetch, reviews, hideOwnReview }: { refetch(): void; reviews: Review[]; hideOwnReview: boolean; }) {
+function ReviewList({ refetch, reviews, hideOwnReview, profileId }: { refetch(): void; reviews: Review[]; hideOwnReview: boolean; profileId: string; }) {
const myId = UserStore.getCurrentUser().id;
return (
@@ -104,6 +105,7 @@ function ReviewList({ refetch, reviews, hideOwnReview }: { refetch(): void; revi
key={review.id}
review={review}
refetch={refetch}
+ profileId={profileId}
/>
)}
diff --git a/src/plugins/reviewDB/utils.tsx b/src/plugins/reviewDB/utils.tsx
index a9c8ca57..63ab84dd 100644
--- a/src/plugins/reviewDB/utils.tsx
+++ b/src/plugins/reviewDB/utils.tsx
@@ -20,7 +20,7 @@ import { classNameFactory } from "@api/Styles";
import { Logger } from "@utils/Logger";
import { openModal } from "@utils/modal";
import { findByProps } from "@webpack";
-import { React, Toasts } from "@webpack/common";
+import { React, Toasts, UserStore } from "@webpack/common";
import { Review, UserType } from "./entities";
import { settings } from "./settings";
@@ -73,9 +73,11 @@ export function showToast(text: string) {
});
}
-export function canDeleteReview(review: Review, userId: string) {
+export function canDeleteReview(profileId: string, review: Review) {
+ const myId = UserStore.getCurrentUser().id;
return (
- review.sender.discordID === userId
+ myId === profileId
+ || review.sender.discordID === profileId
|| settings.store.user?.type === UserType.Admin
);
}