partnerpedia/pully — Issue #10: Determining comment threads from API
Author: tjwallace
Created: 2012-01-29 20:27:48+00:00
State: open

How can we determine comment "threads" so replying with "action tags" are properly scoped?

### Docs

* [Pull request comments](http://developer.github.com/v3/pulls/comments/)
* [Issue comments](http://developer.github.com/v3/issues/comments/)

### Sample request

Comments from [this rails pull request](https://github.com/rails/rails/pull/4732).

`curl https://api.github.com/repos/rails/rails/pulls/4732/comments`

```json
[
{
"updated_at": "2012-01-29T04:29:36Z",
"user": {
"gravatar_id": "77237b97a465ae5a293ad323b7296837",
"login": "carlosantoniodasilva",
"url": "https://api.github.com/users/carlosantoniodasilva",
"avatar_url": "https://secure.gravatar.com/avatar/77237b97a465ae5a293ad323b7296837?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"id": 26328
},
"commit_id": "2352b50e71d3165128317c7927eb0163d87ba992",
"created_at": "2012-01-28T14:02:49Z",
"position": null,
"body": "Is this variable required?",
"path": "activerecord/lib/active_record/dynamic_finder_match.rb",
"id": 394879,
"url": "https://api.github.com/repos/rails/rails/pulls/comments/394879"
},
{
"updated_at": "2012-01-29T04:29:36Z",
"user": {
"gravatar_id": "77237b97a465ae5a293ad323b7296837",
"login": "carlosantoniodasilva",
"url": "https://api.github.com/users/carlosantoniodasilva",
"avatar_url": "https://secure.gravatar.com/avatar/77237b97a465ae5a293ad323b7296837?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"id": 26328
},
"commit_id": "2352b50e71d3165128317c7927eb0163d87ba992",
"created_at": "2012-01-28T14:07:22Z",
"position": null,
"body": "I think this could be refactored to use `Array#find` instead. What do you think about:\n\n```ruby\nmethod = method.to_s\n[FindBy, FindByBang, FindOrInitializeCreateBy].find do |klass|\n klass.match(method)\nend\n```",
"path": "activerecord/lib/active_record/dynamic_finder_match.rb",
"id": 394887,
"url": "https://api.github.com/repos/rails/rails/pulls/comments/394887"
},
{
"updated_at": "2012-01-29T04:29:36Z",
"user": {
"gravatar_id": "2940bc7d4506f3e099e3dcc32a412b98",
"login": "jonleighton",
"url": "https://api.github.com/users/jonleighton",
"avatar_url": "https://secure.gravatar.com/avatar/2940bc7d4506f3e099e3dcc32a412b98?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"id": 1979
},
"commit_id": "2352b50e71d3165128317c7927eb0163d87ba992",
"created_at": "2012-01-28T14:53:03Z",
"position": null,
"body": "agree, also please do `[foo, bar]` not `[ foo, bar ]` for consistency :)",
"path": "activerecord/lib/active_record/dynamic_finder_match.rb",
"id": 394909,
"url": "https://api.github.com/repos/rails/rails/pulls/comments/394909"
},
{
"updated_at": "2012-01-29T04:29:36Z",
"user": {
"gravatar_id": "2940bc7d4506f3e099e3dcc32a412b98",
"login": "jonleighton",
"url": "https://api.github.com/users/jonleighton",
"avatar_url": "https://secure.gravatar.com/avatar/2940bc7d4506f3e099e3dcc32a412b98?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"id": 1979
},
"commit_id": "2352b50e71d3165128317c7927eb0163d87ba992",
"created_at": "2012-01-28T14:53:36Z",
"position": null,
"body": "nested ternaries hurt my eyes ;) please expand to normal conditionals",
"path": "activerecord/lib/active_record/dynamic_finder_match.rb",
"id": 394910,
"url": "https://api.github.com/repos/rails/rails/pulls/comments/394910"
},
{
"updated_at": "2012-01-29T04:33:52Z",
"user": {
"gravatar_id": "dd24adb5a3a430fed83a33ed552fe1b5",
"login": "pwim",
"url": "https://api.github.com/users/pwim",
"avatar_url": "https://secure.gravatar.com/avatar/dd24adb5a3a430fed83a33ed552fe1b5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"id": 30756
},
"commit_id": "2352b50e71d3165128317c7927eb0163d87ba992",
"created_at": "2012-01-29T04:33:52Z",
"position": null,
"body": "@carlosantoniodasilva I wanted to do something like that, but `Array#find` returns the matched element, which in this case would be the class, as opposed to the value of the block which is the instantiated block itself. I further refactored it in 2352b50 to do something like your suggesting, but I'm not sure if this is better or not.",
"path": "activerecord/lib/active_record/dynamic_finder_match.rb",
"id": 395307,
"url": "https://api.github.com/repos/rails/rails/pulls/comments/395307"
},
{
"updated_at": "2012-01-29T18:36:38Z",
"user": {
"gravatar_id": "77237b97a465ae5a293ad323b7296837",
"login": "carlosantoniodasilva",
"url": "https://api.github.com/users/carlosantoniodasilva",
"avatar_url": "https://secure.gravatar.com/avatar/77237b97a465ae5a293ad323b7296837?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"id": 26328
},
"commit_id": "2352b50e71d3165128317c7927eb0163d87ba992",
"created_at": "2012-01-29T18:36:38Z",
"position": null,
"body": "@pwin Yeah that's right. I like the new implementation, the only downside I can see is that you have to match again to get the matched object when you find the right class through `matches?`, right?",
"path": "activerecord/lib/active_record/dynamic_finder_match.rb",
"id": 395571,
"url": "https://api.github.com/repos/rails/rails/pulls/comments/395571"
}
]
```