impr(reporting): dont allow reporting for suspected cheating if user has opted out of leaderboards

This commit is contained in:
Miodec 2024-02-05 15:08:45 +01:00
parent 7326ff0985
commit b8e647d38d
3 changed files with 5 additions and 2 deletions

View file

@ -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!!!!!!

View file

@ -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>(

View file

@ -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,