{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments/25246761","id":25246761,"diff_hunk":"@@ -133,6 +133,43 @@ object RichEvent {\n     def deficientGuardianMembersTickets = event.internalTicketing.flatMap(_.memberDiscountOpt).exists(_.fewerMembersTicketsThanGeneralTickets)\n   }\n \n+  case class DiscoverEvent(event: EBEvent, image: Option[EventImage], contentOpt: Option[Content]) extends RichEvent {\n+    val imgUrl = image.flatMap(_.assets.headOption).fold(fallbackImage) { asset =>\n+      val file = asset.secureUrl.getOrElse(asset.file)\n+      val regex = \"\\\\d+.jpg\".r\n+      regex.replaceFirstIn(file, \"{width}.jpg\")\n+    }\n+\n+    private val widths = image.fold(List.empty[Int])(_.assets.map(_.dimensions.width))\n+\n+    val pastImageOpt = for {\n+      content <- contentOpt\n+      elements <- content.elements\n+      element <- elements.find(_.relation == \"main\")\n+      assetOpt <- element.assets.find(_.typeData.get(\"width\") == Some(\"460\"))\n+    } yield assetOpt\n+\n+    val availableWidths = widths.mkString(\",\")\n+\n+    val imageMetadata = image.map(_.metadata)\n+\n+    val socialImgUrl = image.flatMap(_.assets.find(_.dimensions.width == widths.max)).fold(fallbackImage){ asset =>\n+      asset.secureUrl.getOrElse(asset.file)\n+    }\n+","path":"frontend/app/model/RichEvent.scala","position":27,"original_position":27,"commit_id":"e2c893ad27c93cc00ffdc1f34b1103bbe2a586f4","original_commit_id":"e2c893ad27c93cc00ffdc1f34b1103bbe2a586f4","user":{"login":"jennysivapalan","id":944375,"avatar_url":"https://avatars.githubusercontent.com/u/944375?v=3","gravatar_id":"","url":"https://api.github.com/users/jennysivapalan","html_url":"https://github.com/jennysivapalan","followers_url":"https://api.github.com/users/jennysivapalan/followers","following_url":"https://api.github.com/users/jennysivapalan/following{/other_user}","gists_url":"https://api.github.com/users/jennysivapalan/gists{/gist_id}","starred_url":"https://api.github.com/users/jennysivapalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennysivapalan/subscriptions","organizations_url":"https://api.github.com/users/jennysivapalan/orgs","repos_url":"https://api.github.com/users/jennysivapalan/repos","events_url":"https://api.github.com/users/jennysivapalan/events{/privacy}","received_events_url":"https://api.github.com/users/jennysivapalan/received_events","type":"User","site_admin":false},"body":"Alot of these methods are duplicates of GuLiveEventsService - I wonder if it's worth extending that and overriding the specific methods?","created_at":"2015-02-24T11:54:51Z","updated_at":"2015-02-24T11:54:51Z","html_url":"https://github.com/guardian/membership-frontend/pull/231#discussion_r25246761","pull_request_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/231","_links":{"self":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments/25246761"},"html":{"href":"https://github.com/guardian/membership-frontend/pull/231#discussion_r25246761"},"pull_request":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/231"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/membership-frontend/pulls/231","id":29700635,"html_url":"https://github.com/guardian/membership-frontend/pull/231","diff_url":"https://github.com/guardian/membership-frontend/pull/231.diff","patch_url":"https://github.com/guardian/membership-frontend/pull/231.patch","issue_url":"https://api.github.com/repos/guardian/membership-frontend/issues/231","number":231,"state":"open","locked":false,"title":"Event list powered by two accounts","user":{"login":"feedmypixel","id":2305016,"avatar_url":"https://avatars.githubusercontent.com/u/2305016?v=3","gravatar_id":"","url":"https://api.github.com/users/feedmypixel","html_url":"https://github.com/feedmypixel","followers_url":"https://api.github.com/users/feedmypixel/followers","following_url":"https://api.github.com/users/feedmypixel/following{/other_user}","gists_url":"https://api.github.com/users/feedmypixel/gists{/gist_id}","starred_url":"https://api.github.com/users/feedmypixel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedmypixel/subscriptions","organizations_url":"https://api.github.com/users/feedmypixel/orgs","repos_url":"https://api.github.com/users/feedmypixel/repos","events_url":"https://api.github.com/users/feedmypixel/events{/privacy}","received_events_url":"https://api.github.com/users/feedmypixel/received_events","type":"User","site_admin":false},"body":"- DiscoverEventService added\r\n- DiscoverEvent case class in RichEvent added\r\n\r\ncc @jennysivapalan @rtyley \r\n\r\n## Event list with displaying events from 2 accounts\r\n![events the guardian membership](https://cloud.githubusercontent.com/assets/2305016/6287974/8c3ab522-b90d-11e4-88f0-bab97d12adc7.png)\r\n\r\n## Discover Event\r\n![event detail member pre-sale event the guardian membership](https://cloud.githubusercontent.com/assets/2305016/6287990/9ba797aa-b90d-11e4-84bc-7666ae4fb2de.png)\r\n\r\n","created_at":"2015-02-20T14:45:24Z","updated_at":"2015-02-24T11:54:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e5d00efe7ce1cde81c247143a8e8aeaf4b03d09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/231/commits","review_comments_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/231/comments","review_comment_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/membership-frontend/issues/231/comments","statuses_url":"https://api.github.com/repos/guardian/membership-frontend/statuses/e2c893ad27c93cc00ffdc1f34b1103bbe2a586f4","head":{"label":"guardian:event-list-powered-by-two-accounts","ref":"event-list-powered-by-two-accounts","sha":"e2c893ad27c93cc00ffdc1f34b1103bbe2a586f4","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":28401521,"name":"membership-frontend","full_name":"guardian/membership-frontend","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/membership-frontend","description":"Bringing the Guardian to life through live events and meet-ups","fork":false,"url":"https://api.github.com/repos/guardian/membership-frontend","forks_url":"https://api.github.com/repos/guardian/membership-frontend/forks","keys_url":"https://api.github.com/repos/guardian/membership-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/membership-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/membership-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/membership-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/membership-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/membership-frontend/events","assignees_url":"https://api.github.com/repos/guardian/membership-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/membership-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/membership-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/membership-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/membership-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/membership-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/membership-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/membership-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/membership-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/membership-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/membership-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/membership-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/membership-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/membership-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/membership-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/membership-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/membership-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/membership-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/membership-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/membership-frontend/merges","archive_url":"https://api.github.com/repos/guardian/membership-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/membership-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/membership-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/membership-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/membership-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/membership-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/membership-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/membership-frontend/releases{/id}","created_at":"2014-12-23T14:14:38Z","updated_at":"2015-02-24T11:24:40Z","pushed_at":"2015-02-24T11:51:54Z","git_url":"git://github.com/guardian/membership-frontend.git","ssh_url":"git@github.com:guardian/membership-frontend.git","clone_url":"https://github.com/guardian/membership-frontend.git","svn_url":"https://github.com/guardian/membership-frontend","homepage":"https://membership.theguardian.com/","size":26942,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":5,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"f1be55abdbb3ad8730263b35a9c837b0e9d24763","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":28401521,"name":"membership-frontend","full_name":"guardian/membership-frontend","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/membership-frontend","description":"Bringing the Guardian to life through live events and meet-ups","fork":false,"url":"https://api.github.com/repos/guardian/membership-frontend","forks_url":"https://api.github.com/repos/guardian/membership-frontend/forks","keys_url":"https://api.github.com/repos/guardian/membership-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/membership-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/membership-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/membership-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/membership-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/membership-frontend/events","assignees_url":"https://api.github.com/repos/guardian/membership-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/membership-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/membership-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/membership-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/membership-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/membership-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/membership-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/membership-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/membership-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/membership-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/membership-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/membership-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/membership-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/membership-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/membership-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/membership-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/membership-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/membership-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/membership-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/membership-frontend/merges","archive_url":"https://api.github.com/repos/guardian/membership-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/membership-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/membership-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/membership-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/membership-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/membership-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/membership-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/membership-frontend/releases{/id}","created_at":"2014-12-23T14:14:38Z","updated_at":"2015-02-24T11:24:40Z","pushed_at":"2015-02-24T11:51:54Z","git_url":"git://github.com/guardian/membership-frontend.git","ssh_url":"git@github.com:guardian/membership-frontend.git","clone_url":"https://github.com/guardian/membership-frontend.git","svn_url":"https://github.com/guardian/membership-frontend","homepage":"https://membership.theguardian.com/","size":26942,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/231"},"html":{"href":"https://github.com/guardian/membership-frontend/pull/231"},"issue":{"href":"https://api.github.com/repos/guardian/membership-frontend/issues/231"},"comments":{"href":"https://api.github.com/repos/guardian/membership-frontend/issues/231/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/231/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/231/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/membership-frontend/statuses/e2c893ad27c93cc00ffdc1f34b1103bbe2a586f4"}}}}