{"action":"created","comment":{"url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/comments/53106685","id":53106685,"diff_hunk":"@@ -359,20 +365,25 @@\n     },\n \n     copyDescription: function(){\n-      var useRichText = this.ticket().comment().useRichText();\n-      var ticketDescription = this.ticket().description();\n-      var newLine = useRichText ? '<br />' : '\\n';\n-      var descriptionDelimiter = helpers.fmt(newLine + \"--- %@ ---\" + newLine, this.I18n.t(\"delimiter\"));\n-      var formDescription = this.formDescription()\n-        .split(descriptionDelimiter);\n-      ticketDescription = useRichText ? this.convertLineBreaksToHtml(ticketDescription) : ticketDescription;\n-\n-      var ret = formDescription[0];\n-\n-      if (formDescription.length === 1)\n-        ret += descriptionDelimiter + ticketDescription;\n-\n-      this.formDescription(ret);\n+      //calling out to comments endpoint here because the lotus model always returns HTML\n+      //for the this.ticket().comments()[0].value and we may need MD or HTML.\n+      this.ajax('fetchComments', this.ticket().id()).then(function(data) {\n+        var useRichText = this.ticket().comment().useRichText();\n+        var ticketDescription = data.comments[0];\n+        var newTicketContent = useRichText ? ticketDescription.html_body : ticketDescription.body;\n+        var newLine = useRichText ? '<br />' : '\\n';\n+        var descriptionDelimiter = helpers.fmt(newLine + \"--- %@ ---\" + newLine, this.I18n.t(\"delimiter\"));\n+        var formDescription = this.formDescription()\n+          .split(descriptionDelimiter);\n+        //newTicketContent = useRichText ? this.convertLineBreaksToHtml(newTicketContent) : newTicketContent;","path":"app.js","position":41,"original_position":41,"commit_id":"857af0e7f6220be864ebe58e0f3122cd670a9d28","original_commit_id":"857af0e7f6220be864ebe58e0f3122cd670a9d28","user":{"login":"adammw","id":153219,"avatar_url":"https://avatars.githubusercontent.com/u/153219?v=3","gravatar_id":"","url":"https://api.github.com/users/adammw","html_url":"https://github.com/adammw","followers_url":"https://api.github.com/users/adammw/followers","following_url":"https://api.github.com/users/adammw/following{/other_user}","gists_url":"https://api.github.com/users/adammw/gists{/gist_id}","starred_url":"https://api.github.com/users/adammw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adammw/subscriptions","organizations_url":"https://api.github.com/users/adammw/orgs","repos_url":"https://api.github.com/users/adammw/repos","events_url":"https://api.github.com/users/adammw/events{/privacy}","received_events_url":"https://api.github.com/users/adammw/received_events","type":"User","site_admin":false},"body":"remove commented out code.","created_at":"2016-02-17T00:57:37Z","updated_at":"2016-02-17T00:57:37Z","html_url":"https://github.com/zendesk/linked_ticket_app/pull/45#discussion_r53106685","pull_request_url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/comments/53106685"},"html":{"href":"https://github.com/zendesk/linked_ticket_app/pull/45#discussion_r53106685"},"pull_request":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45","id":59580439,"html_url":"https://github.com/zendesk/linked_ticket_app/pull/45","diff_url":"https://github.com/zendesk/linked_ticket_app/pull/45.diff","patch_url":"https://github.com/zendesk/linked_ticket_app/pull/45.patch","issue_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/45","number":45,"state":"open","locked":false,"title":"[OFFAPPS-611] Changed behaviour of copyDescription to call out to REST API to get d…","user":{"login":"pmgrove","id":4024784,"avatar_url":"https://avatars.githubusercontent.com/u/4024784?v=3","gravatar_id":"","url":"https://api.github.com/users/pmgrove","html_url":"https://github.com/pmgrove","followers_url":"https://api.github.com/users/pmgrove/followers","following_url":"https://api.github.com/users/pmgrove/following{/other_user}","gists_url":"https://api.github.com/users/pmgrove/gists{/gist_id}","starred_url":"https://api.github.com/users/pmgrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmgrove/subscriptions","organizations_url":"https://api.github.com/users/pmgrove/orgs","repos_url":"https://api.github.com/users/pmgrove/repos","events_url":"https://api.github.com/users/pmgrove/events{/privacy}","received_events_url":"https://api.github.com/users/pmgrove/received_events","type":"User","site_admin":false},"body":":v:\r\n\r\n/cc @zendesk/vegemite\r\n\r\n### Description\r\n\r\nChanged behaviour of `copyDescription` to call out to REST API to get description. The reason for doing this is that `this.ticket().comments()[0].value()` will always return HTML but we need to ensure we get the correct mark-up for the users setting (Markdown or Rich text).\r\n\r\n### References\r\n* JIRA: https://zendesk.atlassian.net/browse/OFFAPPS-611\r\n\r\n### Risks\r\n* Does it work across browsers (including IE!)?\r\n  * This change only affects the way data is retrieved.\r\n* Are there any performance implications?\r\n  * A small performance hit because we are now calling out to the REST API instead of using the data API.","created_at":"2016-02-17T00:53:11Z","updated_at":"2016-02-17T00:57:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"162468b10de5633097bcf74ed9eb4f7a8e4b2d01","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45/commits","review_comments_url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45/comments","review_comment_url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/45/comments","statuses_url":"https://api.github.com/repos/zendesk/linked_ticket_app/statuses/857af0e7f6220be864ebe58e0f3122cd670a9d28","head":{"label":"zendesk:pmgrove/get-description-from-API","ref":"pmgrove/get-description-from-API","sha":"857af0e7f6220be864ebe58e0f3122cd670a9d28","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":11429698,"name":"linked_ticket_app","full_name":"zendesk/linked_ticket_app","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/linked_ticket_app","description":"This is Zendesk's linked ticket App","fork":false,"url":"https://api.github.com/repos/zendesk/linked_ticket_app","forks_url":"https://api.github.com/repos/zendesk/linked_ticket_app/forks","keys_url":"https://api.github.com/repos/zendesk/linked_ticket_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/linked_ticket_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/linked_ticket_app/teams","hooks_url":"https://api.github.com/repos/zendesk/linked_ticket_app/hooks","issue_events_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/linked_ticket_app/events","assignees_url":"https://api.github.com/repos/zendesk/linked_ticket_app/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/linked_ticket_app/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/linked_ticket_app/tags","blobs_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/linked_ticket_app/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/linked_ticket_app/languages","stargazers_url":"https://api.github.com/repos/zendesk/linked_ticket_app/stargazers","contributors_url":"https://api.github.com/repos/zendesk/linked_ticket_app/contributors","subscribers_url":"https://api.github.com/repos/zendesk/linked_ticket_app/subscribers","subscription_url":"https://api.github.com/repos/zendesk/linked_ticket_app/subscription","commits_url":"https://api.github.com/repos/zendesk/linked_ticket_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/linked_ticket_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/linked_ticket_app/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/linked_ticket_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/linked_ticket_app/merges","archive_url":"https://api.github.com/repos/zendesk/linked_ticket_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/linked_ticket_app/downloads","issues_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/linked_ticket_app/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/linked_ticket_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/linked_ticket_app/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/linked_ticket_app/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/linked_ticket_app/deployments","created_at":"2013-07-15T17:59:41Z","updated_at":"2016-02-09T04:52:04Z","pushed_at":"2016-02-17T00:53:11Z","git_url":"git://github.com/zendesk/linked_ticket_app.git","ssh_url":"git@github.com:zendesk/linked_ticket_app.git","clone_url":"https://github.com/zendesk/linked_ticket_app.git","svn_url":"https://github.com/zendesk/linked_ticket_app","homepage":null,"size":699,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":2,"default_branch":"master"}},"base":{"label":"zendesk:master","ref":"master","sha":"cfcb0d68573f36c8bcd500643ebee7384e3e3f00","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":11429698,"name":"linked_ticket_app","full_name":"zendesk/linked_ticket_app","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/linked_ticket_app","description":"This is Zendesk's linked ticket App","fork":false,"url":"https://api.github.com/repos/zendesk/linked_ticket_app","forks_url":"https://api.github.com/repos/zendesk/linked_ticket_app/forks","keys_url":"https://api.github.com/repos/zendesk/linked_ticket_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/linked_ticket_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/linked_ticket_app/teams","hooks_url":"https://api.github.com/repos/zendesk/linked_ticket_app/hooks","issue_events_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/linked_ticket_app/events","assignees_url":"https://api.github.com/repos/zendesk/linked_ticket_app/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/linked_ticket_app/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/linked_ticket_app/tags","blobs_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/linked_ticket_app/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/linked_ticket_app/languages","stargazers_url":"https://api.github.com/repos/zendesk/linked_ticket_app/stargazers","contributors_url":"https://api.github.com/repos/zendesk/linked_ticket_app/contributors","subscribers_url":"https://api.github.com/repos/zendesk/linked_ticket_app/subscribers","subscription_url":"https://api.github.com/repos/zendesk/linked_ticket_app/subscription","commits_url":"https://api.github.com/repos/zendesk/linked_ticket_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/linked_ticket_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/linked_ticket_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/linked_ticket_app/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/linked_ticket_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/linked_ticket_app/merges","archive_url":"https://api.github.com/repos/zendesk/linked_ticket_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/linked_ticket_app/downloads","issues_url":"https://api.github.com/repos/zendesk/linked_ticket_app/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/linked_ticket_app/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/linked_ticket_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/linked_ticket_app/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/linked_ticket_app/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/linked_ticket_app/deployments","created_at":"2013-07-15T17:59:41Z","updated_at":"2016-02-09T04:52:04Z","pushed_at":"2016-02-17T00:53:11Z","git_url":"git://github.com/zendesk/linked_ticket_app.git","ssh_url":"git@github.com:zendesk/linked_ticket_app.git","clone_url":"https://github.com/zendesk/linked_ticket_app.git","svn_url":"https://github.com/zendesk/linked_ticket_app","homepage":null,"size":699,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45"},"html":{"href":"https://github.com/zendesk/linked_ticket_app/pull/45"},"issue":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/45"},"comments":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/zendesk/linked_ticket_app/statuses/857af0e7f6220be864ebe58e0f3122cd670a9d28"}}}}