mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-11 22:51:35 +08:00
optional chaining
This commit is contained in:
parent
afaac1525e
commit
ccb0fcdc2e
2 changed files with 7 additions and 7 deletions
|
|
@ -327,7 +327,7 @@ export function startTest(): boolean {
|
|||
UpdateConfig.setChangedBeforeDb(true);
|
||||
}
|
||||
|
||||
if (Auth.currentUser !== null) {
|
||||
if (Auth?.currentUser) {
|
||||
AnalyticsController.log("testStarted");
|
||||
} else {
|
||||
AnalyticsController.log("testStartedNoLogin");
|
||||
|
|
@ -876,7 +876,7 @@ export async function init(): Promise<void> {
|
|||
await Funbox.activate();
|
||||
}
|
||||
|
||||
if (Config.quoteLength.includes(-3) && !Auth.currentUser) {
|
||||
if (Config.quoteLength.includes(-3) && !Auth?.currentUser) {
|
||||
UpdateConfig.setQuoteLength(-1);
|
||||
}
|
||||
|
||||
|
|
@ -1070,7 +1070,7 @@ export async function init(): Promise<void> {
|
|||
.replace(/_/g, " ")} quotes found`,
|
||||
0
|
||||
);
|
||||
if (Auth.currentUser) {
|
||||
if (Auth?.currentUser) {
|
||||
QuoteSubmitPopup.show(false);
|
||||
}
|
||||
UpdateConfig.setMode("words");
|
||||
|
|
@ -1615,7 +1615,7 @@ export async function finish(difficultyFailed = false): Promise<void> {
|
|||
Result.updateTodayTracker();
|
||||
}
|
||||
|
||||
if (Auth.currentUser == null) {
|
||||
if (!Auth?.currentUser) {
|
||||
$(".pageTest #result #rateQuoteButton").addClass("hidden");
|
||||
$(".pageTest #result #reportQuoteButton").addClass("hidden");
|
||||
AnalyticsController.log("testCompletedNoLogin");
|
||||
|
|
@ -1666,7 +1666,7 @@ export async function finish(difficultyFailed = false): Promise<void> {
|
|||
TestStats.resetIncomplete();
|
||||
}
|
||||
|
||||
completedEvent.uid = Auth.currentUser?.uid as string;
|
||||
completedEvent.uid = Auth?.currentUser?.uid as string;
|
||||
Result.updateRateQuote(TestWords.randomQuote);
|
||||
|
||||
AccountButton.loading(true);
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ export async function screenshot(): Promise<void> {
|
|||
$("#nocss").removeClass("hidden");
|
||||
if (revertCookie) $("#cookiePopupWrapper").removeClass("hidden");
|
||||
if (revealReplay) $("#resultReplay").removeClass("hidden");
|
||||
if (Auth.currentUser == null) {
|
||||
if (!Auth?.currentUser) {
|
||||
$(".pageTest .loginTip").removeClass("hidden");
|
||||
}
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ export async function screenshot(): Promise<void> {
|
|||
$(".pageTest .ssWatermark").text(
|
||||
format(dateNow, "dd MMM yyyy HH:mm") + " | monkeytype.com "
|
||||
);
|
||||
if (Auth.currentUser != null) {
|
||||
if (Auth?.currentUser) {
|
||||
$(".pageTest .ssWatermark").text(
|
||||
DB.getSnapshot().name +
|
||||
" | " +
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue