From 63be933a536da687479d06ac103489b5e1b5f075 Mon Sep 17 00:00:00 2001 From: kraktus Date: Sat, 3 Feb 2024 11:40:58 +0100 Subject: [PATCH] Remind users without emails to set one every 10 days. Only reminding users to set an email at log-in (https://github.com/lichess-org/lila/pull/14094) had no effects, most probably because users stay logged-in for a very long time. --- app/http/KeyPages.scala | 1 + modules/user/src/main/User.scala | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/http/KeyPages.scala b/app/http/KeyPages.scala index d9a206877b09c..ac100a960f69c 100644 --- a/app/http/KeyPages.scala +++ b/app/http/KeyPages.scala @@ -35,6 +35,7 @@ final class KeyPages(val env: Env)(using Executor) .mon(_.lobby segment "preloader.total") .flatMap: h => ctx.me.filter(_.hasTitle).foreach(env.msg.twoFactorReminder(_)) + ctx.me.filterNot(_.hasEmail).foreach(env.msg.emailReminder(_)) renderPage: lila.mon.chronoSync(_.lobby segment "renderSync"): html.lobby.home(h) diff --git a/modules/user/src/main/User.scala b/modules/user/src/main/User.scala index e0a907f5d2c13..e869c046559f3 100644 --- a/modules/user/src/main/User.scala +++ b/modules/user/src/main/User.scala @@ -23,7 +23,8 @@ case class User( plan: Plan, flair: Option[Flair] = None, totpSecret: Option[TotpSecret] = None, - marks: UserMarks = UserMarks.empty + marks: UserMarks = UserMarks.empty, + hasEmail: Boolean ): override def equals(other: Any) = other match @@ -310,7 +311,8 @@ object User: plan = r.getO[Plan](plan) | Plan.empty, totpSecret = r.getO[TotpSecret](totpSecret), flair = r.getO[Flair](flair).filter(FlairApi.exists), - marks = r.getO[UserMarks](marks) | UserMarks.empty + marks = r.getO[UserMarks](marks) | UserMarks.empty, + hasEmail = r.getO[EmailAddress](email).isDefined ) def writes(w: BSON.Writer, o: User) =