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

@@ -1289,14 +1289,13 @@ namespace Discord.WebSocket
if (user != null)
{
var globalBefore = user.GlobalUser.Clone();
var before = user.Clone();
if (user.GlobalUser.Update(State, data.User))
{
//Global data was updated, trigger UserUpdated
await TimedInvokeAsync(_userUpdatedEvent, nameof(UserUpdated), globalBefore, user).ConfigureAwait(false);
await TimedInvokeAsync(_userUpdatedEvent, nameof(UserUpdated), before.GlobalUser, user).ConfigureAwait(false);
}
var before = user.Clone();
user.Update(State, data);
var cacheableBefore = new Cacheable<SocketGuildUser, ulong>(before, user.Id, true, () => null);