mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 08:28:39 +00:00
Fix slots page breaking when not logged in
This commit is contained in:
parent
9a1ebc0373
commit
ad7cfa9330
1 changed files with 9 additions and 3 deletions
|
@ -7,15 +7,21 @@
|
|||
@model LBPUnion.ProjectLighthouse.Levels.Slot
|
||||
|
||||
@{
|
||||
User user = (User)ViewData["User"]!;
|
||||
User? user = (User?)ViewData["User"];
|
||||
|
||||
await using Database database = new();
|
||||
|
||||
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
||||
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
||||
|
||||
bool isQueued = false;
|
||||
bool isHearted = false;
|
||||
|
||||
bool isQueued = await database.QueuedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
||||
bool isHearted = await database.HeartedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
||||
if (user != null)
|
||||
{
|
||||
isQueued = await database.QueuedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
||||
isHearted = await database.HeartedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
||||
}
|
||||
|
||||
string callbackUrl = (string)ViewData["CallbackUrl"]!;
|
||||
bool showLink = (bool?)ViewData["ShowLink"] ?? false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue