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),
|
UID = Convert.ToString(userPair.OtherUserUID),
|
||||||
GID = "DIRECT",
|
GID = "DIRECT",
|
||||||
PauseState = (userPair.IsPaused || otherUserPair.IsPaused)
|
PauseStateSelf = userPair.IsPaused,
|
||||||
|
PauseStateOther = otherUserPair.IsPaused
|
||||||
})
|
})
|
||||||
.Union(
|
.Union(
|
||||||
(from userGroupPair in _dbContext.GroupPairs
|
(from userGroupPair in _dbContext.GroupPairs
|
||||||
@@ -34,15 +35,16 @@ public partial class MareHub
|
|||||||
{
|
{
|
||||||
UID = Convert.ToString(otherGroupPair.GroupUserUID),
|
UID = Convert.ToString(otherGroupPair.GroupUserUID),
|
||||||
GID = Convert.ToString(otherGroupPair.GroupGID),
|
GID = Convert.ToString(otherGroupPair.GroupGID),
|
||||||
PauseState = (userGroupPair.IsPaused || otherGroupPair.IsPaused)
|
PauseStateSelf = userGroupPair.IsPaused,
|
||||||
|
PauseStateOther = otherGroupPair.IsPaused,
|
||||||
})
|
})
|
||||||
).AsNoTracking().ToListAsync().ConfigureAwait(false);
|
).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
|
(key, g) => new PausedEntry
|
||||||
{
|
{
|
||||||
UID = key,
|
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()
|
.ToList()
|
||||||
}, StringComparer.Ordinal).ToList();
|
}, StringComparer.Ordinal).ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,6 +407,7 @@ public partial class MareHub
|
|||||||
{
|
{
|
||||||
if (userPair.IsDirectlyPaused != PauseInfo.NoConnection) continue;
|
if (userPair.IsDirectlyPaused != PauseInfo.NoConnection) continue;
|
||||||
if (userPair.IsPausedExcludingGroup(gid) is PauseInfo.Unpaused) continue;
|
if (userPair.IsPausedExcludingGroup(gid) is PauseInfo.Unpaused) continue;
|
||||||
|
if (userPair.IsOtherPausedForSpecificGroup(gid) is PauseInfo.Paused) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var groupUserIdent = _clientIdentService.GetCharacterIdentForUid(groupUserPair.GroupUserUID);
|
var groupUserIdent = _clientIdentService.GetCharacterIdentForUid(groupUserPair.GroupUserUID);
|
||||||
|
|||||||
@@ -3,5 +3,7 @@
|
|||||||
public record PauseState
|
public record PauseState
|
||||||
{
|
{
|
||||||
public string GID { get; set; }
|
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)
|
public PauseInfo IsPausedForSpecificGroup(string gid)
|
||||||
{
|
{
|
||||||
var state = PauseStatesWithoutDirect.SingleOrDefault(g => string.Equals(g.GID, gid, StringComparison.Ordinal));
|
var state = PauseStatesWithoutDirect.SingleOrDefault(g => string.Equals(g.GID, gid, StringComparison.Ordinal));
|
||||||
|
|||||||
Reference in New Issue
Block a user