can't reopen erased account
This commit is contained in:
parent
39d42e320c
commit
9991ce2477
|
@ -251,6 +251,7 @@ object User extends LilaController {
|
||||||
protected[controllers] def renderModZone(username: String, me: UserModel)(implicit ctx: Context): Fu[Result] =
|
protected[controllers] def renderModZone(username: String, me: UserModel)(implicit ctx: Context): Fu[Result] =
|
||||||
OptionFuOk(UserRepo named username) { user =>
|
OptionFuOk(UserRepo named username) { user =>
|
||||||
UserRepo.emails(user.id) zip
|
UserRepo.emails(user.id) zip
|
||||||
|
UserRepo.isErased(user) zip
|
||||||
(Env.security userSpy user) zip
|
(Env.security userSpy user) zip
|
||||||
Env.mod.assessApi.getPlayerAggregateAssessmentWithGames(user.id) zip
|
Env.mod.assessApi.getPlayerAggregateAssessmentWithGames(user.id) zip
|
||||||
Env.mod.logApi.userHistory(user.id) zip
|
Env.mod.logApi.userHistory(user.id) zip
|
||||||
|
@ -258,7 +259,7 @@ object User extends LilaController {
|
||||||
Env.report.api.byAndAbout(user, 20) zip
|
Env.report.api.byAndAbout(user, 20) zip
|
||||||
Env.pref.api.getPref(user) zip
|
Env.pref.api.getPref(user) zip
|
||||||
Env.irwin.api.reports.withPovs(user) flatMap {
|
Env.irwin.api.reports.withPovs(user) flatMap {
|
||||||
case emails ~ spy ~ assess ~ history ~ charges ~ reports ~ pref ~ irwin =>
|
case emails ~ erased ~ spy ~ assess ~ history ~ charges ~ reports ~ pref ~ irwin =>
|
||||||
val familyUserIds = user.id :: spy.otherUserIds.toList
|
val familyUserIds = user.id :: spy.otherUserIds.toList
|
||||||
Env.playban.api.bans(familyUserIds) zip
|
Env.playban.api.bans(familyUserIds) zip
|
||||||
Env.user.noteApi.forMod(familyUserIds) zip
|
Env.user.noteApi.forMod(familyUserIds) zip
|
||||||
|
@ -266,7 +267,7 @@ object User extends LilaController {
|
||||||
reports.userIds ::: assess.??(_.games).flatMap(_.userIds)
|
reports.userIds ::: assess.??(_.games).flatMap(_.userIds)
|
||||||
} map {
|
} map {
|
||||||
case bans ~ notes ~ _ =>
|
case bans ~ notes ~ _ =>
|
||||||
html.user.mod(user, emails, spy, assess, bans, history, charges, reports, pref, irwin, notes)
|
html.user.mod(user, emails, spy, assess, bans, history, charges, reports, pref, irwin, notes, erased)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@(u: User, emails: User.Emails, spy: lila.security.UserSpy, optionAggregateAssessment: Option[lila.evaluation.PlayerAggregateAssessment.WithGames], bans: Map[String, Int], history: List[lila.mod.Modlog], charges: List[lila.plan.Charge], reports: lila.report.Report.ByAndAbout, pref: lila.pref.Pref, irwinReport: Option[lila.irwin.IrwinReport.WithPovs], notes: List[lila.user.Note])(implicit ctx: Context)
|
@(u: User, emails: User.Emails, spy: lila.security.UserSpy, optionAggregateAssessment: Option[lila.evaluation.PlayerAggregateAssessment.WithGames], bans: Map[String, Int], history: List[lila.mod.Modlog], charges: List[lila.plan.Charge], reports: lila.report.Report.ByAndAbout, pref: lila.pref.Pref, irwinReport: Option[lila.irwin.IrwinReport.WithPovs], notes: List[lila.user.Note], erased: User.Erased)(implicit ctx: Context)
|
||||||
|
|
||||||
@import lila.evaluation.Display
|
@import lila.evaluation.Display
|
||||||
@import lila.pref.Pref
|
@import lila.pref.Pref
|
||||||
|
@ -44,19 +44,23 @@
|
||||||
<input class="button@when(u.ipBan, " active")" type="submit" value="IP ban @spy.ips.size" />
|
<input class="button@when(u.ipBan, " active")" type="submit" value="IP ban @spy.ips.size" />
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
@if(!u.disabled) {
|
@if(u.enabled) {
|
||||||
@if(isGranted(_.CloseAccount)) {
|
@if(isGranted(_.CloseAccount)) {
|
||||||
<form method="post" action="@routes.Mod.closeAccount(u.username)" data-hint="Disables this account." class="hint--bottom-left xhr">
|
<form method="post" action="@routes.Mod.closeAccount(u.username)" data-hint="Disables this account." class="hint--bottom-left xhr">
|
||||||
<input class="button" type="submit" value="Close" />
|
<input class="button" type="submit" value="Close" />
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@if(erased.value) {
|
||||||
|
Erased
|
||||||
|
} else {
|
||||||
@if(isGranted(_.ReopenAccount)) {
|
@if(isGranted(_.ReopenAccount)) {
|
||||||
<form method="post" action="@routes.Mod.reopenAccount(u.username)" data-hint="Re-activates this account." class="hint--bottom-left xhr">
|
<form method="post" action="@routes.Mod.reopenAccount(u.username)" data-hint="Re-activates this account." class="hint--bottom-left xhr">
|
||||||
<input type="submit" class="button active" value="Closed" />
|
<input type="submit" class="button active" value="Closed" />
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
<div class="second_mod_button_row">
|
<div class="second_mod_button_row">
|
||||||
@if(isGranted(_.RemoveRanking)) {
|
@if(isGranted(_.RemoveRanking)) {
|
||||||
<form method="post" action="@routes.Mod.rankban(u.username, !u.rankban)" data-hint="@if(u.rankban){In}else{Ex}cludes this user @if(u.rankban){from}else{in} the rankings." class="hint--bottom-left xhr">
|
<form method="post" action="@routes.Mod.rankban(u.username, !u.rankban)" data-hint="@if(u.rankban){In}else{Ex}cludes this user @if(u.rankban){from}else{in} the rankings." class="hint--bottom-left xhr">
|
||||||
|
|
|
@ -133,7 +133,8 @@ object User {
|
||||||
|
|
||||||
val idPattern = """^[\w-]{3,20}$""".r.pattern
|
val idPattern = """^[\w-]{3,20}$""".r.pattern
|
||||||
|
|
||||||
case class GDPRErase(user: User)
|
case class GDPRErase(user: User) extends AnyVal
|
||||||
|
case class Erased(value: Boolean) extends AnyVal
|
||||||
|
|
||||||
case class LightPerf(user: LightUser, perfKey: String, rating: Int, progress: Int)
|
case class LightPerf(user: LightUser, perfKey: String, rating: Int, progress: Int)
|
||||||
case class LightCount(user: LightUser, count: Int)
|
case class LightCount(user: LightUser, count: Int)
|
||||||
|
|
|
@ -411,7 +411,13 @@ object UserRepo {
|
||||||
|
|
||||||
def setEmailConfirmed(id: User.ID): Funit = coll.update($id(id), $unset(F.mustConfirmEmail)).void
|
def setEmailConfirmed(id: User.ID): Funit = coll.update($id(id), $unset(F.mustConfirmEmail)).void
|
||||||
|
|
||||||
def erase(user: User): Funit = coll.update($id(user.id), $unset(F.profile)).void
|
def erase(user: User): Funit = coll.update(
|
||||||
|
$id(user.id),
|
||||||
|
$unset(F.profile) ++ $set("erasedAt" -> DateTime.now)
|
||||||
|
).void
|
||||||
|
|
||||||
|
def isErased(user: User): Fu[User.Erased] =
|
||||||
|
coll.exists($id(user.id) ++ $doc("erasedAt" $exists true)) map User.Erased.apply
|
||||||
|
|
||||||
private def newUser(
|
private def newUser(
|
||||||
username: String,
|
username: String,
|
||||||
|
|
Loading…
Reference in a new issue