override User.equals using only id
This commit is contained in:
parent
70c483dff8
commit
e761097361
|
@ -54,7 +54,7 @@ object Relation extends LilaController {
|
|||
lila.game.BestOpponents(user.id, 50) zip
|
||||
env.api.onlinePopularUsers(20) map {
|
||||
case (opponents, popular) ⇒ popular.filterNot(user ==).foldLeft(opponents) {
|
||||
case (xs, x) ⇒ xs.exists(_._1 is x).fold(xs, xs :+ (x, 0))
|
||||
case (xs, x) ⇒ xs.exists(_._1 == x).fold(xs, xs :+ (x, 0))
|
||||
} |> { html.relation.suggest(user, _) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ sealed abstract class Context(val req: RequestHeader, val me: Option[User]) {
|
|||
|
||||
def isAnon = !isAuth
|
||||
|
||||
def is(user: User): Boolean = me == Some(user)
|
||||
def is(user: User): Boolean = me ?? (user ==)
|
||||
|
||||
def userId = me map (_.id)
|
||||
|
||||
|
|
|
@ -19,9 +19,12 @@ case class User(
|
|||
createdAt: DateTime,
|
||||
seenAt: Option[DateTime]) extends Ordered[User] {
|
||||
|
||||
def compare(other: User) = id compare other.id
|
||||
override def equals(other: Any) = other match {
|
||||
case u: User ⇒ id == u.id
|
||||
case _ ⇒ false
|
||||
}
|
||||
|
||||
def is(other: User) = id == other.id
|
||||
def compare(other: User) = id compare other.id
|
||||
|
||||
def noTroll = !troll
|
||||
|
||||
|
@ -36,7 +39,7 @@ case class User(
|
|||
def nonEmptyBio = bio filter ("" !=)
|
||||
|
||||
def hasGames = count.game > 0
|
||||
|
||||
|
||||
def countRated = count.rated
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue