{"action":"created","comment":{"url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/comments/139822545","pull_request_review_id":63808706,"id":139822545,"diff_hunk":"@@ -33,20 +33,30 @@ def get_user_by_valid_session(session_token):\n \n   return optional_session.user\n \n-def get_user_by_id(user_id):\n-  users = get_users_by_id([userid])\n+def get_user_by_id(my_id, their_id):\n+  users = get_users_by_id(my_id, [their_id])\n   if not users:\n     raise Exception('User with user_id: {} does not exist'.format(str(user_id)))\n   else:\n     return users[0]\n \n-def get_users_by_id(user_ids):\n-  user_ids = set(user_ids)\n-  return User.query.filter(User.id.in_(user_ids)).all()\n+def get_users_by_id(my_id, their_ids):\n+  their_ids = set(their_ids)\n+  them = User.query.filter(User.id.in_(their_ids)).all()\n+  for u in them:\n+    u.is_following = is_following_user(my_id, u.id)\n+  return them\n \n def get_user_by_google_id(google_id):\n   optional_user = User.query.filter(User.google_id == google_id).first()\n   if not optional_user:\n     raise Exception('User with google_id: {} does not exist'.format(google_id))\n   else:\n     return optional_user\n+\n+def is_following_user(my_id, their_id):\n+    optional_following = Following.query \\\n+      .filter(Following.follower_id == my_id\n+              and Following.followed_id == their_id) \\","path":"py/src/app/pcasts/dao/users_dao.py","position":33,"original_position":33,"commit_id":"0047b8f07e836bd69440b121a9a55bb119f53b78","original_commit_id":"0047b8f07e836bd69440b121a9a55bb119f53b78","user":{"login":"ChenJesse","id":11747956,"avatar_url":"https://avatars3.githubusercontent.com/u/11747956?v=4","gravatar_id":"","url":"https://api.github.com/users/ChenJesse","html_url":"https://github.com/ChenJesse","followers_url":"https://api.github.com/users/ChenJesse/followers","following_url":"https://api.github.com/users/ChenJesse/following{/other_user}","gists_url":"https://api.github.com/users/ChenJesse/gists{/gist_id}","starred_url":"https://api.github.com/users/ChenJesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChenJesse/subscriptions","organizations_url":"https://api.github.com/users/ChenJesse/orgs","repos_url":"https://api.github.com/users/ChenJesse/repos","events_url":"https://api.github.com/users/ChenJesse/events{/privacy}","received_events_url":"https://api.github.com/users/ChenJesse/received_events","type":"User","site_admin":false},"body":"Same thing here, should be `.filter(Following.follower_id == my_id, Following.followed_id == their_id)`","created_at":"2017-09-19T21:26:11Z","updated_at":"2017-09-19T21:26:11Z","html_url":"https://github.com/cuappdev/podcast-backend/pull/78#discussion_r139822545","pull_request_url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/comments/139822545"},"html":{"href":"https://github.com/cuappdev/podcast-backend/pull/78#discussion_r139822545"},"pull_request":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78","id":141740507,"html_url":"https://github.com/cuappdev/podcast-backend/pull/78","diff_url":"https://github.com/cuappdev/podcast-backend/pull/78.diff","patch_url":"https://github.com/cuappdev/podcast-backend/pull/78.patch","issue_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues/78","number":78,"state":"open","locked":false,"title":"is_bookmarked, is_recommended, is_subscribed, is_following","user":{"login":"kevingreer","id":7669871,"avatar_url":"https://avatars1.githubusercontent.com/u/7669871?v=4","gravatar_id":"","url":"https://api.github.com/users/kevingreer","html_url":"https://github.com/kevingreer","followers_url":"https://api.github.com/users/kevingreer/followers","following_url":"https://api.github.com/users/kevingreer/following{/other_user}","gists_url":"https://api.github.com/users/kevingreer/gists{/gist_id}","starred_url":"https://api.github.com/users/kevingreer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevingreer/subscriptions","organizations_url":"https://api.github.com/users/kevingreer/orgs","repos_url":"https://api.github.com/users/kevingreer/repos","events_url":"https://api.github.com/users/kevingreer/events{/privacy}","received_events_url":"https://api.github.com/users/kevingreer/received_events","type":"User","site_admin":false},"body":"This PR adds `is_bookmarked` and `is_recommended` fields to episodes that are fetched via the `episodes_dao`. Similarly, it adds `is_subscribed` to series and `is_following` to users.\r\n\r\nWhen the object is fetched via the its respective DAO, I just make a query and check if this model is bookmarked, recommended, etc. then add that information to the model before returning it to the caller.\r\n\r\nThis also includes the denormalization stuff from my previous PR because I accidentally made this branch off of that other branch instead of master.\r\n\r\n #75 ","created_at":"2017-09-19T01:44:33Z","updated_at":"2017-09-19T21:26:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf37af7e23fbedf4078e9f477abed579d924b395","assignee":null,"assignees":[],"requested_reviewers":[{"login":"Jma353","id":10677768,"avatar_url":"https://avatars2.githubusercontent.com/u/10677768?v=4","gravatar_id":"","url":"https://api.github.com/users/Jma353","html_url":"https://github.com/Jma353","followers_url":"https://api.github.com/users/Jma353/followers","following_url":"https://api.github.com/users/Jma353/following{/other_user}","gists_url":"https://api.github.com/users/Jma353/gists{/gist_id}","starred_url":"https://api.github.com/users/Jma353/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jma353/subscriptions","organizations_url":"https://api.github.com/users/Jma353/orgs","repos_url":"https://api.github.com/users/Jma353/repos","events_url":"https://api.github.com/users/Jma353/events{/privacy}","received_events_url":"https://api.github.com/users/Jma353/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78/commits","review_comments_url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78/comments","review_comment_url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues/78/comments","statuses_url":"https://api.github.com/repos/cuappdev/podcast-backend/statuses/0047b8f07e836bd69440b121a9a55bb119f53b78","head":{"label":"cuappdev:kevin/is-x","ref":"kevin/is-x","sha":"0047b8f07e836bd69440b121a9a55bb119f53b78","user":{"login":"cuappdev","id":17533691,"avatar_url":"https://avatars0.githubusercontent.com/u/17533691?v=4","gravatar_id":"","url":"https://api.github.com/users/cuappdev","html_url":"https://github.com/cuappdev","followers_url":"https://api.github.com/users/cuappdev/followers","following_url":"https://api.github.com/users/cuappdev/following{/other_user}","gists_url":"https://api.github.com/users/cuappdev/gists{/gist_id}","starred_url":"https://api.github.com/users/cuappdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuappdev/subscriptions","organizations_url":"https://api.github.com/users/cuappdev/orgs","repos_url":"https://api.github.com/users/cuappdev/repos","events_url":"https://api.github.com/users/cuappdev/events{/privacy}","received_events_url":"https://api.github.com/users/cuappdev/received_events","type":"Organization","site_admin":false},"repo":{"id":81837569,"name":"podcast-backend","full_name":"cuappdev/podcast-backend","owner":{"login":"cuappdev","id":17533691,"avatar_url":"https://avatars0.githubusercontent.com/u/17533691?v=4","gravatar_id":"","url":"https://api.github.com/users/cuappdev","html_url":"https://github.com/cuappdev","followers_url":"https://api.github.com/users/cuappdev/followers","following_url":"https://api.github.com/users/cuappdev/following{/other_user}","gists_url":"https://api.github.com/users/cuappdev/gists{/gist_id}","starred_url":"https://api.github.com/users/cuappdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuappdev/subscriptions","organizations_url":"https://api.github.com/users/cuappdev/orgs","repos_url":"https://api.github.com/users/cuappdev/repos","events_url":"https://api.github.com/users/cuappdev/events{/privacy}","received_events_url":"https://api.github.com/users/cuappdev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cuappdev/podcast-backend","description":"Podcast backend app layer","fork":false,"url":"https://api.github.com/repos/cuappdev/podcast-backend","forks_url":"https://api.github.com/repos/cuappdev/podcast-backend/forks","keys_url":"https://api.github.com/repos/cuappdev/podcast-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuappdev/podcast-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuappdev/podcast-backend/teams","hooks_url":"https://api.github.com/repos/cuappdev/podcast-backend/hooks","issue_events_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues/events{/number}","events_url":"https://api.github.com/repos/cuappdev/podcast-backend/events","assignees_url":"https://api.github.com/repos/cuappdev/podcast-backend/assignees{/user}","branches_url":"https://api.github.com/repos/cuappdev/podcast-backend/branches{/branch}","tags_url":"https://api.github.com/repos/cuappdev/podcast-backend/tags","blobs_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuappdev/podcast-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/cuappdev/podcast-backend/languages","stargazers_url":"https://api.github.com/repos/cuappdev/podcast-backend/stargazers","contributors_url":"https://api.github.com/repos/cuappdev/podcast-backend/contributors","subscribers_url":"https://api.github.com/repos/cuappdev/podcast-backend/subscribers","subscription_url":"https://api.github.com/repos/cuappdev/podcast-backend/subscription","commits_url":"https://api.github.com/repos/cuappdev/podcast-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuappdev/podcast-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuappdev/podcast-backend/contents/{+path}","compare_url":"https://api.github.com/repos/cuappdev/podcast-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuappdev/podcast-backend/merges","archive_url":"https://api.github.com/repos/cuappdev/podcast-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuappdev/podcast-backend/downloads","issues_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues{/number}","pulls_url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/cuappdev/podcast-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/cuappdev/podcast-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuappdev/podcast-backend/labels{/name}","releases_url":"https://api.github.com/repos/cuappdev/podcast-backend/releases{/id}","deployments_url":"https://api.github.com/repos/cuappdev/podcast-backend/deployments","created_at":"2017-02-13T15:07:21Z","updated_at":"2017-03-30T03:35:22Z","pushed_at":"2017-09-19T04:21:09Z","git_url":"git://github.com/cuappdev/podcast-backend.git","ssh_url":"git@github.com:cuappdev/podcast-backend.git","clone_url":"https://github.com/cuappdev/podcast-backend.git","svn_url":"https://github.com/cuappdev/podcast-backend","homepage":"","size":27452,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":1,"default_branch":"master"}},"base":{"label":"cuappdev:master","ref":"master","sha":"faa9d6212ae4bf3952672bb596046d7deba5c398","user":{"login":"cuappdev","id":17533691,"avatar_url":"https://avatars0.githubusercontent.com/u/17533691?v=4","gravatar_id":"","url":"https://api.github.com/users/cuappdev","html_url":"https://github.com/cuappdev","followers_url":"https://api.github.com/users/cuappdev/followers","following_url":"https://api.github.com/users/cuappdev/following{/other_user}","gists_url":"https://api.github.com/users/cuappdev/gists{/gist_id}","starred_url":"https://api.github.com/users/cuappdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuappdev/subscriptions","organizations_url":"https://api.github.com/users/cuappdev/orgs","repos_url":"https://api.github.com/users/cuappdev/repos","events_url":"https://api.github.com/users/cuappdev/events{/privacy}","received_events_url":"https://api.github.com/users/cuappdev/received_events","type":"Organization","site_admin":false},"repo":{"id":81837569,"name":"podcast-backend","full_name":"cuappdev/podcast-backend","owner":{"login":"cuappdev","id":17533691,"avatar_url":"https://avatars0.githubusercontent.com/u/17533691?v=4","gravatar_id":"","url":"https://api.github.com/users/cuappdev","html_url":"https://github.com/cuappdev","followers_url":"https://api.github.com/users/cuappdev/followers","following_url":"https://api.github.com/users/cuappdev/following{/other_user}","gists_url":"https://api.github.com/users/cuappdev/gists{/gist_id}","starred_url":"https://api.github.com/users/cuappdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuappdev/subscriptions","organizations_url":"https://api.github.com/users/cuappdev/orgs","repos_url":"https://api.github.com/users/cuappdev/repos","events_url":"https://api.github.com/users/cuappdev/events{/privacy}","received_events_url":"https://api.github.com/users/cuappdev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cuappdev/podcast-backend","description":"Podcast backend app layer","fork":false,"url":"https://api.github.com/repos/cuappdev/podcast-backend","forks_url":"https://api.github.com/repos/cuappdev/podcast-backend/forks","keys_url":"https://api.github.com/repos/cuappdev/podcast-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuappdev/podcast-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuappdev/podcast-backend/teams","hooks_url":"https://api.github.com/repos/cuappdev/podcast-backend/hooks","issue_events_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues/events{/number}","events_url":"https://api.github.com/repos/cuappdev/podcast-backend/events","assignees_url":"https://api.github.com/repos/cuappdev/podcast-backend/assignees{/user}","branches_url":"https://api.github.com/repos/cuappdev/podcast-backend/branches{/branch}","tags_url":"https://api.github.com/repos/cuappdev/podcast-backend/tags","blobs_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuappdev/podcast-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/cuappdev/podcast-backend/languages","stargazers_url":"https://api.github.com/repos/cuappdev/podcast-backend/stargazers","contributors_url":"https://api.github.com/repos/cuappdev/podcast-backend/contributors","subscribers_url":"https://api.github.com/repos/cuappdev/podcast-backend/subscribers","subscription_url":"https://api.github.com/repos/cuappdev/podcast-backend/subscription","commits_url":"https://api.github.com/repos/cuappdev/podcast-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuappdev/podcast-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuappdev/podcast-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuappdev/podcast-backend/contents/{+path}","compare_url":"https://api.github.com/repos/cuappdev/podcast-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuappdev/podcast-backend/merges","archive_url":"https://api.github.com/repos/cuappdev/podcast-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuappdev/podcast-backend/downloads","issues_url":"https://api.github.com/repos/cuappdev/podcast-backend/issues{/number}","pulls_url":"https://api.github.com/repos/cuappdev/podcast-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/cuappdev/podcast-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/cuappdev/podcast-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuappdev/podcast-backend/labels{/name}","releases_url":"https://api.github.com/repos/cuappdev/podcast-backend/releases{/id}","deployments_url":"https://api.github.com/repos/cuappdev/podcast-backend/deployments","created_at":"2017-02-13T15:07:21Z","updated_at":"2017-03-30T03:35:22Z","pushed_at":"2017-09-19T04:21:09Z","git_url":"git://github.com/cuappdev/podcast-backend.git","ssh_url":"git@github.com:cuappdev/podcast-backend.git","clone_url":"https://github.com/cuappdev/podcast-backend.git","svn_url":"https://github.com/cuappdev/podcast-backend","homepage":"","size":27452,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78"},"html":{"href":"https://github.com/cuappdev/podcast-backend/pull/78"},"issue":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/issues/78"},"comments":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/cuappdev/podcast-backend/statuses/0047b8f07e836bd69440b121a9a55bb119f53b78"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ChenJesse"}}