one cannot challenge when blocked
This commit is contained in:
parent
080afeee05
commit
0e8b98f0cb
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue