link to user class in mod UI
parent
23621ccf4a
commit
27e8c68da0
|
@ -6,6 +6,8 @@ import play.api.i18n.Lang
|
|||
import lila.api.Context
|
||||
import lila.app.templating.Environment._
|
||||
import lila.app.ui.ScalatagsTemplate._
|
||||
import lila.appeal.Appeal
|
||||
import lila.common.EmailAddress
|
||||
import lila.evaluation.Display
|
||||
import lila.mod.IpRender.RenderIp
|
||||
import lila.mod.ModPresets
|
||||
|
@ -13,7 +15,6 @@ import lila.playban.RageSit
|
|||
import lila.security.Granter
|
||||
import lila.security.{ Permission, UserLogins }
|
||||
import lila.user.{ Holder, User }
|
||||
import lila.appeal.Appeal
|
||||
|
||||
object mod {
|
||||
private def mzSection(key: String) =
|
||||
|
@ -578,7 +579,7 @@ object mod {
|
|||
if (o == u || Granter.canViewAltUsername(mod, o))
|
||||
td(dataSort := o.id)(userLink(o, withBestRating = true, params = "?mod"))
|
||||
else td,
|
||||
isGranted(_.Admin) option td(othersWithEmail emailValueOf o),
|
||||
isGranted(_.Admin) option td(emailValueOf(othersWithEmail)(o)),
|
||||
td(
|
||||
// show prints and ips separately
|
||||
dataSort := other.score + (other.ips.nonEmpty ?? 1000000) + (other.fps.nonEmpty ?? 3000000)
|
||||
|
@ -638,6 +639,12 @@ object mod {
|
|||
)
|
||||
}
|
||||
|
||||
private def emailValueOf(emails: UserLogins.WithMeSortedWithEmails)(u: User) =
|
||||
emails.emails.get(u.id).map(_.value) map {
|
||||
case EmailAddress.clasIdRegex(id) => a(href := routes.Clas.show(id))(s"Class #$id")
|
||||
case email => frag(email)
|
||||
}
|
||||
|
||||
def identification(mod: Holder, user: User, logins: UserLogins)(implicit
|
||||
ctx: Context,
|
||||
renderIp: RenderIp
|
||||
|
|
|
@ -105,6 +105,8 @@ object EmailAddress {
|
|||
isValid(str) option EmailAddress(str)
|
||||
|
||||
private def isNoReply(str: String) = str.startsWith("noreply.") && str.endsWith("@lichess.org")
|
||||
|
||||
val clasIdRegex = """^noreply\.class\.(\w{8})\.\w+@lichess\.org""".r
|
||||
}
|
||||
|
||||
case class Domain private (value: String) extends AnyVal with StringValue {
|
||||
|
|
|
@ -224,9 +224,7 @@ object UserLogins {
|
|||
client: UserAgent.Client
|
||||
)
|
||||
|
||||
case class WithMeSortedWithEmails(others: List[OtherUser], emails: Map[User.ID, EmailAddress]) {
|
||||
def emailValueOf(u: User) = emails.get(u.id).map(_.value)
|
||||
}
|
||||
case class WithMeSortedWithEmails(others: List[OtherUser], emails: Map[User.ID, EmailAddress])
|
||||
|
||||
def withMeSortedWithEmails(
|
||||
userRepo: UserRepo,
|
||||
|
|
Loading…
Reference in New Issue