FIx more issues with challenges.
This commit is contained in:
@@ -120,7 +120,8 @@ public class HomeController : Controller
|
||||
var challenge = _database.GetChallenge(id);
|
||||
if (challenge == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
// Challenge not found.
|
||||
return NotFound();
|
||||
}
|
||||
var model = new ChallengeViewModel
|
||||
{
|
||||
|
||||
@@ -73,6 +73,11 @@ public class InMemoryDatabase : ISingletonDependency
|
||||
{
|
||||
lock (Challenges)
|
||||
{
|
||||
if (Challenges.All(t => t.Value.Permission != ChallengePermission.Public))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Challenges
|
||||
.FirstOrDefault(t => t.Value.Permission == ChallengePermission.Public)
|
||||
.Key;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1 class="display-4">Waiting for joining...</h1>
|
||||
<h1 class="display-4">Waiting for opponent joining...</h1>
|
||||
<p class="lead">Please share the link of this room to your friend!</p>
|
||||
@{
|
||||
var link = $"{Context.Request.Scheme}://{Context.Request.Host}/Home/{nameof(HomeController.Challenge)}/{Model.RoomId}";
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<td>@item.Value.Message</td>
|
||||
<td>@item.Value.Creator.NickName</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-primary" data-room-id="@item.Key">Join</button>
|
||||
<a class="btn btn-sm btn-primary" asp-controller="Home" asp-action="Challenge" asp-route-id="@item.Key">Join</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user