fix display of active but absent chans

This commit is contained in:
Thibault Duplessis 2014-01-04 12:25:23 +01:00
parent 66561f004d
commit 32002143d9
2 changed files with 6 additions and 4 deletions

View file

@ -59,8 +59,8 @@ private[chat] final class Api(
def populate(head: ChatHead, user: User): Fu[Chat] =
namer.chans(head.chans, user) zip {
relationApi blocking user.id flatMap {
LineRepo.find(head.activeChanKeys, user.troll, _, NB_LINES) flatMap {
relationApi blocking user.id flatMap { blocks =>
LineRepo.find(head.watchingChanKeys, user.troll, blocks, NB_LINES) flatMap {
_.map(namer.line).sequenceFu
}
}

View file

@ -13,7 +13,7 @@ case class ChatHead(
activeChanKeys: Set[String],
mainChanKey: Option[String]) {
def chanKeys = chans map (_.key)
lazy val chanKeys = chans map (_.key)
def setChan(c: Chan, value: Boolean) =
if (value) copy(chans = (c :: chans).distinct).sorted
@ -49,7 +49,9 @@ case class ChatHead(
activeChans = activeChanKeys filterNot Chan.autoActive,
mainChan = (mainChanKey filterNot Chan.autoActive) orElse pref.mainChan)
def sees(line: Line) = (chanKeys contains line.chan.key) && (activeChanKeys contains line.chan.key)
def sees(line: Line) = watchingChanKeys contains line.chan.key
lazy val watchingChanKeys = activeChanKeys intersect chanKeys.toSet
def sorted = copy(chans = chans.sorted)
}