one cannot challenge when blocked

This commit is contained in:
Thibault Duplessis 2013-06-05 14:10:01 +02:00
parent 080afeee05
commit 0e8b98f0cb
2 changed files with 12 additions and 2 deletions

View file

@ -25,8 +25,16 @@ object Setup extends LilaController with TheftPrevention {
}
def friendForm(username: Option[String]) = Open { implicit ctx
env.forms friendFilled get("fen") map {
html.setup.friend(_, username)
username ?? UserRepo.named flatMap { userOption
(userOption |@| ctx.me).tupled ?? {
case (user, me) Env.relation.api.blocks(user.id, me.id) map { blocks
!blocks option user
}
}
} flatMap { user
env.forms friendFilled get("fen") map {
html.setup.friend(_, user map (_.username))
}
}
}

View file

@ -2,12 +2,14 @@
@ctx.userId.map { myId =>
@if(myId != userId) {
@if(!blocks(userId, myId)) {
<a title="@trans.composeMessage()" href="@routes.Message.form()?username=@userId" class="icon button" href="#">
<span class="s16 message"></span>
</a>
<a title="@trans.challengeToPlay()" href="@routes.Lobby.home()?username=@userIdToUsername(userId)#friend" class="icon button" href="#">
<span class="s16 challenge"></span>
</a>
}
@relationWith(userId) match {
case None => {
<a