{"action":"created","comment":{"url":"https://api.github.com/repos/ding2/ding2/pulls/comments/182760758","pull_request_review_id":113601119,"id":182760758,"diff_hunk":"@@ -20,18 +19,20 @@ $plugin = array(\n  * Implements hook_content_type_render().\n  */\n function ding_list_add_list_content_type_render($subtype, $conf, $panel_args, $context) {\n-  global $user;\n-\n-  // For unknown reasons the $entity->uid is not filled, when it's loaded via\n-  // the context. Which is why we reload the entity using entity_load_single.\n-  $list = entity_load_single('ding_type', $context->data->id);\n+  $list = $context->data;\n \n   $block = new stdClass();\n   $block->content = array();\n \n   // Users can only add lists they don't own.\n-  if ($list->uid != $user->uid && user_access('use personalisation')) {\n-    $block->content = drupal_get_form('ding_list_add_element_form', 'ding_list', $list->id, t('Add to lists I follow'));\n+  if (!ding_list_is_owner($list) && user_access('use personalisation')) {\n+    $follow_list = ding_list_get_list(DING_LIST_TYPE_LISTS);\n+    if ($element = ding_list_has_element($follow_list, $list['list_id'])) {\n+      $block->content = drupal_get_form('ding_list_remove_element_form__' . $element['element_id'], $element, t('Unfollow list'));","path":"modules/p2/ding_list/plugins/content_types/add_list.inc","position":null,"original_position":30,"commit_id":"579a99f3ade8394e313be33f56ee5d82465c3a17","original_commit_id":"c20d49bebad1a852654121091236c28e6f2eec07","user":{"login":"kasperg","id":73966,"avatar_url":"https://avatars2.githubusercontent.com/u/73966?v=4","gravatar_id":"","url":"https://api.github.com/users/kasperg","html_url":"https://github.com/kasperg","followers_url":"https://api.github.com/users/kasperg/followers","following_url":"https://api.github.com/users/kasperg/following{/other_user}","gists_url":"https://api.github.com/users/kasperg/gists{/gist_id}","starred_url":"https://api.github.com/users/kasperg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kasperg/subscriptions","organizations_url":"https://api.github.com/users/kasperg/orgs","repos_url":"https://api.github.com/users/kasperg/repos","events_url":"https://api.github.com/users/kasperg/events{/privacy}","received_events_url":"https://api.github.com/users/kasperg/received_events","type":"User","site_admin":false},"body":"Thanks for elaborating. I do not have any better way to achieve this than what you already provided.","created_at":"2018-04-19T14:14:35Z","updated_at":"2018-04-19T14:14:35Z","html_url":"https://github.com/ding2/ding2/pull/1072#discussion_r182760758","pull_request_url":"https://api.github.com/repos/ding2/ding2/pulls/1072","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments/182760758"},"html":{"href":"https://github.com/ding2/ding2/pull/1072#discussion_r182760758"},"pull_request":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1072"}},"in_reply_to_id":181676857},"pull_request":{"url":"https://api.github.com/repos/ding2/ding2/pulls/1072","id":179019470,"html_url":"https://github.com/ding2/ding2/pull/1072","diff_url":"https://github.com/ding2/ding2/pull/1072.diff","patch_url":"https://github.com/ding2/ding2/pull/1072.patch","issue_url":"https://api.github.com/repos/ding2/ding2/issues/1072","number":1072,"state":"open","locked":false,"title":"3333: Initial ding list restructure","user":{"login":"BirkAndMe","id":163625,"avatar_url":"https://avatars1.githubusercontent.com/u/163625?v=4","gravatar_id":"","url":"https://api.github.com/users/BirkAndMe","html_url":"https://github.com/BirkAndMe","followers_url":"https://api.github.com/users/BirkAndMe/followers","following_url":"https://api.github.com/users/BirkAndMe/following{/other_user}","gists_url":"https://api.github.com/users/BirkAndMe/gists{/gist_id}","starred_url":"https://api.github.com/users/BirkAndMe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BirkAndMe/subscriptions","organizations_url":"https://api.github.com/users/BirkAndMe/orgs","repos_url":"https://api.github.com/users/BirkAndMe/repos","events_url":"https://api.github.com/users/BirkAndMe/events{/privacy}","received_events_url":"https://api.github.com/users/BirkAndMe/received_events","type":"User","site_admin":false},"body":"https://platform.dandigbib.org/issues/3333\r\n\r\nThere's still some todo comments, and the v2_ functions in ting_openlist will take the place of the older functions without v2_.","created_at":"2018-04-03T07:54:27Z","updated_at":"2018-04-19T14:14:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2cf1530b520225d95bcb6db445e1690941dc1f45","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ding2/ding2/pulls/1072/commits","review_comments_url":"https://api.github.com/repos/ding2/ding2/pulls/1072/comments","review_comment_url":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ding2/ding2/issues/1072/comments","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/579a99f3ade8394e313be33f56ee5d82465c3a17","head":{"label":"b14:b3333","ref":"b3333","sha":"579a99f3ade8394e313be33f56ee5d82465c3a17","user":{"login":"b14","id":2855819,"avatar_url":"https://avatars2.githubusercontent.com/u/2855819?v=4","gravatar_id":"","url":"https://api.github.com/users/b14","html_url":"https://github.com/b14","followers_url":"https://api.github.com/users/b14/followers","following_url":"https://api.github.com/users/b14/following{/other_user}","gists_url":"https://api.github.com/users/b14/gists{/gist_id}","starred_url":"https://api.github.com/users/b14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b14/subscriptions","organizations_url":"https://api.github.com/users/b14/orgs","repos_url":"https://api.github.com/users/b14/repos","events_url":"https://api.github.com/users/b14/events{/privacy}","received_events_url":"https://api.github.com/users/b14/received_events","type":"Organization","site_admin":false},"repo":{"id":55677883,"name":"ding2","full_name":"b14/ding2","owner":{"login":"b14","id":2855819,"avatar_url":"https://avatars2.githubusercontent.com/u/2855819?v=4","gravatar_id":"","url":"https://api.github.com/users/b14","html_url":"https://github.com/b14","followers_url":"https://api.github.com/users/b14/followers","following_url":"https://api.github.com/users/b14/following{/other_user}","gists_url":"https://api.github.com/users/b14/gists{/gist_id}","starred_url":"https://api.github.com/users/b14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b14/subscriptions","organizations_url":"https://api.github.com/users/b14/orgs","repos_url":"https://api.github.com/users/b14/repos","events_url":"https://api.github.com/users/b14/events{/privacy}","received_events_url":"https://api.github.com/users/b14/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/b14/ding2","description":"Ding install profile","fork":true,"url":"https://api.github.com/repos/b14/ding2","forks_url":"https://api.github.com/repos/b14/ding2/forks","keys_url":"https://api.github.com/repos/b14/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/b14/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/b14/ding2/teams","hooks_url":"https://api.github.com/repos/b14/ding2/hooks","issue_events_url":"https://api.github.com/repos/b14/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/b14/ding2/events","assignees_url":"https://api.github.com/repos/b14/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/b14/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/b14/ding2/tags","blobs_url":"https://api.github.com/repos/b14/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/b14/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/b14/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/b14/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/b14/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/b14/ding2/languages","stargazers_url":"https://api.github.com/repos/b14/ding2/stargazers","contributors_url":"https://api.github.com/repos/b14/ding2/contributors","subscribers_url":"https://api.github.com/repos/b14/ding2/subscribers","subscription_url":"https://api.github.com/repos/b14/ding2/subscription","commits_url":"https://api.github.com/repos/b14/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/b14/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/b14/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/b14/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/b14/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/b14/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/b14/ding2/merges","archive_url":"https://api.github.com/repos/b14/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/b14/ding2/downloads","issues_url":"https://api.github.com/repos/b14/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/b14/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/b14/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/b14/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/b14/ding2/labels{/name}","releases_url":"https://api.github.com/repos/b14/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/b14/ding2/deployments","created_at":"2016-04-07T08:34:26Z","updated_at":"2016-05-26T14:27:47Z","pushed_at":"2018-04-19T13:37:53Z","git_url":"git://github.com/b14/ding2.git","ssh_url":"git@github.com:b14/ding2.git","clone_url":"https://github.com/b14/ding2.git","svn_url":"https://github.com/b14/ding2","homepage":"","size":95519,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ding2:master","ref":"master","sha":"0968fd0eefbfb161b412ab4ab272f6d5b30be701","user":{"login":"ding2","id":564698,"avatar_url":"https://avatars0.githubusercontent.com/u/564698?v=4","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"repo":{"id":1266749,"name":"ding2","full_name":"ding2/ding2","owner":{"login":"ding2","id":564698,"avatar_url":"https://avatars0.githubusercontent.com/u/564698?v=4","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ding2/ding2","description":"Ding install profile","fork":false,"url":"https://api.github.com/repos/ding2/ding2","forks_url":"https://api.github.com/repos/ding2/ding2/forks","keys_url":"https://api.github.com/repos/ding2/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ding2/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ding2/ding2/teams","hooks_url":"https://api.github.com/repos/ding2/ding2/hooks","issue_events_url":"https://api.github.com/repos/ding2/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/ding2/ding2/events","assignees_url":"https://api.github.com/repos/ding2/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/ding2/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/ding2/ding2/tags","blobs_url":"https://api.github.com/repos/ding2/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ding2/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ding2/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ding2/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/ding2/ding2/languages","stargazers_url":"https://api.github.com/repos/ding2/ding2/stargazers","contributors_url":"https://api.github.com/repos/ding2/ding2/contributors","subscribers_url":"https://api.github.com/repos/ding2/ding2/subscribers","subscription_url":"https://api.github.com/repos/ding2/ding2/subscription","commits_url":"https://api.github.com/repos/ding2/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ding2/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ding2/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ding2/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ding2/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/ding2/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ding2/ding2/merges","archive_url":"https://api.github.com/repos/ding2/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ding2/ding2/downloads","issues_url":"https://api.github.com/repos/ding2/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/ding2/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/ding2/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/ding2/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ding2/ding2/labels{/name}","releases_url":"https://api.github.com/repos/ding2/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/ding2/ding2/deployments","created_at":"2011-01-18T10:54:00Z","updated_at":"2018-04-09T12:58:20Z","pushed_at":"2018-04-19T13:38:19Z","git_url":"git://github.com/ding2/ding2.git","ssh_url":"git@github.com:ding2/ding2.git","clone_url":"https://github.com/ding2/ding2.git","svn_url":"https://github.com/ding2/ding2","homepage":"","size":94951,"stargazers_count":13,"watchers_count":13,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":42,"mirror_url":null,"archived":false,"open_issues_count":189,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":42,"open_issues":189,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1072"},"html":{"href":"https://github.com/ding2/ding2/pull/1072"},"issue":{"href":"https://api.github.com/repos/ding2/ding2/issues/1072"},"comments":{"href":"https://api.github.com/repos/ding2/ding2/issues/1072/comments"},"review_comments":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1072/comments"},"review_comment":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1072/commits"},"statuses":{"href":"https://api.github.com/repos/ding2/ding2/statuses/579a99f3ade8394e313be33f56ee5d82465c3a17"}},"author_association":"NONE"}}
{"actor":{"display_login":"kasperg"}}