{"action":"created","comment":{"url":"https://api.github.com/repos/allegro/ralph/pulls/comments/53144257","id":53144257,"diff_hunk":"@@ -0,0 +1,73 @@\n+function getCallerNode(win) {\n+    var name = windowname_to_id(win.name);\n+    var elem = document.querySelector('#' + name);\n+    return elem;\n+}\n+\n+function dismissRelatedLookupPopup(win, chosenId) {\n+    debugger;\n+    var name = windowname_to_id(win.name);\n+    var elem = document.getElementById(name);\n+    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {\n+        elem.value += ',' + chosenId;\n+    } else if (elem.nodeName.toUpperCase() === 'AUTO-COMPLETE') {\n+        elem.updateById(chosenId);\n+    } else {\n+        document.getElementById(name).value = chosenId;\n+    }\n+    win.close();\n+}\n+\n+function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {\n+    debugger;\n+    elem = getCallerNode(win);\n+    elem.reloadBadges();\n+    win.close();\n+}\n+\n+function dismissAddRelatedObjectPopup(win, newId, newRepr) {\n+    debugger;\n+    // newId and newRepr are expected to have previously been escaped by\n+    // django.utils.html.escape.\n+    newId = html_unescape(newId);\n+    newRepr = html_unescape(newRepr);\n+    var name = windowname_to_id(win.name);\n+    var elem = document.getElementById(name);\n+    var o;\n+    if (elem.nodeName.toUpperCase() === 'AUTO-COMPLETE') {\n+        elem.updateById(newId);\n+    } else if (elem) {\n+        var elemName = elem.nodeName.toUpperCase();\n+        if (elemName == 'SELECT') {\n+            o = new Option(newRepr, newId);\n+            elem.options[elem.options.length] = o;\n+            o.selected = true;\n+        } else if (elemName == 'INPUT') {\n+            if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {","path":"src/ralph/admin/static/auto-complete-helpers.js","position":46,"original_position":46,"commit_id":"575c1bfb1aa45a7d6e3e09d74f3d6c34e1b03d6e","original_commit_id":"575c1bfb1aa45a7d6e3e09d74f3d6c34e1b03d6e","user":{"login":"mkurek","id":107437,"avatar_url":"https://avatars.githubusercontent.com/u/107437?v=3","gravatar_id":"","url":"https://api.github.com/users/mkurek","html_url":"https://github.com/mkurek","followers_url":"https://api.github.com/users/mkurek/followers","following_url":"https://api.github.com/users/mkurek/following{/other_user}","gists_url":"https://api.github.com/users/mkurek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkurek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkurek/subscriptions","organizations_url":"https://api.github.com/users/mkurek/orgs","repos_url":"https://api.github.com/users/mkurek/repos","events_url":"https://api.github.com/users/mkurek/events{/privacy}","received_events_url":"https://api.github.com/users/mkurek/received_events","type":"User","site_admin":false},"body":"this code seems very similar to the one in `dismissRelatedLookupPopup` - could you extract it to one function?","created_at":"2016-02-17T10:17:19Z","updated_at":"2016-02-17T10:17:19Z","html_url":"https://github.com/allegro/ralph/pull/2216#discussion_r53144257","pull_request_url":"https://api.github.com/repos/allegro/ralph/pulls/2216","_links":{"self":{"href":"https://api.github.com/repos/allegro/ralph/pulls/comments/53144257"},"html":{"href":"https://github.com/allegro/ralph/pull/2216#discussion_r53144257"},"pull_request":{"href":"https://api.github.com/repos/allegro/ralph/pulls/2216"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/ralph/pulls/2216","id":59491422,"html_url":"https://github.com/allegro/ralph/pull/2216","diff_url":"https://github.com/allegro/ralph/pull/2216.diff","patch_url":"https://github.com/allegro/ralph/pull/2216.patch","issue_url":"https://api.github.com/repos/allegro/ralph/issues/2216","number":2216,"state":"open","locked":false,"title":"[M2M] Fixed comments","user":{"login":"xliiv","id":298994,"avatar_url":"https://avatars.githubusercontent.com/u/298994?v=3","gravatar_id":"","url":"https://api.github.com/users/xliiv","html_url":"https://github.com/xliiv","followers_url":"https://api.github.com/users/xliiv/followers","following_url":"https://api.github.com/users/xliiv/following{/other_user}","gists_url":"https://api.github.com/users/xliiv/gists{/gist_id}","starred_url":"https://api.github.com/users/xliiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xliiv/subscriptions","organizations_url":"https://api.github.com/users/xliiv/orgs","repos_url":"https://api.github.com/users/xliiv/repos","events_url":"https://api.github.com/users/xliiv/events{/privacy}","received_events_url":"https://api.github.com/users/xliiv/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-16T13:39:45Z","updated_at":"2016-02-17T10:17:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"009f20fd755c8c56b673479bb3701cffd97627f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/allegro/ralph/pulls/2216/commits","review_comments_url":"https://api.github.com/repos/allegro/ralph/pulls/2216/comments","review_comment_url":"https://api.github.com/repos/allegro/ralph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allegro/ralph/issues/2216/comments","statuses_url":"https://api.github.com/repos/allegro/ralph/statuses/575c1bfb1aa45a7d6e3e09d74f3d6c34e1b03d6e","head":{"label":"xliiv:old-comments","ref":"old-comments","sha":"575c1bfb1aa45a7d6e3e09d74f3d6c34e1b03d6e","user":{"login":"xliiv","id":298994,"avatar_url":"https://avatars.githubusercontent.com/u/298994?v=3","gravatar_id":"","url":"https://api.github.com/users/xliiv","html_url":"https://github.com/xliiv","followers_url":"https://api.github.com/users/xliiv/followers","following_url":"https://api.github.com/users/xliiv/following{/other_user}","gists_url":"https://api.github.com/users/xliiv/gists{/gist_id}","starred_url":"https://api.github.com/users/xliiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xliiv/subscriptions","organizations_url":"https://api.github.com/users/xliiv/orgs","repos_url":"https://api.github.com/users/xliiv/repos","events_url":"https://api.github.com/users/xliiv/events{/privacy}","received_events_url":"https://api.github.com/users/xliiv/received_events","type":"User","site_admin":false},"repo":{"id":16946165,"name":"ralph","full_name":"xliiv/ralph","owner":{"login":"xliiv","id":298994,"avatar_url":"https://avatars.githubusercontent.com/u/298994?v=3","gravatar_id":"","url":"https://api.github.com/users/xliiv","html_url":"https://github.com/xliiv","followers_url":"https://api.github.com/users/xliiv/followers","following_url":"https://api.github.com/users/xliiv/following{/other_user}","gists_url":"https://api.github.com/users/xliiv/gists{/gist_id}","starred_url":"https://api.github.com/users/xliiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xliiv/subscriptions","organizations_url":"https://api.github.com/users/xliiv/orgs","repos_url":"https://api.github.com/users/xliiv/repos","events_url":"https://api.github.com/users/xliiv/events{/privacy}","received_events_url":"https://api.github.com/users/xliiv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xliiv/ralph","description":"Ralph is an asset management system for your data center.","fork":true,"url":"https://api.github.com/repos/xliiv/ralph","forks_url":"https://api.github.com/repos/xliiv/ralph/forks","keys_url":"https://api.github.com/repos/xliiv/ralph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xliiv/ralph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xliiv/ralph/teams","hooks_url":"https://api.github.com/repos/xliiv/ralph/hooks","issue_events_url":"https://api.github.com/repos/xliiv/ralph/issues/events{/number}","events_url":"https://api.github.com/repos/xliiv/ralph/events","assignees_url":"https://api.github.com/repos/xliiv/ralph/assignees{/user}","branches_url":"https://api.github.com/repos/xliiv/ralph/branches{/branch}","tags_url":"https://api.github.com/repos/xliiv/ralph/tags","blobs_url":"https://api.github.com/repos/xliiv/ralph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xliiv/ralph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xliiv/ralph/git/refs{/sha}","trees_url":"https://api.github.com/repos/xliiv/ralph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xliiv/ralph/statuses/{sha}","languages_url":"https://api.github.com/repos/xliiv/ralph/languages","stargazers_url":"https://api.github.com/repos/xliiv/ralph/stargazers","contributors_url":"https://api.github.com/repos/xliiv/ralph/contributors","subscribers_url":"https://api.github.com/repos/xliiv/ralph/subscribers","subscription_url":"https://api.github.com/repos/xliiv/ralph/subscription","commits_url":"https://api.github.com/repos/xliiv/ralph/commits{/sha}","git_commits_url":"https://api.github.com/repos/xliiv/ralph/git/commits{/sha}","comments_url":"https://api.github.com/repos/xliiv/ralph/comments{/number}","issue_comment_url":"https://api.github.com/repos/xliiv/ralph/issues/comments{/number}","contents_url":"https://api.github.com/repos/xliiv/ralph/contents/{+path}","compare_url":"https://api.github.com/repos/xliiv/ralph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xliiv/ralph/merges","archive_url":"https://api.github.com/repos/xliiv/ralph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xliiv/ralph/downloads","issues_url":"https://api.github.com/repos/xliiv/ralph/issues{/number}","pulls_url":"https://api.github.com/repos/xliiv/ralph/pulls{/number}","milestones_url":"https://api.github.com/repos/xliiv/ralph/milestones{/number}","notifications_url":"https://api.github.com/repos/xliiv/ralph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xliiv/ralph/labels{/name}","releases_url":"https://api.github.com/repos/xliiv/ralph/releases{/id}","deployments_url":"https://api.github.com/repos/xliiv/ralph/deployments","created_at":"2014-02-18T11:03:52Z","updated_at":"2015-01-05T10:16:49Z","pushed_at":"2016-02-16T13:45:57Z","git_url":"git://github.com/xliiv/ralph.git","ssh_url":"git@github.com:xliiv/ralph.git","clone_url":"https://github.com/xliiv/ralph.git","svn_url":"https://github.com/xliiv/ralph","homepage":"http://ralph.allegrogroup.com/","size":30180,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"allegro:feature/many2many-widget","ref":"feature/many2many-widget","sha":"fcb6be405d1ce4b7670e21faf3614a404a20bf30","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":4359038,"name":"ralph","full_name":"allegro/ralph","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/ralph","description":"Ralph is an asset management system for your data center.","fork":false,"url":"https://api.github.com/repos/allegro/ralph","forks_url":"https://api.github.com/repos/allegro/ralph/forks","keys_url":"https://api.github.com/repos/allegro/ralph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/ralph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/ralph/teams","hooks_url":"https://api.github.com/repos/allegro/ralph/hooks","issue_events_url":"https://api.github.com/repos/allegro/ralph/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/ralph/events","assignees_url":"https://api.github.com/repos/allegro/ralph/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/ralph/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/ralph/tags","blobs_url":"https://api.github.com/repos/allegro/ralph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/ralph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/ralph/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/ralph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/ralph/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/ralph/languages","stargazers_url":"https://api.github.com/repos/allegro/ralph/stargazers","contributors_url":"https://api.github.com/repos/allegro/ralph/contributors","subscribers_url":"https://api.github.com/repos/allegro/ralph/subscribers","subscription_url":"https://api.github.com/repos/allegro/ralph/subscription","commits_url":"https://api.github.com/repos/allegro/ralph/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/ralph/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/ralph/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/ralph/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/ralph/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/ralph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/ralph/merges","archive_url":"https://api.github.com/repos/allegro/ralph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/ralph/downloads","issues_url":"https://api.github.com/repos/allegro/ralph/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/ralph/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/ralph/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/ralph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/ralph/labels{/name}","releases_url":"https://api.github.com/repos/allegro/ralph/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/ralph/deployments","created_at":"2012-05-17T14:04:57Z","updated_at":"2016-02-16T10:57:51Z","pushed_at":"2016-02-17T10:08:34Z","git_url":"git://github.com/allegro/ralph.git","ssh_url":"git@github.com:allegro/ralph.git","clone_url":"https://github.com/allegro/ralph.git","svn_url":"https://github.com/allegro/ralph","homepage":"http://allegro.tech/ralph/","size":32653,"stargazers_count":371,"watchers_count":371,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":93,"mirror_url":null,"open_issues_count":73,"forks":93,"open_issues":73,"watchers":371,"default_branch":"ng"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/ralph/pulls/2216"},"html":{"href":"https://github.com/allegro/ralph/pull/2216"},"issue":{"href":"https://api.github.com/repos/allegro/ralph/issues/2216"},"comments":{"href":"https://api.github.com/repos/allegro/ralph/issues/2216/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/ralph/pulls/2216/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/ralph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allegro/ralph/pulls/2216/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/ralph/statuses/575c1bfb1aa45a7d6e3e09d74f3d6c34e1b03d6e"}}}}