New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight issues and PRs from org members #438
Comments
I think we'd need an API key for that. This works, but it needs pagination for orgs with 101+ members: fetch('https://api.github.com/orgs/facebook/members?per_page=100')
.then(r => r.json()).then(members => {
$('.opened-by a').each((i, contributor) => {
if(members.some(m => m.login === contributor.textContent)) {
contributor.closest('.Box-row').style.background = '#eee';
}
});
}); Once v4 goes public we can get a much lighter response (but still paginated): query {
organization(login:"facebook") {
members(first: 100) {
edges {
node {
login
}
}
}
}
} |
I think we should wait for the GraphQL API. It will make this much simpler to implement. |
If you mean "wait for it to come out of early access", see https://github.com/blog/2359-introducing-github-marketplace-and-more-tools-to-customize-your-workflow |
It doesn't look like GraphQL simplifies things in this case, from what I understand the only advantage is getting only what's needed as opposed to a big JSON. I hoped you could query the visible user names directly but I don't think that's possible. |
This is actually sort of possible in a single GraphQL query: query {
sindresorhus: user(login:"sindresorhus") {
organizations(first: 100) {
edges {
node {
login
}
}
}
}
bfredit: user(login:"bfred-it") {
organizations(first: 100) {
edges {
node {
login
}
}
}
}
etc...
} This lets you query multiple specific users at once for their organizations. It still is paginated but I doubt that there are many users that joined more than 100 orgs. However: I don't know how you can tell if the current repo is part of an organization, I see no clues in the HTML. |
Just stumbled upon this and if I find the time I will take another look at it, but I see two ways to solve this. 1. Get all members of an organisation query ($org: String!, $cursor: String) {
organization(login: $org) {
login
members(first: 100, after: $cursor) {
pageInfo{
hasNextPage
endCursor
}
nodes {
login
}
}
}
} This would return a list of members and the page information {
"data": {
"organization": {
"login": "bfred-it-obsolete",
"members": {
"pageInfo": {
"hasNextPage": false,
"endCursor": "Y3Vyc29yOnYyOpHOABVlgQ=="
},
"nodes": [
{
"login": "bfred-it"
}
]
}
}
}
} If the passed {
"data": {
"organization": null
},
"errors": [
{
"message": "Could not resolve to an Organization with the login of 'bfred-it'.",
"type": "NOT_FOUND",
"path": [
"organization"
],
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
} 2. Test the query ($org: String!) {
sindresorhus: user(login: "sindresorhus") {
organization(login: $org) {
login
}
}
bfredit: user(login: "bfred-it") {
organization(login: $org) {
login
}
}
} This would return the {
"data": {
"sindresorhus": {
"organization": null
},
"bfredit": {
"organization": {
"login": "bfred-it-obsolete"
}
}
}
} Two problems I can see here are that
|
This might need a separate request for each user, perhaps cached forever.
The PR list only shows 20 PRs at a time, so that's not much of an issue. I built this type of query for my other extension, perhaps you can just copy-paste most of it: https://github.com/bfred-it/github-issue-link-status/blob/a079c3db069e16374713708b521254cecc1329c1/source/content.js#L35-L60 |
If anyone wants to pick this up: .rgh-collaborator {
border: 1px solid #c0d3eb;
border-radius: 3px;
padding: 2px 5px;
} {
repository(owner: "sindresorhus", name: "refined-github") {
collaborators(first: 100) {
nodes {
login
}
}
}
} {
"data": {
"repository": {
"collaborators": {
"nodes": [
{
"login": "sindresorhus"
},
{
"login": "hkdobrev"
},
{
"login": "SpaceK33z"
},
{
"login": "kevva"
},
{
"login": "paulmolluzzo"
},
{
"login": "busches"
},
{
"login": "bfred-it"
},
{
"login": "SamVerschueren"
},
{
"login": "jgierer12"
},
{
"login": "DrewML"
}
]
}
}
}
} |
Context: for example, in the React team, much of the work happens via PRs, even by the core team. However, these core team PRs are lost in the long, long list of contributions.
Proposal: highlight PRs that are from members of the repo owning org, Facebook in the example of React.
The text was updated successfully, but these errors were encountered: