mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 10:08: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
|
@model LBPUnion.ProjectLighthouse.Levels.Slot
|
||||||
|
|
||||||
@{
|
@{
|
||||||
User user = (User)ViewData["User"]!;
|
User? user = (User?)ViewData["User"];
|
||||||
|
|
||||||
await using Database database = new();
|
await using Database database = new();
|
||||||
|
|
||||||
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
||||||
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
||||||
|
|
||||||
bool isQueued = await database.QueuedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
bool isQueued = false;
|
||||||
bool isHearted = await database.HeartedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
bool isHearted = false;
|
||||||
|
|
||||||
|
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"]!;
|
string callbackUrl = (string)ViewData["CallbackUrl"]!;
|
||||||
bool showLink = (bool?)ViewData["ShowLink"] ?? false;
|
bool showLink = (bool?)ViewData["ShowLink"] ?? false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue