{"action":"created","comment":{"url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/comments/63760473","id":63760473,"diff_hunk":"@@ -0,0 +1,9 @@\n+module.exports = (param) ->\n+  param = param.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\")\n+  regexS = \"[\\\\?&]\" + param + \"=([^&#]*)\"\n+  regex = new RegExp regexS\n+  results = regex.exec window.location.href\n+  if results?.length > 1\n+    return decodeURIComponent results[1]\n+  else\n+    return null","path":"src/code/utils/get-query-param.coffee","position":9,"original_position":9,"commit_id":"58c9bb60a5a0100d0a7b50f8329abd9895c22cc1","original_commit_id":"58c9bb60a5a0100d0a7b50f8329abd9895c22cc1","user":{"login":"kswenson","id":235234,"avatar_url":"https://avatars.githubusercontent.com/u/235234?v=3","gravatar_id":"","url":"https://api.github.com/users/kswenson","html_url":"https://github.com/kswenson","followers_url":"https://api.github.com/users/kswenson/followers","following_url":"https://api.github.com/users/kswenson/following{/other_user}","gists_url":"https://api.github.com/users/kswenson/gists{/gist_id}","starred_url":"https://api.github.com/users/kswenson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kswenson/subscriptions","organizations_url":"https://api.github.com/users/kswenson/orgs","repos_url":"https://api.github.com/users/kswenson/repos","events_url":"https://api.github.com/users/kswenson/events{/privacy}","received_events_url":"https://api.github.com/users/kswenson/received_events","type":"User","site_admin":false},"body":"Right, I'm thinking JS. In CS it would be `if results?.length > 1 then decodeURIComponent results[1] else null` but as you say, a matter of preference.","created_at":"2016-05-18T18:51:44Z","updated_at":"2016-05-18T18:51:44Z","html_url":"https://github.com/concord-consortium/cloud-file-manager/pull/26#discussion_r63760473","pull_request_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/comments/63760473"},"html":{"href":"https://github.com/concord-consortium/cloud-file-manager/pull/26#discussion_r63760473"},"pull_request":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26","id":70535731,"html_url":"https://github.com/concord-consortium/cloud-file-manager/pull/26","diff_url":"https://github.com/concord-consortium/cloud-file-manager/pull/26.diff","patch_url":"https://github.com/concord-consortium/cloud-file-manager/pull/26.patch","issue_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/26","number":26,"state":"open","locked":false,"title":"Use run key from LARA when saving as a student","user":{"login":"sfentress","id":35721,"avatar_url":"https://avatars.githubusercontent.com/u/35721?v=3","gravatar_id":"","url":"https://api.github.com/users/sfentress","html_url":"https://github.com/sfentress","followers_url":"https://api.github.com/users/sfentress/followers","following_url":"https://api.github.com/users/sfentress/following{/other_user}","gists_url":"https://api.github.com/users/sfentress/gists{/gist_id}","starred_url":"https://api.github.com/users/sfentress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfentress/subscriptions","organizations_url":"https://api.github.com/users/sfentress/orgs","repos_url":"https://api.github.com/users/sfentress/repos","events_url":"https://api.github.com/users/sfentress/events{/privacy}","received_events_url":"https://api.github.com/users/sfentress/received_events","type":"User","site_admin":false},"body":"This allows student to launch shared documents from LARA and save back to their own copies.\r\n\r\nWhen a student launches using from LARA using a document on the document-server which was shared by an author, they do not have write-access to that file. Instead, LARA also providers them with the runKey associated with that document in the url as a query parameter.\r\n\r\nIf we save to the same document using that runKey, then the document-server will automatically create a copy for us, allowing us to save our changes to it. It will then pass down the new id for the file we have ownership to, allowing us to save to that new document from then on.\r\n\r\nWe were already capturing a using the new id, but two changes had to be introduced:\r\n\r\n1. Capture the runKey and use it on the first save\r\n2. Don't try to save via patch on the first save of a session\r\n\r\nThe second point means that we won't be as efficient in our first save, as we may do a full-save even on a document we already own. Unfortunately, it doesn't seem that there is a way of distinguishing between a document we own and one we don't, until we have a successful first save. At which point, the record id returned by the server will always be one that we own. ","created_at":"2016-05-18T14:16:35Z","updated_at":"2016-05-18T18:51:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e0262a39a5b18885811bf7b1b7d0847a0e4efe66","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26/commits","review_comments_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26/comments","review_comment_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/26/comments","statuses_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/statuses/58c9bb60a5a0100d0a7b50f8329abd9895c22cc1","head":{"label":"concord-consortium:useRunKeyFromLara","ref":"useRunKeyFromLara","sha":"58c9bb60a5a0100d0a7b50f8329abd9895c22cc1","user":{"login":"concord-consortium","id":319219,"avatar_url":"https://avatars.githubusercontent.com/u/319219?v=3","gravatar_id":"","url":"https://api.github.com/users/concord-consortium","html_url":"https://github.com/concord-consortium","followers_url":"https://api.github.com/users/concord-consortium/followers","following_url":"https://api.github.com/users/concord-consortium/following{/other_user}","gists_url":"https://api.github.com/users/concord-consortium/gists{/gist_id}","starred_url":"https://api.github.com/users/concord-consortium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concord-consortium/subscriptions","organizations_url":"https://api.github.com/users/concord-consortium/orgs","repos_url":"https://api.github.com/users/concord-consortium/repos","events_url":"https://api.github.com/users/concord-consortium/events{/privacy}","received_events_url":"https://api.github.com/users/concord-consortium/received_events","type":"Organization","site_admin":false},"repo":{"id":46497015,"name":"cloud-file-manager","full_name":"concord-consortium/cloud-file-manager","owner":{"login":"concord-consortium","id":319219,"avatar_url":"https://avatars.githubusercontent.com/u/319219?v=3","gravatar_id":"","url":"https://api.github.com/users/concord-consortium","html_url":"https://github.com/concord-consortium","followers_url":"https://api.github.com/users/concord-consortium/followers","following_url":"https://api.github.com/users/concord-consortium/following{/other_user}","gists_url":"https://api.github.com/users/concord-consortium/gists{/gist_id}","starred_url":"https://api.github.com/users/concord-consortium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concord-consortium/subscriptions","organizations_url":"https://api.github.com/users/concord-consortium/orgs","repos_url":"https://api.github.com/users/concord-consortium/repos","events_url":"https://api.github.com/users/concord-consortium/events{/privacy}","received_events_url":"https://api.github.com/users/concord-consortium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/concord-consortium/cloud-file-manager","description":"Javascript library that enables applications to save and load files from various file systems.","fork":false,"url":"https://api.github.com/repos/concord-consortium/cloud-file-manager","forks_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/forks","keys_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/teams","hooks_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/hooks","issue_events_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/events{/number}","events_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/events","assignees_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/assignees{/user}","branches_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/branches{/branch}","tags_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/tags","blobs_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/languages","stargazers_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/stargazers","contributors_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/contributors","subscribers_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/subscribers","subscription_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/subscription","commits_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/contents/{+path}","compare_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/merges","archive_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/downloads","issues_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues{/number}","pulls_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/labels{/name}","releases_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/releases{/id}","deployments_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/deployments","created_at":"2015-11-19T14:22:10Z","updated_at":"2016-01-29T21:29:03Z","pushed_at":"2016-05-18T14:16:35Z","git_url":"git://github.com/concord-consortium/cloud-file-manager.git","ssh_url":"git@github.com:concord-consortium/cloud-file-manager.git","clone_url":"https://github.com/concord-consortium/cloud-file-manager.git","svn_url":"https://github.com/concord-consortium/cloud-file-manager","homepage":"","size":6579,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"concord-consortium:master","ref":"master","sha":"4f7e8f38320632647df8faecb195c0bebc484af2","user":{"login":"concord-consortium","id":319219,"avatar_url":"https://avatars.githubusercontent.com/u/319219?v=3","gravatar_id":"","url":"https://api.github.com/users/concord-consortium","html_url":"https://github.com/concord-consortium","followers_url":"https://api.github.com/users/concord-consortium/followers","following_url":"https://api.github.com/users/concord-consortium/following{/other_user}","gists_url":"https://api.github.com/users/concord-consortium/gists{/gist_id}","starred_url":"https://api.github.com/users/concord-consortium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concord-consortium/subscriptions","organizations_url":"https://api.github.com/users/concord-consortium/orgs","repos_url":"https://api.github.com/users/concord-consortium/repos","events_url":"https://api.github.com/users/concord-consortium/events{/privacy}","received_events_url":"https://api.github.com/users/concord-consortium/received_events","type":"Organization","site_admin":false},"repo":{"id":46497015,"name":"cloud-file-manager","full_name":"concord-consortium/cloud-file-manager","owner":{"login":"concord-consortium","id":319219,"avatar_url":"https://avatars.githubusercontent.com/u/319219?v=3","gravatar_id":"","url":"https://api.github.com/users/concord-consortium","html_url":"https://github.com/concord-consortium","followers_url":"https://api.github.com/users/concord-consortium/followers","following_url":"https://api.github.com/users/concord-consortium/following{/other_user}","gists_url":"https://api.github.com/users/concord-consortium/gists{/gist_id}","starred_url":"https://api.github.com/users/concord-consortium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concord-consortium/subscriptions","organizations_url":"https://api.github.com/users/concord-consortium/orgs","repos_url":"https://api.github.com/users/concord-consortium/repos","events_url":"https://api.github.com/users/concord-consortium/events{/privacy}","received_events_url":"https://api.github.com/users/concord-consortium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/concord-consortium/cloud-file-manager","description":"Javascript library that enables applications to save and load files from various file systems.","fork":false,"url":"https://api.github.com/repos/concord-consortium/cloud-file-manager","forks_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/forks","keys_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/teams","hooks_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/hooks","issue_events_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/events{/number}","events_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/events","assignees_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/assignees{/user}","branches_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/branches{/branch}","tags_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/tags","blobs_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/languages","stargazers_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/stargazers","contributors_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/contributors","subscribers_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/subscribers","subscription_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/subscription","commits_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/contents/{+path}","compare_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/merges","archive_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/downloads","issues_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues{/number}","pulls_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/labels{/name}","releases_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/releases{/id}","deployments_url":"https://api.github.com/repos/concord-consortium/cloud-file-manager/deployments","created_at":"2015-11-19T14:22:10Z","updated_at":"2016-01-29T21:29:03Z","pushed_at":"2016-05-18T14:16:35Z","git_url":"git://github.com/concord-consortium/cloud-file-manager.git","ssh_url":"git@github.com:concord-consortium/cloud-file-manager.git","clone_url":"https://github.com/concord-consortium/cloud-file-manager.git","svn_url":"https://github.com/concord-consortium/cloud-file-manager","homepage":"","size":6579,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26"},"html":{"href":"https://github.com/concord-consortium/cloud-file-manager/pull/26"},"issue":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/26"},"comments":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/concord-consortium/cloud-file-manager/statuses/58c9bb60a5a0100d0a7b50f8329abd9895c22cc1"}}}}