pull/7125/head
Thibault Duplessis 2020-08-16 14:43:26 +02:00
parent c6ed157217
commit d25ef1ff63
22 changed files with 99 additions and 72 deletions

View File

@ -48,8 +48,11 @@ object widget {
pic(c, if (link) 300 else 350),
div(cls := "overview")(
(if (link) h2 else h1)(cls := "coach-name")(titleName(c)),
c.coach.profile.headline.map { h =>
p(cls := s"headline ${if (h.length < 60) "small" else if (h.length < 120) "medium" else "large"}")(h)
c.coach.profile.headline
.map { h =>
p(
cls := s"headline ${if (h.length < 60) "small" else if (h.length < 120) "medium" else "large"}"
)(h)
},
table(
tbody(

View File

@ -94,7 +94,9 @@ object side {
div(cls := s"player color-icon is ${p.color.name} text")(
playerLink(p, withOnline = false, withDiff = true, withBerserk = true)
),
tour.flatMap(_.teamVs).map(_.teams(p.color)) map { teamLink(_, withIcon = false)(cls := "team") }
tour.flatMap(_.teamVs).map(_.teams(p.color)) map {
teamLink(_, withIcon = false)(cls := "team")
}
)
}
)

View File

@ -103,14 +103,16 @@ object bits {
div(cls := "now-playing")(
playing.partition(_.isMyTurn) pipe {
case (myTurn, otherTurn) =>
(myTurn ++ otherTurn.take(6 - myTurn.size)) take 9 map { pov =>
(myTurn ++ otherTurn.take(6 - myTurn.size)) take 9 map {
pov =>
a(href := routes.Round.player(pov.fullId), cls := pov.isMyTurn.option("my_turn"))(
gameFen(pov, withLink = false, withTitle = false, withLive = false),
span(cls := "meta")(
playerText(pov.opponent, withRating = false),
span(cls := "indicator")(
if (pov.isMyTurn)
pov.remainingSeconds.fold[Frag](trans.yourTurn())(secondsFromNow(_, alwaysRelative = true))
pov.remainingSeconds
.fold[Frag](trans.yourTurn())(secondsFromNow(_, alwaysRelative = true))
else nbsp
)
)

View File

@ -18,7 +18,9 @@ object header {
s.streamer.name
),
s.streamer.headline.map(_.value).map { d =>
p(cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}")(d)
p(cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}")(
d
)
},
div(cls := "services")(
s.streamer.twitch.map { twitch =>

View File

@ -34,7 +34,9 @@ object index {
div(cls := "overview")(
h1(dataIcon := "")(titleTag(s.user.title), stringValueFrag(s.streamer.name)),
s.streamer.headline.map(_.value).map { d =>
p(cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}")(d)
p(
cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}"
)(d)
},
div(cls := "services")(
s.streamer.twitch.map { twitch =>

View File

@ -7,7 +7,7 @@ import lila.common.config._
@Module
final class Env(
db: lila.db.Db,
userRepo: lila.user.UserRepo,
userRepo: lila.user.UserRepo
)(implicit ec: scala.concurrent.ExecutionContext) {
private val coll = db(CollName("appeal"))

View File

@ -179,13 +179,17 @@ trait CollExt { self: dsl with QueryBuilderExt =>
coll.update.one(selector, $set(field -> value))
def updateFieldUnchecked[V: BSONWriter](selector: Bdoc, field: String, value: V): Unit =
coll.update(ordered = false, writeConcern = WriteConcern.Unacknowledged).one(selector, $set(field -> value))
coll
.update(ordered = false, writeConcern = WriteConcern.Unacknowledged)
.one(selector, $set(field -> value))
def incField(selector: Bdoc, field: String, value: Int = 1) =
coll.update.one(selector, $inc(field -> value))
def incFieldUnchecked(selector: Bdoc, field: String, value: Int = 1): Unit =
coll.update(ordered = false, writeConcern = WriteConcern.Unacknowledged).one(selector, $inc(field -> value))
coll
.update(ordered = false, writeConcern = WriteConcern.Unacknowledged)
.one(selector, $inc(field -> value))
def unsetField(selector: Bdoc, field: String, multi: Boolean = false) =
coll.update.one(selector, $unset(field), multi = multi)

View File

@ -21,7 +21,8 @@ object EvalCacheSelector {
.sortBy(-_._1)
.map(_._2)
// then sort each group's evals, and keep only the best eval in each group
.map(_ sortBy ranking).flatMap(_.lastOption)
.map(_ sortBy ranking)
.flatMap(_.lastOption)
// now remove obsolete evals
.foldLeft(Nil: Evals) {
case (acc, e) if acc.exists { makesObsolete(_, e) } => acc

View File

@ -62,7 +62,8 @@ final class Analyser(
case true => fuFalse
case _ => {
import req._
val sender = Work.Sender(req.userId.some, none, mod = false, system = lila.user.User isOfficial req.userId)
val sender =
Work.Sender(req.userId.some, none, mod = false, system = lila.user.User isOfficial req.userId)
limiter(sender, ignoreConcurrentCheck = true) flatMap { accepted =>
if (!accepted) logger.info(s"Study request declined: ${req.studyId}/${req.chapterId} by $sender")
accepted ?? {

View File

@ -13,12 +13,16 @@ case class JsonQuestion(
for {
realMetric <- Metric.byKey get metric
realFilters =
filters.flatMap {
filters
.flatMap {
case (filterKey, valueKeys) => {
def build[X](dimension: Dimension[X]) =
Filter[X](dimension, valueKeys.flatMap {
Filter[X](
dimension,
valueKeys.flatMap {
Dimension.valueByKey(dimension, _)
}).some
}
).some
filterKey match {
case Period.key => build(Period)

View File

@ -23,7 +23,8 @@ final class MsgCompat(
def inbox(me: User, pageOpt: Option[Int]): Fu[JsObject] = {
val page = pageOpt.fold(1)(_ atLeast 1 atMost 2)
api.threadsOf(me) flatMap { allThreads =>
val threads = allThreads.slice((page - 1) * maxPerPage.value, (page - 1) * maxPerPage.value + maxPerPage.value)
val threads =
allThreads.slice((page - 1) * maxPerPage.value, (page - 1) * maxPerPage.value + maxPerPage.value)
lightUserApi.preloadMany(threads.map(_ other me)) inject
PaginatorJson {
Paginator

View File

@ -87,7 +87,8 @@ final class JSONHandlers(getLightUser: LightUser.GetterSync) {
}
implicit val andUnreadWrites: Writes[Notification.AndUnread] = Json.writes[Notification.AndUnread]
implicit val newNotificationWrites: Writes[NewNotification] = (newNotification: NewNotification) => Json.obj(
implicit val newNotificationWrites: Writes[NewNotification] = (newNotification: NewNotification) =>
Json.obj(
"notification" -> newNotification.notification,
"unread" -> newNotification.unreadNotifications
)

View File

@ -177,7 +177,8 @@ final class Store(val coll: Coll, cacheApi: lila.memo.CacheApi, localIp: IpAddre
val olds = sessions
.groupBy(_.compositeKey)
.view
.values.flatMap(_ drop 1)
.values
.flatMap(_ drop 1)
.filter(_._id != keepSessionId)
.map(_._id)
coll.delete.one($inIds(olds)).void

View File

@ -4,7 +4,9 @@ import lila.common.IpAddress
import play.api.libs.ws.StandaloneWSClient
final class Tor(ws: StandaloneWSClient, config: SecurityConfig.Tor)(implicit ec: scala.concurrent.ExecutionContext) {
final class Tor(ws: StandaloneWSClient, config: SecurityConfig.Tor)(implicit
ec: scala.concurrent.ExecutionContext
) {
private var ips = Set.empty[IpAddress]

View File

@ -130,8 +130,8 @@ final class RemoteSocket(
}
})
val subPromise = Promise[Unit]()
conn.async.subscribe(channel).thenRun {
() => subPromise.success(())
conn.async.subscribe(channel).thenRun { () =>
subPromise.success(())
}
subPromise.future
}

View File

@ -46,7 +46,8 @@ final class Env(
settingStore[UserIds](
"streamerAlwaysFeatured",
default = UserIds(Nil),
text = "Twitch streamers who get featured without the keyword - lichess usernames separated by a comma".some
text =
"Twitch streamers who get featured without the keyword - lichess usernames separated by a comma".some
)
}