This commit is contained in:
rootdarkarchon
2023-10-26 19:58:40 +02:00
parent 2f17a47378
commit 8b49fb5788

View File

@@ -7,7 +7,6 @@ using MareSynchronos.API.Data;
using MareSynchronos.API.Dto.Group; using MareSynchronos.API.Dto.Group;
using MareSynchronosShared.Metrics; using MareSynchronosShared.Metrics;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using MareSynchronosShared.Data;
namespace MareSynchronosServer.Hubs; namespace MareSynchronosServer.Hubs;
@@ -251,8 +250,8 @@ public partial class MareHub
private async Task<UserInfo?> GetPairInfo(string uid, string otheruid) private async Task<UserInfo?> GetPairInfo(string uid, string otheruid)
{ {
var clientPairs = from cp in _dbContext.ClientPairs.Where(u => u.UserUID == uid && u.OtherUserUID == otheruid) var clientPairs = from cp in _dbContext.ClientPairs
join cp2 in _dbContext.ClientPairs.Where(u => u.OtherUserUID == uid && u.UserUID == otheruid) join cp2 in _dbContext.ClientPairs
on new on new
{ {
UserUID = cp.UserUID, UserUID = cp.UserUID,
@@ -264,7 +263,7 @@ public partial class MareHub
OtherUserUID = cp2.UserUID OtherUserUID = cp2.UserUID
} into joined } into joined
from c in joined.DefaultIfEmpty() from c in joined.DefaultIfEmpty()
where cp.UserUID == uid where cp.UserUID == uid && cp.OtherUserUID == otheruid
select new select new
{ {
UserUID = cp.UserUID, UserUID = cp.UserUID,
@@ -274,8 +273,8 @@ public partial class MareHub
}; };
var groupPairs = from gp in _dbContext.GroupPairs.Where(u => u.GroupUserUID == uid) var groupPairs = from gp in _dbContext.GroupPairs
join gp2 in _dbContext.GroupPairs.Where(u => u.GroupUserUID == otheruid) join gp2 in _dbContext.GroupPairs
on new on new
{ {
GID = gp.GroupGID GID = gp.GroupGID
@@ -284,7 +283,7 @@ public partial class MareHub
{ {
GID = gp2.GroupGID GID = gp2.GroupGID
} }
where gp.GroupUserUID == uid where gp.GroupUserUID == uid && gp2.GroupUserUID == otheruid
select new select new
{ {
UserUID = gp.GroupUserUID, UserUID = gp.GroupUserUID,
@@ -306,8 +305,7 @@ public partial class MareHub
into otherperms into otherperms
from otherperm in otherperms.DefaultIfEmpty() from otherperm in otherperms.DefaultIfEmpty()
where user.UserUID == uid where user.UserUID == uid
&& u.UID == user.OtherUserUID && user.OtherUserUID == otheruid
&& ownperm.UserUID == uid
select new select new
{ {
UserUID = user.UserUID, UserUID = user.UserUID,
@@ -334,8 +332,8 @@ public partial class MareHub
private async Task<Dictionary<string, UserInfo>> GetAllPairInfo(string uid) private async Task<Dictionary<string, UserInfo>> GetAllPairInfo(string uid)
{ {
var clientPairs = from cp in _dbContext.ClientPairs.Where(u => u.UserUID == uid) var clientPairs = from cp in _dbContext.ClientPairs
join cp2 in _dbContext.ClientPairs.Where(u => u.OtherUserUID == uid) join cp2 in _dbContext.ClientPairs
on new on new
{ {
UserUID = cp.UserUID, UserUID = cp.UserUID,
@@ -357,8 +355,8 @@ public partial class MareHub
}; };
var groupPairs = from gp in _dbContext.GroupPairs.Where(u => u.GroupUserUID == uid) var groupPairs = from gp in _dbContext.GroupPairs
join gp2 in _dbContext.GroupPairs.Where(u => u.GroupUserUID != uid) join gp2 in _dbContext.GroupPairs
on new on new
{ {
GID = gp.GroupGID GID = gp.GroupGID
@@ -367,7 +365,7 @@ public partial class MareHub
{ {
GID = gp2.GroupGID GID = gp2.GroupGID
} }
where gp.GroupUserUID == uid where gp.GroupUserUID == uid && gp2.GroupUserUID != uid
select new select new
{ {
UserUID = gp.GroupUserUID, UserUID = gp.GroupUserUID,
@@ -388,9 +386,6 @@ public partial class MareHub
equals new { UserUID = p.UserUID, OtherUserUID = p.OtherUserUID } equals new { UserUID = p.UserUID, OtherUserUID = p.OtherUserUID }
into otherperms into otherperms
from otherperm in otherperms.DefaultIfEmpty() from otherperm in otherperms.DefaultIfEmpty()
where user.UserUID == uid
&& u.UID == user.OtherUserUID
&& ownperm.UserUID == uid
select new select new
{ {
UserUID = user.UserUID, UserUID = user.UserUID,