mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 21:37:59 +03:00
Use Enumerable.LeftJoin for activity log user query
This commit is contained in:
@@ -56,11 +56,11 @@ public class ActivityManager : IActivityManager
|
|||||||
var dbContext = await _provider.CreateDbContextAsync().ConfigureAwait(false);
|
var dbContext = await _provider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
// TODO switch to LeftJoin in .NET 10.
|
var entries = dbContext.ActivityLogs.LeftJoin(
|
||||||
var entries = from a in dbContext.ActivityLogs
|
dbContext.Users,
|
||||||
join u in dbContext.Users on a.UserId equals u.Id into ugj
|
a => a.UserId,
|
||||||
from u in ugj.DefaultIfEmpty()
|
u => u.Id,
|
||||||
select new ExpandedActivityLog { ActivityLog = a, Username = u.Username };
|
(a, u) => new ExpandedActivityLog { ActivityLog = a, Username = u == null ? null : u.Username });
|
||||||
|
|
||||||
if (query.HasUserId is not null)
|
if (query.HasUserId is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user