{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/23097203","id":23097203,"diff_hunk":"@@ -300,62 +305,51 @@ var ActivityHandler = {\n       ActivityHandler.displayUnsentConfirmation(activity);\n     }\n   },\n-  // Deliver the user to the correct view\n-  // based on the params provided in the\n-  // \"message\" object.\n-  //\n-  toView: function ah_toView(message) {\n-    /**\n-     *  \"message\" is either a message object that belongs\n-     *  to a thread, or a message object from the system.\n-     *\n-     *\n-     *  message {\n-     *    number: A string phone number to pre-populate\n-     *            the recipients list with.\n-     *\n-     *    body: An optional body to preset the compose\n-     *           input with.\n-     *\n-     *    contact: An optional \"contact\" object\n-     *\n-     *    threadId: An option threadId corresponding\n-     *              to a new or existing thread.\n-     *\n-     *  }\n-     */\n \n+  /**\n+   * Delivers the user to the correct view based on the params provided in the\n+   * \"message\" parameter.\n+   * @param {{number: string, body: string, contact: MozContact,\n+   * threadId: number}} message It's either a message object that belongs to a\n+   * thread, or a message object from the system. \"number\" is a string phone\n+   * number to pre-populate the recipients list with, \"body\" is an optional body\n+   * to preset the compose input with, \"contact\" is an optional MozContact\n+   * instance, \"threadId\" is an optional threadId corresponding to a new or\n+   * existing thread.\n+   * @param {Boolean} focusComposer Indicates whether we need to focus composer\n+   * when we navigate to Thread panel.\n+   */\n+  toView: function ah_toView(message, focusComposer) {\n     if (!message) {\n       return;\n     }\n \n     this.isLocked = false;\n-    var threadId = message.threadId ? message.threadId : null;\n-    var body = message.body || '';\n-    var number = message.number ? message.number : '';\n-    var contact = message.contact ? message.contact : null;\n \n-    var showAction = function act_action() {\n+    var navigateToView = function act_navigateToView() {\n       // If we only have a body, just trigger a new message.\n-      if (!threadId) {\n-        ActivityHandler.triggerNewMessage(body, number, contact);\n+      if (!message.threadId) {\n+        ActivityHandler.triggerNewMessage(\n+          message.body, message.number, message.contact\n+        );\n         return;\n       }\n \n-      Navigation.toPanel('thread', { id: threadId }).then(Compose.focus);\n+      Navigation.toPanel(\n+        'thread', { id: message.threadId, focusComposer: focusComposer }\n+      );\n     };\n \n     navigator.mozL10n.once(function waitLocalized() {\n       if (!document.hidden) {\n         // Case of calling from Notification\n-        showAction();\n+        navigateToView();\n         return;\n       }\n \n-      document.addEventListener('visibilitychange',\n-        function waitVisibility() {\n-          document.removeEventListener('visibilitychange', waitVisibility);\n-          showAction();\n+      document.addEventListener('visibilitychange', function waitVisibility() {\n+        document.removeEventListener('visibilitychange', waitVisibility);\n+        navigateToView();","path":"apps/sms/js/activity_handler.js","position":127,"original_position":127,"commit_id":"8fcf71ee7132eb15ac283bb84ec18c870f94e1a4","original_commit_id":"8fcf71ee7132eb15ac283bb84ec18c870f94e1a4","user":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"body":"I don't really remember why we wait for a visibility change... but let's not change this in a blocker.","created_at":"2015-01-16T18:03:20Z","updated_at":"2015-01-16T18:03:20Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/27395#discussion_r23097203","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/23097203"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/27395#discussion_r23097203"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395","id":27393701,"html_url":"https://github.com/mozilla-b2g/gaia/pull/27395","diff_url":"https://github.com/mozilla-b2g/gaia/pull/27395.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/27395.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/27395","number":27395,"state":"open","locked":false,"title":"Bug 1116780 - [Messages] We should not focus the composer after clicking a notification. r=julien","user":{"login":"azasypkin","id":1713708,"avatar_url":"https://avatars.githubusercontent.com/u/1713708?v=3","gravatar_id":"","url":"https://api.github.com/users/azasypkin","html_url":"https://github.com/azasypkin","followers_url":"https://api.github.com/users/azasypkin/followers","following_url":"https://api.github.com/users/azasypkin/following{/other_user}","gists_url":"https://api.github.com/users/azasypkin/gists{/gist_id}","starred_url":"https://api.github.com/users/azasypkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azasypkin/subscriptions","organizations_url":"https://api.github.com/users/azasypkin/orgs","repos_url":"https://api.github.com/users/azasypkin/repos","events_url":"https://api.github.com/users/azasypkin/events{/privacy}","received_events_url":"https://api.github.com/users/azasypkin/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-14T23:31:46Z","updated_at":"2015-01-16T18:03:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b30e563a0c9bbf5831923714bc1924b915d3173","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/27395/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/8fcf71ee7132eb15ac283bb84ec18c870f94e1a4","head":{"label":"azasypkin:bug-1116780-dont-focus-on-notification-alternate","ref":"bug-1116780-dont-focus-on-notification-alternate","sha":"8fcf71ee7132eb15ac283bb84ec18c870f94e1a4","user":{"login":"azasypkin","id":1713708,"avatar_url":"https://avatars.githubusercontent.com/u/1713708?v=3","gravatar_id":"","url":"https://api.github.com/users/azasypkin","html_url":"https://github.com/azasypkin","followers_url":"https://api.github.com/users/azasypkin/followers","following_url":"https://api.github.com/users/azasypkin/following{/other_user}","gists_url":"https://api.github.com/users/azasypkin/gists{/gist_id}","starred_url":"https://api.github.com/users/azasypkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azasypkin/subscriptions","organizations_url":"https://api.github.com/users/azasypkin/orgs","repos_url":"https://api.github.com/users/azasypkin/repos","events_url":"https://api.github.com/users/azasypkin/events{/privacy}","received_events_url":"https://api.github.com/users/azasypkin/received_events","type":"User","site_admin":false},"repo":{"id":17702910,"name":"gaia","full_name":"azasypkin/gaia","owner":{"login":"azasypkin","id":1713708,"avatar_url":"https://avatars.githubusercontent.com/u/1713708?v=3","gravatar_id":"","url":"https://api.github.com/users/azasypkin","html_url":"https://github.com/azasypkin","followers_url":"https://api.github.com/users/azasypkin/followers","following_url":"https://api.github.com/users/azasypkin/following{/other_user}","gists_url":"https://api.github.com/users/azasypkin/gists{/gist_id}","starred_url":"https://api.github.com/users/azasypkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azasypkin/subscriptions","organizations_url":"https://api.github.com/users/azasypkin/orgs","repos_url":"https://api.github.com/users/azasypkin/repos","events_url":"https://api.github.com/users/azasypkin/events{/privacy}","received_events_url":"https://api.github.com/users/azasypkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/azasypkin/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see https://wiki.mozilla.org/Release_Management/B2G_Landing","fork":true,"url":"https://api.github.com/repos/azasypkin/gaia","forks_url":"https://api.github.com/repos/azasypkin/gaia/forks","keys_url":"https://api.github.com/repos/azasypkin/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azasypkin/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azasypkin/gaia/teams","hooks_url":"https://api.github.com/repos/azasypkin/gaia/hooks","issue_events_url":"https://api.github.com/repos/azasypkin/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/azasypkin/gaia/events","assignees_url":"https://api.github.com/repos/azasypkin/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/azasypkin/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/azasypkin/gaia/tags","blobs_url":"https://api.github.com/repos/azasypkin/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azasypkin/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azasypkin/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/azasypkin/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azasypkin/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/azasypkin/gaia/languages","stargazers_url":"https://api.github.com/repos/azasypkin/gaia/stargazers","contributors_url":"https://api.github.com/repos/azasypkin/gaia/contributors","subscribers_url":"https://api.github.com/repos/azasypkin/gaia/subscribers","subscription_url":"https://api.github.com/repos/azasypkin/gaia/subscription","commits_url":"https://api.github.com/repos/azasypkin/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/azasypkin/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/azasypkin/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/azasypkin/gaia/issues/comments/{number}","contents_url":"https://api.github.com/repos/azasypkin/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/azasypkin/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azasypkin/gaia/merges","archive_url":"https://api.github.com/repos/azasypkin/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azasypkin/gaia/downloads","issues_url":"https://api.github.com/repos/azasypkin/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/azasypkin/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/azasypkin/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/azasypkin/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azasypkin/gaia/labels{/name}","releases_url":"https://api.github.com/repos/azasypkin/gaia/releases{/id}","created_at":"2014-03-13T08:22:23Z","updated_at":"2015-01-11T11:52:12Z","pushed_at":"2015-01-16T13:44:52Z","git_url":"git://github.com/azasypkin/gaia.git","ssh_url":"git@github.com:azasypkin/gaia.git","clone_url":"https://github.com/azasypkin/gaia.git","svn_url":"https://github.com/azasypkin/gaia","homepage":"https://wiki.mozilla.org/B2G","size":877122,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"bcc76f93f5659ac1eb8a769167109fd2d7ca4fbd","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-01-16T15:50:39Z","pushed_at":"2015-01-16T15:50:39Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1379902,"stargazers_count":1854,"watchers_count":1854,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2163,"mirror_url":null,"open_issues_count":828,"forks":2163,"open_issues":828,"watchers":1854,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/27395"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/27395"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/27395/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/27395/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/8fcf71ee7132eb15ac283bb84ec18c870f94e1a4"}}}}