Commit eb183a7b authored by Martin Lowe's avatar Martin Lowe 🇨🇦
Browse files

Merge branch 'malowe/master/fixbotcheck' into 'master'

Fix weirdness w bot check when project has no bots

See merge request !217
parents 042c2a91 33e8b647
Pipeline #5821 passed with stage
in 0 seconds
......@@ -393,6 +393,7 @@ export class GitlabSyncRunner {
const projectMembers = await this.api.ProjectMembers.all(project.id, { includeInherited: false });
for (const idx in projectMembers) {
const member = projectMembers[idx];
this.logger.verbose(`Checking '${member.username}' for removal on project '${project.namespace.full_path}'(${member.access_level})`);
// skip bot user or admin users
if (this.isBot(member.username, projectIDs) || member.access_level === adminPermissionsLevel) {
continue;
......@@ -821,7 +822,7 @@ export class GitlabSyncRunner {
* @returns true if the user is a designated bot for the projects, otherwise false.
*/
isBot(uname: string, projectIDs: string[]): boolean {
return projectIDs.some(v => this.bots[v]?.indexOf(uname) !== -1);
return projectIDs.some(v => this.bots[v] !== undefined && this.bots[v]!.indexOf(uname) !== -1);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment