diff --git a/src/plugins/reviewDB/Utils/Utils.tsx b/src/plugins/reviewDB/Utils/Utils.tsx index d09c8d49..42426b2b 100644 --- a/src/plugins/reviewDB/Utils/Utils.tsx +++ b/src/plugins/reviewDB/Utils/Utils.tsx @@ -44,20 +44,19 @@ export function authorize(callback?: any) { {...props} scopes={["identify"]} responseType="code" - redirectUri="https://manti.vendicated.dev/URauth" + redirectUri="https://manti.vendicated.dev/api/reviewdb/auth" permissions={0n} clientId="915703782174752809" cancelCompletesFlow={false} callback={async (u: string) => { try { const url = new URL(u); - url.searchParams.append("returnType", "json"); url.searchParams.append("clientMod", "vencord"); const res = await fetch(url, { headers: new Headers({ Accept: "application/json" }) }); - const { token, status } = await res.json(); - if (status === 0) { + const { token, success } = await res.json(); + if (success) { Settings.plugins.ReviewDB.token = token; showToast("Successfully logged in!"); callback?.(); @@ -65,7 +64,7 @@ export function authorize(callback?: any) { showToast("An Error occurred while logging in."); } } catch (e) { - new Logger("ReviewDB").error("Failed to authorise", e); + new Logger("ReviewDB").error("Failed to authorize", e); } }} /> @@ -86,5 +85,5 @@ export function showToast(text: string) { export const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); export function canDeleteReview(review: Review, userId: string) { - if (review.sender.discordID === userId || Settings.plugins.ReviewDB.userType === UserType.Admin) return true; + if (review.sender.discordID === userId || Settings.plugins.ReviewDB.user?.type === UserType.Admin) return true; } diff --git a/src/plugins/reviewDB/components/ReviewComponent.tsx b/src/plugins/reviewDB/components/ReviewComponent.tsx index 04973d75..ac09b4cc 100644 --- a/src/plugins/reviewDB/components/ReviewComponent.tsx +++ b/src/plugins/reviewDB/components/ReviewComponent.tsx @@ -34,19 +34,17 @@ export default LazyComponent(() => { const [ { cozyMessage, buttons, message, groupStart }, { container, isHeader }, - { avatar, clickable, username, messageContent, wrapper, cozy, timestampInline, timestamp }, - { contents }, + { avatar, clickable, username, messageContent, wrapper, cozy }, buttonClasses, - { defaultColor } ] = findBulk( p("cozyMessage"), p("container", "isHeader"), p("avatar", "zalgo"), - p("contents"), p("button", "wrapper", "selected"), - p("defaultColor") ); + const dateFormat = new Intl.DateTimeFormat(); + return function ReviewComponent({ review, refetch }: { review: Review; refetch(): void; }) { function openModal() { openUserProfileModal(review.sender.discordID); @@ -89,7 +87,7 @@ export default LazyComponent(() => { } }> -
{review.comment}
diff --git a/src/plugins/reviewDB/components/ReviewsView.tsx b/src/plugins/reviewDB/components/ReviewsView.tsx index f4bd2481..ff46ccaa 100644 --- a/src/plugins/reviewDB/components/ReviewsView.tsx +++ b/src/plugins/reviewDB/components/ReviewsView.tsx @@ -19,7 +19,7 @@ import { Settings } from "@api/Settings"; import { classes } from "@utils/misc"; import { useAwaiter } from "@utils/react"; -import { findLazy } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { Forms, React, Text, UserStore } from "@webpack/common"; import type { KeyboardEvent } from "react"; @@ -27,7 +27,7 @@ import { addReview, getReviews } from "../Utils/ReviewDBAPI"; import { authorize, showToast } from "../Utils/Utils"; import ReviewComponent from "./ReviewComponent"; -const Classes = findLazy(m => typeof m.textarea === "string"); +const Classes = findByPropsLazy("inputDefault", "editable"); export default function ReviewsView({ userId }: { userId: string; }) { const { token } = Settings.plugins.ReviewDB; @@ -65,7 +65,7 @@ export default function ReviewsView({ userId }: { userId: string; }) { tag="h2" variant="eyebrow" style={{ - marginBottom: "12px", + marginBottom: "8px", color: "var(--header-primary)" }} > @@ -79,13 +79,17 @@ export default function ReviewsView({ userId }: { userId: string; }) { /> )} {reviews?.length === 0 && ( -+ You are banned from ReviewDB {(user.type === UserType.Banned) ? "permanently" : "until " + endDate.toLocaleString()} +
++ Offending Review: {user.banInfo.reviewContent} +
++ Continued offenses will result in a permanent ban. +
+ >, + cancelText: "Appeal", + confirmText: "Ok", + onCancel: () => { + window.open("https://forms.gle/Thj3rDYaMdKoMMuq6"); + } + }); + } + } + + settings.user = user; }, 4000); },