{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/comments/33943852","id":33943852,"diff_hunk":"@@ -0,0 +1,71 @@\n+var request = require(\"request\");\n+\n+function isEmpty(val) {\n+  return val === null || val === undefined;\n+}\n+\n+module.exports = function(config) {\n+  return function(req, res) {\n+    var project = JSON.parse(JSON.stringify(req.session.project.meta));\n+    delete project.id;\n+    delete project.publish_url;\n+\n+    if(!req.body || isEmpty(req.body.description) || isEmpty(req.body.dateUpdated) || isEmpty(req.body.public)) {\n+      res.status(400).send({ error:  \"Request body missing data\" });\n+      return;\n+    }\n+\n+    project.description = req.body.description;\n+    // Uncomment the line below once https://github.com/mozilla/publish.webmaker.org/issues/98 is done\n+    // project.public = req.body.public;\n+    project.date_updated = req.body.dateUpdated;\n+\n+    request({\n+      method: \"PUT\",\n+      uri: config.publishURL + \"/projects/\" + req.session.project.meta.id,\n+      headers: {\n+        \"Authorization\": \"token \" + req.user.token\n+      },\n+      body: project,\n+      json: true\n+    }, function(err, response, body) {\n+      if(err) {\n+        res.status(500).send({error: err});\n+        return;\n+      }\n+\n+      if(response.statusCode !== 201) {","path":"routes/publish.js","position":37,"original_position":37,"commit_id":"d5dc3861f982b2ed93981252744f15955b74df23","original_commit_id":"d5dc3861f982b2ed93981252744f15955b74df23","user":{"login":"sedge","id":1616860,"avatar_url":"https://avatars.githubusercontent.com/u/1616860?v=3","gravatar_id":"","url":"https://api.github.com/users/sedge","html_url":"https://github.com/sedge","followers_url":"https://api.github.com/users/sedge/followers","following_url":"https://api.github.com/users/sedge/following{/other_user}","gists_url":"https://api.github.com/users/sedge/gists{/gist_id}","starred_url":"https://api.github.com/users/sedge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sedge/subscriptions","organizations_url":"https://api.github.com/users/sedge/orgs","repos_url":"https://api.github.com/users/sedge/repos","events_url":"https://api.github.com/users/sedge/events{/privacy}","received_events_url":"https://api.github.com/users/sedge/received_events","type":"User","site_admin":false},"body":"I'd also combine these two cases under one response code, unless there's a reason you need the publish server's response back.","created_at":"2015-07-06T15:08:01Z","updated_at":"2015-07-06T15:08:01Z","html_url":"https://github.com/mozilla/thimble.webmaker.org/pull/628#discussion_r33943852","pull_request_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628","_links":{"self":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/comments/33943852"},"html":{"href":"https://github.com/mozilla/thimble.webmaker.org/pull/628#discussion_r33943852"},"pull_request":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628","id":38819812,"html_url":"https://github.com/mozilla/thimble.webmaker.org/pull/628","diff_url":"https://github.com/mozilla/thimble.webmaker.org/pull/628.diff","patch_url":"https://github.com/mozilla/thimble.webmaker.org/pull/628.patch","issue_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues/628","number":628,"state":"open","locked":false,"title":"Get Publishing working","user":{"login":"gideonthomas","id":5816130,"avatar_url":"https://avatars.githubusercontent.com/u/5816130?v=3","gravatar_id":"","url":"https://api.github.com/users/gideonthomas","html_url":"https://github.com/gideonthomas","followers_url":"https://api.github.com/users/gideonthomas/followers","following_url":"https://api.github.com/users/gideonthomas/following{/other_user}","gists_url":"https://api.github.com/users/gideonthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/gideonthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gideonthomas/subscriptions","organizations_url":"https://api.github.com/users/gideonthomas/orgs","repos_url":"https://api.github.com/users/gideonthomas/repos","events_url":"https://api.github.com/users/gideonthomas/events{/privacy}","received_events_url":"https://api.github.com/users/gideonthomas/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-29T21:29:44Z","updated_at":"2015-07-06T15:08:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f23d99920a9aafe8d7a608c8764f2356283b5ba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628/commits","review_comments_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628/comments","review_comment_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues/628/comments","statuses_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/statuses/d5dc3861f982b2ed93981252744f15955b74df23","head":{"label":"gideonthomas:publish","ref":"publish","sha":"d5dc3861f982b2ed93981252744f15955b74df23","user":{"login":"gideonthomas","id":5816130,"avatar_url":"https://avatars.githubusercontent.com/u/5816130?v=3","gravatar_id":"","url":"https://api.github.com/users/gideonthomas","html_url":"https://github.com/gideonthomas","followers_url":"https://api.github.com/users/gideonthomas/followers","following_url":"https://api.github.com/users/gideonthomas/following{/other_user}","gists_url":"https://api.github.com/users/gideonthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/gideonthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gideonthomas/subscriptions","organizations_url":"https://api.github.com/users/gideonthomas/orgs","repos_url":"https://api.github.com/users/gideonthomas/repos","events_url":"https://api.github.com/users/gideonthomas/events{/privacy}","received_events_url":"https://api.github.com/users/gideonthomas/received_events","type":"User","site_admin":false},"repo":{"id":31554137,"name":"thimble.webmaker.org","full_name":"gideonthomas/thimble.webmaker.org","owner":{"login":"gideonthomas","id":5816130,"avatar_url":"https://avatars.githubusercontent.com/u/5816130?v=3","gravatar_id":"","url":"https://api.github.com/users/gideonthomas","html_url":"https://github.com/gideonthomas","followers_url":"https://api.github.com/users/gideonthomas/followers","following_url":"https://api.github.com/users/gideonthomas/following{/other_user}","gists_url":"https://api.github.com/users/gideonthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/gideonthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gideonthomas/subscriptions","organizations_url":"https://api.github.com/users/gideonthomas/orgs","repos_url":"https://api.github.com/users/gideonthomas/repos","events_url":"https://api.github.com/users/gideonthomas/events{/privacy}","received_events_url":"https://api.github.com/users/gideonthomas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gideonthomas/thimble.webmaker.org","description":"a minimal thimble on node.js POC","fork":true,"url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org","forks_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/forks","keys_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/teams","hooks_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/hooks","issue_events_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/issues/events{/number}","events_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/events","assignees_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/assignees{/user}","branches_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/branches{/branch}","tags_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/tags","blobs_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/statuses/{sha}","languages_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/languages","stargazers_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/stargazers","contributors_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/contributors","subscribers_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/subscribers","subscription_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/subscription","commits_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/contents/{+path}","compare_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/merges","archive_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/downloads","issues_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/issues{/number}","pulls_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/pulls{/number}","milestones_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/milestones{/number}","notifications_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/labels{/name}","releases_url":"https://api.github.com/repos/gideonthomas/thimble.webmaker.org/releases{/id}","created_at":"2015-03-02T17:51:20Z","updated_at":"2015-03-02T17:51:21Z","pushed_at":"2015-07-06T13:46:12Z","git_url":"git://github.com/gideonthomas/thimble.webmaker.org.git","ssh_url":"git@github.com:gideonthomas/thimble.webmaker.org.git","clone_url":"https://github.com/gideonthomas/thimble.webmaker.org.git","svn_url":"https://github.com/gideonthomas/thimble.webmaker.org","homepage":null,"size":17102,"stargazers_count":0,"watchers_count":0,"language":"HTML","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":"mvpIntegration"}},"base":{"label":"mozilla:bramble","ref":"bramble","sha":"b15c7b47c175b584fe46e29a37c8b3ea619694dc","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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":9349840,"name":"thimble.webmaker.org","full_name":"mozilla/thimble.webmaker.org","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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/thimble.webmaker.org","description":"Thimble coding editor","fork":false,"url":"https://api.github.com/repos/mozilla/thimble.webmaker.org","forks_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/forks","keys_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/teams","hooks_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/hooks","issue_events_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/events","assignees_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/tags","blobs_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/languages","stargazers_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/stargazers","contributors_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/contributors","subscribers_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/subscribers","subscription_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/subscription","commits_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/merges","archive_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/downloads","issues_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/thimble.webmaker.org/releases{/id}","created_at":"2013-04-10T15:54:34Z","updated_at":"2015-07-03T06:54:19Z","pushed_at":"2015-07-06T13:47:27Z","git_url":"git://github.com/mozilla/thimble.webmaker.org.git","ssh_url":"git@github.com:mozilla/thimble.webmaker.org.git","clone_url":"https://github.com/mozilla/thimble.webmaker.org.git","svn_url":"https://github.com/mozilla/thimble.webmaker.org","homepage":"thimble.webmaker.org","size":21281,"stargazers_count":68,"watchers_count":68,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":102,"forks":71,"open_issues":102,"watchers":68,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628"},"html":{"href":"https://github.com/mozilla/thimble.webmaker.org/pull/628"},"issue":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues/628"},"comments":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/issues/628/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/pulls/628/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/thimble.webmaker.org/statuses/d5dc3861f982b2ed93981252744f15955b74df23"}}}}