{"action":"created","comment":{"url":"https://api.github.com/repos/wireapp/wire-webapp/pulls/comments/86604905","pull_request_review_id":7258043,"id":86604905,"diff_hunk":"@@ -21,54 +21,32 @@ z.components ?= {}\n \n class z.components.EphemeralTimer\n   constructor: (params) ->\n-    scheduled_time = new Date(params.expires()).getTime()\n-    starting_time = Date.now()\n-    timer = scheduled_time - starting_time\n-    update_interval = 1000 / 10\n+    message_et = params.message\n+    ephemeral_expires = new Date(message_et.ephemeral_expires()).getTime()\n+    ephemeral_started = new Date(message_et.ephemeral_started()).getTime()\n+\n+    ephemeral_duration = ephemeral_expires - ephemeral_started\n \n     @progress = ko.observable 0\n     @remaining_time = ko.observable 0\n \n-    @title_caption = ko.pureComputed =>\n-      title = ''\n-      moment_duration = moment.duration(@remaining_time())\n-      if moment_duration.asHours() is 1\n-        title += \"#{moment_duration.hours()} #{z.localization.Localizer.get_text z.string.ephememal_units_hour}, \"\n-      else if moment_duration.asHours() > 1\n-        title += \"#{moment_duration.hours()} #{z.localization.Localizer.get_text z.string.ephememal_units_hours}, \"\n-\n-      if moment_duration.asMinutes() is 1\n-        title += \"#{moment_duration.minutes()} #{z.localization.Localizer.get_text z.string.ephememal_units_minute} #{z.localization.Localizer.get_text z.string.and} \"\n-      else if moment_duration.asMinutes() > 1\n-        title += \"#{moment_duration.minutes()} #{z.localization.Localizer.get_text z.string.ephememal_units_minutes} #{z.localization.Localizer.get_text z.string.and} \"\n-\n-      if moment_duration.asSeconds() is 1\n-        title += \"#{moment_duration.seconds()} #{z.localization.Localizer.get_text z.string.ephememal_units_second}\"\n-      else if moment_duration.asSeconds() > 1\n-        title += \"#{moment_duration.seconds()} #{z.localization.Localizer.get_text z.string.ephememal_units_seconds}\"\n-\n-    @interval_id = window.setInterval =>\n-      if Date.now() >= scheduled_time\n-        window.clearInterval @interval_id\n+    message_et.ephemeral_remaining.subscribe (remaining_time) =>\n+      if Date.now() >= ephemeral_expires\n+        @progress 1\n       else\n-        @remaining_time scheduled_time - Date.now()\n-        elapsed_time = timer - @remaining_time()\n-        @progress elapsed_time / timer\n-    , update_interval\n+        elapsed_time = ephemeral_duration - remaining_time\n+        @progress elapsed_time / ephemeral_duration","path":"app/script/components/ephemeralTimer.coffee","position":47,"original_position":47,"commit_id":"fc9acc10b8437c2246f70ec2c1c6f4029c030a9c","original_commit_id":"fc9acc10b8437c2246f70ec2c1c6f4029c030a9c","user":{"login":"herrmannplatz","id":174685,"avatar_url":"https://avatars.githubusercontent.com/u/174685?v=3","gravatar_id":"","url":"https://api.github.com/users/herrmannplatz","html_url":"https://github.com/herrmannplatz","followers_url":"https://api.github.com/users/herrmannplatz/followers","following_url":"https://api.github.com/users/herrmannplatz/following{/other_user}","gists_url":"https://api.github.com/users/herrmannplatz/gists{/gist_id}","starred_url":"https://api.github.com/users/herrmannplatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/herrmannplatz/subscriptions","organizations_url":"https://api.github.com/users/herrmannplatz/orgs","repos_url":"https://api.github.com/users/herrmannplatz/repos","events_url":"https://api.github.com/users/herrmannplatz/events{/privacy}","received_events_url":"https://api.github.com/users/herrmannplatz/received_events","type":"User","site_admin":false},"body":"you should dispose the subscription in destroy function to avoid memory leaks","created_at":"2016-11-04T18:20:20Z","updated_at":"2016-11-04T18:20:20Z","html_url":"https://github.com/wireapp/wire-webapp/pull/429#discussion_r86604905","pull_request_url":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429","_links":{"self":{"href":"https://api.github.com/repos/wireapp/wire-webapp/pulls/comments/86604905"},"html":{"href":"https://github.com/wireapp/wire-webapp/pull/429#discussion_r86604905"},"pull_request":{"href":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429"}}},"pull_request":{"url":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429","id":92389968,"html_url":"https://github.com/wireapp/wire-webapp/pull/429","diff_url":"https://github.com/wireapp/wire-webapp/pull/429.diff","patch_url":"https://github.com/wireapp/wire-webapp/pull/429.patch","issue_url":"https://api.github.com/repos/wireapp/wire-webapp/issues/429","number":429,"state":"open","locked":false,"title":"Unify ephemeral timer","user":{"login":"gregor","id":10243309,"avatar_url":"https://avatars.githubusercontent.com/u/10243309?v=3","gravatar_id":"","url":"https://api.github.com/users/gregor","html_url":"https://github.com/gregor","followers_url":"https://api.github.com/users/gregor/followers","following_url":"https://api.github.com/users/gregor/following{/other_user}","gists_url":"https://api.github.com/users/gregor/gists{/gist_id}","starred_url":"https://api.github.com/users/gregor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregor/subscriptions","organizations_url":"https://api.github.com/users/gregor/orgs","repos_url":"https://api.github.com/users/gregor/repos","events_url":"https://api.github.com/users/gregor/events{/privacy}","received_events_url":"https://api.github.com/users/gregor/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-04T18:12:06Z","updated_at":"2016-11-04T18:20:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbdafced24146ffd98ad0bade840bb0356259d78","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429/commits","review_comments_url":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429/comments","review_comment_url":"https://api.github.com/repos/wireapp/wire-webapp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wireapp/wire-webapp/issues/429/comments","statuses_url":"https://api.github.com/repos/wireapp/wire-webapp/statuses/fc9acc10b8437c2246f70ec2c1c6f4029c030a9c","head":{"label":"wireapp:improv/WEBAPP-3345","ref":"improv/WEBAPP-3345","sha":"fc9acc10b8437c2246f70ec2c1c6f4029c030a9c","user":{"login":"wireapp","id":16047324,"avatar_url":"https://avatars.githubusercontent.com/u/16047324?v=3","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"repo":{"id":63881328,"name":"wire-webapp","full_name":"wireapp/wire-webapp","owner":{"login":"wireapp","id":16047324,"avatar_url":"https://avatars.githubusercontent.com/u/16047324?v=3","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wireapp/wire-webapp","description":"👽 Wire for Web — Modern communication. Full privacy.","fork":false,"url":"https://api.github.com/repos/wireapp/wire-webapp","forks_url":"https://api.github.com/repos/wireapp/wire-webapp/forks","keys_url":"https://api.github.com/repos/wireapp/wire-webapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wireapp/wire-webapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wireapp/wire-webapp/teams","hooks_url":"https://api.github.com/repos/wireapp/wire-webapp/hooks","issue_events_url":"https://api.github.com/repos/wireapp/wire-webapp/issues/events{/number}","events_url":"https://api.github.com/repos/wireapp/wire-webapp/events","assignees_url":"https://api.github.com/repos/wireapp/wire-webapp/assignees{/user}","branches_url":"https://api.github.com/repos/wireapp/wire-webapp/branches{/branch}","tags_url":"https://api.github.com/repos/wireapp/wire-webapp/tags","blobs_url":"https://api.github.com/repos/wireapp/wire-webapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wireapp/wire-webapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wireapp/wire-webapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/wireapp/wire-webapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wireapp/wire-webapp/statuses/{sha}","languages_url":"https://api.github.com/repos/wireapp/wire-webapp/languages","stargazers_url":"https://api.github.com/repos/wireapp/wire-webapp/stargazers","contributors_url":"https://api.github.com/repos/wireapp/wire-webapp/contributors","subscribers_url":"https://api.github.com/repos/wireapp/wire-webapp/subscribers","subscription_url":"https://api.github.com/repos/wireapp/wire-webapp/subscription","commits_url":"https://api.github.com/repos/wireapp/wire-webapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/wireapp/wire-webapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/wireapp/wire-webapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/wireapp/wire-webapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/wireapp/wire-webapp/contents/{+path}","compare_url":"https://api.github.com/repos/wireapp/wire-webapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wireapp/wire-webapp/merges","archive_url":"https://api.github.com/repos/wireapp/wire-webapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wireapp/wire-webapp/downloads","issues_url":"https://api.github.com/repos/wireapp/wire-webapp/issues{/number}","pulls_url":"https://api.github.com/repos/wireapp/wire-webapp/pulls{/number}","milestones_url":"https://api.github.com/repos/wireapp/wire-webapp/milestones{/number}","notifications_url":"https://api.github.com/repos/wireapp/wire-webapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wireapp/wire-webapp/labels{/name}","releases_url":"https://api.github.com/repos/wireapp/wire-webapp/releases{/id}","deployments_url":"https://api.github.com/repos/wireapp/wire-webapp/deployments","created_at":"2016-07-21T15:34:05Z","updated_at":"2016-11-04T15:34:47Z","pushed_at":"2016-11-04T18:12:06Z","git_url":"git://github.com/wireapp/wire-webapp.git","ssh_url":"git@github.com:wireapp/wire-webapp.git","clone_url":"https://github.com/wireapp/wire-webapp.git","svn_url":"https://github.com/wireapp/wire-webapp","homepage":"https://app.wire.com","size":11448,"stargazers_count":491,"watchers_count":491,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":39,"forks":73,"open_issues":39,"watchers":491,"default_branch":"dev"}},"base":{"label":"wireapp:dev","ref":"dev","sha":"cf0186248627228c03950fde0914be51757986a4","user":{"login":"wireapp","id":16047324,"avatar_url":"https://avatars.githubusercontent.com/u/16047324?v=3","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"repo":{"id":63881328,"name":"wire-webapp","full_name":"wireapp/wire-webapp","owner":{"login":"wireapp","id":16047324,"avatar_url":"https://avatars.githubusercontent.com/u/16047324?v=3","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wireapp/wire-webapp","description":"👽 Wire for Web — Modern communication. Full privacy.","fork":false,"url":"https://api.github.com/repos/wireapp/wire-webapp","forks_url":"https://api.github.com/repos/wireapp/wire-webapp/forks","keys_url":"https://api.github.com/repos/wireapp/wire-webapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wireapp/wire-webapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wireapp/wire-webapp/teams","hooks_url":"https://api.github.com/repos/wireapp/wire-webapp/hooks","issue_events_url":"https://api.github.com/repos/wireapp/wire-webapp/issues/events{/number}","events_url":"https://api.github.com/repos/wireapp/wire-webapp/events","assignees_url":"https://api.github.com/repos/wireapp/wire-webapp/assignees{/user}","branches_url":"https://api.github.com/repos/wireapp/wire-webapp/branches{/branch}","tags_url":"https://api.github.com/repos/wireapp/wire-webapp/tags","blobs_url":"https://api.github.com/repos/wireapp/wire-webapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wireapp/wire-webapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wireapp/wire-webapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/wireapp/wire-webapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wireapp/wire-webapp/statuses/{sha}","languages_url":"https://api.github.com/repos/wireapp/wire-webapp/languages","stargazers_url":"https://api.github.com/repos/wireapp/wire-webapp/stargazers","contributors_url":"https://api.github.com/repos/wireapp/wire-webapp/contributors","subscribers_url":"https://api.github.com/repos/wireapp/wire-webapp/subscribers","subscription_url":"https://api.github.com/repos/wireapp/wire-webapp/subscription","commits_url":"https://api.github.com/repos/wireapp/wire-webapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/wireapp/wire-webapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/wireapp/wire-webapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/wireapp/wire-webapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/wireapp/wire-webapp/contents/{+path}","compare_url":"https://api.github.com/repos/wireapp/wire-webapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wireapp/wire-webapp/merges","archive_url":"https://api.github.com/repos/wireapp/wire-webapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wireapp/wire-webapp/downloads","issues_url":"https://api.github.com/repos/wireapp/wire-webapp/issues{/number}","pulls_url":"https://api.github.com/repos/wireapp/wire-webapp/pulls{/number}","milestones_url":"https://api.github.com/repos/wireapp/wire-webapp/milestones{/number}","notifications_url":"https://api.github.com/repos/wireapp/wire-webapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wireapp/wire-webapp/labels{/name}","releases_url":"https://api.github.com/repos/wireapp/wire-webapp/releases{/id}","deployments_url":"https://api.github.com/repos/wireapp/wire-webapp/deployments","created_at":"2016-07-21T15:34:05Z","updated_at":"2016-11-04T15:34:47Z","pushed_at":"2016-11-04T18:12:06Z","git_url":"git://github.com/wireapp/wire-webapp.git","ssh_url":"git@github.com:wireapp/wire-webapp.git","clone_url":"https://github.com/wireapp/wire-webapp.git","svn_url":"https://github.com/wireapp/wire-webapp","homepage":"https://app.wire.com","size":11448,"stargazers_count":491,"watchers_count":491,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":39,"forks":73,"open_issues":39,"watchers":491,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429"},"html":{"href":"https://github.com/wireapp/wire-webapp/pull/429"},"issue":{"href":"https://api.github.com/repos/wireapp/wire-webapp/issues/429"},"comments":{"href":"https://api.github.com/repos/wireapp/wire-webapp/issues/429/comments"},"review_comments":{"href":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429/comments"},"review_comment":{"href":"https://api.github.com/repos/wireapp/wire-webapp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wireapp/wire-webapp/pulls/429/commits"},"statuses":{"href":"https://api.github.com/repos/wireapp/wire-webapp/statuses/fc9acc10b8437c2246f70ec2c1c6f4029c030a9c"}}}}
{"actor":{"display_login":"herrmannplatz"}}