mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 15:26:15 +08:00
impr(reporting): dont allow reporting for suspected cheating if user has opted out of leaderboards
This commit is contained in:
parent
fed310ee9c
commit
7326ff0985
|
@ -9,15 +9,18 @@ const wrapperId = "userReportPopupWrapper";
|
|||
|
||||
interface State {
|
||||
userUid?: string;
|
||||
lbOptOut?: boolean;
|
||||
}
|
||||
|
||||
const state: State = {
|
||||
userUid: undefined,
|
||||
lbOptOut: undefined,
|
||||
};
|
||||
|
||||
interface ShowOptions {
|
||||
uid: string;
|
||||
name: string;
|
||||
lbOptOut: boolean;
|
||||
}
|
||||
|
||||
export async function show(options: ShowOptions): Promise<void> {
|
||||
|
@ -30,6 +33,7 @@ export async function show(options: ShowOptions): Promise<void> {
|
|||
|
||||
const { name } = options;
|
||||
state.userUid = options.uid;
|
||||
state.lbOptOut = options.lbOptOut;
|
||||
|
||||
$("#userReportPopup .user").text(name);
|
||||
$("#userReportPopup .reason").val("Inappropriate name");
|
||||
|
@ -85,6 +89,16 @@ async function submitReport(): Promise<void> {
|
|||
return Notifications.add("Please provide a comment");
|
||||
}
|
||||
|
||||
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.",
|
||||
0,
|
||||
{
|
||||
duration: 10,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const characterDifference = comment.length - 250;
|
||||
if (characterDifference > 0) {
|
||||
return Notifications.add(
|
||||
|
|
Loading…
Reference in a new issue