fixes issue where character hash of paused users in a syncshell was uselessly sent
This commit is contained in:
@@ -22,7 +22,8 @@ public partial class MareHub
|
||||
{
|
||||
UID = Convert.ToString(userPair.OtherUserUID),
|
||||
GID = "DIRECT",
|
||||
PauseState = (userPair.IsPaused || otherUserPair.IsPaused)
|
||||
PauseStateSelf = userPair.IsPaused,
|
||||
PauseStateOther = otherUserPair.IsPaused
|
||||
})
|
||||
.Union(
|
||||
(from userGroupPair in _dbContext.GroupPairs
|
||||
@@ -34,15 +35,16 @@ public partial class MareHub
|
||||
{
|
||||
UID = Convert.ToString(otherGroupPair.GroupUserUID),
|
||||
GID = Convert.ToString(otherGroupPair.GroupGID),
|
||||
PauseState = (userGroupPair.IsPaused || otherGroupPair.IsPaused)
|
||||
PauseStateSelf = userGroupPair.IsPaused,
|
||||
PauseStateOther = otherGroupPair.IsPaused,
|
||||
})
|
||||
).AsNoTracking().ToListAsync().ConfigureAwait(false);
|
||||
|
||||
return query.GroupBy(g => g.UID, g => (g.GID, g.PauseState),
|
||||
return query.GroupBy(g => g.UID, g => (g.GID, g.PauseStateSelf, g.PauseStateOther),
|
||||
(key, g) => new PausedEntry
|
||||
{
|
||||
UID = key,
|
||||
PauseStates = g.Select(p => new PauseState() { GID = string.Equals(p.GID, "DIRECT", StringComparison.Ordinal) ? null : p.GID, IsPaused = p.PauseState })
|
||||
PauseStates = g.Select(p => new PauseState() { GID = string.Equals(p.GID, "DIRECT", StringComparison.Ordinal) ? null : p.GID, IsSelfPaused = p.PauseStateSelf, IsOtherPaused = p.PauseStateOther })
|
||||
.ToList()
|
||||
}, StringComparer.Ordinal).ToList();
|
||||
}
|
||||
|
||||
@@ -407,6 +407,7 @@ public partial class MareHub
|
||||
{
|
||||
if (userPair.IsDirectlyPaused != PauseInfo.NoConnection) continue;
|
||||
if (userPair.IsPausedExcludingGroup(gid) is PauseInfo.Unpaused) continue;
|
||||
if (userPair.IsOtherPausedForSpecificGroup(gid) is PauseInfo.Paused) continue;
|
||||
}
|
||||
|
||||
var groupUserIdent = _clientIdentService.GetCharacterIdentForUid(groupUserPair.GroupUserUID);
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
public record PauseState
|
||||
{
|
||||
public string GID { get; set; }
|
||||
public bool IsPaused { get; set; }
|
||||
public bool IsPaused => IsSelfPaused || IsOtherPaused;
|
||||
public bool IsSelfPaused { get; set; }
|
||||
public bool IsOtherPaused { get; set; }
|
||||
}
|
||||
@@ -37,6 +37,13 @@ public record PausedEntry
|
||||
}
|
||||
}
|
||||
|
||||
public PauseInfo IsOtherPausedForSpecificGroup(string gid)
|
||||
{
|
||||
var state = PauseStatesWithoutDirect.SingleOrDefault(g => string.Equals(g.GID, gid, StringComparison.Ordinal));
|
||||
if (state == null) return PauseInfo.NoConnection;
|
||||
return state.IsOtherPaused ? PauseInfo.Paused : PauseInfo.Unpaused;
|
||||
}
|
||||
|
||||
public PauseInfo IsPausedForSpecificGroup(string gid)
|
||||
{
|
||||
var state = PauseStatesWithoutDirect.SingleOrDefault(g => string.Equals(g.GID, gid, StringComparison.Ordinal));
|
||||
|
||||
Reference in New Issue
Block a user