{"action":"created","comment":{"url":"https://api.github.com/repos/w3c/respec/pulls/comments/31965263","id":31965263,"diff_hunk":"@@ -0,0 +1,98 @@\n+// Module core/contrib\n+// Fetches names of contributors from github and uses them to fill\n+// in the content of elements with key identifiers:\n+// #gh-commenters: people having contributed comments to issues.\n+// #gh-contributors: people whose PR have been merged.\n+// Spec editors get filtered out automatically.\n+\n+define(\n+    [\"github\"],\n+    function (github) {\n+        return {\n+            run: function (conf, doc, cb, msg) {\n+                function theEnd () {\n+                    msg.pub(\"end\", \"core/contrib\");\n+                    cb();\n+                }\n+                \n+                function prop(prop) {\n+                    return function (o) {\n+                        return o[prop];\n+                    };\n+                }\n+                \n+                function slice(args) {\n+                    return Array.prototype.slice.call(args, 0)\n+                }\n+\n+                function findUsers() {\n+                    var users = {};\n+                    slice(arguments).forEach(function (things) {\n+                        things.forEach(function (thing) {\n+                            if (thing.user) {\n+                                users[thing.user.url] = true;\n+                            }\n+                        });\n+                    });\n+                    return Object.keys(users);\n+                }  \n+\n+                function join(things) {\n+                    if (!things.length) {\n+                        return \"\";\n+                    }\n+                    things = things.slice(0);\n+                    var last = things.pop();\n+                    var length = things.length;\n+                    if (length === 0) {\n+                        return last;\n+                    }\n+                    if (length === 1) {\n+                        return things[0] + \" and \" + last;\n+                    }\n+                    return things.join(\", \") + \", and \" + last;\n+                }\n+\n+                function toHTML(urls, editors, element) {\n+                    return $.when.apply($, urls.map(function (url) {\n+                        return github.fetch(url);\n+                    })).then(function () {\n+                        var names = slice(arguments).map(function (user) {\n+                            user = user[0];\n+                            return user.name || user.login;\n+                        }).filter(function (name) {\n+                            return editors.indexOf(name) < 0;\n+                        });\n+                        names.sort(function (a, b) {\n+                            return a.toLowerCase().localeCompare(b.toLowerCase());\n+                        });\n+                        $(element).html(join(names)).attr(\"id\", null);\n+                    });\n+                }\n+\n+                msg.pub(\"start\", \"core/contrib\");\n+                var $commenters = $(doc).find(\"#gh-commenters\")[0];\n+                var $contributors = $(doc).find(\"#gh-contributors\")[0];\n+                if (conf.githubAPI && ($commenters || $contributors)) {\n+                    github.fetch(conf.githubAPI).then(function (json) {\n+                        return $.when(\n+                            github.fetchIndex(json.issues_url),\n+                            github.fetchIndex(json.issue_comment_url),\n+                            github.fetchIndex(json.contributors_url)\n+                        ).then(function(issues, comments, contributors) {\n+                            var editors = respecConfig.editors.map(prop(\"name\"));\n+                            var commenters = findUsers(issues, comments);\n+                            contributors = contributors.map(prop(\"url\"));\n+                            return $.when(\n+                                toHTML(commenters, editors, $commenters),\n+                                toHTML(contributors, editors, $contributors)\n+                            );\n+                        });\n+                    }).then(theEnd);","path":"js/core/contrib.js","position":91,"original_position":91,"commit_id":"9b760f6f980562ddf323afd0f5ee29ff2888a1e6","original_commit_id":"9b760f6f980562ddf323afd0f5ee29ff2888a1e6","user":{"login":"marcoscaceres","id":870154,"avatar_url":"https://avatars.githubusercontent.com/u/870154?v=3","gravatar_id":"","url":"https://api.github.com/users/marcoscaceres","html_url":"https://github.com/marcoscaceres","followers_url":"https://api.github.com/users/marcoscaceres/followers","following_url":"https://api.github.com/users/marcoscaceres/following{/other_user}","gists_url":"https://api.github.com/users/marcoscaceres/gists{/gist_id}","starred_url":"https://api.github.com/users/marcoscaceres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcoscaceres/subscriptions","organizations_url":"https://api.github.com/users/marcoscaceres/orgs","repos_url":"https://api.github.com/users/marcoscaceres/repos","events_url":"https://api.github.com/users/marcoscaceres/events{/privacy}","received_events_url":"https://api.github.com/users/marcoscaceres/received_events","type":"User","site_admin":false},"body":"You should \r\n`return;`\r\nhere. and remove the `} else {` and the just call `theEnd();`\r\n","created_at":"2015-06-08T22:09:21Z","updated_at":"2015-06-08T22:09:21Z","html_url":"https://github.com/w3c/respec/pull/447#discussion_r31965263","pull_request_url":"https://api.github.com/repos/w3c/respec/pulls/447","_links":{"self":{"href":"https://api.github.com/repos/w3c/respec/pulls/comments/31965263"},"html":{"href":"https://github.com/w3c/respec/pull/447#discussion_r31965263"},"pull_request":{"href":"https://api.github.com/repos/w3c/respec/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/w3c/respec/pulls/447","id":37199253,"html_url":"https://github.com/w3c/respec/pull/447","diff_url":"https://github.com/w3c/respec/pull/447.diff","patch_url":"https://github.com/w3c/respec/pull/447.patch","issue_url":"https://api.github.com/repos/w3c/respec/issues/447","number":447,"state":"open","locked":false,"title":"This module simplifies acknowledging contributions made through GitHub.","user":{"login":"tobie","id":3392,"avatar_url":"https://avatars.githubusercontent.com/u/3392?v=3","gravatar_id":"","url":"https://api.github.com/users/tobie","html_url":"https://github.com/tobie","followers_url":"https://api.github.com/users/tobie/followers","following_url":"https://api.github.com/users/tobie/following{/other_user}","gists_url":"https://api.github.com/users/tobie/gists{/gist_id}","starred_url":"https://api.github.com/users/tobie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobie/subscriptions","organizations_url":"https://api.github.com/users/tobie/orgs","repos_url":"https://api.github.com/users/tobie/repos","events_url":"https://api.github.com/users/tobie/events{/privacy}","received_events_url":"https://api.github.com/users/tobie/received_events","type":"User","site_admin":false},"body":"Fetches names of contributors from github and uses them to fill\r\nin the content of elements with key identifiers:\r\n`#gh-commenters`: people having contributed comments to issues.\r\n`#gh-contributors`: people whose PR have been merged.\r\nSpec editors get filtered out automatically.\r\n\r\n/cc @marcoscaceres ","created_at":"2015-06-08T21:43:38Z","updated_at":"2015-06-08T22:09:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d169ca90b804c9153f6312f7b4213d8f4bbd5f3c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/w3c/respec/pulls/447/commits","review_comments_url":"https://api.github.com/repos/w3c/respec/pulls/447/comments","review_comment_url":"https://api.github.com/repos/w3c/respec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/w3c/respec/issues/447/comments","statuses_url":"https://api.github.com/repos/w3c/respec/statuses/9b760f6f980562ddf323afd0f5ee29ff2888a1e6","head":{"label":"tobie:ack","ref":"ack","sha":"9b760f6f980562ddf323afd0f5ee29ff2888a1e6","user":{"login":"tobie","id":3392,"avatar_url":"https://avatars.githubusercontent.com/u/3392?v=3","gravatar_id":"","url":"https://api.github.com/users/tobie","html_url":"https://github.com/tobie","followers_url":"https://api.github.com/users/tobie/followers","following_url":"https://api.github.com/users/tobie/following{/other_user}","gists_url":"https://api.github.com/users/tobie/gists{/gist_id}","starred_url":"https://api.github.com/users/tobie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobie/subscriptions","organizations_url":"https://api.github.com/users/tobie/orgs","repos_url":"https://api.github.com/users/tobie/repos","events_url":"https://api.github.com/users/tobie/events{/privacy}","received_events_url":"https://api.github.com/users/tobie/received_events","type":"User","site_admin":false},"repo":{"id":4660898,"name":"respec","full_name":"tobie/respec","owner":{"login":"tobie","id":3392,"avatar_url":"https://avatars.githubusercontent.com/u/3392?v=3","gravatar_id":"","url":"https://api.github.com/users/tobie","html_url":"https://github.com/tobie","followers_url":"https://api.github.com/users/tobie/followers","following_url":"https://api.github.com/users/tobie/following{/other_user}","gists_url":"https://api.github.com/users/tobie/gists{/gist_id}","starred_url":"https://api.github.com/users/tobie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobie/subscriptions","organizations_url":"https://api.github.com/users/tobie/orgs","repos_url":"https://api.github.com/users/tobie/repos","events_url":"https://api.github.com/users/tobie/events{/privacy}","received_events_url":"https://api.github.com/users/tobie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tobie/respec","description":"Specification Edition Support Tool","fork":true,"url":"https://api.github.com/repos/tobie/respec","forks_url":"https://api.github.com/repos/tobie/respec/forks","keys_url":"https://api.github.com/repos/tobie/respec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tobie/respec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tobie/respec/teams","hooks_url":"https://api.github.com/repos/tobie/respec/hooks","issue_events_url":"https://api.github.com/repos/tobie/respec/issues/events{/number}","events_url":"https://api.github.com/repos/tobie/respec/events","assignees_url":"https://api.github.com/repos/tobie/respec/assignees{/user}","branches_url":"https://api.github.com/repos/tobie/respec/branches{/branch}","tags_url":"https://api.github.com/repos/tobie/respec/tags","blobs_url":"https://api.github.com/repos/tobie/respec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tobie/respec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tobie/respec/git/refs{/sha}","trees_url":"https://api.github.com/repos/tobie/respec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tobie/respec/statuses/{sha}","languages_url":"https://api.github.com/repos/tobie/respec/languages","stargazers_url":"https://api.github.com/repos/tobie/respec/stargazers","contributors_url":"https://api.github.com/repos/tobie/respec/contributors","subscribers_url":"https://api.github.com/repos/tobie/respec/subscribers","subscription_url":"https://api.github.com/repos/tobie/respec/subscription","commits_url":"https://api.github.com/repos/tobie/respec/commits{/sha}","git_commits_url":"https://api.github.com/repos/tobie/respec/git/commits{/sha}","comments_url":"https://api.github.com/repos/tobie/respec/comments{/number}","issue_comment_url":"https://api.github.com/repos/tobie/respec/issues/comments{/number}","contents_url":"https://api.github.com/repos/tobie/respec/contents/{+path}","compare_url":"https://api.github.com/repos/tobie/respec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tobie/respec/merges","archive_url":"https://api.github.com/repos/tobie/respec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tobie/respec/downloads","issues_url":"https://api.github.com/repos/tobie/respec/issues{/number}","pulls_url":"https://api.github.com/repos/tobie/respec/pulls{/number}","milestones_url":"https://api.github.com/repos/tobie/respec/milestones{/number}","notifications_url":"https://api.github.com/repos/tobie/respec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tobie/respec/labels{/name}","releases_url":"https://api.github.com/repos/tobie/respec/releases{/id}","created_at":"2012-06-14T08:17:38Z","updated_at":"2014-09-18T13:42:42Z","pushed_at":"2015-06-08T21:42:51Z","git_url":"git://github.com/tobie/respec.git","ssh_url":"git@github.com:tobie/respec.git","clone_url":"https://github.com/tobie/respec.git","svn_url":"https://github.com/tobie/respec","homepage":null,"size":5987,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"gh-pages"}},"base":{"label":"w3c:develop","ref":"develop","sha":"1e0be6bc4144b132d8b186c91d5ddac93d191aa6","user":{"login":"w3c","id":379216,"avatar_url":"https://avatars.githubusercontent.com/u/379216?v=3","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"repo":{"id":4287066,"name":"respec","full_name":"w3c/respec","owner":{"login":"w3c","id":379216,"avatar_url":"https://avatars.githubusercontent.com/u/379216?v=3","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/w3c/respec","description":"Specification Edition Support Tool","fork":false,"url":"https://api.github.com/repos/w3c/respec","forks_url":"https://api.github.com/repos/w3c/respec/forks","keys_url":"https://api.github.com/repos/w3c/respec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/w3c/respec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/w3c/respec/teams","hooks_url":"https://api.github.com/repos/w3c/respec/hooks","issue_events_url":"https://api.github.com/repos/w3c/respec/issues/events{/number}","events_url":"https://api.github.com/repos/w3c/respec/events","assignees_url":"https://api.github.com/repos/w3c/respec/assignees{/user}","branches_url":"https://api.github.com/repos/w3c/respec/branches{/branch}","tags_url":"https://api.github.com/repos/w3c/respec/tags","blobs_url":"https://api.github.com/repos/w3c/respec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/w3c/respec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/w3c/respec/git/refs{/sha}","trees_url":"https://api.github.com/repos/w3c/respec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/w3c/respec/statuses/{sha}","languages_url":"https://api.github.com/repos/w3c/respec/languages","stargazers_url":"https://api.github.com/repos/w3c/respec/stargazers","contributors_url":"https://api.github.com/repos/w3c/respec/contributors","subscribers_url":"https://api.github.com/repos/w3c/respec/subscribers","subscription_url":"https://api.github.com/repos/w3c/respec/subscription","commits_url":"https://api.github.com/repos/w3c/respec/commits{/sha}","git_commits_url":"https://api.github.com/repos/w3c/respec/git/commits{/sha}","comments_url":"https://api.github.com/repos/w3c/respec/comments{/number}","issue_comment_url":"https://api.github.com/repos/w3c/respec/issues/comments{/number}","contents_url":"https://api.github.com/repos/w3c/respec/contents/{+path}","compare_url":"https://api.github.com/repos/w3c/respec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/w3c/respec/merges","archive_url":"https://api.github.com/repos/w3c/respec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/w3c/respec/downloads","issues_url":"https://api.github.com/repos/w3c/respec/issues{/number}","pulls_url":"https://api.github.com/repos/w3c/respec/pulls{/number}","milestones_url":"https://api.github.com/repos/w3c/respec/milestones{/number}","notifications_url":"https://api.github.com/repos/w3c/respec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/w3c/respec/labels{/name}","releases_url":"https://api.github.com/repos/w3c/respec/releases{/id}","created_at":"2012-05-10T16:39:37Z","updated_at":"2015-05-27T06:56:39Z","pushed_at":"2015-06-08T21:43:39Z","git_url":"git://github.com/w3c/respec.git","ssh_url":"git@github.com:w3c/respec.git","clone_url":"https://github.com/w3c/respec.git","svn_url":"https://github.com/w3c/respec","homepage":null,"size":8371,"stargazers_count":88,"watchers_count":88,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":79,"mirror_url":null,"open_issues_count":58,"forks":79,"open_issues":58,"watchers":88,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/w3c/respec/pulls/447"},"html":{"href":"https://github.com/w3c/respec/pull/447"},"issue":{"href":"https://api.github.com/repos/w3c/respec/issues/447"},"comments":{"href":"https://api.github.com/repos/w3c/respec/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/w3c/respec/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/w3c/respec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/w3c/respec/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/w3c/respec/statuses/9b760f6f980562ddf323afd0f5ee29ff2888a1e6"}}}}