fix ublog urls
parent
edc65840e7
commit
5b690e5e2b
|
@ -219,7 +219,7 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
|
|||
// whiteUsername 1-0 blackUsername
|
||||
def gameSummary(whiteUserId: String, blackUserId: String, finished: Boolean, result: Option[Boolean]) = {
|
||||
val res = if (finished) chess.Color.showResult(result map Color.fromWhite) else "*"
|
||||
s"${usernameOrId(whiteUserId)} $res ${usernameOrId(blackUserId)}"
|
||||
s"${titleNameOrId(whiteUserId)} $res ${titleNameOrId(blackUserId)}"
|
||||
}
|
||||
|
||||
def gameResult(game: Game) =
|
||||
|
@ -248,13 +248,13 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
|
|||
}
|
||||
val variant = c.variant.exotic ?? s" ${c.variant.name}"
|
||||
val challenger = c.challengerUser.fold(trans.anonymous.txt()) { reg =>
|
||||
s"${usernameOrId(reg.id)} (${reg.rating.show})"
|
||||
s"${titleNameOrId(reg.id)} (${reg.rating.show})"
|
||||
}
|
||||
val players =
|
||||
if (c.isOpen) "Open challenge"
|
||||
else
|
||||
c.destUser.fold(s"Challenge from $challenger") { dest =>
|
||||
s"$challenger challenges ${usernameOrId(dest.id)} (${dest.rating.show})"
|
||||
s"$challenger challenges ${titleNameOrId(dest.id)} (${dest.rating.show})"
|
||||
}
|
||||
s"$speed$variant ${c.mode.name} Chess • $players"
|
||||
}
|
||||
|
|
|
@ -79,8 +79,9 @@ trait UserHelper { self: I18nHelper with StringHelper with NumberHelper =>
|
|||
|
||||
def lightUser = env.user.lightUserSync
|
||||
|
||||
def usernameOrId(userId: String) = lightUser(userId).fold(userId)(_.titleName)
|
||||
def usernameOrAnon(userId: Option[String]) = userId.flatMap(lightUser).fold(User.anonymous)(_.titleName)
|
||||
def usernameOrId(userId: String) = lightUser(userId).fold(userId)(_.name)
|
||||
def titleNameOrId(userId: String) = lightUser(userId).fold(userId)(_.titleName)
|
||||
def titleNameOrAnon(userId: Option[String]) = userId.flatMap(lightUser).fold(User.anonymous)(_.titleName)
|
||||
|
||||
def isOnline(userId: String) = env.socket isOnline userId
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ object bits {
|
|||
cls := List("student" -> true, "active" -> student.exists(s.is)),
|
||||
href := routes.Clas.studentShow(clas.clas.id.value, s.userId)
|
||||
)(
|
||||
usernameOrId(s.userId),
|
||||
titleNameOrId(s.userId),
|
||||
em(s.realName)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ object student {
|
|||
),
|
||||
p(trans.clas.makeSureToCopy()),
|
||||
pre(
|
||||
trans.clas.studentCredentials(student.realName, usernameOrId(student.userId), password.value)
|
||||
trans.clas.studentCredentials(student.realName, titleNameOrId(student.userId), password.value)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -229,7 +229,7 @@ object student {
|
|||
created map { case Student.WithPassword(student, password) =>
|
||||
tr(
|
||||
td(student.realName),
|
||||
td(usernameOrId(student.userId)),
|
||||
td(titleNameOrId(student.userId)),
|
||||
td(password.value)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ object event {
|
|||
div(cls := "box__top")(
|
||||
h1(
|
||||
a(href := routes.Event.show(event.id))(event.title),
|
||||
span("Created by ", usernameOrId(event.createdBy.value), " ", momentFromNow(event.createdAt)),
|
||||
span("Created by ", titleNameOrId(event.createdBy.value), " ", momentFromNow(event.createdAt)),
|
||||
event.updatedBy map { updatedBy =>
|
||||
span("Updated by ", usernameOrId(updatedBy.value), " ", event.updatedAt.map(momentFromNow(_)))
|
||||
span("Updated by ", titleNameOrId(updatedBy.value), " ", event.updatedAt.map(momentFromNow(_)))
|
||||
}
|
||||
),
|
||||
st.form(cls := "box__top__actions", action := routes.Event.cloneE(event.id), method := "get")(
|
||||
|
|
|
@ -131,7 +131,7 @@ object communication {
|
|||
),
|
||||
title := pov.game.fromFriend.option("Friend game")
|
||||
)(
|
||||
usernameOrAnon(pov.opponent.userId),
|
||||
titleNameOrAnon(pov.opponent.userId),
|
||||
" – ",
|
||||
momentFromNowOnce(pov.game.movedAt)
|
||||
),
|
||||
|
|
|
@ -37,7 +37,7 @@ fetch($button.data('action'), {method:'post'})
|
|||
cls := "report-block button",
|
||||
st.title := trans.block.txt()
|
||||
)(
|
||||
span(cls := "text", dataIcon := "")("Block ", usernameOrId(userId))
|
||||
span(cls := "text", dataIcon := "")("Block ", titleNameOrId(userId))
|
||||
)
|
||||
),
|
||||
br,
|
||||
|
|
|
@ -49,7 +49,7 @@ object message {
|
|||
|
||||
def privateStudy(study: lila.study.Study)(implicit ctx: Context) =
|
||||
apply(
|
||||
title = s"${usernameOrId(study.ownerId)}'s study",
|
||||
title = s"${titleNameOrId(study.ownerId)}'s study",
|
||||
back = routes.Study.allDefault(1).url.some
|
||||
)(
|
||||
"Sorry! This study is private, you cannot access it.",
|
||||
|
|
|
@ -100,7 +100,7 @@ object bits extends Context.ToLang {
|
|||
|
||||
def contextual(userId: User.ID)(implicit lang: Lang): Frag =
|
||||
redirectLink(userId)(cls := "context-streamer text", dataIcon := "")(
|
||||
xIsStreaming(usernameOrId(userId))
|
||||
xIsStreaming(titleNameOrId(userId))
|
||||
)
|
||||
|
||||
def rules(implicit lang: Lang) =
|
||||
|
|
|
@ -62,7 +62,7 @@ object bits {
|
|||
" ",
|
||||
s.study.likes.value,
|
||||
" • ",
|
||||
usernameOrId(s.study.ownerId),
|
||||
titleNameOrId(s.study.ownerId),
|
||||
" • ",
|
||||
momentFromNow(s.study.createdAt)
|
||||
)
|
||||
|
@ -78,7 +78,7 @@ object bits {
|
|||
s.study.members.members.values
|
||||
.take(4)
|
||||
.map { m =>
|
||||
li(cls := "text", dataIcon := (if (m.canContribute) "" else ""))(usernameOrId(m.id))
|
||||
li(cls := "text", dataIcon := (if (m.canContribute) "" else ""))(titleNameOrId(m.id))
|
||||
}
|
||||
.toList
|
||||
)
|
||||
|
|
|
@ -60,7 +60,7 @@ object show {
|
|||
.OpenGraph(
|
||||
title = s.name.value,
|
||||
url = s"$netBaseUrl${routes.Study.show(s.id.value).url}",
|
||||
description = s"A chess study by ${usernameOrId(s.ownerId)}"
|
||||
description = s"A chess study by ${titleNameOrId(s.ownerId)}"
|
||||
)
|
||||
.some
|
||||
)(
|
||||
|
|
|
@ -65,7 +65,7 @@ object show {
|
|||
s"${s.nbPlayers} players compete in the ${showEnglishDate(s.startsAt)} ${s.name} swiss tournament " +
|
||||
s"organized by ${teamIdToName(s.teamId)}. " +
|
||||
s.winnerId.fold("Winner is not yet decided.") { winnerId =>
|
||||
s"${usernameOrId(winnerId)} takes the prize home!"
|
||||
s"${titleNameOrId(winnerId)} takes the prize home!"
|
||||
}
|
||||
)
|
||||
.some
|
||||
|
|
|
@ -217,7 +217,7 @@ object show {
|
|||
div(cls := "meta")(
|
||||
strong(post.topicName),
|
||||
em(
|
||||
post.userId map usernameOrId,
|
||||
post.userId map titleNameOrId,
|
||||
" • ",
|
||||
momentFromNow(post.createdAt)
|
||||
)
|
||||
|
|
|
@ -51,7 +51,7 @@ object crud {
|
|||
h1(
|
||||
a(href := routes.Tournament.show(tour.id))(tour.name()),
|
||||
" ",
|
||||
span("Created by ", usernameOrId(tour.createdBy), " on ", showDate(tour.createdAt))
|
||||
span("Created by ", titleNameOrId(tour.createdBy), " on ", showDate(tour.createdAt))
|
||||
),
|
||||
st.form(
|
||||
cls := "box__top__actions",
|
||||
|
|
|
@ -57,7 +57,7 @@ object show {
|
|||
s"${tour.nbPlayers} players compete in the ${showEnglishDate(tour.startsAt)} ${tour.name()}. " +
|
||||
s"${tour.clock.show} ${tour.mode.name} games are played during ${tour.minutes} minutes. " +
|
||||
tour.winnerId.fold("Winner is not yet decided.") { winnerId =>
|
||||
s"${usernameOrId(winnerId)} takes the prize home!"
|
||||
s"${titleNameOrId(winnerId)} takes the prize home!"
|
||||
}
|
||||
)
|
||||
.some
|
||||
|
|
|
@ -601,7 +601,7 @@ object mod {
|
|||
td(dataSort := userNotes.size)(
|
||||
a(href := s"${routes.User.show(o.username)}?notes")(
|
||||
notesText(
|
||||
title := s"Notes from ${userNotes.map(_.from).map(usernameOrId).mkString(", ")}",
|
||||
title := s"Notes from ${userNotes.map(_.from).map(titleNameOrId).mkString(", ")}",
|
||||
cls := "is-green"
|
||||
),
|
||||
userNotes.size
|
||||
|
|
Loading…
Reference in New Issue