From 053e5c5494de86b1b114dcb1e1d5245a11472a19 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 5 Feb 2021 20:15:50 +0200 Subject: Added a workaround for removing all friends --- src/DevHive.Services/Services/UserService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs index 99ac050..22d5052 100644 --- a/src/DevHive.Services/Services/UserService.cs +++ b/src/DevHive.Services/Services/UserService.cs @@ -128,7 +128,10 @@ namespace DevHive.Services.Services User currentUser = await this._userRepository.GetByIdAsync(updateUserServiceModel.Id); await this.PopulateUserModel(currentUser, updateUserServiceModel); - await this.CreateRelationToFriends(currentUser, updateUserServiceModel.Friends.ToList()); + if (updateUserServiceModel.Friends.Count() > 0) + await this.CreateRelationToFriends(currentUser, updateUserServiceModel.Friends.ToList()); + else + currentUser.Friends.Clear(); IdentityResult result = await this._userManager.UpdateAsync(currentUser); -- cgit v1.2.3