{"action":"created","comment":{"url":"https://api.github.com/repos/mattermost/platform/pulls/comments/47029810","id":47029810,"diff_hunk":"@@ -984,3 +985,41 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) {\n \n \tw.Write([]byte(posts.ToJson()))\n }\n+\n+func GetStarredPosts(c *Context, w http.ResponseWriter, r *http.Request) {\n+\tposts, err := getStarredPosts(c.Session.UserId)\n+\tif err != nil {\n+\t\tc.Err = err\n+\t\treturn\n+\t}\n+\n+\tw.Write([]byte(posts.ToJson()))\n+}\n+\n+func getStarredPosts(userId string) (*model.PostList, *model.AppError) {\n+\tpchan := Srv.Store.Preference().GetCategory(userId, model.PREFERENCE_CATEGORY_STARRED_POSTS)\n+\n+\tif presult := <-pchan; presult.Err != nil {\n+\t\treturn nil, presult.Err\n+\t} else {\n+\t\tpreferences := presult.Data.(model.Preferences)\n+\t\tids := make([]string, 0, len(preferences))\n+\n+\t\tfor _, pref := range preferences {\n+\t\t\tif pref.Value == \"true\" {\n+\t\t\t\tids = append(ids, pref.Name)\n+\t\t\t}\n+\t\t}\n+\n+\t\tif len(ids) == 0 {\n+\t\t\treturn &model.PostList{}, nil\n+\t\t} else {\n+\t\t\tpochan := Srv.Store.Post().GetByIds(ids)\n+\t\t\tif poresult := <-pochan; poresult.Err != nil {\n+\t\t\t\treturn nil, poresult.Err\n+\t\t\t} else {\n+\t\t\t\treturn poresult.Data.(*model.PostList), nil","path":"api/post.go","position":45,"original_position":45,"commit_id":"6f5f11bc7dec4719d63eb71f9efc70fef4b2396b","original_commit_id":"6f5f11bc7dec4719d63eb71f9efc70fef4b2396b","user":{"login":"coreyhulen","id":1431746,"avatar_url":"https://avatars.githubusercontent.com/u/1431746?v=3","gravatar_id":"","url":"https://api.github.com/users/coreyhulen","html_url":"https://github.com/coreyhulen","followers_url":"https://api.github.com/users/coreyhulen/followers","following_url":"https://api.github.com/users/coreyhulen/following{/other_user}","gists_url":"https://api.github.com/users/coreyhulen/gists{/gist_id}","starred_url":"https://api.github.com/users/coreyhulen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreyhulen/subscriptions","organizations_url":"https://api.github.com/users/coreyhulen/orgs","repos_url":"https://api.github.com/users/coreyhulen/repos","events_url":"https://api.github.com/users/coreyhulen/events{/privacy}","received_events_url":"https://api.github.com/users/coreyhulen/received_events","type":"User","site_admin":false},"body":"I think something still needs to be done here since you may be access posts you don't have access too.  Would need to call something like `HasPermissionsToChannel()` for each distinct channelId found.","created_at":"2015-12-08T23:16:18Z","updated_at":"2015-12-08T23:16:18Z","html_url":"https://github.com/mattermost/platform/pull/1664#discussion_r47029810","pull_request_url":"https://api.github.com/repos/mattermost/platform/pulls/1664","_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments/47029810"},"html":{"href":"https://github.com/mattermost/platform/pull/1664#discussion_r47029810"},"pull_request":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1664"}}},"pull_request":{"url":"https://api.github.com/repos/mattermost/platform/pulls/1664","id":53046148,"html_url":"https://github.com/mattermost/platform/pull/1664","diff_url":"https://github.com/mattermost/platform/pull/1664.diff","patch_url":"https://github.com/mattermost/platform/pull/1664.patch","issue_url":"https://api.github.com/repos/mattermost/platform/issues/1664","number":1664,"state":"open","locked":false,"title":"PLT-1379: Starring channels and posts","user":{"login":"florianorben","id":1024005,"avatar_url":"https://avatars.githubusercontent.com/u/1024005?v=3","gravatar_id":"","url":"https://api.github.com/users/florianorben","html_url":"https://github.com/florianorben","followers_url":"https://api.github.com/users/florianorben/followers","following_url":"https://api.github.com/users/florianorben/following{/other_user}","gists_url":"https://api.github.com/users/florianorben/gists{/gist_id}","starred_url":"https://api.github.com/users/florianorben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/florianorben/subscriptions","organizations_url":"https://api.github.com/users/florianorben/orgs","repos_url":"https://api.github.com/users/florianorben/repos","events_url":"https://api.github.com/users/florianorben/events{/privacy}","received_events_url":"https://api.github.com/users/florianorben/received_events","type":"User","site_admin":false},"body":"Allows to set stars (=favorites) on posts and channels","created_at":"2015-12-08T22:08:14Z","updated_at":"2015-12-08T23:16:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f5e9b36d3e06cc5db3f454772c224bf5bacdfdd","assignee":null,"milestone":{"url":"https://api.github.com/repos/mattermost/platform/milestones/8","html_url":"https://github.com/mattermost/platform/milestones/v1.4.0","labels_url":"https://api.github.com/repos/mattermost/platform/milestones/8/labels","id":1448079,"number":8,"title":"v1.4.0","description":"","creator":{"login":"crspeller","id":3191642,"avatar_url":"https://avatars.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":4,"closed_issues":0,"state":"open","created_at":"2015-12-07T16:25:26Z","updated_at":"2015-12-08T23:11:41Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/mattermost/platform/pulls/1664/commits","review_comments_url":"https://api.github.com/repos/mattermost/platform/pulls/1664/comments","review_comment_url":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/1664/comments","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/6f5f11bc7dec4719d63eb71f9efc70fef4b2396b","head":{"label":"florianorben:PLT-1379","ref":"PLT-1379","sha":"6f5f11bc7dec4719d63eb71f9efc70fef4b2396b","user":{"login":"florianorben","id":1024005,"avatar_url":"https://avatars.githubusercontent.com/u/1024005?v=3","gravatar_id":"","url":"https://api.github.com/users/florianorben","html_url":"https://github.com/florianorben","followers_url":"https://api.github.com/users/florianorben/followers","following_url":"https://api.github.com/users/florianorben/following{/other_user}","gists_url":"https://api.github.com/users/florianorben/gists{/gist_id}","starred_url":"https://api.github.com/users/florianorben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/florianorben/subscriptions","organizations_url":"https://api.github.com/users/florianorben/orgs","repos_url":"https://api.github.com/users/florianorben/repos","events_url":"https://api.github.com/users/florianorben/events{/privacy}","received_events_url":"https://api.github.com/users/florianorben/received_events","type":"User","site_admin":false},"repo":{"id":44068501,"name":"platform","full_name":"florianorben/platform","owner":{"login":"florianorben","id":1024005,"avatar_url":"https://avatars.githubusercontent.com/u/1024005?v=3","gravatar_id":"","url":"https://api.github.com/users/florianorben","html_url":"https://github.com/florianorben","followers_url":"https://api.github.com/users/florianorben/followers","following_url":"https://api.github.com/users/florianorben/following{/other_user}","gists_url":"https://api.github.com/users/florianorben/gists{/gist_id}","starred_url":"https://api.github.com/users/florianorben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/florianorben/subscriptions","organizations_url":"https://api.github.com/users/florianorben/orgs","repos_url":"https://api.github.com/users/florianorben/repos","events_url":"https://api.github.com/users/florianorben/events{/privacy}","received_events_url":"https://api.github.com/users/florianorben/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/florianorben/platform","description":"Open source Slack-alternative in Golang and React","fork":true,"url":"https://api.github.com/repos/florianorben/platform","forks_url":"https://api.github.com/repos/florianorben/platform/forks","keys_url":"https://api.github.com/repos/florianorben/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/florianorben/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/florianorben/platform/teams","hooks_url":"https://api.github.com/repos/florianorben/platform/hooks","issue_events_url":"https://api.github.com/repos/florianorben/platform/issues/events{/number}","events_url":"https://api.github.com/repos/florianorben/platform/events","assignees_url":"https://api.github.com/repos/florianorben/platform/assignees{/user}","branches_url":"https://api.github.com/repos/florianorben/platform/branches{/branch}","tags_url":"https://api.github.com/repos/florianorben/platform/tags","blobs_url":"https://api.github.com/repos/florianorben/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/florianorben/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/florianorben/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/florianorben/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/florianorben/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/florianorben/platform/languages","stargazers_url":"https://api.github.com/repos/florianorben/platform/stargazers","contributors_url":"https://api.github.com/repos/florianorben/platform/contributors","subscribers_url":"https://api.github.com/repos/florianorben/platform/subscribers","subscription_url":"https://api.github.com/repos/florianorben/platform/subscription","commits_url":"https://api.github.com/repos/florianorben/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/florianorben/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/florianorben/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/florianorben/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/florianorben/platform/contents/{+path}","compare_url":"https://api.github.com/repos/florianorben/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/florianorben/platform/merges","archive_url":"https://api.github.com/repos/florianorben/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/florianorben/platform/downloads","issues_url":"https://api.github.com/repos/florianorben/platform/issues{/number}","pulls_url":"https://api.github.com/repos/florianorben/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/florianorben/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/florianorben/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/florianorben/platform/labels{/name}","releases_url":"https://api.github.com/repos/florianorben/platform/releases{/id}","created_at":"2015-10-11T20:32:07Z","updated_at":"2015-10-11T20:32:11Z","pushed_at":"2015-12-08T22:07:34Z","git_url":"git://github.com/florianorben/platform.git","ssh_url":"git@github.com:florianorben/platform.git","clone_url":"https://github.com/florianorben/platform.git","svn_url":"https://github.com/florianorben/platform","homepage":"http://mattermost.org","size":25825,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"f006951959acad76c8626d85fac3521d302bb0ee","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars.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://avatars.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}","created_at":"2015-06-15T06:50:02Z","updated_at":"2015-12-08T21:06:09Z","pushed_at":"2015-12-08T22:38:53Z","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":"http://mattermost.org","size":27821,"stargazers_count":5904,"watchers_count":5904,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":534,"mirror_url":null,"open_issues_count":66,"forks":534,"open_issues":66,"watchers":5904,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1664"},"html":{"href":"https://github.com/mattermost/platform/pull/1664"},"issue":{"href":"https://api.github.com/repos/mattermost/platform/issues/1664"},"comments":{"href":"https://api.github.com/repos/mattermost/platform/issues/1664/comments"},"review_comments":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1664/comments"},"review_comment":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1664/commits"},"statuses":{"href":"https://api.github.com/repos/mattermost/platform/statuses/6f5f11bc7dec4719d63eb71f9efc70fef4b2396b"}}}}