diff options
author | Manti <67705577+mantikafasi@users.noreply.github.com> | 2023-04-30 01:53:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-30 00:53:37 +0200 |
commit | 043381963bf7c3899c3224c05c18ff8542773a3e (patch) | |
tree | 131052dbf7a37648a3d3bc331825458a04a8f017 /src/plugins/reviewDB/index.tsx | |
parent | 5b485806eaf5cdf893746ff85f495aad2427b986 (diff) | |
download | Vencord-043381963bf7c3899c3224c05c18ff8542773a3e.tar.gz Vencord-043381963bf7c3899c3224c05c18ff8542773a3e.tar.bz2 Vencord-043381963bf7c3899c3224c05c18ff8542773a3e.zip |
ReviewDB: make warning review disableable; add timestamps (#948)
Diffstat (limited to 'src/plugins/reviewDB/index.tsx')
-rw-r--r-- | src/plugins/reviewDB/index.tsx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx index 01740a2..d8fc1cd 100644 --- a/src/plugins/reviewDB/index.tsx +++ b/src/plugins/reviewDB/index.tsx @@ -22,11 +22,11 @@ import { Settings } from "@api/settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { Button, UserStore } from "@webpack/common"; +import { Button } from "@webpack/common"; import { User } from "discord-types/general"; import ReviewsView from "./components/ReviewsView"; -import { getLastReviewID } from "./Utils/ReviewDBAPI"; +import { getCurrentUserInfo } from "./Utils/ReviewDBAPI"; import { authorize, showToast } from "./Utils/Utils"; export default definePlugin({ @@ -58,19 +58,31 @@ export default definePlugin({ type: OptionType.BOOLEAN, description: "Notify about new reviews on startup", default: true, + }, + showWarning: { + type: OptionType.BOOLEAN, + description: "Display warning to be respectful at the top of the reviews list", + default: true, + }, + hideTimestamps: { + type: OptionType.BOOLEAN, + description: "Hide timestamps on reviews", + default: false, } }, async start() { const settings = Settings.plugins.ReviewDB; - if (!settings.lastReviewId || !settings.notifyReviews) return; + if (!settings.notifyReviews || !settings.token) return; setTimeout(async () => { - const id = await getLastReviewID(UserStore.getCurrentUser().id); - if (settings.lastReviewId < id) { - showToast("You have new reviews on your profile!"); - settings.lastReviewId = id; + const user = await getCurrentUserInfo(settings.token); + if (settings.lastReviewId < user.lastReviewID) { + settings.lastReviewId = user.lastReviewID; + if (user.lastReviewID !== 0) + showToast("You have new reviews on your profile!"); } + settings.userType = user.type; }, 4000); }, |