{"action":"created","comment":{"url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/comments/140515339","pull_request_review_id":64603836,"id":140515339,"diff_hunk":"@@ -50,25 +50,36 @@ var init = function(app, schema, sequelize, config) {\n \n             /// 1. Am I Facebook Crawler?\n             //https://developers.facebook.com/docs/sharing/webmasters/crawler\n-            if (/facebookexternalhit|Facebot/.test(req.get('User-Agent')) && parseInt(req.params.abver)) {\n+            if (/facebookexternalhit|Facebot/.test(req.get('User-Agent')) && parseInt(req.params.abver) >= 0 ) {\n \n-              //What does FB do if you send it a 302 (temporary redirect)?\n-              // will it try to visit it again and get a different 302 if visiting again, or will it just\n-              // cache it?\n-              // If it DOES redirect each time, then /0/ could choose by bandit, itself\n-\n-              var murl = (req.params.domain + decodeURIComponent(pathname || '/'));\n+              var murl = (req.params.domain + decodeURIComponent(pathname || '/').replace(/.fb\\d+/,''));\n               schema.Metadata.findOne({\n-                'where': { 'url':murl.replace(/.fb\\d+/,''), 'id':parseInt(req.params.abver)}\n+                'where': { 'url':murl, 'id':parseInt(req.params.abver)}\n               }).then(function(trial) {\n-                //maybe this part should go down by 'function failure'?\n                 if (!trial) {\n                   if (/testshare/.test(pathname)) {\n                     res.render('shareheaders', {\n                       'extraProperties': domainInfo.extraProperties || [],\n                       'title': \"Fooooo\",\n                       'description': 'basdfasdf',\n                     });\n+                  } else if (req.params.abver == '0') {\n+                    // if facebook is sent a 302, redirect it to top performing treatment\n+                    bandit.getUrlTrials(murl, sequelize, 'action', function(variants, resolve, reject, numResults) {","path":"public.js","position":28,"original_position":28,"commit_id":"b81daafac79044068fcde2d058c810ffbf4b2569","original_commit_id":"b81daafac79044068fcde2d058c810ffbf4b2569","user":{"login":"schuyler1d","id":52117,"avatar_url":"https://avatars1.githubusercontent.com/u/52117?v=4","gravatar_id":"","url":"https://api.github.com/users/schuyler1d","html_url":"https://github.com/schuyler1d","followers_url":"https://api.github.com/users/schuyler1d/followers","following_url":"https://api.github.com/users/schuyler1d/following{/other_user}","gists_url":"https://api.github.com/users/schuyler1d/gists{/gist_id}","starred_url":"https://api.github.com/users/schuyler1d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schuyler1d/subscriptions","organizations_url":"https://api.github.com/users/schuyler1d/orgs","repos_url":"https://api.github.com/users/schuyler1d/repos","events_url":"https://api.github.com/users/schuyler1d/events{/privacy}","received_events_url":"https://api.github.com/users/schuyler1d/received_events","type":"User","site_admin":false},"body":"I don't think you need to use the bandit.getUrlTrials here.  just delete this line (and the `])` at the end), and go right to the findOne call.  We did the getUrlTrials before I realized what that was","created_at":"2017-09-22T14:54:53Z","updated_at":"2017-09-22T15:00:41Z","html_url":"https://github.com/MoveOnOrg/sharebandit/pull/56#discussion_r140515339","pull_request_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/comments/140515339"},"html":{"href":"https://github.com/MoveOnOrg/sharebandit/pull/56#discussion_r140515339"},"pull_request":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56","id":142596681,"html_url":"https://github.com/MoveOnOrg/sharebandit/pull/56","diff_url":"https://github.com/MoveOnOrg/sharebandit/pull/56.diff","patch_url":"https://github.com/MoveOnOrg/sharebandit/pull/56.patch","issue_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/56","number":56,"state":"open","locked":false,"title":"Send fb best treatment metadata rather than redirecting on r/0:url","user":{"login":"lady3bean","id":10011287,"avatar_url":"https://avatars2.githubusercontent.com/u/10011287?v=4","gravatar_id":"","url":"https://api.github.com/users/lady3bean","html_url":"https://github.com/lady3bean","followers_url":"https://api.github.com/users/lady3bean/followers","following_url":"https://api.github.com/users/lady3bean/following{/other_user}","gists_url":"https://api.github.com/users/lady3bean/gists{/gist_id}","starred_url":"https://api.github.com/users/lady3bean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lady3bean/subscriptions","organizations_url":"https://api.github.com/users/lady3bean/orgs","repos_url":"https://api.github.com/users/lady3bean/repos","events_url":"https://api.github.com/users/lady3bean/events{/privacy}","received_events_url":"https://api.github.com/users/lady3bean/received_events","type":"User","site_admin":false},"body":"Would close https://github.com/MoveOnOrg/sharebandit/issues/54 but needs review, and maybe to add a new test","created_at":"2017-09-22T14:44:08Z","updated_at":"2017-09-22T15:00:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1ca1e410b77f680110204da9f25853a889e8868","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56/commits","review_comments_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56/comments","review_comment_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/56/comments","statuses_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/statuses/b81daafac79044068fcde2d058c810ffbf4b2569","head":{"label":"MoveOnOrg:fb-redirects","ref":"fb-redirects","sha":"b81daafac79044068fcde2d058c810ffbf4b2569","user":{"login":"MoveOnOrg","id":15254795,"avatar_url":"https://avatars3.githubusercontent.com/u/15254795?v=4","gravatar_id":"","url":"https://api.github.com/users/MoveOnOrg","html_url":"https://github.com/MoveOnOrg","followers_url":"https://api.github.com/users/MoveOnOrg/followers","following_url":"https://api.github.com/users/MoveOnOrg/following{/other_user}","gists_url":"https://api.github.com/users/MoveOnOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/MoveOnOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoveOnOrg/subscriptions","organizations_url":"https://api.github.com/users/MoveOnOrg/orgs","repos_url":"https://api.github.com/users/MoveOnOrg/repos","events_url":"https://api.github.com/users/MoveOnOrg/events{/privacy}","received_events_url":"https://api.github.com/users/MoveOnOrg/received_events","type":"Organization","site_admin":false},"repo":{"id":52538835,"name":"sharebandit","full_name":"MoveOnOrg/sharebandit","owner":{"login":"MoveOnOrg","id":15254795,"avatar_url":"https://avatars3.githubusercontent.com/u/15254795?v=4","gravatar_id":"","url":"https://api.github.com/users/MoveOnOrg","html_url":"https://github.com/MoveOnOrg","followers_url":"https://api.github.com/users/MoveOnOrg/followers","following_url":"https://api.github.com/users/MoveOnOrg/following{/other_user}","gists_url":"https://api.github.com/users/MoveOnOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/MoveOnOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoveOnOrg/subscriptions","organizations_url":"https://api.github.com/users/MoveOnOrg/orgs","repos_url":"https://api.github.com/users/MoveOnOrg/repos","events_url":"https://api.github.com/users/MoveOnOrg/events{/privacy}","received_events_url":"https://api.github.com/users/MoveOnOrg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MoveOnOrg/sharebandit","description":"System to track and optimize different share choices","fork":false,"url":"https://api.github.com/repos/MoveOnOrg/sharebandit","forks_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/forks","keys_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/teams","hooks_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/hooks","issue_events_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/events{/number}","events_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/events","assignees_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/assignees{/user}","branches_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/branches{/branch}","tags_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/tags","blobs_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/refs{/sha}","trees_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/statuses/{sha}","languages_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/languages","stargazers_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/stargazers","contributors_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/contributors","subscribers_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/subscribers","subscription_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/subscription","commits_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/commits{/sha}","git_commits_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/commits{/sha}","comments_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/comments{/number}","issue_comment_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/comments{/number}","contents_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/contents/{+path}","compare_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/merges","archive_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/downloads","issues_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues{/number}","pulls_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls{/number}","milestones_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/milestones{/number}","notifications_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/labels{/name}","releases_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/releases{/id}","deployments_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/deployments","created_at":"2016-02-25T16:15:40Z","updated_at":"2017-04-19T17:56:20Z","pushed_at":"2017-09-22T14:44:09Z","git_url":"git://github.com/MoveOnOrg/sharebandit.git","ssh_url":"git@github.com:MoveOnOrg/sharebandit.git","clone_url":"https://github.com/MoveOnOrg/sharebandit.git","svn_url":"https://github.com/MoveOnOrg/sharebandit","homepage":"","size":4907,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":12,"forks":3,"open_issues":12,"watchers":5,"default_branch":"master"}},"base":{"label":"MoveOnOrg:master","ref":"master","sha":"7ac620c1b6a48edb8d81e591eea50717fa169025","user":{"login":"MoveOnOrg","id":15254795,"avatar_url":"https://avatars3.githubusercontent.com/u/15254795?v=4","gravatar_id":"","url":"https://api.github.com/users/MoveOnOrg","html_url":"https://github.com/MoveOnOrg","followers_url":"https://api.github.com/users/MoveOnOrg/followers","following_url":"https://api.github.com/users/MoveOnOrg/following{/other_user}","gists_url":"https://api.github.com/users/MoveOnOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/MoveOnOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoveOnOrg/subscriptions","organizations_url":"https://api.github.com/users/MoveOnOrg/orgs","repos_url":"https://api.github.com/users/MoveOnOrg/repos","events_url":"https://api.github.com/users/MoveOnOrg/events{/privacy}","received_events_url":"https://api.github.com/users/MoveOnOrg/received_events","type":"Organization","site_admin":false},"repo":{"id":52538835,"name":"sharebandit","full_name":"MoveOnOrg/sharebandit","owner":{"login":"MoveOnOrg","id":15254795,"avatar_url":"https://avatars3.githubusercontent.com/u/15254795?v=4","gravatar_id":"","url":"https://api.github.com/users/MoveOnOrg","html_url":"https://github.com/MoveOnOrg","followers_url":"https://api.github.com/users/MoveOnOrg/followers","following_url":"https://api.github.com/users/MoveOnOrg/following{/other_user}","gists_url":"https://api.github.com/users/MoveOnOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/MoveOnOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoveOnOrg/subscriptions","organizations_url":"https://api.github.com/users/MoveOnOrg/orgs","repos_url":"https://api.github.com/users/MoveOnOrg/repos","events_url":"https://api.github.com/users/MoveOnOrg/events{/privacy}","received_events_url":"https://api.github.com/users/MoveOnOrg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MoveOnOrg/sharebandit","description":"System to track and optimize different share choices","fork":false,"url":"https://api.github.com/repos/MoveOnOrg/sharebandit","forks_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/forks","keys_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/teams","hooks_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/hooks","issue_events_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/events{/number}","events_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/events","assignees_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/assignees{/user}","branches_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/branches{/branch}","tags_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/tags","blobs_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/refs{/sha}","trees_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/statuses/{sha}","languages_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/languages","stargazers_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/stargazers","contributors_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/contributors","subscribers_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/subscribers","subscription_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/subscription","commits_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/commits{/sha}","git_commits_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/git/commits{/sha}","comments_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/comments{/number}","issue_comment_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/comments{/number}","contents_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/contents/{+path}","compare_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/merges","archive_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/downloads","issues_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues{/number}","pulls_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls{/number}","milestones_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/milestones{/number}","notifications_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/labels{/name}","releases_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/releases{/id}","deployments_url":"https://api.github.com/repos/MoveOnOrg/sharebandit/deployments","created_at":"2016-02-25T16:15:40Z","updated_at":"2017-04-19T17:56:20Z","pushed_at":"2017-09-22T14:44:09Z","git_url":"git://github.com/MoveOnOrg/sharebandit.git","ssh_url":"git@github.com:MoveOnOrg/sharebandit.git","clone_url":"https://github.com/MoveOnOrg/sharebandit.git","svn_url":"https://github.com/MoveOnOrg/sharebandit","homepage":"","size":4907,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":12,"forks":3,"open_issues":12,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56"},"html":{"href":"https://github.com/MoveOnOrg/sharebandit/pull/56"},"issue":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/56"},"comments":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/MoveOnOrg/sharebandit/statuses/b81daafac79044068fcde2d058c810ffbf4b2569"}},"author_association":"NONE"}}
{"actor":{"display_login":"schuyler1d"}}