Skip to content

Commit

Permalink
ctservice.js: Avoid global group membership endpoint alltogether
Browse files Browse the repository at this point in the history
  • Loading branch information
fschrempf committed Oct 20, 2023
1 parent 434051e commit 1e6031e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/ctservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,17 @@ exports.getChurchToolsData = async (site) => {
});
}

if (allGroupsIds) {
log.info('Get Person IDs of Group Members from ChurchTools');
ctPersonIds = await this.getPersonsInGroups(site);
}

log.info('Get Groups from ChurchTools');
const ctGroups = await this.getGroups(allGroupsIds, site);
log.info('Get Group Memberships from ChurchTools');
const ctGroupIds = ctGroups.map((group) => group.id);
const ctGroupMembership = await this.getGroupMemberships(ctGroupIds, site);
log.info('Get Person Details from ChurchTools');
if (allGroupsIds != null) {
ctPersonIds = ctGroupMembership.map((member) => member.id);
ctPersonIds = Array.from(new Set(ctPersonIds));
}
const ctPersons = await this.getPersons(ctPersonIds, site);
log.info('Get Group Memberships from ChurchTools');
const groupIds = ctGroups.map((group) => group.id);
const ctGroupMembership = await this.getGroupMemberships(groupIds, site);

return {
groups: ctGroups,
Expand Down

0 comments on commit 1e6031e

Please sign in to comment.