{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/tagmanager/pulls/comments/62205885","id":62205885,"diff_hunk":"@@ -16,77 +16,99 @@ export default class TargetingEdit extends React.Component {\n   }\n \n   onTagSelected(tag) {\n+    var tags = this.props.sponsorship.tags || [];\n+    if(!this.hasTag(tag)) {\n+      tags.push(tag);\n+      this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {\n+        tags: tags\n+      }));\n+    }\n+  }\n+\n+  onTagRemoved(tag) {\n+    var tags = this.props.sponsorship.tags || [];\n     this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {\n-      tag: tag\n+      tags: R.filter(t => tag.id !== t.id, tags)\n     }));\n   }\n \n-  onUpdateSection(e) {\n+  onSectionSelected(e) {\n     const sectionId = parseInt(e.target.value, 10);\n     const section = R.find(R.propEq('id', sectionId))(this.props.sections);\n-    this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {\n-      section: section\n-    }));\n+    var sections = this.props.sponsorship.sections || [];\n+    if(!this.hasSection(section)) {\n+      sections.push(section);\n+      this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {\n+        sections: sections\n+      }));\n+    }\n   }\n \n-  clearSection() {\n+  onSectionRemoved(section) {\n+    var sections = this.props.sponsorship.sections || [];\n     this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {\n-      section: undefined\n+      sections: R.filter(s => section.id !== s.id, sections)\n     }));\n   }\n \n-  renderTag(tag, setTagFn) {\n-    if(!!this.props.sponsorship.section) {\n-      return (<div>Remove the targeted section to target by tag.</div>);\n-    }\n-\n-    if (!tag) {\n-      return <TagSelect onTagClick={setTagFn} />;\n-    }\n+  renderTags(tags) {\n+    tags = tags || [];\n+    var selectTagFn = this.onTagSelected.bind(this);\n+    var removeTagFn = this.onTagRemoved.bind(this);\n \n     return (\n-      <div className=\"merge__tag\">\n-        {tag.internalName}\n-        <i className=\"i-cross\" onClick={setTagFn.bind(this, undefined)} />\n-      </div>\n+        <div>\n+          {tags.map(function (tag) {\n+            return (\n+              <div className=\"merge__tag\" key={tag.id}>\n+                {tag.internalName}\n+                <i className=\"i-cross\" onClick={removeTagFn.bind(null, tag)}/>\n+              </div>\n+            )\n+          })}\n+          <TagSelect onTagClick={selectTagFn}/>\n+        </div>\n     );\n   }\n \n-  renderSection() {\n-    if(!!this.props.sponsorship.tag) {\n-      return (<div>Remove the targeted tag to target by section.</div>);\n-    }\n-\n-    if(!this.sectionId()) {\n-      return (\n-        <SectionSelect\n-          selectedId={this.sectionId()}\n-          sections={this.props.sections}\n-          isMicrosite={false}\n-          onChange={this.onUpdateSection.bind(this)}\n-          disabled={this.hasTag()}\n-          />\n-      );\n-    }\n-\n+  renderSections(sections) {\n+    sections = sections || [];\n+    var selectSectionFn = this.onSectionSelected.bind(this);\n+    var removeSectionFn = this.onSectionRemoved.bind(this);\n     return (\n-      <div className=\"merge__tag\">\n-        {this.props.sponsorship.section.name}\n-        <i className=\"i-cross\" onClick={this.clearSection.bind(this)} />\n-      </div>\n+        <div>\n+          {sections.map(function (section) {\n+            return (\n+                <div className=\"merge__tag\" key={section.id}>\n+                  {section.name}\n+                  <i className=\"i-cross\" onClick={removeSectionFn.bind(null, section)}/>\n+                </div>\n+            );\n+          })}\n+          <SectionSelect\n+              selectedId=\"\"\n+              sections={this.props.sections}\n+              isMicrosite={false}\n+              onChange={selectSectionFn}\n+          />\n+        </div>\n     );\n   }\n \n-  sectionId() {\n-    if(this.props.sponsorship.section) {\n-      return this.props.sponsorship.section.id;\n-    } else {\n-      return undefined;\n+  hasSection(section) {\n+    var sections = this.props.sponsorship.sections;\n+    if(!sections || !sections.length) {\n+      return false;\n     }\n+    return section ? !!R.find(s => s.id === section.id, sections) : true;\n   }\n \n-  hasTag() {\n-    return this.props.sponsorship.tag && this.props.sponsorship.tag.id;\n+  hasTag(tag) {\n+    var tags = this.props.sponsorship.tags;\n+      if(!tags || !tags.length) {\n+      return false;","path":"public/components/SponsorshipEdit/TargetingEdit.react.js","position":141,"original_position":141,"commit_id":"75863b2c2e0465217a34bf1c1d00cc315af7389c","original_commit_id":"75863b2c2e0465217a34bf1c1d00cc315af7389c","user":{"login":"clloyd","id":551573,"avatar_url":"https://avatars.githubusercontent.com/u/551573?v=3","gravatar_id":"","url":"https://api.github.com/users/clloyd","html_url":"https://github.com/clloyd","followers_url":"https://api.github.com/users/clloyd/followers","following_url":"https://api.github.com/users/clloyd/following{/other_user}","gists_url":"https://api.github.com/users/clloyd/gists{/gist_id}","starred_url":"https://api.github.com/users/clloyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clloyd/subscriptions","organizations_url":"https://api.github.com/users/clloyd/orgs","repos_url":"https://api.github.com/users/clloyd/repos","events_url":"https://api.github.com/users/clloyd/events{/privacy}","received_events_url":"https://api.github.com/users/clloyd/received_events","type":"User","site_admin":false},"body":"Indenting is off","created_at":"2016-05-05T15:42:22Z","updated_at":"2016-05-05T15:42:22Z","html_url":"https://github.com/guardian/tagmanager/pull/227#discussion_r62205885","pull_request_url":"https://api.github.com/repos/guardian/tagmanager/pulls/227","_links":{"self":{"href":"https://api.github.com/repos/guardian/tagmanager/pulls/comments/62205885"},"html":{"href":"https://github.com/guardian/tagmanager/pull/227#discussion_r62205885"},"pull_request":{"href":"https://api.github.com/repos/guardian/tagmanager/pulls/227"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/tagmanager/pulls/227","id":69007195,"html_url":"https://github.com/guardian/tagmanager/pull/227","diff_url":"https://github.com/guardian/tagmanager/pull/227.diff","patch_url":"https://github.com/guardian/tagmanager/pull/227.patch","issue_url":"https://api.github.com/repos/guardian/tagmanager/issues/227","number":227,"state":"open","locked":false,"title":"Sw paid content updates","user":{"login":"steppenwells","id":145254,"avatar_url":"https://avatars.githubusercontent.com/u/145254?v=3","gravatar_id":"","url":"https://api.github.com/users/steppenwells","html_url":"https://github.com/steppenwells","followers_url":"https://api.github.com/users/steppenwells/followers","following_url":"https://api.github.com/users/steppenwells/following{/other_user}","gists_url":"https://api.github.com/users/steppenwells/gists{/gist_id}","starred_url":"https://api.github.com/users/steppenwells/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steppenwells/subscriptions","organizations_url":"https://api.github.com/users/steppenwells/orgs","repos_url":"https://api.github.com/users/steppenwells/repos","events_url":"https://api.github.com/users/steppenwells/events{/privacy}","received_events_url":"https://api.github.com/users/steppenwells/received_events","type":"User","site_admin":false},"body":"Many updates for paid content tags and sponsorships stuff:\r\n\r\nCreating paid content now spawns a microsite (or can be spawned in an existing microsite or conventional section).\r\n\r\nPaid content now has a sub type, reflecting the original type of the tag - this can be used by the frontend to change how they render and may have more options in the future.\r\n\r\nSponsorships can now have custom about this content links (as we discovered during migration).\r\n\r\nSponsorships can now target mutliple tags and sections (rather than only one).\r\n\r\nAdds a temporary migration endpoint to allow paid contnet tags to be transformed (work in conjuction with the sponsorship migration tool).\r\n\r\n","created_at":"2016-05-05T13:33:27Z","updated_at":"2016-05-05T15:42:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d483aadbec952f41650cd4d07e9370ba01ee9f0a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/tagmanager/pulls/227/commits","review_comments_url":"https://api.github.com/repos/guardian/tagmanager/pulls/227/comments","review_comment_url":"https://api.github.com/repos/guardian/tagmanager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/tagmanager/issues/227/comments","statuses_url":"https://api.github.com/repos/guardian/tagmanager/statuses/75863b2c2e0465217a34bf1c1d00cc315af7389c","head":{"label":"guardian:sw-paid-content-updates","ref":"sw-paid-content-updates","sha":"75863b2c2e0465217a34bf1c1d00cc315af7389c","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":44527927,"name":"tagmanager","full_name":"guardian/tagmanager","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/tagmanager","description":"The tag manager","fork":false,"url":"https://api.github.com/repos/guardian/tagmanager","forks_url":"https://api.github.com/repos/guardian/tagmanager/forks","keys_url":"https://api.github.com/repos/guardian/tagmanager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/tagmanager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/tagmanager/teams","hooks_url":"https://api.github.com/repos/guardian/tagmanager/hooks","issue_events_url":"https://api.github.com/repos/guardian/tagmanager/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/tagmanager/events","assignees_url":"https://api.github.com/repos/guardian/tagmanager/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/tagmanager/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/tagmanager/tags","blobs_url":"https://api.github.com/repos/guardian/tagmanager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/tagmanager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/tagmanager/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/tagmanager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/tagmanager/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/tagmanager/languages","stargazers_url":"https://api.github.com/repos/guardian/tagmanager/stargazers","contributors_url":"https://api.github.com/repos/guardian/tagmanager/contributors","subscribers_url":"https://api.github.com/repos/guardian/tagmanager/subscribers","subscription_url":"https://api.github.com/repos/guardian/tagmanager/subscription","commits_url":"https://api.github.com/repos/guardian/tagmanager/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/tagmanager/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/tagmanager/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/tagmanager/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/tagmanager/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/tagmanager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/tagmanager/merges","archive_url":"https://api.github.com/repos/guardian/tagmanager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/tagmanager/downloads","issues_url":"https://api.github.com/repos/guardian/tagmanager/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/tagmanager/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/tagmanager/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/tagmanager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/tagmanager/labels{/name}","releases_url":"https://api.github.com/repos/guardian/tagmanager/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/tagmanager/deployments","created_at":"2015-10-19T10:40:14Z","updated_at":"2016-03-16T12:05:00Z","pushed_at":"2016-05-05T13:41:08Z","git_url":"git://github.com/guardian/tagmanager.git","ssh_url":"git@github.com:guardian/tagmanager.git","clone_url":"https://github.com/guardian/tagmanager.git","svn_url":"https://github.com/guardian/tagmanager","homepage":null,"size":13961,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":4,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"4ae49de2b6acf195dccb92766e1f6bcb5569be5b","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":44527927,"name":"tagmanager","full_name":"guardian/tagmanager","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/tagmanager","description":"The tag manager","fork":false,"url":"https://api.github.com/repos/guardian/tagmanager","forks_url":"https://api.github.com/repos/guardian/tagmanager/forks","keys_url":"https://api.github.com/repos/guardian/tagmanager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/tagmanager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/tagmanager/teams","hooks_url":"https://api.github.com/repos/guardian/tagmanager/hooks","issue_events_url":"https://api.github.com/repos/guardian/tagmanager/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/tagmanager/events","assignees_url":"https://api.github.com/repos/guardian/tagmanager/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/tagmanager/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/tagmanager/tags","blobs_url":"https://api.github.com/repos/guardian/tagmanager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/tagmanager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/tagmanager/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/tagmanager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/tagmanager/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/tagmanager/languages","stargazers_url":"https://api.github.com/repos/guardian/tagmanager/stargazers","contributors_url":"https://api.github.com/repos/guardian/tagmanager/contributors","subscribers_url":"https://api.github.com/repos/guardian/tagmanager/subscribers","subscription_url":"https://api.github.com/repos/guardian/tagmanager/subscription","commits_url":"https://api.github.com/repos/guardian/tagmanager/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/tagmanager/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/tagmanager/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/tagmanager/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/tagmanager/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/tagmanager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/tagmanager/merges","archive_url":"https://api.github.com/repos/guardian/tagmanager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/tagmanager/downloads","issues_url":"https://api.github.com/repos/guardian/tagmanager/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/tagmanager/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/tagmanager/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/tagmanager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/tagmanager/labels{/name}","releases_url":"https://api.github.com/repos/guardian/tagmanager/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/tagmanager/deployments","created_at":"2015-10-19T10:40:14Z","updated_at":"2016-03-16T12:05:00Z","pushed_at":"2016-05-05T13:41:08Z","git_url":"git://github.com/guardian/tagmanager.git","ssh_url":"git@github.com:guardian/tagmanager.git","clone_url":"https://github.com/guardian/tagmanager.git","svn_url":"https://github.com/guardian/tagmanager","homepage":null,"size":13961,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/tagmanager/pulls/227"},"html":{"href":"https://github.com/guardian/tagmanager/pull/227"},"issue":{"href":"https://api.github.com/repos/guardian/tagmanager/issues/227"},"comments":{"href":"https://api.github.com/repos/guardian/tagmanager/issues/227/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/tagmanager/pulls/227/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/tagmanager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/tagmanager/pulls/227/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/tagmanager/statuses/75863b2c2e0465217a34bf1c1d00cc315af7389c"}}}}