{"action":"created","comment":{"url":"https://api.github.com/repos/mattermost/platform/pulls/comments/104328176","pull_request_review_id":25159924,"id":104328176,"diff_hunk":"@@ -115,6 +116,33 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) {\n \t}\n }\n \n+func getChannelUnread(c *Context, w http.ResponseWriter, r *http.Request) {\n+\tc.RequireChannelId()\n+\tif c.Err != nil {\n+\t\treturn\n+\t}\n+\n+\t// check permissions\n+\tif !app.SessionHasPermissionToChannel(c.Session, c.Params.ChannelId, model.PERMISSION_READ_CHANNEL) {\n+\t\tc.SetPermissionError(model.PERMISSION_READ_CHANNEL)\n+\t\treturn\n+\t}\n+\n+\tif !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {\n+\t\tc.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)\n+\t\treturn\n+\t}","path":"api4/channel.go","position":27,"original_position":27,"commit_id":"e7cbc630c1e80327b52719029a64a2e16a4effa8","original_commit_id":"e7cbc630c1e80327b52719029a64a2e16a4effa8","user":{"login":"jwilander","id":2672098,"avatar_url":"https://avatars3.githubusercontent.com/u/2672098?v=3","gravatar_id":"","url":"https://api.github.com/users/jwilander","html_url":"https://github.com/jwilander","followers_url":"https://api.github.com/users/jwilander/followers","following_url":"https://api.github.com/users/jwilander/following{/other_user}","gists_url":"https://api.github.com/users/jwilander/gists{/gist_id}","starred_url":"https://api.github.com/users/jwilander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwilander/subscriptions","organizations_url":"https://api.github.com/users/jwilander/orgs","repos_url":"https://api.github.com/users/jwilander/repos","events_url":"https://api.github.com/users/jwilander/events{/privacy}","received_events_url":"https://api.github.com/users/jwilander/received_events","type":"User","site_admin":false},"body":"This check is not needed, please remove","created_at":"2017-03-05T23:21:25Z","updated_at":"2017-03-05T23:29:54Z","html_url":"https://github.com/mattermost/platform/pull/5622#discussion_r104328176","pull_request_url":"https://api.github.com/repos/mattermost/platform/pulls/5622","_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments/104328176"},"html":{"href":"https://github.com/mattermost/platform/pull/5622#discussion_r104328176"},"pull_request":{"href":"https://api.github.com/repos/mattermost/platform/pulls/5622"}}},"pull_request":{"url":"https://api.github.com/repos/mattermost/platform/pulls/5622","id":109000332,"html_url":"https://github.com/mattermost/platform/pull/5622","diff_url":"https://github.com/mattermost/platform/pull/5622.diff","patch_url":"https://github.com/mattermost/platform/pull/5622.patch","issue_url":"https://api.github.com/repos/mattermost/platform/issues/5622","number":5622,"state":"open","locked":false,"title":"ApiV4: GET /channels/{channel_id}/unread","user":{"login":"andreistanciu24","id":11387264,"avatar_url":"https://avatars2.githubusercontent.com/u/11387264?v=3","gravatar_id":"","url":"https://api.github.com/users/andreistanciu24","html_url":"https://github.com/andreistanciu24","followers_url":"https://api.github.com/users/andreistanciu24/followers","following_url":"https://api.github.com/users/andreistanciu24/following{/other_user}","gists_url":"https://api.github.com/users/andreistanciu24/gists{/gist_id}","starred_url":"https://api.github.com/users/andreistanciu24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreistanciu24/subscriptions","organizations_url":"https://api.github.com/users/andreistanciu24/orgs","repos_url":"https://api.github.com/users/andreistanciu24/repos","events_url":"https://api.github.com/users/andreistanciu24/events{/privacy}","received_events_url":"https://api.github.com/users/andreistanciu24/received_events","type":"User","site_admin":false},"body":"Please make sure you've read the [pull request](http://docs.mattermost.com/developer/contribution-guide.html#preparing-a-pull-request) section of our [code contribution guidelines](http://docs.mattermost.com/developer/contribution-guide.html).\r\n\r\nWhen filling in a section please remove the help text and the above text.\r\n\r\n#### Summary\r\nGet unread totals for a channel.\r\n\r\n#### Ticket Link\r\nhttps://mattermost.atlassian.net/browse/PLT-5243\r\n\r\n#### Checklist\r\n[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]\r\n- [ x] Added or updated unit tests (required for all new features)\r\n- [ x] Added API documentation (required for all new APIs)\r\n- [ x] All new/modified APIs include changes to the drivers\r\n- [ ] Has enterprise changes (please link)\r\n- [ ] Has UI changes\r\n- [ ] Includes text changes and localization file ([.../i18n/en.json](https://github.com/mattermost/platform/blob/master/i18n/en.json) and [.../webapp/i18n/en.json](https://github.com/mattermost/platform/tree/master/webapp/i18n/en.json)) updates\r\n- [ ] Touches critical sections of the codebase (auth, upgrade, etc.)\r\n","created_at":"2017-03-03T15:54:24Z","updated_at":"2017-03-05T23:29:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cee209855801637658fd1e9d286f1208ecfa5ce2","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/mattermost/platform/milestones/21","html_url":"https://github.com/mattermost/platform/milestone/21","labels_url":"https://api.github.com/repos/mattermost/platform/milestones/21/labels","id":2343595,"number":21,"title":"v3.8.0","description":"","creator":{"login":"crspeller","id":3191642,"avatar_url":"https://avatars2.githubusercontent.com/u/3191642?v=3","gravatar_id":"","url":"https://api.github.com/users/crspeller","html_url":"https://github.com/crspeller","followers_url":"https://api.github.com/users/crspeller/followers","following_url":"https://api.github.com/users/crspeller/following{/other_user}","gists_url":"https://api.github.com/users/crspeller/gists{/gist_id}","starred_url":"https://api.github.com/users/crspeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crspeller/subscriptions","organizations_url":"https://api.github.com/users/crspeller/orgs","repos_url":"https://api.github.com/users/crspeller/repos","events_url":"https://api.github.com/users/crspeller/events{/privacy}","received_events_url":"https://api.github.com/users/crspeller/received_events","type":"User","site_admin":false},"open_issues":29,"closed_issues":4,"state":"open","created_at":"2017-02-23T15:30:03Z","updated_at":"2017-03-05T13:36:15Z","due_on":"2017-04-16T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mattermost/platform/pulls/5622/commits","review_comments_url":"https://api.github.com/repos/mattermost/platform/pulls/5622/comments","review_comment_url":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/5622/comments","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/e7cbc630c1e80327b52719029a64a2e16a4effa8","head":{"label":"andreistanciu24:get_channel_unread_api4","ref":"get_channel_unread_api4","sha":"e7cbc630c1e80327b52719029a64a2e16a4effa8","user":{"login":"andreistanciu24","id":11387264,"avatar_url":"https://avatars2.githubusercontent.com/u/11387264?v=3","gravatar_id":"","url":"https://api.github.com/users/andreistanciu24","html_url":"https://github.com/andreistanciu24","followers_url":"https://api.github.com/users/andreistanciu24/followers","following_url":"https://api.github.com/users/andreistanciu24/following{/other_user}","gists_url":"https://api.github.com/users/andreistanciu24/gists{/gist_id}","starred_url":"https://api.github.com/users/andreistanciu24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreistanciu24/subscriptions","organizations_url":"https://api.github.com/users/andreistanciu24/orgs","repos_url":"https://api.github.com/users/andreistanciu24/repos","events_url":"https://api.github.com/users/andreistanciu24/events{/privacy}","received_events_url":"https://api.github.com/users/andreistanciu24/received_events","type":"User","site_admin":false},"repo":{"id":80108791,"name":"platform","full_name":"andreistanciu24/platform","owner":{"login":"andreistanciu24","id":11387264,"avatar_url":"https://avatars2.githubusercontent.com/u/11387264?v=3","gravatar_id":"","url":"https://api.github.com/users/andreistanciu24","html_url":"https://github.com/andreistanciu24","followers_url":"https://api.github.com/users/andreistanciu24/followers","following_url":"https://api.github.com/users/andreistanciu24/following{/other_user}","gists_url":"https://api.github.com/users/andreistanciu24/gists{/gist_id}","starred_url":"https://api.github.com/users/andreistanciu24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreistanciu24/subscriptions","organizations_url":"https://api.github.com/users/andreistanciu24/orgs","repos_url":"https://api.github.com/users/andreistanciu24/repos","events_url":"https://api.github.com/users/andreistanciu24/events{/privacy}","received_events_url":"https://api.github.com/users/andreistanciu24/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andreistanciu24/platform","description":"Open source Slack-alternative in Golang and React - Mattermost","fork":true,"url":"https://api.github.com/repos/andreistanciu24/platform","forks_url":"https://api.github.com/repos/andreistanciu24/platform/forks","keys_url":"https://api.github.com/repos/andreistanciu24/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andreistanciu24/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andreistanciu24/platform/teams","hooks_url":"https://api.github.com/repos/andreistanciu24/platform/hooks","issue_events_url":"https://api.github.com/repos/andreistanciu24/platform/issues/events{/number}","events_url":"https://api.github.com/repos/andreistanciu24/platform/events","assignees_url":"https://api.github.com/repos/andreistanciu24/platform/assignees{/user}","branches_url":"https://api.github.com/repos/andreistanciu24/platform/branches{/branch}","tags_url":"https://api.github.com/repos/andreistanciu24/platform/tags","blobs_url":"https://api.github.com/repos/andreistanciu24/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andreistanciu24/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andreistanciu24/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/andreistanciu24/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andreistanciu24/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/andreistanciu24/platform/languages","stargazers_url":"https://api.github.com/repos/andreistanciu24/platform/stargazers","contributors_url":"https://api.github.com/repos/andreistanciu24/platform/contributors","subscribers_url":"https://api.github.com/repos/andreistanciu24/platform/subscribers","subscription_url":"https://api.github.com/repos/andreistanciu24/platform/subscription","commits_url":"https://api.github.com/repos/andreistanciu24/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/andreistanciu24/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/andreistanciu24/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/andreistanciu24/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/andreistanciu24/platform/contents/{+path}","compare_url":"https://api.github.com/repos/andreistanciu24/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andreistanciu24/platform/merges","archive_url":"https://api.github.com/repos/andreistanciu24/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andreistanciu24/platform/downloads","issues_url":"https://api.github.com/repos/andreistanciu24/platform/issues{/number}","pulls_url":"https://api.github.com/repos/andreistanciu24/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/andreistanciu24/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/andreistanciu24/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andreistanciu24/platform/labels{/name}","releases_url":"https://api.github.com/repos/andreistanciu24/platform/releases{/id}","deployments_url":"https://api.github.com/repos/andreistanciu24/platform/deployments","created_at":"2017-01-26T11:24:10Z","updated_at":"2017-01-26T11:24:16Z","pushed_at":"2017-03-03T16:23:48Z","git_url":"git://github.com/andreistanciu24/platform.git","ssh_url":"git@github.com:andreistanciu24/platform.git","clone_url":"https://github.com/andreistanciu24/platform.git","svn_url":"https://github.com/andreistanciu24/platform","homepage":"https://mattermost.com","size":73172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mattermost:master","ref":"master","sha":"12e9eb00738f89e7b5b3e6984777e61acf162ef3","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars2.githubusercontent.com/u/9828093?v=3","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"repo":{"id":37448451,"name":"platform","full_name":"mattermost/platform","owner":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars2.githubusercontent.com/u/9828093?v=3","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mattermost/platform","description":"Open source Slack-alternative in Golang and React - Mattermost","fork":false,"url":"https://api.github.com/repos/mattermost/platform","forks_url":"https://api.github.com/repos/mattermost/platform/forks","keys_url":"https://api.github.com/repos/mattermost/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattermost/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattermost/platform/teams","hooks_url":"https://api.github.com/repos/mattermost/platform/hooks","issue_events_url":"https://api.github.com/repos/mattermost/platform/issues/events{/number}","events_url":"https://api.github.com/repos/mattermost/platform/events","assignees_url":"https://api.github.com/repos/mattermost/platform/assignees{/user}","branches_url":"https://api.github.com/repos/mattermost/platform/branches{/branch}","tags_url":"https://api.github.com/repos/mattermost/platform/tags","blobs_url":"https://api.github.com/repos/mattermost/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattermost/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattermost/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattermost/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/mattermost/platform/languages","stargazers_url":"https://api.github.com/repos/mattermost/platform/stargazers","contributors_url":"https://api.github.com/repos/mattermost/platform/contributors","subscribers_url":"https://api.github.com/repos/mattermost/platform/subscribers","subscription_url":"https://api.github.com/repos/mattermost/platform/subscription","commits_url":"https://api.github.com/repos/mattermost/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattermost/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattermost/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattermost/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattermost/platform/contents/{+path}","compare_url":"https://api.github.com/repos/mattermost/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattermost/platform/merges","archive_url":"https://api.github.com/repos/mattermost/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattermost/platform/downloads","issues_url":"https://api.github.com/repos/mattermost/platform/issues{/number}","pulls_url":"https://api.github.com/repos/mattermost/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/mattermost/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/mattermost/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattermost/platform/labels{/name}","releases_url":"https://api.github.com/repos/mattermost/platform/releases{/id}","deployments_url":"https://api.github.com/repos/mattermost/platform/deployments","created_at":"2015-06-15T06:50:02Z","updated_at":"2017-03-05T16:20:52Z","pushed_at":"2017-03-05T22:59:07Z","git_url":"git://github.com/mattermost/platform.git","ssh_url":"git@github.com:mattermost/platform.git","clone_url":"https://github.com/mattermost/platform.git","svn_url":"https://github.com/mattermost/platform","homepage":"https://mattermost.com","size":73488,"stargazers_count":10080,"watchers_count":10080,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1467,"mirror_url":null,"open_issues_count":154,"forks":1467,"open_issues":154,"watchers":10080,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/5622"},"html":{"href":"https://github.com/mattermost/platform/pull/5622"},"issue":{"href":"https://api.github.com/repos/mattermost/platform/issues/5622"},"comments":{"href":"https://api.github.com/repos/mattermost/platform/issues/5622/comments"},"review_comments":{"href":"https://api.github.com/repos/mattermost/platform/pulls/5622/comments"},"review_comment":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mattermost/platform/pulls/5622/commits"},"statuses":{"href":"https://api.github.com/repos/mattermost/platform/statuses/e7cbc630c1e80327b52719029a64a2e16a4effa8"}}}}
{"actor":{"display_login":"jwilander"}}