{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/93678672","pull_request_review_id":14211894,"id":93678672,"diff_hunk":"@@ -0,0 +1,64 @@\n+import createTest from '@r/platform/createTest';\n+import * as platformActions from '@r/platform/actions';\n+import * as postActions from 'app/actions/posts';\n+\n+import routes from 'app/router';\n+\n+import playingPosts, { DEFAULT } from './playingPosts';\n+\n+createTest({ reducers: { playingPosts }, routes }, ({ getStore, expect }) => {\n+  describe('playingPosts', () => {\n+    describe('GOTO_PAGE_INDEX', () => {\n+      it('should reset PlayingPosts to default', () => {\n+        const { store } = getStore({ playingPosts: { 'id23e': true }});\n+\n+        store.dispatch(platformActions.gotoPageIndex());\n+        const { playingPosts } = store.getState();\n+        expect(playingPosts).to.eql(DEFAULT);\n+      });\n+    });\n+\n+    describe('SET_PAGE', () => {\n+      it('should reset state to a blank object', () => {\n+        const { store } = getStore({ playingPosts: { 'id23e': true }});\n+        \n+        store.dispatch(platformActions.setPage('/', {}));\n+        const { playingPosts } = store.getState();\n+        expect(playingPosts).to.eql(DEFAULT);\n+      });\n+\n+      it('should leave post playing state if user is going to comment page', () => {\n+        const postId = 'id23e';\n+        const playingState = { [postId]: true };\n+        const { store } = getStore({ playingPosts: playingState });\n+\n+        store.dispatch(platformActions.setPage('/', { urlParams: { postId: postId }}));","path":"src/app/reducers/playingPosts.test.js","position":35,"original_position":35,"commit_id":"de5c4a9e315a9cfb507d901c2ecaf2e03834e355","original_commit_id":"de5c4a9e315a9cfb507d901c2ecaf2e03834e355","user":{"login":"curioussavage","id":7064600,"avatar_url":"https://avatars.githubusercontent.com/u/7064600?v=3","gravatar_id":"","url":"https://api.github.com/users/curioussavage","html_url":"https://github.com/curioussavage","followers_url":"https://api.github.com/users/curioussavage/followers","following_url":"https://api.github.com/users/curioussavage/following{/other_user}","gists_url":"https://api.github.com/users/curioussavage/gists{/gist_id}","starred_url":"https://api.github.com/users/curioussavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curioussavage/subscriptions","organizations_url":"https://api.github.com/users/curioussavage/orgs","repos_url":"https://api.github.com/users/curioussavage/repos","events_url":"https://api.github.com/users/curioussavage/events{/privacy}","received_events_url":"https://api.github.com/users/curioussavage/received_events","type":"User","site_admin":false},"body":"Ill add that for clarity - my reducer only looks at the urlParams key","created_at":"2016-12-22T19:01:36Z","updated_at":"2016-12-22T19:01:36Z","html_url":"https://github.com/reddit/reddit-mobile/pull/918#discussion_r93678672","pull_request_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918","_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/comments/93678672"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/918#discussion_r93678672"},"pull_request":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918","id":97042173,"html_url":"https://github.com/reddit/reddit-mobile/pull/918","diff_url":"https://github.com/reddit/reddit-mobile/pull/918.diff","patch_url":"https://github.com/reddit/reddit-mobile/pull/918.patch","issue_url":"https://api.github.com/repos/reddit/reddit-mobile/issues/918","number":918,"state":"open","locked":false,"title":"Playing state gif ","user":{"login":"curioussavage","id":7064600,"avatar_url":"https://avatars.githubusercontent.com/u/7064600?v=3","gravatar_id":"","url":"https://api.github.com/users/curioussavage","html_url":"https://github.com/curioussavage","followers_url":"https://api.github.com/users/curioussavage/followers","following_url":"https://api.github.com/users/curioussavage/following{/other_user}","gists_url":"https://api.github.com/users/curioussavage/gists{/gist_id}","starred_url":"https://api.github.com/users/curioussavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curioussavage/subscriptions","organizations_url":"https://api.github.com/users/curioussavage/orgs","repos_url":"https://api.github.com/users/curioussavage/repos","events_url":"https://api.github.com/users/curioussavage/events{/privacy}","received_events_url":"https://api.github.com/users/curioussavage/received_events","type":"User","site_admin":false},"body":"[CONT-4](https://reddit.atlassian.net/browse/CONT-4)\r\n\r\n\r\n**issue:**\r\nThis pull request resolves the issue caused by gifs playing when users go back to the previous page. example: from a comment page back to a listing page where they had previously expanded several posts. The problem is all the gifs playing at once use up a lot of data and slow things down.\r\n\r\n**solution:**\r\nplaying state was moved out of the postContent component into redux and also decoupled from expanded state.\r\n\r\n**bonus:**\r\n this lets us keep playing the gifs seamlessly when a user taps on the comments page link after playing the gif (only relevant platforms like android that play video/gifs inline).\r\n\r\n\r\n**concerns:**\r\n1. since moved out the only state in postContent it was expedient to convert it to a pure functional component. This was a major refactor of the component. Several pre-existing bugs were discovered while refactoring. There is the possibility of new bugs being introduced so please test the various behaviors required by the postContent component other than playing. This component may be a good place to add some ui testing in the future too.\r\n2. the logic to decide when to play or not turned out to be a teeny bit convoluted, there could be states where we get undesired behavior still. The reducer was tested and does handle the back button and links going back to the listing correctly ( removes the playing state on all posts )","created_at":"2016-12-08T01:22:18Z","updated_at":"2016-12-22T19:01:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d06b017d411adc33486ba9742e65fc3e403fd2e6","assignee":{"login":"curioussavage","id":7064600,"avatar_url":"https://avatars.githubusercontent.com/u/7064600?v=3","gravatar_id":"","url":"https://api.github.com/users/curioussavage","html_url":"https://github.com/curioussavage","followers_url":"https://api.github.com/users/curioussavage/followers","following_url":"https://api.github.com/users/curioussavage/following{/other_user}","gists_url":"https://api.github.com/users/curioussavage/gists{/gist_id}","starred_url":"https://api.github.com/users/curioussavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curioussavage/subscriptions","organizations_url":"https://api.github.com/users/curioussavage/orgs","repos_url":"https://api.github.com/users/curioussavage/repos","events_url":"https://api.github.com/users/curioussavage/events{/privacy}","received_events_url":"https://api.github.com/users/curioussavage/received_events","type":"User","site_admin":false},"assignees":[{"login":"curioussavage","id":7064600,"avatar_url":"https://avatars.githubusercontent.com/u/7064600?v=3","gravatar_id":"","url":"https://api.github.com/users/curioussavage","html_url":"https://github.com/curioussavage","followers_url":"https://api.github.com/users/curioussavage/followers","following_url":"https://api.github.com/users/curioussavage/following{/other_user}","gists_url":"https://api.github.com/users/curioussavage/gists{/gist_id}","starred_url":"https://api.github.com/users/curioussavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curioussavage/subscriptions","organizations_url":"https://api.github.com/users/curioussavage/orgs","repos_url":"https://api.github.com/users/curioussavage/repos","events_url":"https://api.github.com/users/curioussavage/events{/privacy}","received_events_url":"https://api.github.com/users/curioussavage/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918/commits","review_comments_url":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918/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/918/comments","statuses_url":"https://api.github.com/repos/reddit/reddit-mobile/statuses/de5c4a9e315a9cfb507d901c2ecaf2e03834e355","head":{"label":"curioussavage:playing-state-gif","ref":"playing-state-gif","sha":"de5c4a9e315a9cfb507d901c2ecaf2e03834e355","user":{"login":"curioussavage","id":7064600,"avatar_url":"https://avatars.githubusercontent.com/u/7064600?v=3","gravatar_id":"","url":"https://api.github.com/users/curioussavage","html_url":"https://github.com/curioussavage","followers_url":"https://api.github.com/users/curioussavage/followers","following_url":"https://api.github.com/users/curioussavage/following{/other_user}","gists_url":"https://api.github.com/users/curioussavage/gists{/gist_id}","starred_url":"https://api.github.com/users/curioussavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curioussavage/subscriptions","organizations_url":"https://api.github.com/users/curioussavage/orgs","repos_url":"https://api.github.com/users/curioussavage/repos","events_url":"https://api.github.com/users/curioussavage/events{/privacy}","received_events_url":"https://api.github.com/users/curioussavage/received_events","type":"User","site_admin":false},"repo":{"id":35171597,"name":"reddit-mobile","full_name":"curioussavage/reddit-mobile","owner":{"login":"curioussavage","id":7064600,"avatar_url":"https://avatars.githubusercontent.com/u/7064600?v=3","gravatar_id":"","url":"https://api.github.com/users/curioussavage","html_url":"https://github.com/curioussavage","followers_url":"https://api.github.com/users/curioussavage/followers","following_url":"https://api.github.com/users/curioussavage/following{/other_user}","gists_url":"https://api.github.com/users/curioussavage/gists{/gist_id}","starred_url":"https://api.github.com/users/curioussavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curioussavage/subscriptions","organizations_url":"https://api.github.com/users/curioussavage/orgs","repos_url":"https://api.github.com/users/curioussavage/repos","events_url":"https://api.github.com/users/curioussavage/events{/privacy}","received_events_url":"https://api.github.com/users/curioussavage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/curioussavage/reddit-mobile","description":null,"fork":true,"url":"https://api.github.com/repos/curioussavage/reddit-mobile","forks_url":"https://api.github.com/repos/curioussavage/reddit-mobile/forks","keys_url":"https://api.github.com/repos/curioussavage/reddit-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/curioussavage/reddit-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/curioussavage/reddit-mobile/teams","hooks_url":"https://api.github.com/repos/curioussavage/reddit-mobile/hooks","issue_events_url":"https://api.github.com/repos/curioussavage/reddit-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/curioussavage/reddit-mobile/events","assignees_url":"https://api.github.com/repos/curioussavage/reddit-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/curioussavage/reddit-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/curioussavage/reddit-mobile/tags","blobs_url":"https://api.github.com/repos/curioussavage/reddit-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/curioussavage/reddit-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/curioussavage/reddit-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/curioussavage/reddit-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/curioussavage/reddit-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/curioussavage/reddit-mobile/languages","stargazers_url":"https://api.github.com/repos/curioussavage/reddit-mobile/stargazers","contributors_url":"https://api.github.com/repos/curioussavage/reddit-mobile/contributors","subscribers_url":"https://api.github.com/repos/curioussavage/reddit-mobile/subscribers","subscription_url":"https://api.github.com/repos/curioussavage/reddit-mobile/subscription","commits_url":"https://api.github.com/repos/curioussavage/reddit-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/curioussavage/reddit-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/curioussavage/reddit-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/curioussavage/reddit-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/curioussavage/reddit-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/curioussavage/reddit-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/curioussavage/reddit-mobile/merges","archive_url":"https://api.github.com/repos/curioussavage/reddit-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/curioussavage/reddit-mobile/downloads","issues_url":"https://api.github.com/repos/curioussavage/reddit-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/curioussavage/reddit-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/curioussavage/reddit-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/curioussavage/reddit-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/curioussavage/reddit-mobile/labels{/name}","releases_url":"https://api.github.com/repos/curioussavage/reddit-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/curioussavage/reddit-mobile/deployments","created_at":"2015-05-06T16:55:50Z","updated_at":"2016-01-21T19:27:43Z","pushed_at":"2016-12-22T00:04:07Z","git_url":"git://github.com/curioussavage/reddit-mobile.git","ssh_url":"git@github.com:curioussavage/reddit-mobile.git","clone_url":"https://github.com/curioussavage/reddit-mobile.git","svn_url":"https://github.com/curioussavage/reddit-mobile","homepage":null,"size":7694,"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":"6d47126ea79b02a255db7ac7b328fcc74717155f","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-12-21T09:27:47Z","pushed_at":"2016-12-22T01:53:18Z","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":10341,"stargazers_count":898,"watchers_count":898,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":163,"mirror_url":null,"open_issues_count":20,"forks":163,"open_issues":20,"watchers":898,"default_branch":"2X"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918"},"html":{"href":"https://github.com/reddit/reddit-mobile/pull/918"},"issue":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/918"},"comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/issues/918/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/reddit-mobile/pulls/918/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/918/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/reddit-mobile/statuses/de5c4a9e315a9cfb507d901c2ecaf2e03834e355"}}}}
{"actor":{"display_login":"curioussavage"}}