fix: Clone being created on updated entity (#2077)

* Patch clone being created on updated entity

* Clone globaluser as its not within the same instance

* Clone the globaluser alongside the guilduser

* Patch, non-assigned

* Update user entities for globaluser setter
This commit is contained in:
Armano den Boef
2022-02-03 19:03:22 +01:00
committed by GitHub
parent 9116c9a97c
commit 7d6f4f3b6c
9 changed files with 18 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ namespace Discord.WebSocket
private long? _joinedAtTicks;
private ImmutableArray<ulong> _roleIds;
internal override SocketGlobalUser GlobalUser { get; }
internal override SocketGlobalUser GlobalUser { get; set; }
/// <summary>
/// Gets the guild the user is in.
/// </summary>
@@ -248,7 +248,13 @@ namespace Discord.WebSocket
=> CDN.GetGuildUserAvatarUrl(Id, Guild.Id, GuildAvatarId, size, format);
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")}, Guild)";
internal new SocketGuildUser Clone() => MemberwiseClone() as SocketGuildUser;
internal new SocketGuildUser Clone()
{
var clone = MemberwiseClone() as SocketGuildUser;
clone.GlobalUser = GlobalUser.Clone();
return clone;
}
#endregion
#region IGuildUser