Skip to content

Commit

Permalink
fix: call to getGithubTeamsForMember when not an org
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Jan 21, 2023
1 parent ab21e7f commit 5403fb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/context/accountContext.ts
Expand Up @@ -216,7 +216,7 @@ const initAccountContext = async <
getGithubTeamsForMember: async (memberId): Promise<OrgMember['teams']> => {
if (accountInfo.type !== 'Organization') {
throw new Error(
`Invalid account type "${accountInfo.type}" for getTeamsForMember`,
`Invalid account type "${accountInfo.type}" for getGithubTeamsForMember`,
);
}
const orgMember = await appContext.mongoStores.orgMembers.findOne({
Expand Down
4 changes: 3 additions & 1 deletion src/events/pr-handlers/reviewSubmitted.ts
Expand Up @@ -74,7 +74,9 @@ export default function reviewSubmitted(
const [{ reviewers, reviewStates }, reviewerGithubTeams] =
await Promise.all([
getReviewersAndReviewStates(context, repoContext),
repoContext.getGithubTeamsForMember(reviewer.id),
repoContext.accountEmbed.type !== 'Organization'
? []
: repoContext.getGithubTeamsForMember(reviewer.id),
]);
const { owner, assignees, followers } =
getRolesFromPullRequestAndReviewers(pullRequest, reviewers, {
Expand Down

0 comments on commit 5403fb0

Please sign in to comment.