From 2fb14f598dd51ad2cf830e4c3e2ad9f5a2791a74 Mon Sep 17 00:00:00 2001 From: Jeff McAffer Date: Fri, 9 Dec 2016 08:50:13 -0800 Subject: [PATCH] Add repo types for token trait user --- lib/githubFetcher.js | 5 +++-- lib/processor.js | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/githubFetcher.js b/lib/githubFetcher.js index 9f493f5..b009c2b 100644 --- a/lib/githubFetcher.js +++ b/lib/githubFetcher.js @@ -137,8 +137,9 @@ class GitHubFetcher { } _getToken(request) { - const typeDetails = this._getTypeDetails(request.type); - return this.tokenFactory.getToken(typeDetails.tokenTraits); + const traits = this._getTypeDetails(request.type).tokenTraits; + const repoType = request.context.repoType; + return this.tokenFactory.getToken(traits.concat(repoType ? [repoType] : [])); } _getHeaders(request) { diff --git a/lib/processor.js b/lib/processor.js index 22d7bd9..e018fb3 100644 --- a/lib/processor.js +++ b/lib/processor.js @@ -126,6 +126,9 @@ class Processor { // * invitations // * stargazers const document = request.document; + if (document.private) { + request.context.repoType = 'private'; + } request.addRootSelfLink(); request.linkSiblings(`urn:user:${document.owner.id}:repos`);