{"action":"created","comment":{"url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/comments/209337139","pull_request_review_id":145338593,"id":209337139,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTMzNzEzOQ==","diff_hunk":"@@ -0,0 +1,197 @@\n+import { Injectable } from '@angular/core';\n+import { Router, RoutesRecognized } from '@angular/router';\n+import { filter } from 'rxjs/operators/filter';\n+import { Store, select } from '@ngrx/store';\n+import { selectRoutedPageEpisodes, selectRouter } from '../../ngrx/reducers/selectors/';\n+import {\n+  RouterParams, Episode,\n+  MetricsType, ChartType, CHARTTYPE_PODCAST,\n+  INTERVAL_DAILY,\n+  METRICSTYPE_DEMOGRAPHICS,\n+  METRICSTYPE_DOWNLOADS,\n+  METRICSTYPE_TRAFFICSOURCES } from '../../ngrx/';\n+import * as localStorageUtil from '../../shared/util/local-storage.util';\n+import * as dateUtil from '../../shared/util/date/';\n+import * as ACTIONS from '../../ngrx/actions/';\n+\n+@Injectable()\n+export class RoutingService {\n+  routerParams: RouterParams;\n+  episodes: Episode[];\n+\n+  constructor (public store: Store<any>,\n+               private router: Router) {\n+    this.dontAllowRoot();\n+    this.subRoutedPageEpisodes();\n+    this.subAndCheckRouterParams();\n+  }\n+\n+  dontAllowRoot() {\n+    // for redirecting users routed to '/'\n+    this.router.events.pipe(\n+      filter(event => event instanceof RoutesRecognized)\n+    ).subscribe((event: RoutesRecognized) => {\n+      if (event.url === '/' && this.routerParams && this.routerParams.podcastId) {","path":"src/app/core/routing/routing.service.ts","position":34,"original_position":34,"commit_id":"bce81eafd829f96a5f6558c62d4b909731d2a8fb","original_commit_id":"bce81eafd829f96a5f6558c62d4b909731d2a8fb","user":{"login":"sandikbarr","id":2250413,"node_id":"MDQ6VXNlcjIyNTA0MTM=","avatar_url":"https://avatars2.githubusercontent.com/u/2250413?v=4","gravatar_id":"","url":"https://api.github.com/users/sandikbarr","html_url":"https://github.com/sandikbarr","followers_url":"https://api.github.com/users/sandikbarr/followers","following_url":"https://api.github.com/users/sandikbarr/following{/other_user}","gists_url":"https://api.github.com/users/sandikbarr/gists{/gist_id}","starred_url":"https://api.github.com/users/sandikbarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandikbarr/subscriptions","organizations_url":"https://api.github.com/users/sandikbarr/orgs","repos_url":"https://api.github.com/users/sandikbarr/repos","events_url":"https://api.github.com/users/sandikbarr/events{/privacy}","received_events_url":"https://api.github.com/users/sandikbarr/received_events","type":"User","site_admin":false},"body":"watches for routing events to '/' and redirects back to the app route","created_at":"2018-08-10T17:48:54Z","updated_at":"2018-08-10T17:48:54Z","html_url":"https://github.com/PRX/metrics.prx.org/pull/299#discussion_r209337139","pull_request_url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/comments/209337139"},"html":{"href":"https://github.com/PRX/metrics.prx.org/pull/299#discussion_r209337139"},"pull_request":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299","id":207679033,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3Njc5MDMz","html_url":"https://github.com/PRX/metrics.prx.org/pull/299","diff_url":"https://github.com/PRX/metrics.prx.org/pull/299.diff","patch_url":"https://github.com/PRX/metrics.prx.org/pull/299.patch","issue_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues/299","number":299,"state":"open","locked":false,"title":"move to the new castle api","user":{"login":"sandikbarr","id":2250413,"node_id":"MDQ6VXNlcjIyNTA0MTM=","avatar_url":"https://avatars2.githubusercontent.com/u/2250413?v=4","gravatar_id":"","url":"https://api.github.com/users/sandikbarr","html_url":"https://github.com/sandikbarr","followers_url":"https://api.github.com/users/sandikbarr/followers","following_url":"https://api.github.com/users/sandikbarr/following{/other_user}","gists_url":"https://api.github.com/users/sandikbarr/gists{/gist_id}","starred_url":"https://api.github.com/users/sandikbarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandikbarr/subscriptions","organizations_url":"https://api.github.com/users/sandikbarr/orgs","repos_url":"https://api.github.com/users/sandikbarr/repos","events_url":"https://api.github.com/users/sandikbarr/events{/privacy}","received_events_url":"https://api.github.com/users/sandikbarr/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-10T17:44:17Z","updated_at":"2018-08-10T17:48:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6eceba0269f16ba0120098879b8d9a6396a02641","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299/commits","review_comments_url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299/comments","review_comment_url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues/299/comments","statuses_url":"https://api.github.com/repos/PRX/metrics.prx.org/statuses/bce81eafd829f96a5f6558c62d4b909731d2a8fb","head":{"label":"PRX:feat/castle-api","ref":"feat/castle-api","sha":"bce81eafd829f96a5f6558c62d4b909731d2a8fb","user":{"login":"PRX","id":160453,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ1Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/160453?v=4","gravatar_id":"","url":"https://api.github.com/users/PRX","html_url":"https://github.com/PRX","followers_url":"https://api.github.com/users/PRX/followers","following_url":"https://api.github.com/users/PRX/following{/other_user}","gists_url":"https://api.github.com/users/PRX/gists{/gist_id}","starred_url":"https://api.github.com/users/PRX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRX/subscriptions","organizations_url":"https://api.github.com/users/PRX/orgs","repos_url":"https://api.github.com/users/PRX/repos","events_url":"https://api.github.com/users/PRX/events{/privacy}","received_events_url":"https://api.github.com/users/PRX/received_events","type":"Organization","site_admin":false},"repo":{"id":92314349,"node_id":"MDEwOlJlcG9zaXRvcnk5MjMxNDM0OQ==","name":"metrics.prx.org","full_name":"PRX/metrics.prx.org","owner":{"login":"PRX","id":160453,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ1Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/160453?v=4","gravatar_id":"","url":"https://api.github.com/users/PRX","html_url":"https://github.com/PRX","followers_url":"https://api.github.com/users/PRX/followers","following_url":"https://api.github.com/users/PRX/following{/other_user}","gists_url":"https://api.github.com/users/PRX/gists{/gist_id}","starred_url":"https://api.github.com/users/PRX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRX/subscriptions","organizations_url":"https://api.github.com/users/PRX/orgs","repos_url":"https://api.github.com/users/PRX/repos","events_url":"https://api.github.com/users/PRX/events{/privacy}","received_events_url":"https://api.github.com/users/PRX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PRX/metrics.prx.org","description":"PRX Metrics Frontend App","fork":false,"url":"https://api.github.com/repos/PRX/metrics.prx.org","forks_url":"https://api.github.com/repos/PRX/metrics.prx.org/forks","keys_url":"https://api.github.com/repos/PRX/metrics.prx.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PRX/metrics.prx.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PRX/metrics.prx.org/teams","hooks_url":"https://api.github.com/repos/PRX/metrics.prx.org/hooks","issue_events_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues/events{/number}","events_url":"https://api.github.com/repos/PRX/metrics.prx.org/events","assignees_url":"https://api.github.com/repos/PRX/metrics.prx.org/assignees{/user}","branches_url":"https://api.github.com/repos/PRX/metrics.prx.org/branches{/branch}","tags_url":"https://api.github.com/repos/PRX/metrics.prx.org/tags","blobs_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PRX/metrics.prx.org/statuses/{sha}","languages_url":"https://api.github.com/repos/PRX/metrics.prx.org/languages","stargazers_url":"https://api.github.com/repos/PRX/metrics.prx.org/stargazers","contributors_url":"https://api.github.com/repos/PRX/metrics.prx.org/contributors","subscribers_url":"https://api.github.com/repos/PRX/metrics.prx.org/subscribers","subscription_url":"https://api.github.com/repos/PRX/metrics.prx.org/subscription","commits_url":"https://api.github.com/repos/PRX/metrics.prx.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/PRX/metrics.prx.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/PRX/metrics.prx.org/contents/{+path}","compare_url":"https://api.github.com/repos/PRX/metrics.prx.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PRX/metrics.prx.org/merges","archive_url":"https://api.github.com/repos/PRX/metrics.prx.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PRX/metrics.prx.org/downloads","issues_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues{/number}","pulls_url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls{/number}","milestones_url":"https://api.github.com/repos/PRX/metrics.prx.org/milestones{/number}","notifications_url":"https://api.github.com/repos/PRX/metrics.prx.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PRX/metrics.prx.org/labels{/name}","releases_url":"https://api.github.com/repos/PRX/metrics.prx.org/releases{/id}","deployments_url":"https://api.github.com/repos/PRX/metrics.prx.org/deployments","created_at":"2017-05-24T16:38:41Z","updated_at":"2018-07-24T14:50:30Z","pushed_at":"2018-08-10T17:44:17Z","git_url":"git://github.com/PRX/metrics.prx.org.git","ssh_url":"git@github.com:PRX/metrics.prx.org.git","clone_url":"https://github.com/PRX/metrics.prx.org.git","svn_url":"https://github.com/PRX/metrics.prx.org","homepage":null,"size":1240,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":52,"watchers":1,"default_branch":"master"}},"base":{"label":"PRX:master","ref":"master","sha":"12f0473677c46e9e7137a74c7b029f45496803b7","user":{"login":"PRX","id":160453,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ1Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/160453?v=4","gravatar_id":"","url":"https://api.github.com/users/PRX","html_url":"https://github.com/PRX","followers_url":"https://api.github.com/users/PRX/followers","following_url":"https://api.github.com/users/PRX/following{/other_user}","gists_url":"https://api.github.com/users/PRX/gists{/gist_id}","starred_url":"https://api.github.com/users/PRX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRX/subscriptions","organizations_url":"https://api.github.com/users/PRX/orgs","repos_url":"https://api.github.com/users/PRX/repos","events_url":"https://api.github.com/users/PRX/events{/privacy}","received_events_url":"https://api.github.com/users/PRX/received_events","type":"Organization","site_admin":false},"repo":{"id":92314349,"node_id":"MDEwOlJlcG9zaXRvcnk5MjMxNDM0OQ==","name":"metrics.prx.org","full_name":"PRX/metrics.prx.org","owner":{"login":"PRX","id":160453,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ1Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/160453?v=4","gravatar_id":"","url":"https://api.github.com/users/PRX","html_url":"https://github.com/PRX","followers_url":"https://api.github.com/users/PRX/followers","following_url":"https://api.github.com/users/PRX/following{/other_user}","gists_url":"https://api.github.com/users/PRX/gists{/gist_id}","starred_url":"https://api.github.com/users/PRX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PRX/subscriptions","organizations_url":"https://api.github.com/users/PRX/orgs","repos_url":"https://api.github.com/users/PRX/repos","events_url":"https://api.github.com/users/PRX/events{/privacy}","received_events_url":"https://api.github.com/users/PRX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PRX/metrics.prx.org","description":"PRX Metrics Frontend App","fork":false,"url":"https://api.github.com/repos/PRX/metrics.prx.org","forks_url":"https://api.github.com/repos/PRX/metrics.prx.org/forks","keys_url":"https://api.github.com/repos/PRX/metrics.prx.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PRX/metrics.prx.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PRX/metrics.prx.org/teams","hooks_url":"https://api.github.com/repos/PRX/metrics.prx.org/hooks","issue_events_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues/events{/number}","events_url":"https://api.github.com/repos/PRX/metrics.prx.org/events","assignees_url":"https://api.github.com/repos/PRX/metrics.prx.org/assignees{/user}","branches_url":"https://api.github.com/repos/PRX/metrics.prx.org/branches{/branch}","tags_url":"https://api.github.com/repos/PRX/metrics.prx.org/tags","blobs_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PRX/metrics.prx.org/statuses/{sha}","languages_url":"https://api.github.com/repos/PRX/metrics.prx.org/languages","stargazers_url":"https://api.github.com/repos/PRX/metrics.prx.org/stargazers","contributors_url":"https://api.github.com/repos/PRX/metrics.prx.org/contributors","subscribers_url":"https://api.github.com/repos/PRX/metrics.prx.org/subscribers","subscription_url":"https://api.github.com/repos/PRX/metrics.prx.org/subscription","commits_url":"https://api.github.com/repos/PRX/metrics.prx.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/PRX/metrics.prx.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/PRX/metrics.prx.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/PRX/metrics.prx.org/contents/{+path}","compare_url":"https://api.github.com/repos/PRX/metrics.prx.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PRX/metrics.prx.org/merges","archive_url":"https://api.github.com/repos/PRX/metrics.prx.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PRX/metrics.prx.org/downloads","issues_url":"https://api.github.com/repos/PRX/metrics.prx.org/issues{/number}","pulls_url":"https://api.github.com/repos/PRX/metrics.prx.org/pulls{/number}","milestones_url":"https://api.github.com/repos/PRX/metrics.prx.org/milestones{/number}","notifications_url":"https://api.github.com/repos/PRX/metrics.prx.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PRX/metrics.prx.org/labels{/name}","releases_url":"https://api.github.com/repos/PRX/metrics.prx.org/releases{/id}","deployments_url":"https://api.github.com/repos/PRX/metrics.prx.org/deployments","created_at":"2017-05-24T16:38:41Z","updated_at":"2018-07-24T14:50:30Z","pushed_at":"2018-08-10T17:44:17Z","git_url":"git://github.com/PRX/metrics.prx.org.git","ssh_url":"git@github.com:PRX/metrics.prx.org.git","clone_url":"https://github.com/PRX/metrics.prx.org.git","svn_url":"https://github.com/PRX/metrics.prx.org","homepage":null,"size":1240,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":52,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299"},"html":{"href":"https://github.com/PRX/metrics.prx.org/pull/299"},"issue":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/issues/299"},"comments":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/PRX/metrics.prx.org/statuses/bce81eafd829f96a5f6558c62d4b909731d2a8fb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sandikbarr"}}