GitHub PullRequestReviewCommentEvent at 2014-10-23 00:02:09
Repository: marketplace-operator-dashboard
Actor: cvan
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/comments/19252886","id":19252886,"diff_hunk":"@@ -0,0 +1,134 @@\n+/*\n+    Fetch a list of carrier/region pairs upon which a user has been granted\n+    object-level permission to operate.\n+*/\n+\n+define('operators', ['defer', 'jquery', 'nunjucks', 'requests', 'settings', 'storage', 'underscore', 'urls', 'z'],\n+    function(defer, $, nunjucks, requests, settings, storage, _, urls, z) {\n+\n+    var console = require('log')('operators');\n+\n+    var ALL_OPERATORS_KEY = 'operators_all';\n+    var CURRENT_OPERATOR_KEY = 'operators_current';\n+\n+    function getAll() {\n+        var all = storage.getItem(ALL_OPERATORS_KEY);\n+        return all ? all : [];\n+    }\n+\n+    function getCurrent() {\n+        var current = storage.getItem(CURRENT_OPERATOR_KEY);\n+        return current ? current : null;\n+    }\n+\n+    function setAll(data) {\n+        console.log('Storing operators', data);\n+        storage.setItem(ALL_OPERATORS_KEY, data);\n+    }\n+\n+    function setCurrent(carrier, region) {\n+        console.log('Setting current operator', carrier, region);\n+        storage.setItem(CURRENT_OPERATOR_KEY, {\n+            carrier: carrier,\n+            region: region\n+        });\n+    }\n+\n+    function removeAll() {\n+        console.log('Removing all operators');\n+        removeCurrent();\n+        storage.removeItem(ALL_OPERATORS_KEY);\n+    }\n+\n+    function removeCurrent() {\n+        console.log('Removing current operator')\n+        storage.removeItem(CURRENT_OPERATOR_KEY);\n+    }\n+\n+    function showMessage() {\n+        if (!$('#operator-message').length) {\n+            console.log('Showing operator message');\n+            $('<section />', {\n+                id: 'operator-message'\n+            }).insertAfter('#site-header');\n+        } else {\n+            console.log('Updating operator message');\n+        }\n+        var tmpl = nunjucks.env.render('include/operator_message.html', {\n+            'operators': getAll(),\n+            'current_operator': getCurrent()\n+        });\n+        $('#operator-message').html(tmpl);\n+    }\n+\n+    function fetch() {\n+        var def = defer.Deferred();\n+        requests.get(urls.api.url('permissions')).done(function(data) {\n+            var operators = data.objects;\n+            console.log('Received operators from server', operators);\n+            setAll(operators);\n+\n+            // Ensure that the currently selected region is available to the\n+            // use. If not, clear it.\n+            if (getCurrent() && operators) {\n+                if (!$.inArray(current, operators)) {\n+                    removeCurrent();\n+                }\n+            }\n+\n+            // Set the current region to the first available, for the sake of\n+            // having one selected.\n+            if (!getCurrent() && operators) {\n+                setCurrent(operators[0].carrier, operators[0].region);\n+\n+            }\n+\n+            z.page.trigger('reload_chrome');\n+            def.resolve(data);\n+        });\n+        return def.promise();\n+    }\n+\n+    z.body.on('click', '#show_change_operator', function(evt) {\n+        evt.preventDefault();\n+        console.log('Showing operator change form')\n+        var $message = $('#operator-message');\n+        $message.find('p').hide();\n+        $message.find('form').show();\n+    });\n+\n+    z.body.on('click', 'form button[type=\"cancel\"]', function(evt) {\n+        evt.preventDefault();\n+        console.log('Hiding operator change form')\n+        var $message = $('#operator-message');","path":"src/media/js/operators.js","position":103,"original_position":103,"commit_id":"80e7301ddb326ecd57f517421d63c8a834a9d172","original_commit_id":"80e7301ddb326ecd57f517421d63c8a834a9d172","user":{"login":"cvan","id":203725,"avatar_url":"https://avatars.githubusercontent.com/u/203725?v=2","gravatar_id":"","url":"https://api.github.com/users/cvan","html_url":"https://github.com/cvan","followers_url":"https://api.github.com/users/cvan/followers","following_url":"https://api.github.com/users/cvan/following{/other_user}","gists_url":"https://api.github.com/users/cvan/gists{/gist_id}","starred_url":"https://api.github.com/users/cvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvan/subscriptions","organizations_url":"https://api.github.com/users/cvan/orgs","repos_url":"https://api.github.com/users/cvan/repos","events_url":"https://api.github.com/users/cvan/events{/privacy}","received_events_url":"https://api.github.com/users/cvan/received_events","type":"User","site_admin":false},"body":"can we keep around a `$message` reference when it's created? after it's created, it seems to be queried four times after that.\r\n","created_at":"2014-10-23T00:02:09Z","updated_at":"2014-10-23T00:02:09Z","html_url":"https://github.com/mozilla/marketplace-operator-dashboard/pull/1#discussion_r19252886","pull_request_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/comments/19252886"},"html":{"href":"https://github.com/mozilla/marketplace-operator-dashboard/pull/1#discussion_r19252886"},"pull_request":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1","id":23196945,"html_url":"https://github.com/mozilla/marketplace-operator-dashboard/pull/1","diff_url":"https://github.com/mozilla/marketplace-operator-dashboard/pull/1.diff","patch_url":"https://github.com/mozilla/marketplace-operator-dashboard/pull/1.patch","issue_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues/1","number":1,"state":"open","locked":false,"title":"Allow users to choose an active operator (bug 1074422)","user":{"login":"chuckharmston","id":23885,"avatar_url":"https://avatars.githubusercontent.com/u/23885?v=2","gravatar_id":"","url":"https://api.github.com/users/chuckharmston","html_url":"https://github.com/chuckharmston","followers_url":"https://api.github.com/users/chuckharmston/followers","following_url":"https://api.github.com/users/chuckharmston/following{/other_user}","gists_url":"https://api.github.com/users/chuckharmston/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckharmston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckharmston/subscriptions","organizations_url":"https://api.github.com/users/chuckharmston/orgs","repos_url":"https://api.github.com/users/chuckharmston/repos","events_url":"https://api.github.com/users/chuckharmston/events{/privacy}","received_events_url":"https://api.github.com/users/chuckharmston/received_events","type":"User","site_admin":false},"body":"Short video of the experience: http://chuck.mn/2P2V452F3R1v\r\n\r\n- The list of carrier/region pairs is pulled from the API on login.\r\n- Visuals of the experience are pending suggestions from @pwalm\r\n- I'll make a few line comments to explain some things.\r\n\r\nr? @ngokevin @spasovski @cvan","created_at":"2014-10-22T23:12:06Z","updated_at":"2014-10-23T00:02:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47d9a3fc1c62418bc4894adfe4feaa669b8af3b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues/1/comments","statuses_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/statuses/80e7301ddb326ecd57f517421d63c8a834a9d172","head":{"label":"chuckharmston:dev","ref":"dev","sha":"80e7301ddb326ecd57f517421d63c8a834a9d172","user":{"login":"chuckharmston","id":23885,"avatar_url":"https://avatars.githubusercontent.com/u/23885?v=2","gravatar_id":"","url":"https://api.github.com/users/chuckharmston","html_url":"https://github.com/chuckharmston","followers_url":"https://api.github.com/users/chuckharmston/followers","following_url":"https://api.github.com/users/chuckharmston/following{/other_user}","gists_url":"https://api.github.com/users/chuckharmston/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckharmston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckharmston/subscriptions","organizations_url":"https://api.github.com/users/chuckharmston/orgs","repos_url":"https://api.github.com/users/chuckharmston/repos","events_url":"https://api.github.com/users/chuckharmston/events{/privacy}","received_events_url":"https://api.github.com/users/chuckharmston/received_events","type":"User","site_admin":false},"repo":{"id":25439317,"name":"marketplace-operator-dashboard","full_name":"chuckharmston/marketplace-operator-dashboard","owner":{"login":"chuckharmston","id":23885,"avatar_url":"https://avatars.githubusercontent.com/u/23885?v=2","gravatar_id":"","url":"https://api.github.com/users/chuckharmston","html_url":"https://github.com/chuckharmston","followers_url":"https://api.github.com/users/chuckharmston/followers","following_url":"https://api.github.com/users/chuckharmston/following{/other_user}","gists_url":"https://api.github.com/users/chuckharmston/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckharmston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckharmston/subscriptions","organizations_url":"https://api.github.com/users/chuckharmston/orgs","repos_url":"https://api.github.com/users/chuckharmston/repos","events_url":"https://api.github.com/users/chuckharmston/events{/privacy}","received_events_url":"https://api.github.com/users/chuckharmston/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chuckharmston/marketplace-operator-dashboard","description":"Operator dashboard for the Firefox Marketplace","fork":true,"url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard","forks_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/forks","keys_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/teams","hooks_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/hooks","issue_events_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/issues/events{/number}","events_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/events","assignees_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/assignees{/user}","branches_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/branches{/branch}","tags_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/tags","blobs_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/statuses/{sha}","languages_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/languages","stargazers_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/stargazers","contributors_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/contributors","subscribers_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/subscribers","subscription_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/subscription","commits_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/issues/comments/{number}","contents_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/contents/{+path}","compare_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/merges","archive_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/downloads","issues_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/issues{/number}","pulls_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/pulls{/number}","milestones_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/milestones{/number}","notifications_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/labels{/name}","releases_url":"https://api.github.com/repos/chuckharmston/marketplace-operator-dashboard/releases{/id}","created_at":"2014-10-19T20:32:51Z","updated_at":"2014-10-19T20:39:45Z","pushed_at":"2014-10-22T23:08:23Z","git_url":"git://github.com/chuckharmston/marketplace-operator-dashboard.git","ssh_url":"git@github.com:chuckharmston/marketplace-operator-dashboard.git","clone_url":"https://github.com/chuckharmston/marketplace-operator-dashboard.git","svn_url":"https://github.com/chuckharmston/marketplace-operator-dashboard","homepage":"","size":288,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"e226f62a5bc06ad8f95529dfb0a15420d8c6ad9d","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=2","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":17146400,"name":"marketplace-operator-dashboard","full_name":"mozilla/marketplace-operator-dashboard","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=2","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/marketplace-operator-dashboard","description":"Operator dashboard for the Firefox Marketplace","fork":false,"url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard","forks_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/forks","keys_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/teams","hooks_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/hooks","issue_events_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/events","assignees_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/tags","blobs_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/languages","stargazers_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/stargazers","contributors_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/contributors","subscribers_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/subscribers","subscription_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/subscription","commits_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/merges","archive_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/downloads","issues_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/releases{/id}","created_at":"2014-02-24T18:40:24Z","updated_at":"2014-09-22T18:56:19Z","pushed_at":"2014-10-21T22:51:27Z","git_url":"git://github.com/mozilla/marketplace-operator-dashboard.git","ssh_url":"git@github.com:mozilla/marketplace-operator-dashboard.git","clone_url":"https://github.com/mozilla/marketplace-operator-dashboard.git","svn_url":"https://github.com/mozilla/marketplace-operator-dashboard","homepage":"","size":320,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1"},"html":{"href":"https://github.com/mozilla/marketplace-operator-dashboard/pull/1"},"issue":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues/1"},"comments":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/marketplace-operator-dashboard/statuses/80e7301ddb326ecd57f517421d63c8a834a9d172"}}}}