From aaf311feb217abd9a1db98033672c1bdbe8c408a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:09:54 -0400 Subject: [PATCH] ReviewDB: Fix Limit + Change Profile Component A Little --- src/plugins/reviewDB/index.tsx | 32 ++++++++++++++++------------- src/plugins/reviewDB/reviewDbApi.ts | 4 ++-- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx index 8542a0aff..bcb62dda1 100644 --- a/src/plugins/reviewDB/index.tsx +++ b/src/plugins/reviewDB/index.tsx @@ -157,7 +157,7 @@ export default definePlugin({ }, renderProfileComponent: ErrorBoundary.wrap(({ user, isSideBar = false }: { user: User; isSideBar?: boolean; }) => { - const [reviewData] = useAwaiter(() => getReviews(user.id), { deps: [user.id], fallbackValue: null }); + const [reviewData] = useAwaiter(() => getReviews(user.id, 0, true), { deps: [user.id], fallbackValue: null }); // Discord are masters at using a crap ton of html elements and css classes to create a simple ui that could have // been made with less than half of the number of elements, so we have to do this insanity to replicate their ui @@ -170,20 +170,24 @@ export default definePlugin({ User Reviews {!!reviewData?.reviewCount && (
- {reviewData.reviews.slice(0, 4).map((review, idx) => { - const showCount = idx === 3 && reviewData.reviewCount > 4; + {reviewData.reviews + .filter(review => review.id !== 0) + .slice(0, 4) + .reverse() + .map((review, idx) => { + const showCount = idx === 3 && reviewData.reviewCount > 4; - return ( -
- {review.sender.username} - {showCount && ( -
- +{reviewData.reviewCount - 3} -
- )} -
- ); - })} + return ( +
+ {review.sender.username} + {showCount && ( +
+ +{reviewData.reviewCount - 3} +
+ )} +
+ ); + })}
)} diff --git a/src/plugins/reviewDB/reviewDbApi.ts b/src/plugins/reviewDB/reviewDbApi.ts index e899216a3..e724adac7 100644 --- a/src/plugins/reviewDB/reviewDbApi.ts +++ b/src/plugins/reviewDB/reviewDbApi.ts @@ -47,14 +47,14 @@ async function rdbRequest(path: string, options: RequestInit = {}) { }); } -export async function getReviews(id: string, offset = 0): Promise { +export async function getReviews(id: string, offset = 0, isProfileComponent = false): Promise { let flags = 0; if (!settings.store.showWarning) flags |= WarningFlag; const params = new URLSearchParams({ flags: String(flags), offset: String(offset), - limit: "4" + ...(isProfileComponent ? { limit: "4" } : {}) }); const req = await fetch(`${API_URL}/users/${id}/reviews?${params}`);