From 61793f5fe27ac355ce68b68b7bdfbd033855476b Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 25 Nov 2020 17:18:56 -0500 Subject: [PATCH] Actually fix deduplicating arguments (#249) --- PluralKit.Bot/Commands/Groups.cs | 4 ++-- PluralKit.Bot/Commands/MemberGroup.cs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index c055e191..1334cde3 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -322,6 +322,7 @@ namespace PluralKit.Bot var members = (await ctx.ParseMemberList(ctx.System.Id)) .Select(m => m.Id) + .Distinct() .ToList(); await using var conn = await _db.Obtain(); @@ -329,6 +330,7 @@ namespace PluralKit.Bot var existingMembersInGroup = (await conn.QueryMemberList(target.System, new DatabaseViewsExt.MemberListQueryOptions {GroupFilter = target.Id})) .Select(m => m.Id.Value) + .Distinct() .ToHashSet(); List toAction; @@ -337,7 +339,6 @@ namespace PluralKit.Bot { toAction = members .Where(m => !existingMembersInGroup.Contains(m.Value)) - .Distinct() .ToList(); await _repo.AddMembersToGroup(conn, target.Id, toAction); } @@ -345,7 +346,6 @@ namespace PluralKit.Bot { toAction = members .Where(m => existingMembersInGroup.Contains(m.Value)) - .Distinct() .ToList(); await _repo.RemoveMembersFromGroup(conn, target.Id, toAction); } diff --git a/PluralKit.Bot/Commands/MemberGroup.cs b/PluralKit.Bot/Commands/MemberGroup.cs index b78a5a10..6a8f9f7b 100644 --- a/PluralKit.Bot/Commands/MemberGroup.cs +++ b/PluralKit.Bot/Commands/MemberGroup.cs @@ -26,11 +26,13 @@ namespace PluralKit.Bot var groups = (await ctx.ParseGroupList(ctx.System.Id)) .Select(g => g.Id) + .Distinct() .ToList(); await using var conn = await _db.Obtain(); var existingGroups = (await _repo.GetMemberGroups(conn, target.Id).ToListAsync()) .Select(g => g.Id) + .Distinct() .ToList(); List toAction;