Simplify conditional expression

pull/9607/head
Stepan Goremykin 1 year ago
parent 19e65269a2
commit b6cfdb8b92

@ -571,9 +571,7 @@ namespace Emby.Server.Implementations.Dto
return null; return null;
} }
}).Where(i => i is not null) }).Where(i => i is not null)
.Where(i => user is null ? .Where(i => user is null || i.IsVisible(user))
true :
i.IsVisible(user))
.DistinctBy(x => x.Name, StringComparer.OrdinalIgnoreCase) .DistinctBy(x => x.Name, StringComparer.OrdinalIgnoreCase)
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase); .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);

@ -2749,9 +2749,7 @@ namespace Emby.Server.Implementations.Library
} }
}) })
.Where(i => i is not null) .Where(i => i is not null)
.Where(i => query.User is null ? .Where(i => query.User is null || i.IsVisible(query.User))
true :
i.IsVisible(query.User))
.ToList(); .ToList();
} }

@ -133,9 +133,7 @@ namespace Jellyfin.Server.Migrations.Routines
SkipBackwardLength = dto.CustomPrefs.TryGetValue("skipBackLength", out length) && int.TryParse(length, out var skipBackwardLength) SkipBackwardLength = dto.CustomPrefs.TryGetValue("skipBackLength", out length) && int.TryParse(length, out var skipBackwardLength)
? skipBackwardLength ? skipBackwardLength
: 10000, : 10000,
EnableNextVideoInfoOverlay = dto.CustomPrefs.TryGetValue("enableNextVideoInfoOverlay", out var enabled) && !string.IsNullOrEmpty(enabled) EnableNextVideoInfoOverlay = !dto.CustomPrefs.TryGetValue("enableNextVideoInfoOverlay", out var enabled) || string.IsNullOrEmpty(enabled) || bool.Parse(enabled),
? bool.Parse(enabled)
: true,
DashboardTheme = dto.CustomPrefs.TryGetValue("dashboardtheme", out var theme) ? theme : string.Empty, DashboardTheme = dto.CustomPrefs.TryGetValue("dashboardtheme", out var theme) ? theme : string.Empty,
TvHome = dto.CustomPrefs.TryGetValue("tvhome", out var home) ? home : string.Empty TvHome = dto.CustomPrefs.TryGetValue("tvhome", out var home) ? home : string.Empty
}; };

Loading…
Cancel
Save