{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/40317730","id":40317730,"diff_hunk":"@@ -421,33 +421,41 @@ var MessageManager = {\n \n   markMessagesRead: function mm_markMessagesRead(list, isRead = true) {\n     if (!this._mozMobileMessage || !list.length) {\n-      return;\n+      return Promise.reject(new Error('The mozMobileMessage API is not available or list is empty.'));\n     }\n \n+    var self = this;\n+    var deferred = Utils.Promise.defer();\n+\n     // We chain the calls to the API in a way that we make no call to\n     // 'markMessageRead' until a previous call is completed. This way any\n     // other potential call to the API, like the one for getting a message\n     // list, could be done within the calls to mark the messages as read.\n \n-    var id = list.pop();\n-    // TODO: Third parameter of markMessageRead is return read request.\n-    //       Here we always return read request for now, but we can let user\n-    //       decide to return request or not in Bug 971658.\n-    var req = this._mozMobileMessage.markMessageRead(id, isRead, true);\n-    // isRead == false i.e mark as unread case, marking only one message\n-    // as unread is sufficient.\n-    req.onsuccess = (function onsuccess() {\n-      if (!list.length || !isRead) {\n-        return;\n-      } else if (isRead) {\n-        this.markMessagesRead(list, isRead);\n-      }\n-    }).bind(this);\n+    // sendReadReport == true if Send-Read-Reports switch in Messaging Settings\n+    // is enabled else false\n \n-    req.onerror = function onerror() {\n-      console.error(\n-        'Error while marking message %d as read: %s', id, this.error.name\n-      );\n+    Settings.toSendReadReport().then((result) => {\n+      var sendReadReport = result['message.mms.sendReadReport.enabled'];\n+      markMessage(sendReadReport);\n+    });\n+\n+    function markMessage(sendReadReport) {\n+      var id = list.pop();\n+      var req = self._mozMobileMessage.markMessageRead(id, isRead, sendReadReport);","path":"apps/sms/services/js/message_manager.js","position":44,"original_position":44,"commit_id":"9adf4b06660de3554b870c7f18c269360c66b236","original_commit_id":"9adf4b06660de3554b870c7f18c269360c66b236","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":"remember the request has a \"then\" method now, you can use it directly.","created_at":"2015-09-24T13:25:41Z","updated_at":"2015-09-24T13:25:41Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/31993#discussion_r40317730","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/40317730"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/31993#discussion_r40317730"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993","id":45746398,"html_url":"https://github.com/mozilla-b2g/gaia/pull/31993","diff_url":"https://github.com/mozilla-b2g/gaia/pull/31993.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/31993.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/31993","number":31993,"state":"open","locked":false,"title":"Bug 1180470 - [Messages] Propose a setting to disable sending the read report","user":{"login":"kumarrishav","id":4078325,"avatar_url":"https://avatars.githubusercontent.com/u/4078325?v=3","gravatar_id":"","url":"https://api.github.com/users/kumarrishav","html_url":"https://github.com/kumarrishav","followers_url":"https://api.github.com/users/kumarrishav/followers","following_url":"https://api.github.com/users/kumarrishav/following{/other_user}","gists_url":"https://api.github.com/users/kumarrishav/gists{/gist_id}","starred_url":"https://api.github.com/users/kumarrishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumarrishav/subscriptions","organizations_url":"https://api.github.com/users/kumarrishav/orgs","repos_url":"https://api.github.com/users/kumarrishav/repos","events_url":"https://api.github.com/users/kumarrishav/events{/privacy}","received_events_url":"https://api.github.com/users/kumarrishav/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-23T06:12:07Z","updated_at":"2015-09-24T13:25:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af8f4bb9f50364831ab67fd38d1800fc4a06b7e5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993/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/31993/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/9adf4b06660de3554b870c7f18c269360c66b236","head":{"label":"kumarrishav:Bug-1180470","ref":"Bug-1180470","sha":"9adf4b06660de3554b870c7f18c269360c66b236","user":{"login":"kumarrishav","id":4078325,"avatar_url":"https://avatars.githubusercontent.com/u/4078325?v=3","gravatar_id":"","url":"https://api.github.com/users/kumarrishav","html_url":"https://github.com/kumarrishav","followers_url":"https://api.github.com/users/kumarrishav/followers","following_url":"https://api.github.com/users/kumarrishav/following{/other_user}","gists_url":"https://api.github.com/users/kumarrishav/gists{/gist_id}","starred_url":"https://api.github.com/users/kumarrishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumarrishav/subscriptions","organizations_url":"https://api.github.com/users/kumarrishav/orgs","repos_url":"https://api.github.com/users/kumarrishav/repos","events_url":"https://api.github.com/users/kumarrishav/events{/privacy}","received_events_url":"https://api.github.com/users/kumarrishav/received_events","type":"User","site_admin":false},"repo":{"id":14716677,"name":"gaia","full_name":"kumarrishav/gaia","owner":{"login":"kumarrishav","id":4078325,"avatar_url":"https://avatars.githubusercontent.com/u/4078325?v=3","gravatar_id":"","url":"https://api.github.com/users/kumarrishav","html_url":"https://github.com/kumarrishav","followers_url":"https://api.github.com/users/kumarrishav/followers","following_url":"https://api.github.com/users/kumarrishav/following{/other_user}","gists_url":"https://api.github.com/users/kumarrishav/gists{/gist_id}","starred_url":"https://api.github.com/users/kumarrishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumarrishav/subscriptions","organizations_url":"https://api.github.com/users/kumarrishav/orgs","repos_url":"https://api.github.com/users/kumarrishav/repos","events_url":"https://api.github.com/users/kumarrishav/events{/privacy}","received_events_url":"https://api.github.com/users/kumarrishav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kumarrishav/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/kumarrishav/gaia","forks_url":"https://api.github.com/repos/kumarrishav/gaia/forks","keys_url":"https://api.github.com/repos/kumarrishav/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kumarrishav/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kumarrishav/gaia/teams","hooks_url":"https://api.github.com/repos/kumarrishav/gaia/hooks","issue_events_url":"https://api.github.com/repos/kumarrishav/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/kumarrishav/gaia/events","assignees_url":"https://api.github.com/repos/kumarrishav/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/kumarrishav/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/kumarrishav/gaia/tags","blobs_url":"https://api.github.com/repos/kumarrishav/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kumarrishav/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kumarrishav/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/kumarrishav/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kumarrishav/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/kumarrishav/gaia/languages","stargazers_url":"https://api.github.com/repos/kumarrishav/gaia/stargazers","contributors_url":"https://api.github.com/repos/kumarrishav/gaia/contributors","subscribers_url":"https://api.github.com/repos/kumarrishav/gaia/subscribers","subscription_url":"https://api.github.com/repos/kumarrishav/gaia/subscription","commits_url":"https://api.github.com/repos/kumarrishav/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/kumarrishav/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/kumarrishav/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/kumarrishav/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/kumarrishav/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/kumarrishav/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kumarrishav/gaia/merges","archive_url":"https://api.github.com/repos/kumarrishav/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kumarrishav/gaia/downloads","issues_url":"https://api.github.com/repos/kumarrishav/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/kumarrishav/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/kumarrishav/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/kumarrishav/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kumarrishav/gaia/labels{/name}","releases_url":"https://api.github.com/repos/kumarrishav/gaia/releases{/id}","created_at":"2013-11-26T12:45:49Z","updated_at":"2015-04-01T07:33:18Z","pushed_at":"2015-09-24T01:50:18Z","git_url":"git://github.com/kumarrishav/gaia.git","ssh_url":"git@github.com:kumarrishav/gaia.git","clone_url":"https://github.com/kumarrishav/gaia.git","svn_url":"https://github.com/kumarrishav/gaia","homepage":"https://wiki.mozilla.org/B2G","size":926571,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"b426c40896732189a530d77cb799214b2c27aed9","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-09-24T09:41:23Z","pushed_at":"2015-09-24T13:06:03Z","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":1638194,"stargazers_count":1983,"watchers_count":1983,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2444,"mirror_url":null,"open_issues_count":1229,"forks":2444,"open_issues":1229,"watchers":1983,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/31993"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/31993"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/31993/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/31993/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/31993/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/9adf4b06660de3554b870c7f18c269360c66b236"}}}}