We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b670fb commit 25ce04eCopy full SHA for 25ce04e
1 file changed
MangoAPI.BusinessLogic/ApiCommands/Communities/LeaveGroupCommandHandler.cs
@@ -73,11 +73,13 @@ public async Task<Result<LeaveGroupResponse>> Handle(
73
74
return responseFactory.SuccessResponse(LeaveGroupResponse.FromSuccess(chat.Id));
75
}
76
-
77
- dbContext.Chats.Remove(chat);
+
+ var userChat = chat.ChatUsers.First(x => x.UserId == request.UserId);
78
chat.IncrementMembersCount(-1);
79
80
dbContext.Update(chat);
81
+ dbContext.UserChats.Remove(userChat);
82
83
await dbContext.SaveChangesAsync(cancellationToken);
84
85
0 commit comments