one can chat alone

This commit is contained in:
Thibault Duplessis 2014-01-04 12:41:05 +01:00
parent 5dfad3eb19
commit eca241b950
2 changed files with 4 additions and 1 deletions

View file

@ -44,7 +44,7 @@ private[chat] final class ChatActor(
api.systemWrite(chan, text) pipeTo self
}
case SetOpen(member, value) prefApi.setChatPref(member.userId, _.copy(on = value))
case SetOpen(member, value) prefApi.setChatPref(member.userId, _.copy(on = value))
case SetHeight(member, value) prefApi.setChatPref(member.userId, _.copy(height = value))
@ -71,6 +71,7 @@ private[chat] final class ChatActor(
}
case Query(member, toId) api getUserOption toId foreach {
case Some(to) if member.is(toId) self ! Flash(member, "Can't start a private chat with yourself")
case Some(to) relationApi.follows(to.id, member.userId) onSuccess {
case true api.join(member, UserChan(member.userId, toId)) foreach { head
member setHead head

View file

@ -21,6 +21,8 @@ private[chat] final class ChatMember(
def hasActiveChan = head.activeChanKeys contains _
def is(username: String) = userId == username.toLowerCase
def tell(msg: JsValue) {
channel push msg
}