Skip to content

Commit

Permalink
Merge pull request #45 from bswinnerton/use-repo-affiliation
Browse files Browse the repository at this point in the history
Only ask for owned repositories from GitHub
  • Loading branch information
bswinnerton authored Mar 10, 2017
2 parents 7c33390 + bf07115 commit 792fd56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
14 changes: 4 additions & 10 deletions Contents/Scripts/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ class Account {
return this._fetchRepositories();
});

return repositoryEdges.reduce(function(repositories, edge) {
return repositoryEdges.map(function(edge) {
let repo = edge.node;
let owner = new Account(repo.owner.login);

// Only return repositories that the account directly owns
if (owner.login === this.login) {
let repository = new Repository(owner, repo.name, repo.description);
repositories.push(repository);
}

return repositories;
}.bind(this), []);
return new Repository(owner, repo.name, repo.description);
});
}

_fetchRepositories(cursor, allEdges) {
Expand All @@ -54,7 +48,7 @@ class Account {
const query = `
query($login: String!, $cursor: String) {
repositoryOwner(login: $login) {
repositories(first: 30, after: $cursor, orderBy: {field: PUSHED_AT, direction: DESC}) {
repositories(first: 30, after: $cursor, affiliation:[OWNER], orderBy: {field: PUSHED_AT, direction: DESC}) {
edges {
cursor
node {
Expand Down
3 changes: 1 addition & 2 deletions Contents/Scripts/bundle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 792fd56

Please sign in to comment.