Skip to content

Commit a1847e6

Browse files
committed
Fixed total robux and annoymous mode
1 parent ac3f1e5 commit a1847e6

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/content/core/settings/handlesettings.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ export const syncDonatorTier = async () => {
7878
method: 'GET',
7979
});
8080

81-
if (response.status !== 'success' || !response.badges) {
81+
if (!response?.badges) {
8282
return state.cachedResponse || null;
8383
}
8484

8585
const badges = response.badges;
8686
let tier = 0;
87-
if (badges.donator_3 === true || badges.legacy_donator === true) {
87+
if (badges.donator_3 || badges.legacy_donator) {
8888
tier = 3;
89-
} else if (badges.donator_2 === true) {
89+
} else if (badges.donator_2) {
9090
tier = 2;
91-
} else if (badges.donator_1 === true) {
91+
} else if (badges.donator_1) {
9292
tier = 1;
9393
}
9494

src/content/features/settings/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,15 @@ function getTotalDonatedFromBadgesResponse(response) {
695695
const totalDonated =
696696
response?.badges?.total_donated ??
697697
response?.total_donated ??
698-
response?.badges?.totalDonated;
698+
response?.badges?.totalDonated ??
699+
response?.totalDonated;
699700

700701
const numericTotal = Number(totalDonated);
701-
return Number.isFinite(numericTotal) ? numericTotal : null;
702+
return !isNaN(numericTotal) &&
703+
totalDonated !== null &&
704+
totalDonated !== undefined
705+
? numericTotal
706+
: null;
702707
}
703708

704709
function renderTopDonators(container, donators, thumbMap, currentUserId) {
@@ -2367,8 +2372,10 @@ export async function updateContent(buttonInfo, contentContainer) {
23672372
'AvatarHeadshot',
23682373
'60x60',
23692374
);
2370-
const userThumb = thumbs[0]?.imageUrl;
2371-
if (userThumb) {
2375+
const thumbData = thumbs[0];
2376+
const userThumbUrl = thumbData?.imageUrl;
2377+
2378+
if (userThumbUrl) {
23722379
const tierContainer = contentContainer.querySelector(
23732380
`#donator-tier-${userTier}-header`,
23742381
);
@@ -2379,7 +2386,7 @@ export async function updateContent(buttonInfo, contentContainer) {
23792386
'margin-left: auto; display: inline-flex; align-items: center; gap: 8px; background-color: var(--rovalra-container-background-color, rgba(0,0,0,0.1)); padding: 4px 10px 4px 4px; border-radius: 20px; border: 1px solid var(--rovalra-border-color); color: var(--rovalra-main-text-color); white-space: nowrap;';
23802387

23812388
const img = document.createElement('img');
2382-
img.src = userThumb;
2389+
img.src = userThumbUrl;
23832390
img.style.cssText =
23842391
'width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;';
23852392
tierBadge.appendChild(img);

0 commit comments

Comments
 (0)