diff --git a/api/handlers/slack.ts b/api/handlers/slack.ts index 320503789..483a4db62 100644 --- a/api/handlers/slack.ts +++ b/api/handlers/slack.ts @@ -24,15 +24,18 @@ export async function buildEntitledBranchList(entitlement: any, repoBranchesRepo const [repoOwner, repoName, directoryPath] = repo.split('/'); const branches = await repoBranchesRepository.getRepoBranches(repoName, directoryPath); for (const branch of branches) { - if ('buildWithSnooty' in branch && branch['buildsWithSnooty']) { - const active = branch['active']; - const repoPath = `${repoOwner}/${repoName}${directoryPath ? '/' + directoryPath : ''}/${ - branch['gitBranchName'] - }`; - if (!active) { - entitledBranches.push(`!inactive ` + `${repoPath}`); - } else { - entitledBranches.push(repoPath); + if ('buildsWithSnooty' in branch) { + const buildWithSnooty = branch['buildsWithSnooty']; + if (buildWithSnooty) { + const active = branch['active']; + const repoPath = `${repoOwner}/${repoName}${directoryPath ? '/' + directoryPath : ''}/${ + branch['gitBranchName'] + }`; + if (!active) { + entitledBranches.push(`!inactive ` + `${repoPath}`); + } else { + entitledBranches.push(repoPath); + } } } }