{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/frontend/pulls/comments/41984659","id":41984659,"diff_hunk":"@@ -0,0 +1,36 @@\n+define([\n+    'common/utils/cookies',\n+    'common/utils/config',\n+    'common/utils/storage',\n+    'common/modules/identity/api',\n+    'common/modules/commercial/adfree/renew-adfree-status'\n+], function (\n+    cookies,\n+    config,\n+    storage,\n+    identity,\n+    renewAdfreeStatus\n+) {\n+    return maintainAdfreeFreshness;\n+\n+    function maintainAdfreeFreshness() {\n+        if (featureEnabled() && identity.isUserLoggedIn() && userNeedsNewAdfreeCookie()) {\n+            renewAdfreeStatus.renew();\n+        }\n+    }\n+\n+    function userNeedsNewAdfreeCookie() {\n+        var adfreeCookie = cookies.get('gu_adfree_user');\n+        return (adfreeCookie === null) || adfreeCookieStale();\n+    }\n+\n+    function adfreeCookieStale() {\n+        var adfreeCookieExpiry = storage.local.get('gu.adfree.user.expiry'),","path":"static/src/javascripts/projects/common/modules/commercial/adfree/maintain-adfree-freshness.js","position":28,"original_position":28,"commit_id":"5140c0bb0c4dbae31d8eed8b570752e4121c3344","original_commit_id":"5140c0bb0c4dbae31d8eed8b570752e4121c3344","user":{"login":"uplne","id":2579465,"avatar_url":"https://avatars.githubusercontent.com/u/2579465?v=3","gravatar_id":"","url":"https://api.github.com/users/uplne","html_url":"https://github.com/uplne","followers_url":"https://api.github.com/users/uplne/followers","following_url":"https://api.github.com/users/uplne/following{/other_user}","gists_url":"https://api.github.com/users/uplne/gists{/gist_id}","starred_url":"https://api.github.com/users/uplne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uplne/subscriptions","organizations_url":"https://api.github.com/users/uplne/orgs","repos_url":"https://api.github.com/users/uplne/repos","events_url":"https://api.github.com/users/uplne/events{/privacy}","received_events_url":"https://api.github.com/users/uplne/received_events","type":"User","site_admin":false},"body":"As I remember it correctly, cookies are very grey area. EU law + users don't like them so we are generally trying to avoid them as much as possible.\r\n\r\nHowever I agree that it would be nicer to have everything at one place.","created_at":"2015-10-14T12:01:24Z","updated_at":"2015-10-14T12:01:24Z","html_url":"https://github.com/guardian/frontend/pull/10854#discussion_r41984659","pull_request_url":"https://api.github.com/repos/guardian/frontend/pulls/10854","_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments/41984659"},"html":{"href":"https://github.com/guardian/frontend/pull/10854#discussion_r41984659"},"pull_request":{"href":"https://api.github.com/repos/guardian/frontend/pulls/10854"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/frontend/pulls/10854","id":47524398,"html_url":"https://github.com/guardian/frontend/pull/10854","diff_url":"https://github.com/guardian/frontend/pull/10854.diff","patch_url":"https://github.com/guardian/frontend/pull/10854.patch","issue_url":"https://api.github.com/repos/guardian/frontend/issues/10854","number":10854,"state":"open","locked":false,"title":"Get adfree status from remote server","user":{"login":"jbreckmckye","id":3148617,"avatar_url":"https://avatars.githubusercontent.com/u/3148617?v=3","gravatar_id":"","url":"https://api.github.com/users/jbreckmckye","html_url":"https://github.com/jbreckmckye","followers_url":"https://api.github.com/users/jbreckmckye/followers","following_url":"https://api.github.com/users/jbreckmckye/following{/other_user}","gists_url":"https://api.github.com/users/jbreckmckye/gists{/gist_id}","starred_url":"https://api.github.com/users/jbreckmckye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbreckmckye/subscriptions","organizations_url":"https://api.github.com/users/jbreckmckye/orgs","repos_url":"https://api.github.com/users/jbreckmckye/repos","events_url":"https://api.github.com/users/jbreckmckye/events{/privacy}","received_events_url":"https://api.github.com/users/jbreckmckye/received_events","type":"User","site_admin":false},"body":"This pull request is for the adfree experience product.\r\n\r\nWe use an adfree cookie to tell us whether a signed in user is able to see adfree or not. We need to hit a remote endpoint to gather that cookie. We also need that cookie to have a concept of being 'stale' without it expiring - so that we can respect its value temporarily whilst we quietly verify it.\r\n\r\nThis pull request does _not_ include the work to remove the cookies on signout.\r\n\r\nThe 'maintain-adfree-freshness' script is separate to the user-ad-preference.js file; the latter may be removed soon as we will need to reason about the user's adfree status in the pre-render head scripts.\r\n\r\nOne question I had was whether the endpoint URI should be hardcoded in the script. At the moment, there are no pre-production or dev endpoints to use. Should this URI be inserted into the various dev/prod config files regardless?\r\n\r\n@calanthe - I know you were waiting on this.","created_at":"2015-10-13T12:07:29Z","updated_at":"2015-10-14T12:01:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0884e139d3e95e28b2e7d39c0a61737e69a88d2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/frontend/pulls/10854/commits","review_comments_url":"https://api.github.com/repos/guardian/frontend/pulls/10854/comments","review_comment_url":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/frontend/issues/10854/comments","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/5140c0bb0c4dbae31d8eed8b570752e4121c3344","head":{"label":"guardian:refresh-adfree-status","ref":"refresh-adfree-status","sha":"5140c0bb0c4dbae31d8eed8b570752e4121c3344","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":4370755,"name":"frontend","full_name":"guardian/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/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","created_at":"2012-05-18T15:39:15Z","updated_at":"2015-10-13T22:22:06Z","pushed_at":"2015-10-14T11:30:44Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":516288,"stargazers_count":2961,"watchers_count":2961,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":293,"mirror_url":null,"open_issues_count":40,"forks":293,"open_issues":40,"watchers":2961,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"4a681fc1e05b15af818986e67452bd63f262bb51","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":4370755,"name":"frontend","full_name":"guardian/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/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","created_at":"2012-05-18T15:39:15Z","updated_at":"2015-10-13T22:22:06Z","pushed_at":"2015-10-14T11:30:44Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":516288,"stargazers_count":2961,"watchers_count":2961,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":293,"mirror_url":null,"open_issues_count":40,"forks":293,"open_issues":40,"watchers":2961,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/10854"},"html":{"href":"https://github.com/guardian/frontend/pull/10854"},"issue":{"href":"https://api.github.com/repos/guardian/frontend/issues/10854"},"comments":{"href":"https://api.github.com/repos/guardian/frontend/issues/10854/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/frontend/pulls/10854/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/frontend/pulls/10854/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/frontend/statuses/5140c0bb0c4dbae31d8eed8b570752e4121c3344"}}}}