From db0fc609d8c2d2cb7e7cfe9a82b3e808ec46a8c1 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Wed, 26 Feb 2020 18:13:03 -0500 Subject: [PATCH] various: dedupe invites to ships in search --- pkg/interface/chat/src/js/components/lib/invite-search.js | 4 +++- .../contacts/src/js/components/lib/invite-search.js | 4 +++- .../publish/src/js/components/lib/invite-search.js | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/interface/chat/src/js/components/lib/invite-search.js b/pkg/interface/chat/src/js/components/lib/invite-search.js index 162a4b5ab2..0c18d88c0c 100644 --- a/pkg/interface/chat/src/js/components/lib/invite-search.js +++ b/pkg/interface/chat/src/js/components/lib/invite-search.js @@ -152,7 +152,9 @@ export class InviteSearch extends Component { searchValue: "", searchResults: { groups: [], ships: [] } }); - ships.push(ship); + if (!ships.includes(ship)) { + ships.push(ship); + } if (groups.length > 0) { return false; } diff --git a/pkg/interface/contacts/src/js/components/lib/invite-search.js b/pkg/interface/contacts/src/js/components/lib/invite-search.js index 12817c10d7..c429fd2d7c 100644 --- a/pkg/interface/contacts/src/js/components/lib/invite-search.js +++ b/pkg/interface/contacts/src/js/components/lib/invite-search.js @@ -152,7 +152,9 @@ export class InviteSearch extends Component { searchValue: "", searchResults: { groups: [], ships: [] } }); - ships.push(ship); + if (!ships.includes(ship)) { + ships.push(ship); + } if (groups.length > 0) { return false; } diff --git a/pkg/interface/publish/src/js/components/lib/invite-search.js b/pkg/interface/publish/src/js/components/lib/invite-search.js index 312628203d..695912d6e7 100644 --- a/pkg/interface/publish/src/js/components/lib/invite-search.js +++ b/pkg/interface/publish/src/js/components/lib/invite-search.js @@ -152,8 +152,10 @@ export class InviteSearch extends Component { searchValue: "", searchResults: { groups: [], ships: [] } }); - ships.push(ship); - if (groups.length > 0) { + if (!ships.includes(ship)) { + ships.push(ship); + } + if ((groups.length > 0)) { return false; } this.props.setInvite({ groups: groups, ships: ships });