Added new analytics datapoint to capture invite users event (#4095)

New analytics datapoint added to capture event : invite users to organisation
This commit is contained in:
Abhijeet 2021-04-22 10:59:47 +05:30 committed by GitHub
parent 6b31aa333b
commit 005e00a8a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -638,7 +638,23 @@ public class UserServiceImpl extends BaseService<UserRepository, User, String> i
//Lets save the updated user object
return repository.save(invitedUser);
})
.collectList();
.collectList()
.flatMap(users -> Mono.zip(Mono.just(users), currentUserMono))
.flatMap(tuple -> {
List<User> users = tuple.getT1();
User currentUser = tuple.getT2();
HashMap<String, Object> analyticsProperties = new HashMap<>();
long numberOfUsers = users.size();
List<String> invitedUsers = new ArrayList<>();
for (User user: users) {
invitedUsers.add(user.getEmail());
}
analyticsProperties.put("numberOfUsersInvited", numberOfUsers);
analyticsProperties.put("userEmails", invitedUsers);
analyticsService.sendEvent("execute_INVITE_USERS", currentUser.getEmail(), analyticsProperties);
return Mono.just(users);
});
// Trigger the flow to first add the users to the organization and then update each user with the organizationId
// added to the user's list of organizations.