gh4a
gh4a copied to clipboard
[RFE] add button for watching an issue
This way I can watch an issue without making a dummy comment (see #129).
Unfortunately, it looks there's no way to do this with the Github API :-( I can't find a way to subscribe to anything that's not a repository (be it an issue or a pull request).
I guess a label for "needs-api-support" would be good then for this issue?
Good idea :)
Using the Firefox inspector, it looks like GitHub just sends a POST to notifications/threads with the Referer header set to what you want to subscribe to or unsubscribe from.
Can you post the full request for a subscription request for any issue in this repo? (I can't as I'm automatically subscribed due to being a collaborator) The docs ( https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription) say one needs a thread id, but it's not obvious where this id comes from.
On Thu, Sep 25, 2014 at 10:32:54 -0700, maniac103 wrote:
Can you post the full request for a subscription request for any issue in this repo? (I can't as I'm automatically subscribed due to being a collaborator) The docs ( https://developer.github.com/v3/activity/notifications/# set-a-thread-subscription) say one needs a thread id, but it's not obvious where this id comes from.
Looking at the parameters sent:
utf8: "✓"
authenticity_token: "..."
repository_id: "1388190"
thread_id: "43842983"
thread_class: "Issue"
id: "unsubscribe"
I see this in the page's source code:
data-channel="slapperwan/gh4a:issue:43842983"
There is also a <meta> tag for the repository_id value, but not one
for the thread.
This would be a really nice featue :)
I can confirm that the browser sends a POST request to https://github.com/notifications/thread, the referer being e.g. https://github.com/danieloeh/AntennaPod/issues/100.
When subscribing, the request body remains the same; it's simply subscribe instead of unsubscribe.
utf8=%E2%9C%93
&authenticity_token=…
&repository_id=5244445
&thread_id=10139376
&thread_class=Issue
&id=subscribe
Is not this https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription?
@bhack Looks like the API interface we are looking for.
I think I found that one earlier; what I missed was a way to find out the thread ID.
There's no way to get the thread ID, until you get the notification...
Asked to github team.
Thanks. So it looks like watching an issue indeed isn't possible with the current API.
So, were there any related API changes in the last year so subscribing might work?
I don't see any relevant API endpoints still :( .
Any status updates on this? (I'm posting this comment primarily to subscribe to this issue lol)
I just talked to the Github support some days ago, just about this issue. There is still no way to retrieve the thread ID without a notification. They know about this but they were not able to provide me a roadmap or information on whether / when this might be resolved.
That's annoying. I could really use it, too 😕
How does the browser get the thread id?
Github's web frontend doesn't use the official API, but a combination of server-side rendered pages and an unofficial API. They simply have more possibilities.
Can't octodroid simply emulate that?
No, it can't. We'll stick to the API, everything else us not supportable.
In the notifications view though there is a menu entry to "Unsubscribe". Couldn't the same "Subscribe"/" Unsubscribe" toggle be shown in the 3-dot-menu of an issue view?
Nope, notifications API does provide subscription id but it's not available when accessing the issue by itself and there is no way to request this separately either.
notifications API does provide subscription id but it's not available when accessing the issue by itself
It is available (at least now) in the response for the GET /repos/:owner/:repo/issues/:number request (see the id parameter). See for example this issue:
"id": 43842983,
"number": 215,
As far as I understand this id is the "thread id" that can be used to subscribe/unsubscribe through the notifications API.
As far as I understand this id is the "thread id" that can be used to subscribe/unsubscribe through the notifications API.
How did you come to this conclusion? I don't think it's the case. As an example:
- curl https://api.github.com/repos/slapperwan/gh4a/issues/777
[...]
"id": 265823140,
"number": 777,
[...]
- curl -H "Authorization: Token XXX" https://api.github.com/notifications
[...]
"id": "267086772",
"unread": true,
"reason": "mention",
"updated_at": "2017-10-20T13:58:47Z",
"last_read_at": "2017-10-16T18:01:45Z",
"subject": {
"title": "Line comments being typed lost on portrait/landscape rotation",
"url": "https://api.github.com/repos/slapperwan/gh4a/issues/777",
"latest_comment_url": "https://api.github.com/repos/slapperwan/gh4a/issues/comments/338214630",
"type": "Issue"
},
[...]
"subscription_url": "https://api.github.com/notifications/threads/267086772/subscription"
[...]
So - AFAICT - issue ID and subscription ID is not the same thing. Consequently,
curl -X PUT -d subscribed=false -d ignored=false -H "Authorization: Token XXX" https://api.github.com/notifications/threads/265823140/subscription
yields
{
"message": "Must have admin rights to Repository.",
"documentation_url": "https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription"
}
so it seems to have interpreted the ID differently.
You are right! I shouldn't have interpreted it this way before testing as you did 👍
It seems like you could query https://github.com/USERNAME/REPONAME/issues/ISSUE_ID/show_partial?partial=issues%2Ftitle and parse out data-channel (looks like "issue:THREAD_ID") from there. Definitely unofficial API, however.
It looks like the GraphQL API has support for changing subscriptions.
Hello, any news on this ?
#605 seems to be the relevant issue there. The app would need to be ported to use GraphQL. https://blog.apollographql.com/launching-apollo-graphql-on-android-40ee0b5789bd?gi=46c44c646e07 seems like a promising way to do it (though I just did a simple search and other libraries may do it better in the time since that post).