Skip to content

Commit

Permalink
Feat : Add remove existing param
Browse files Browse the repository at this point in the history
Add the given emails and remove every other invites
  • Loading branch information
clementmoine committed Mar 20, 2023
1 parent cf2a2b4 commit 203b0e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
async function invite(users) {
async function invite(users, removeExisting = false) {
const projectScope = angular.element('[ng-click="openShareModal()"]').scope();

projectScope.openShareModal();
Expand All @@ -9,7 +9,10 @@ async function invite(users) {
const inviteModalScope = angular.element('[inv-modal]').scope();

inviteModalScope.teamMembers.forEach((member) => {
if (!users.includes(member.email) || member.isSelectedForProject) {
const shouldInvite = users.includes(member.email) && !member.isSelectedForProject;
const shouldRemove = !users.includes(member.email) && member.isSelectedForProject && removeExisting;

if (!shouldInvite && !shouldRemove) {
return;
}

Expand Down

0 comments on commit 203b0e6

Please sign in to comment.