Skip to content

Commit

Permalink
impr(reporting): dont allow reporting for suspected cheating if user …
Browse files Browse the repository at this point in the history
…has opted out of leaderboards
  • Loading branch information
Miodec committed Feb 5, 2024
1 parent 7326ff0 commit b8e647d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/src/ts/elements/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export async function update(

profileElement.attr("uid", profile.uid ?? "");
profileElement.attr("name", profile.name ?? "");
profileElement.attr("lbOptOut", `${profile.lbOptOut ?? false}`);

// ============================================================================
// DO FREAKING NOT USE .HTML OR .APPEND HERE - USER INPUT!!!!!!
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/ts/pages/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,10 @@ async function update(options: UpdateOptions): Promise<void> {
$(".page.pageProfile").on("click", ".profile .userReportButton", () => {
const uid = $(".page.pageProfile .profile").attr("uid") ?? "";
const name = $(".page.pageProfile .profile").attr("name") ?? "";
const lbOptOut =
($(".page.pageProfile .profile").attr("lbOptOut") ?? "false") === "true";

UserReportPopup.show({ uid, name });
UserReportPopup.show({ uid, name, lbOptOut });
});

export const page = new Page<undefined | Profile.ProfileData>(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/popups/user-report-popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function submitReport(): Promise<void> {

if (reason === "Suspected cheating" && state.lbOptOut) {
return Notifications.add(
"You cannot report this user for suspected cheating as they have opted out of the leaderboard.",
"You cannot report this user for suspected cheating as they have opted out of the leaderboards.",
0,
{
duration: 10,
Expand Down

0 comments on commit b8e647d

Please sign in to comment.