{"action":"created","comment":{"url":"https://api.github.com/repos/medic/medic-webapp/pulls/comments/222887679","pull_request_review_id":161884209,"id":222887679,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjg4NzY3OQ==","diff_hunk":"@@ -86,19 +66,41 @@ angular\n         });\n     };\n \n-    var replicateTo = function(updateListener) {\n-      return Auth('can_edit')\n-        .then(function() {\n-          return replicate('to', updateListener);\n-        })\n-        .catch(function() {\n-          // not authorized to replicate to server - that's ok\n-          return;\n-        });\n+    var replicateTo = function() {\n+      return $q(function(resolve) {\n+        Auth('can_edit')\n+          .then(function() {\n+            resolve(replicate('to'));\n+          })\n+          .catch(function() {\n+            // not authorized to replicate to server - that's ok\n+            resolve();\n+          });\n+      });\n+    };\n+\n+    var replicateFrom = function() {\n+      return replicate('from');\n     };\n \n-    var replicateFrom = function(updateListener) {\n-      return replicate('from', updateListener);\n+    var sendUpdateForDirectedReplication = function(func, direction) {\n+      return $q(function(resolve, reject) {","path":"webapp/src/js/services/db-sync.js","position":121,"original_position":121,"commit_id":"17e7265429ff69dc93f9600250dcdefd36283ef4","original_commit_id":"17e7265429ff69dc93f9600250dcdefd36283ef4","user":{"login":"kennsippell","id":9014751,"node_id":"MDQ6VXNlcjkwMTQ3NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/9014751?v=4","gravatar_id":"","url":"https://api.github.com/users/kennsippell","html_url":"https://github.com/kennsippell","followers_url":"https://api.github.com/users/kennsippell/followers","following_url":"https://api.github.com/users/kennsippell/following{/other_user}","gists_url":"https://api.github.com/users/kennsippell/gists{/gist_id}","starred_url":"https://api.github.com/users/kennsippell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennsippell/subscriptions","organizations_url":"https://api.github.com/users/kennsippell/orgs","repos_url":"https://api.github.com/users/kennsippell/repos","events_url":"https://api.github.com/users/kennsippell/events{/privacy}","received_events_url":"https://api.github.com/users/kennsippell/received_events","type":"User","site_admin":false},"body":"Definitely right on this one!","created_at":"2018-10-05T04:10:24Z","updated_at":"2018-10-05T04:10:24Z","html_url":"https://github.com/medic/medic-webapp/pull/4871#discussion_r222887679","pull_request_url":"https://api.github.com/repos/medic/medic-webapp/pulls/4871","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/medic/medic-webapp/pulls/comments/222887679"},"html":{"href":"https://github.com/medic/medic-webapp/pull/4871#discussion_r222887679"},"pull_request":{"href":"https://api.github.com/repos/medic/medic-webapp/pulls/4871"}},"in_reply_to_id":222869487},"pull_request":{"url":"https://api.github.com/repos/medic/medic-webapp/pulls/4871","id":220155891,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMTU1ODkx","html_url":"https://github.com/medic/medic-webapp/pull/4871","diff_url":"https://github.com/medic/medic-webapp/pull/4871.diff","patch_url":"https://github.com/medic/medic-webapp/pull/4871.patch","issue_url":"https://api.github.com/repos/medic/medic-webapp/issues/4871","number":4871,"state":"open","locked":false,"title":"4805 - Replace continuous replication","user":{"login":"kennsippell","id":9014751,"node_id":"MDQ6VXNlcjkwMTQ3NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/9014751?v=4","gravatar_id":"","url":"https://api.github.com/users/kennsippell","html_url":"https://github.com/kennsippell","followers_url":"https://api.github.com/users/kennsippell/followers","following_url":"https://api.github.com/users/kennsippell/following{/other_user}","gists_url":"https://api.github.com/users/kennsippell/gists{/gist_id}","starred_url":"https://api.github.com/users/kennsippell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennsippell/subscriptions","organizations_url":"https://api.github.com/users/kennsippell/orgs","repos_url":"https://api.github.com/users/kennsippell/repos","events_url":"https://api.github.com/users/kennsippell/events{/privacy}","received_events_url":"https://api.github.com/users/kennsippell/received_events","type":"User","site_admin":false},"body":"# Description\r\n\r\nReplaces continuous replication with replication at a fixed interval (5 minutes).\r\nUpdates UI with \"Sync now\" button.\r\nIntegrates with Online/Offline browser events to avoid syncs while offline and immediately sync when coming online.\r\n\r\n#4805 and #3976\r\n\r\nDiscussed with @SCdF, this will not be merged into 3.2.\r\nThis doesn't fix `Remove continuous replication code from the API changes endpoint.` from #4805.\r\n\r\n## UI Changes\r\n\r\n![synced](https://user-images.githubusercontent.com/9014751/46434716-43bea200-c709-11e8-8b64-2391b4835166.png)\r\nClickable \"Sync Now\" button\r\n\r\n![err](https://user-images.githubusercontent.com/9014751/46434715-43bea200-c709-11e8-9b67-104930bacbad.png)\r\n\r\n![syncing](https://user-images.githubusercontent.com/9014751/46434717-43bea200-c709-11e8-9e46-813f634a7f82.png)\r\nThis is a new translated string\r\n\r\n## Online/Offline Browser Events\r\n\r\nFor now, we trust these events completely. If the browser reports being offline, then we will not attempt to replicate. For testing, these events do not fire on the localhost domain. Tested on Chrome + Firefox only.\r\n\r\n# Review checklist\r\n\r\n- [ ] Readable: Concise, well named, follows the [style guide](https://github.com/medic/medic-docs/blob/master/development/style-guide.md), documented if necessary.\r\n- [ ] Documented: Announced in Changes.md in plain English. Configuration and user documentation on [medic-docs](https://github.com/medic/medic-docs/)\r\n- [ ] Tested: Unit and/or e2e where appropriate\r\n- [ ] Internationalised: All user facing text\r\n- [ ] Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in Changes.md.","created_at":"2018-10-03T19:40:59Z","updated_at":"2018-10-05T04:10:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9637d0798987625f41f3fab9a7d1fe2ea3f7166a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/medic/medic-webapp/pulls/4871/commits","review_comments_url":"https://api.github.com/repos/medic/medic-webapp/pulls/4871/comments","review_comment_url":"https://api.github.com/repos/medic/medic-webapp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/medic/medic-webapp/issues/4871/comments","statuses_url":"https://api.github.com/repos/medic/medic-webapp/statuses/17e7265429ff69dc93f9600250dcdefd36283ef4","head":{"label":"kennsippell:4805-replace-continuous-replication","ref":"4805-replace-continuous-replication","sha":"17e7265429ff69dc93f9600250dcdefd36283ef4","user":{"login":"kennsippell","id":9014751,"node_id":"MDQ6VXNlcjkwMTQ3NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/9014751?v=4","gravatar_id":"","url":"https://api.github.com/users/kennsippell","html_url":"https://github.com/kennsippell","followers_url":"https://api.github.com/users/kennsippell/followers","following_url":"https://api.github.com/users/kennsippell/following{/other_user}","gists_url":"https://api.github.com/users/kennsippell/gists{/gist_id}","starred_url":"https://api.github.com/users/kennsippell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennsippell/subscriptions","organizations_url":"https://api.github.com/users/kennsippell/orgs","repos_url":"https://api.github.com/users/kennsippell/repos","events_url":"https://api.github.com/users/kennsippell/events{/privacy}","received_events_url":"https://api.github.com/users/kennsippell/received_events","type":"User","site_admin":false},"repo":{"id":148520056,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg1MjAwNTY=","name":"medic-webapp","full_name":"kennsippell/medic-webapp","private":false,"owner":{"login":"kennsippell","id":9014751,"node_id":"MDQ6VXNlcjkwMTQ3NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/9014751?v=4","gravatar_id":"","url":"https://api.github.com/users/kennsippell","html_url":"https://github.com/kennsippell","followers_url":"https://api.github.com/users/kennsippell/followers","following_url":"https://api.github.com/users/kennsippell/following{/other_user}","gists_url":"https://api.github.com/users/kennsippell/gists{/gist_id}","starred_url":"https://api.github.com/users/kennsippell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennsippell/subscriptions","organizations_url":"https://api.github.com/users/kennsippell/orgs","repos_url":"https://api.github.com/users/kennsippell/repos","events_url":"https://api.github.com/users/kennsippell/events{/privacy}","received_events_url":"https://api.github.com/users/kennsippell/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kennsippell/medic-webapp","description":"Medic Mobile combines SMS messaging, data collection, and analytics for health workers and health systems in hard-to-reach areas with or without internet connectivity.","fork":true,"url":"https://api.github.com/repos/kennsippell/medic-webapp","forks_url":"https://api.github.com/repos/kennsippell/medic-webapp/forks","keys_url":"https://api.github.com/repos/kennsippell/medic-webapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kennsippell/medic-webapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kennsippell/medic-webapp/teams","hooks_url":"https://api.github.com/repos/kennsippell/medic-webapp/hooks","issue_events_url":"https://api.github.com/repos/kennsippell/medic-webapp/issues/events{/number}","events_url":"https://api.github.com/repos/kennsippell/medic-webapp/events","assignees_url":"https://api.github.com/repos/kennsippell/medic-webapp/assignees{/user}","branches_url":"https://api.github.com/repos/kennsippell/medic-webapp/branches{/branch}","tags_url":"https://api.github.com/repos/kennsippell/medic-webapp/tags","blobs_url":"https://api.github.com/repos/kennsippell/medic-webapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kennsippell/medic-webapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kennsippell/medic-webapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/kennsippell/medic-webapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kennsippell/medic-webapp/statuses/{sha}","languages_url":"https://api.github.com/repos/kennsippell/medic-webapp/languages","stargazers_url":"https://api.github.com/repos/kennsippell/medic-webapp/stargazers","contributors_url":"https://api.github.com/repos/kennsippell/medic-webapp/contributors","subscribers_url":"https://api.github.com/repos/kennsippell/medic-webapp/subscribers","subscription_url":"https://api.github.com/repos/kennsippell/medic-webapp/subscription","commits_url":"https://api.github.com/repos/kennsippell/medic-webapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/kennsippell/medic-webapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/kennsippell/medic-webapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/kennsippell/medic-webapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/kennsippell/medic-webapp/contents/{+path}","compare_url":"https://api.github.com/repos/kennsippell/medic-webapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kennsippell/medic-webapp/merges","archive_url":"https://api.github.com/repos/kennsippell/medic-webapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kennsippell/medic-webapp/downloads","issues_url":"https://api.github.com/repos/kennsippell/medic-webapp/issues{/number}","pulls_url":"https://api.github.com/repos/kennsippell/medic-webapp/pulls{/number}","milestones_url":"https://api.github.com/repos/kennsippell/medic-webapp/milestones{/number}","notifications_url":"https://api.github.com/repos/kennsippell/medic-webapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kennsippell/medic-webapp/labels{/name}","releases_url":"https://api.github.com/repos/kennsippell/medic-webapp/releases{/id}","deployments_url":"https://api.github.com/repos/kennsippell/medic-webapp/deployments","created_at":"2018-09-12T17:56:36Z","updated_at":"2018-10-02T19:19:36Z","pushed_at":"2018-10-04T05:15:09Z","git_url":"git://github.com/kennsippell/medic-webapp.git","ssh_url":"git@github.com:kennsippell/medic-webapp.git","clone_url":"https://github.com/kennsippell/medic-webapp.git","svn_url":"https://github.com/kennsippell/medic-webapp","homepage":"http://medicmobile.org/tools","size":50825,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"medic:master","ref":"master","sha":"b4c0fa5ec8a077026c3a62d3399f85c501df68af","user":{"login":"medic","id":474424,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3NDQyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/474424?v=4","gravatar_id":"","url":"https://api.github.com/users/medic","html_url":"https://github.com/medic","followers_url":"https://api.github.com/users/medic/followers","following_url":"https://api.github.com/users/medic/following{/other_user}","gists_url":"https://api.github.com/users/medic/gists{/gist_id}","starred_url":"https://api.github.com/users/medic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medic/subscriptions","organizations_url":"https://api.github.com/users/medic/orgs","repos_url":"https://api.github.com/users/medic/repos","events_url":"https://api.github.com/users/medic/events{/privacy}","received_events_url":"https://api.github.com/users/medic/received_events","type":"Organization","site_admin":false},"repo":{"id":2698821,"node_id":"MDEwOlJlcG9zaXRvcnkyNjk4ODIx","name":"medic-webapp","full_name":"medic/medic-webapp","private":false,"owner":{"login":"medic","id":474424,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3NDQyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/474424?v=4","gravatar_id":"","url":"https://api.github.com/users/medic","html_url":"https://github.com/medic","followers_url":"https://api.github.com/users/medic/followers","following_url":"https://api.github.com/users/medic/following{/other_user}","gists_url":"https://api.github.com/users/medic/gists{/gist_id}","starred_url":"https://api.github.com/users/medic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medic/subscriptions","organizations_url":"https://api.github.com/users/medic/orgs","repos_url":"https://api.github.com/users/medic/repos","events_url":"https://api.github.com/users/medic/events{/privacy}","received_events_url":"https://api.github.com/users/medic/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/medic/medic-webapp","description":"Medic Mobile combines SMS messaging, data collection, and analytics for health workers and health systems in hard-to-reach areas with or without internet connectivity.","fork":false,"url":"https://api.github.com/repos/medic/medic-webapp","forks_url":"https://api.github.com/repos/medic/medic-webapp/forks","keys_url":"https://api.github.com/repos/medic/medic-webapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/medic/medic-webapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/medic/medic-webapp/teams","hooks_url":"https://api.github.com/repos/medic/medic-webapp/hooks","issue_events_url":"https://api.github.com/repos/medic/medic-webapp/issues/events{/number}","events_url":"https://api.github.com/repos/medic/medic-webapp/events","assignees_url":"https://api.github.com/repos/medic/medic-webapp/assignees{/user}","branches_url":"https://api.github.com/repos/medic/medic-webapp/branches{/branch}","tags_url":"https://api.github.com/repos/medic/medic-webapp/tags","blobs_url":"https://api.github.com/repos/medic/medic-webapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/medic/medic-webapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/medic/medic-webapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/medic/medic-webapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/medic/medic-webapp/statuses/{sha}","languages_url":"https://api.github.com/repos/medic/medic-webapp/languages","stargazers_url":"https://api.github.com/repos/medic/medic-webapp/stargazers","contributors_url":"https://api.github.com/repos/medic/medic-webapp/contributors","subscribers_url":"https://api.github.com/repos/medic/medic-webapp/subscribers","subscription_url":"https://api.github.com/repos/medic/medic-webapp/subscription","commits_url":"https://api.github.com/repos/medic/medic-webapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/medic/medic-webapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/medic/medic-webapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/medic/medic-webapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/medic/medic-webapp/contents/{+path}","compare_url":"https://api.github.com/repos/medic/medic-webapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/medic/medic-webapp/merges","archive_url":"https://api.github.com/repos/medic/medic-webapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/medic/medic-webapp/downloads","issues_url":"https://api.github.com/repos/medic/medic-webapp/issues{/number}","pulls_url":"https://api.github.com/repos/medic/medic-webapp/pulls{/number}","milestones_url":"https://api.github.com/repos/medic/medic-webapp/milestones{/number}","notifications_url":"https://api.github.com/repos/medic/medic-webapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/medic/medic-webapp/labels{/name}","releases_url":"https://api.github.com/repos/medic/medic-webapp/releases{/id}","deployments_url":"https://api.github.com/repos/medic/medic-webapp/deployments","created_at":"2011-11-02T23:19:55Z","updated_at":"2018-10-04T21:03:12Z","pushed_at":"2018-10-04T21:03:12Z","git_url":"git://github.com/medic/medic-webapp.git","ssh_url":"git@github.com:medic/medic-webapp.git","clone_url":"https://github.com/medic/medic-webapp.git","svn_url":"https://github.com/medic/medic-webapp","homepage":"http://medicmobile.org/tools","size":52624,"stargazers_count":154,"watchers_count":154,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":61,"mirror_url":null,"archived":false,"open_issues_count":343,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":61,"open_issues":343,"watchers":154,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/medic/medic-webapp/pulls/4871"},"html":{"href":"https://github.com/medic/medic-webapp/pull/4871"},"issue":{"href":"https://api.github.com/repos/medic/medic-webapp/issues/4871"},"comments":{"href":"https://api.github.com/repos/medic/medic-webapp/issues/4871/comments"},"review_comments":{"href":"https://api.github.com/repos/medic/medic-webapp/pulls/4871/comments"},"review_comment":{"href":"https://api.github.com/repos/medic/medic-webapp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/medic/medic-webapp/pulls/4871/commits"},"statuses":{"href":"https://api.github.com/repos/medic/medic-webapp/statuses/17e7265429ff69dc93f9600250dcdefd36283ef4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kennsippell"}}