{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/77932110","id":77932110,"diff_hunk":"@@ -1,12 +1,23 @@\n import APIOptions, { optionsWithAuth } from '@r/api-client';\n+import merge from '@r/platform/merge';\n \n-export const apiOptionsFromState = (state) => {\n+export const apiOptionsFromState = state => {\n   if (!state) { return APIOptions; }\n \n   const { session } = state;\n-  if (session && session.accessToken) {\n-    return optionsWithAuth(session.accessToken);\n+  const options = (session && session.accessToken)\n+    ? optionsWithAuth(session.accessToken)\n+    : { ...APIOptions };\n+\n+  // grab loids if we have them, and set the cookie if on the server\n+  const { loid: { loid, loidCreated }, meta } = state;\n+  if (loid && meta.env !== 'CLIENT') {\n+    return merge(options, {\n+      headers: {\n+        'Cookie': `loid=${loid}; loidcreated=${loidCreated}`,","path":"src/lib/apiOptionsFromState.js","position":20,"original_position":20,"commit_id":"8890c4283030799300479e632c2ac28444abf70e","original_commit_id":"8890c4283030799300479e632c2ac28444abf70e","user":{"login":"schwers","id":307983,"avatar_url":"https://avatars.githubusercontent.com/u/307983?v=3","gravatar_id":"","url":"https://api.github.com/users/schwers","html_url":"https://github.com/schwers","followers_url":"https://api.github.com/users/schwers/followers","following_url":"https://api.github.com/users/schwers/following{/other_user}","gists_url":"https://api.github.com/users/schwers/gists{/gist_id}","starred_url":"https://api.github.com/users/schwers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schwers/subscriptions","organizations_url":"https://api.github.com/users/schwers/orgs","repos_url":"https://api.github.com/users/schwers/repos","events_url":"https://api.github.com/users/schwers/events{/privacy}","received_events_url":"https://api.github.com/users/schwers/received_events","type":"User","site_admin":false},"body":"Do we intentionally put loid on state, and pass it, when the users is logged in?","created_at":"2016-09-08T01:07:26Z","updated_at":"2016-09-08T01:07:26Z","html_url":"https://github.com/reddit/reddit-mobile/pull/706#discussion_r77932110","pull_request_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706","_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/77932110"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/706#discussion_r77932110"},"pull_request":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706","id":83184160,"html_url":"https://github.com/reddit/reddit-mobile/pull/706","diff_url":"https://github.com/reddit/reddit-mobile/pull/706.diff","patch_url":"https://github.com/reddit/reddit-mobile/pull/706.patch","issue_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/706","number":706,"state":"open","locked":false,"title":"Grab LOIDs from the server","user":{"login":"nramadas","id":1679892,"avatar_url":"https://avatars.githubusercontent.com/u/1679892?v=3","gravatar_id":"","url":"https://api.github.com/users/nramadas","html_url":"https://github.com/nramadas","followers_url":"https://api.github.com/users/nramadas/followers","following_url":"https://api.github.com/users/nramadas/following{/other_user}","gists_url":"https://api.github.com/users/nramadas/gists{/gist_id}","starred_url":"https://api.github.com/users/nramadas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nramadas/subscriptions","organizations_url":"https://api.github.com/users/nramadas/orgs","repos_url":"https://api.github.com/users/nramadas/repos","events_url":"https://api.github.com/users/nramadas/events{/privacy}","received_events_url":"https://api.github.com/users/nramadas/received_events","type":"User","site_admin":false},"body":"Blocked by node-api-client PR here: https://github.com/reddit/node-api-client/pull/150\r\n\r\nThis patch pulls in the loids created by r2 api into state. It also makes sure that the \"user fetch\" call is highly blocking so that we can be sure `loid`s are in state before any further fetches happen (in case we need to add tracking for any subsequent api calls we make).\r\n\r\n:eyeglasses: @phil303 @schwers ","created_at":"2016-08-29T23:16:30Z","updated_at":"2016-09-08T01:07:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d62cc97ccf8980772037c1a9159dcf40f6ea55b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706/commits","review_comments_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706/comments","review_comment_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/706/comments","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/8890c4283030799300479e632c2ac28444abf70e","head":{"label":"nramadas:2x_loid","ref":"2x_loid","sha":"8890c4283030799300479e632c2ac28444abf70e","user":{"login":"nramadas","id":1679892,"avatar_url":"https://avatars.githubusercontent.com/u/1679892?v=3","gravatar_id":"","url":"https://api.github.com/users/nramadas","html_url":"https://github.com/nramadas","followers_url":"https://api.github.com/users/nramadas/followers","following_url":"https://api.github.com/users/nramadas/following{/other_user}","gists_url":"https://api.github.com/users/nramadas/gists{/gist_id}","starred_url":"https://api.github.com/users/nramadas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nramadas/subscriptions","organizations_url":"https://api.github.com/users/nramadas/orgs","repos_url":"https://api.github.com/users/nramadas/repos","events_url":"https://api.github.com/users/nramadas/events{/privacy}","received_events_url":"https://api.github.com/users/nramadas/received_events","type":"User","site_admin":false},"repo":{"id":49025435,"name":"reddit-mobile","full_name":"nramadas/reddit-mobile","owner":{"login":"nramadas","id":1679892,"avatar_url":"https://avatars.githubusercontent.com/u/1679892?v=3","gravatar_id":"","url":"https://api.github.com/users/nramadas","html_url":"https://github.com/nramadas","followers_url":"https://api.github.com/users/nramadas/followers","following_url":"https://api.github.com/users/nramadas/following{/other_user}","gists_url":"https://api.github.com/users/nramadas/gists{/gist_id}","starred_url":"https://api.github.com/users/nramadas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nramadas/subscriptions","organizations_url":"https://api.github.com/users/nramadas/orgs","repos_url":"https://api.github.com/users/nramadas/repos","events_url":"https://api.github.com/users/nramadas/events{/privacy}","received_events_url":"https://api.github.com/users/nramadas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nramadas/reddit-mobile","description":"","fork":true,"url":"https://api.github.com/repos/nramadas/reddit-mobile","forks_url":"https://api.github.com/repos/nramadas/reddit-mobile/forks","keys_url":"https://api.github.com/repos/nramadas/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nramadas/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nramadas/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/nramadas/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/nramadas/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/nramadas/reddit-mobile/events","assignees_url":"https://api.github.com/repos/nramadas/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/nramadas/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/nramadas/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/nramadas/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nramadas/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nramadas/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/nramadas/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nramadas/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/nramadas/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/nramadas/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/nramadas/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/nramadas/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/nramadas/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/nramadas/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/nramadas/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/nramadas/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/nramadas/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/nramadas/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/nramadas/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nramadas/reddit-mobile/merges","archive_url":"https://api.github.com/repos/nramadas/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nramadas/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/nramadas/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/nramadas/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/nramadas/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/nramadas/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nramadas/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/nramadas/reddit-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/nramadas/reddit-mobile/deployments","created_at":"2016-01-04T21:52:12Z","updated_at":"2016-02-01T19:07:44Z","pushed_at":"2016-09-08T00:56:33Z","git_url":"git://github.com/nramadas/reddit-mobile.git","ssh_url":"git@github.com:nramadas/reddit-mobile.git","clone_url":"https://github.com/nramadas/reddit-mobile.git","svn_url":"https://github.com/nramadas/reddit-mobile","homepage":null,"size":6646,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"reddit:2X","ref":"2X","sha":"423bb02b25987ac5c69e6f90af8e9b4053bbf64b","user":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"repo":{"id":23087554,"name":"reddit-mobile","full_name":"reddit/reddit-mobile","owner":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reddit/reddit-mobile","description":"","fork":false,"url":"https://api.github.com/repos/reddit/reddit-mobile","forks_url":"https://api.github.com/repos/reddit/reddit-mobile/forks","keys_url":"https://api.github.com/repos/reddit/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reddit/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reddit/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/reddit/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/reddit/reddit-mobile/events","assignees_url":"https://api.github.com/repos/reddit/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/reddit/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/reddit/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/reddit/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reddit/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reddit/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/reddit/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/reddit/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/reddit/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/reddit/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/reddit/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/reddit/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/reddit/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/reddit/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/reddit/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/reddit/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/reddit/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reddit/reddit-mobile/merges","archive_url":"https://api.github.com/repos/reddit/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reddit/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/reddit/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/reddit/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/reddit/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reddit/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/reddit/reddit-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/reddit/reddit-mobile/deployments","created_at":"2014-08-18T21:42:05Z","updated_at":"2016-09-05T02:52:07Z","pushed_at":"2016-09-08T00:56:34Z","git_url":"git://github.com/reddit/reddit-mobile.git","ssh_url":"git@github.com:reddit/reddit-mobile.git","clone_url":"https://github.com/reddit/reddit-mobile.git","svn_url":"https://github.com/reddit/reddit-mobile","homepage":null,"size":10397,"stargazers_count":842,"watchers_count":842,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":143,"mirror_url":null,"open_issues_count":29,"forks":143,"open_issues":29,"watchers":842,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/706"},"issue":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/706"},"comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/706/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706/comments"},"review_comment":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/706/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/reddit-mobile/statuses/8890c4283030799300479e632c2ac28444abf70e"}}}}
{"actor":{"display_login":"schwers"}}