-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (19 loc) · 901 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
async function invite(users, removeExisting = false) {
const projectScope = angular.element('[ng-click="openShareModal()"]').scope();
projectScope.openShareModal();
projectScope.$apply();
await new Promise(resolve => setTimeout(resolve, 300));
const inviteModalScope = angular.element('[inv-modal]').scope();
inviteModalScope.teamMembers.forEach((member) => {
const shouldInvite = users.includes(member.email) && !member.isSelectedForProject;
const shouldRemove = !users.includes(member.email) && member.isSelectedForProject && removeExisting;
if (!shouldInvite && !shouldRemove) {
return;
}
inviteModalScope.toggleTeamMemberSelection(member);
});
inviteModalScope.updateTeamMembers();
inviteModalScope.$apply();
}
// Edit that list of emails
invite(['[email protected]', '[email protected]']);