{"action":"created","comment":{"url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/comments/68017748","id":68017748,"diff_hunk":"@@ -45,46 +45,68 @@ function getRelationships (data) {\n           id: ''\n         };\n \n-        rel.id = TypeMapping.toExternal(el.admin.uid);\n-        rel.type = TypeMapping.toExternal(el.admin.id.split('-')[0]);\n-\n-        relationships[key].data.push(rel);\n+        if (el.admin) {\n+          rel.id = TypeMapping.toExternal(el.admin.uid);\n+          rel.type = TypeMapping.toExternal(el.admin.id.split('-')[0]);\n+          relationships[key].data.push(rel);\n+        } else {\n+          addAsAttribute(el, key, response);\n+        }\n       });\n \n       if (relationships[key].length === 1) {\n         relationships[key] = relationships[key][0];\n       }","path":"lib/jsonapi-response.js","position":37,"original_position":37,"commit_id":"b475efcf1399c3c57c5937b1b1d636c531a242d8","original_commit_id":"b475efcf1399c3c57c5937b1b1d636c531a242d8","user":{"login":"alanshaw","id":152863,"avatar_url":"https://avatars.githubusercontent.com/u/152863?v=3","gravatar_id":"","url":"https://api.github.com/users/alanshaw","html_url":"https://github.com/alanshaw","followers_url":"https://api.github.com/users/alanshaw/followers","following_url":"https://api.github.com/users/alanshaw/following{/other_user}","gists_url":"https://api.github.com/users/alanshaw/gists{/gist_id}","starred_url":"https://api.github.com/users/alanshaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanshaw/subscriptions","organizations_url":"https://api.github.com/users/alanshaw/orgs","repos_url":"https://api.github.com/users/alanshaw/repos","events_url":"https://api.github.com/users/alanshaw/events{/privacy}","received_events_url":"https://api.github.com/users/alanshaw/received_events","type":"User","site_admin":false},"body":"Can `relationships[key]` ever be an array? I don't think we need these lines!","created_at":"2016-06-22T09:01:49Z","updated_at":"2016-06-22T09:01:49Z","html_url":"https://github.com/TheScienceMuseum/collectionsonline/pull/78#discussion_r68017748","pull_request_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/comments/68017748"},"html":{"href":"https://github.com/TheScienceMuseum/collectionsonline/pull/78#discussion_r68017748"},"pull_request":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78","id":74646075,"html_url":"https://github.com/TheScienceMuseum/collectionsonline/pull/78","diff_url":"https://github.com/TheScienceMuseum/collectionsonline/pull/78.diff","patch_url":"https://github.com/TheScienceMuseum/collectionsonline/pull/78.patch","issue_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/78","number":78,"state":"open","locked":false,"title":"Makers","user":{"login":"Danwhy","id":8939909,"avatar_url":"https://avatars.githubusercontent.com/u/8939909?v=3","gravatar_id":"","url":"https://api.github.com/users/Danwhy","html_url":"https://github.com/Danwhy","followers_url":"https://api.github.com/users/Danwhy/followers","following_url":"https://api.github.com/users/Danwhy/following{/other_user}","gists_url":"https://api.github.com/users/Danwhy/gists{/gist_id}","starred_url":"https://api.github.com/users/Danwhy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Danwhy/subscriptions","organizations_url":"https://api.github.com/users/Danwhy/orgs","repos_url":"https://api.github.com/users/Danwhy/repos","events_url":"https://api.github.com/users/Danwhy/events{/privacy}","received_events_url":"https://api.github.com/users/Danwhy/received_events","type":"User","site_admin":false},"body":"Maker and place of creation aren't direct attributes of the data, they're nested inside the lifecycle attribute, so this is needed to pull them out and add them as relationships","created_at":"2016-06-21T16:43:50Z","updated_at":"2016-06-22T09:01:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b72115c2e64970fed1bd70f2098a0ce29e94049b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78/commits","review_comments_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78/comments","review_comment_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/78/comments","statuses_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/statuses/b475efcf1399c3c57c5937b1b1d636c531a242d8","head":{"label":"TheScienceMuseum:makers","ref":"makers","sha":"b475efcf1399c3c57c5937b1b1d636c531a242d8","user":{"login":"TheScienceMuseum","id":16609662,"avatar_url":"https://avatars.githubusercontent.com/u/16609662?v=3","gravatar_id":"","url":"https://api.github.com/users/TheScienceMuseum","html_url":"https://github.com/TheScienceMuseum","followers_url":"https://api.github.com/users/TheScienceMuseum/followers","following_url":"https://api.github.com/users/TheScienceMuseum/following{/other_user}","gists_url":"https://api.github.com/users/TheScienceMuseum/gists{/gist_id}","starred_url":"https://api.github.com/users/TheScienceMuseum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheScienceMuseum/subscriptions","organizations_url":"https://api.github.com/users/TheScienceMuseum/orgs","repos_url":"https://api.github.com/users/TheScienceMuseum/repos","events_url":"https://api.github.com/users/TheScienceMuseum/events{/privacy}","received_events_url":"https://api.github.com/users/TheScienceMuseum/received_events","type":"Organization","site_admin":false},"repo":{"id":60347045,"name":"collectionsonline","full_name":"TheScienceMuseum/collectionsonline","owner":{"login":"TheScienceMuseum","id":16609662,"avatar_url":"https://avatars.githubusercontent.com/u/16609662?v=3","gravatar_id":"","url":"https://api.github.com/users/TheScienceMuseum","html_url":"https://github.com/TheScienceMuseum","followers_url":"https://api.github.com/users/TheScienceMuseum/followers","following_url":"https://api.github.com/users/TheScienceMuseum/following{/other_user}","gists_url":"https://api.github.com/users/TheScienceMuseum/gists{/gist_id}","starred_url":"https://api.github.com/users/TheScienceMuseum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheScienceMuseum/subscriptions","organizations_url":"https://api.github.com/users/TheScienceMuseum/orgs","repos_url":"https://api.github.com/users/TheScienceMuseum/repos","events_url":"https://api.github.com/users/TheScienceMuseum/events{/privacy}","received_events_url":"https://api.github.com/users/TheScienceMuseum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheScienceMuseum/collectionsonline","description":"Collections Online","fork":false,"url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline","forks_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/forks","keys_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/teams","hooks_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/hooks","issue_events_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/events{/number}","events_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/events","assignees_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/assignees{/user}","branches_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/branches{/branch}","tags_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/tags","blobs_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/statuses/{sha}","languages_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/languages","stargazers_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/stargazers","contributors_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/contributors","subscribers_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/subscribers","subscription_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/subscription","commits_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/contents/{+path}","compare_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/merges","archive_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/downloads","issues_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues{/number}","pulls_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls{/number}","milestones_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/milestones{/number}","notifications_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/labels{/name}","releases_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/releases{/id}","deployments_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/deployments","created_at":"2016-06-03T12:46:51Z","updated_at":"2016-06-20T17:03:18Z","pushed_at":"2016-06-22T08:54:08Z","git_url":"git://github.com/TheScienceMuseum/collectionsonline.git","ssh_url":"git@github.com:TheScienceMuseum/collectionsonline.git","clone_url":"https://github.com/TheScienceMuseum/collectionsonline.git","svn_url":"https://github.com/TheScienceMuseum/collectionsonline","homepage":"","size":11788,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":31,"forks":0,"open_issues":31,"watchers":4,"default_branch":"master"}},"base":{"label":"TheScienceMuseum:master","ref":"master","sha":"4647d75379267093269ece59b3b90988759eda6e","user":{"login":"TheScienceMuseum","id":16609662,"avatar_url":"https://avatars.githubusercontent.com/u/16609662?v=3","gravatar_id":"","url":"https://api.github.com/users/TheScienceMuseum","html_url":"https://github.com/TheScienceMuseum","followers_url":"https://api.github.com/users/TheScienceMuseum/followers","following_url":"https://api.github.com/users/TheScienceMuseum/following{/other_user}","gists_url":"https://api.github.com/users/TheScienceMuseum/gists{/gist_id}","starred_url":"https://api.github.com/users/TheScienceMuseum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheScienceMuseum/subscriptions","organizations_url":"https://api.github.com/users/TheScienceMuseum/orgs","repos_url":"https://api.github.com/users/TheScienceMuseum/repos","events_url":"https://api.github.com/users/TheScienceMuseum/events{/privacy}","received_events_url":"https://api.github.com/users/TheScienceMuseum/received_events","type":"Organization","site_admin":false},"repo":{"id":60347045,"name":"collectionsonline","full_name":"TheScienceMuseum/collectionsonline","owner":{"login":"TheScienceMuseum","id":16609662,"avatar_url":"https://avatars.githubusercontent.com/u/16609662?v=3","gravatar_id":"","url":"https://api.github.com/users/TheScienceMuseum","html_url":"https://github.com/TheScienceMuseum","followers_url":"https://api.github.com/users/TheScienceMuseum/followers","following_url":"https://api.github.com/users/TheScienceMuseum/following{/other_user}","gists_url":"https://api.github.com/users/TheScienceMuseum/gists{/gist_id}","starred_url":"https://api.github.com/users/TheScienceMuseum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheScienceMuseum/subscriptions","organizations_url":"https://api.github.com/users/TheScienceMuseum/orgs","repos_url":"https://api.github.com/users/TheScienceMuseum/repos","events_url":"https://api.github.com/users/TheScienceMuseum/events{/privacy}","received_events_url":"https://api.github.com/users/TheScienceMuseum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheScienceMuseum/collectionsonline","description":"Collections Online","fork":false,"url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline","forks_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/forks","keys_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/teams","hooks_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/hooks","issue_events_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/events{/number}","events_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/events","assignees_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/assignees{/user}","branches_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/branches{/branch}","tags_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/tags","blobs_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/statuses/{sha}","languages_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/languages","stargazers_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/stargazers","contributors_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/contributors","subscribers_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/subscribers","subscription_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/subscription","commits_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/contents/{+path}","compare_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/merges","archive_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/downloads","issues_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues{/number}","pulls_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls{/number}","milestones_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/milestones{/number}","notifications_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/labels{/name}","releases_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/releases{/id}","deployments_url":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/deployments","created_at":"2016-06-03T12:46:51Z","updated_at":"2016-06-20T17:03:18Z","pushed_at":"2016-06-22T08:54:08Z","git_url":"git://github.com/TheScienceMuseum/collectionsonline.git","ssh_url":"git@github.com:TheScienceMuseum/collectionsonline.git","clone_url":"https://github.com/TheScienceMuseum/collectionsonline.git","svn_url":"https://github.com/TheScienceMuseum/collectionsonline","homepage":"","size":11788,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":31,"forks":0,"open_issues":31,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78"},"html":{"href":"https://github.com/TheScienceMuseum/collectionsonline/pull/78"},"issue":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/78"},"comments":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/TheScienceMuseum/collectionsonline/statuses/b475efcf1399c3c57c5937b1b1d636c531a242d8"}}}}
{"actor":{"display_login":"alanshaw"}}