{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/86656489","pull_request_review_id":7307062,"id":86656489,"diff_hunk":"@@ -87,37 +87,23 @@ const mapDispatchToProps = dispatch => ({\n });\n \n const mergeProps = (stateProps, dispatchProps, ownProps) => {\n-  const { currentPage } = stateProps;\n-  const { queryParams } = currentPage;\n-  const { sort = SORTS.HOT } = queryParams;\n+  const { currentPage: { url, urlParams, queryParams } } = stateProps;\n+\n+  const sort = urlParams.sort || queryParams.sort || SORTS.HOT;\n   const time = ownProps.time || listingTime(queryParams, sort);\n   const { navigateToUrl } = dispatchProps;\n \n-  const onSortChange = sort => {\n-    navigateToUrl(currentPage.url, {\n-      queryParams: {\n-        ...queryParams,\n-        sort,\n-      },\n-    });\n-  };\n-\n-  const onTimeChange = time => {\n-    navigateToUrl(currentPage.url, {\n-      queryParams: {\n-        ...queryParams,\n-        t: time,\n-      },\n-    });\n-  };\n-\n   return {\n-    ...stateProps,\n-    ...ownProps,\n-    onSortChange,\n-    onTimeChange,\n-    sort,\n     time,\n+    sort,\n+    ...ownProps,\n+    ...stateProps,\n+    onTimeChange: time => navigateToUrl(url, { queryParams: { ...queryParams, t: time } }),\n+    onSortChange: sort => {\n+      // add the sort to the url by taking just the '/r/:subredditName' part\n+      const newUrl = [ ...url.split('/').slice(0, 3), sort ].join('/');","path":"src/app/components/SortAndTimeSelector/index.jsx","position":44,"original_position":44,"commit_id":"0683a01fc33e8347daf98a99e8b7853119648a03","original_commit_id":"0683a01fc33e8347daf98a99e8b7853119648a03","user":{"login":"phil303","id":787203,"avatar_url":"https://avatars.githubusercontent.com/u/787203?v=3","gravatar_id":"","url":"https://api.github.com/users/phil303","html_url":"https://github.com/phil303","followers_url":"https://api.github.com/users/phil303/followers","following_url":"https://api.github.com/users/phil303/following{/other_user}","gists_url":"https://api.github.com/users/phil303/gists{/gist_id}","starred_url":"https://api.github.com/users/phil303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil303/subscriptions","organizations_url":"https://api.github.com/users/phil303/orgs","repos_url":"https://api.github.com/users/phil303/repos","events_url":"https://api.github.com/users/phil303/events{/privacy}","received_events_url":"https://api.github.com/users/phil303/received_events","type":"User","site_admin":false},"body":"👍 I think this is a much nicer solution","created_at":"2016-11-05T02:36:18Z","updated_at":"2016-11-05T02:36:18Z","html_url":"https://github.com/reddit/reddit-mobile/pull/879#discussion_r86656489","pull_request_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879","_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/86656489"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/879#discussion_r86656489"},"pull_request":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879","id":92260894,"html_url":"https://github.com/reddit/reddit-mobile/pull/879","diff_url":"https://github.com/reddit/reddit-mobile/pull/879.diff","patch_url":"https://github.com/reddit/reddit-mobile/pull/879.patch","issue_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/879","number":879,"state":"open","locked":false,"title":"Unified urls - Match subreddit sorts to desktop","user":{"login":"phil303","id":787203,"avatar_url":"https://avatars.githubusercontent.com/u/787203?v=3","gravatar_id":"","url":"https://api.github.com/users/phil303","html_url":"https://github.com/phil303","followers_url":"https://api.github.com/users/phil303/followers","following_url":"https://api.github.com/users/phil303/following{/other_user}","gists_url":"https://api.github.com/users/phil303/gists{/gist_id}","starred_url":"https://api.github.com/users/phil303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil303/subscriptions","organizations_url":"https://api.github.com/users/phil303/orgs","repos_url":"https://api.github.com/users/phil303/repos","events_url":"https://api.github.com/users/phil303/events{/privacy}","received_events_url":"https://api.github.com/users/phil303/received_events","type":"User","site_admin":false},"body":"Bug:\r\nCurrently 2X doesn't support urls that have the format of `/r/nba/top`,\r\nwhere the subreddit sort is part of the path. As part of the unified url\r\npush, we need to support this.\r\n\r\nFix:\r\nCurrently we support the sort as a query parameter but we'd like to\r\ndeprecate this over time. So we're going to first look for the sort in\r\nthe url then fallback to the query param then fallback to 'hot'.\r\n\r\nThere's a few other sorts that 2X doesn't support yet at all, such as\r\n\"gilded\" or \"ads\". Per discussion with William, we're going to 404 these\r\n(this is the status quo).\r\n\r\nDemo:\r\n![subreddit sorts](https://cloud.githubusercontent.com/assets/787203/19989476/0b6cb910-a1e4-11e6-9961-c1146071696c.gif)\r\n\r\n\r\n:eyeglasses: @nramadas @wting @schwers ","created_at":"2016-11-03T23:37:29Z","updated_at":"2016-11-05T02:36:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12445bae8728ad2a2febbb9f0c70cb298ef04acf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879/commits","review_comments_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879/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/879/comments","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/0683a01fc33e8347daf98a99e8b7853119648a03","head":{"label":"phil303:canonical-sort-urls","ref":"canonical-sort-urls","sha":"0683a01fc33e8347daf98a99e8b7853119648a03","user":{"login":"phil303","id":787203,"avatar_url":"https://avatars.githubusercontent.com/u/787203?v=3","gravatar_id":"","url":"https://api.github.com/users/phil303","html_url":"https://github.com/phil303","followers_url":"https://api.github.com/users/phil303/followers","following_url":"https://api.github.com/users/phil303/following{/other_user}","gists_url":"https://api.github.com/users/phil303/gists{/gist_id}","starred_url":"https://api.github.com/users/phil303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil303/subscriptions","organizations_url":"https://api.github.com/users/phil303/orgs","repos_url":"https://api.github.com/users/phil303/repos","events_url":"https://api.github.com/users/phil303/events{/privacy}","received_events_url":"https://api.github.com/users/phil303/received_events","type":"User","site_admin":false},"repo":{"id":59247570,"name":"reddit-mobile","full_name":"phil303/reddit-mobile","owner":{"login":"phil303","id":787203,"avatar_url":"https://avatars.githubusercontent.com/u/787203?v=3","gravatar_id":"","url":"https://api.github.com/users/phil303","html_url":"https://github.com/phil303","followers_url":"https://api.github.com/users/phil303/followers","following_url":"https://api.github.com/users/phil303/following{/other_user}","gists_url":"https://api.github.com/users/phil303/gists{/gist_id}","starred_url":"https://api.github.com/users/phil303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil303/subscriptions","organizations_url":"https://api.github.com/users/phil303/orgs","repos_url":"https://api.github.com/users/phil303/repos","events_url":"https://api.github.com/users/phil303/events{/privacy}","received_events_url":"https://api.github.com/users/phil303/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phil303/reddit-mobile","description":null,"fork":true,"url":"https://api.github.com/repos/phil303/reddit-mobile","forks_url":"https://api.github.com/repos/phil303/reddit-mobile/forks","keys_url":"https://api.github.com/repos/phil303/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phil303/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phil303/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/phil303/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/phil303/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/phil303/reddit-mobile/events","assignees_url":"https://api.github.com/repos/phil303/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/phil303/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/phil303/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/phil303/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phil303/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phil303/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/phil303/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phil303/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/phil303/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/phil303/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/phil303/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/phil303/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/phil303/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/phil303/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/phil303/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/phil303/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/phil303/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/phil303/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/phil303/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phil303/reddit-mobile/merges","archive_url":"https://api.github.com/repos/phil303/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phil303/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/phil303/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/phil303/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/phil303/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/phil303/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phil303/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/phil303/reddit-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/phil303/reddit-mobile/deployments","created_at":"2016-05-19T22:33:07Z","updated_at":"2016-05-19T22:33:10Z","pushed_at":"2016-11-04T21:09:58Z","git_url":"git://github.com/phil303/reddit-mobile.git","ssh_url":"git@github.com:phil303/reddit-mobile.git","clone_url":"https://github.com/phil303/reddit-mobile.git","svn_url":"https://github.com/phil303/reddit-mobile","homepage":null,"size":7213,"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":"reddit:2X","ref":"2X","sha":"c16a54444d310be2a57a0c66890e144152260b14","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":null,"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-11-04T21:02:25Z","pushed_at":"2016-11-04T23:55:30Z","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":10814,"stargazers_count":870,"watchers_count":870,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":150,"mirror_url":null,"open_issues_count":22,"forks":150,"open_issues":22,"watchers":870,"default_branch":"2X"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/879"},"issue":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/879"},"comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/879/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/879/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/879/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/reddit-mobile/statuses/0683a01fc33e8347daf98a99e8b7853119648a03"}}}}
{"actor":{"display_login":"phil303"}}