{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/frontend/pulls/comments/44214276","id":44214276,"diff_hunk":"@@ -9,18 +9,18 @@ define([\n     storage,\n     userFeatures\n ) {\n-    function sharedRules() {\n-        var alreadyVisted = storage.local.get('gu.alreadyVisited') || 0;\n-\n-        return detect.getBreakpoint() !== 'mobile' && detect.adblockInUse() && config.switches.adblock && alreadyVisted > 1;\n-    }\n-\n     function noAdblockMsg() {\n-        return sharedRules() && userFeatures.isPayingMember();\n+        var alreadyVisited = storage.local.get('gu.alreadyVisited') || 0;\n+\n+        return detect.adblockInUse() && detect.getBreakpoint() !== 'mobile' && (\n+                alreadyVisited <= 1 ||\n+                !config.switches.adblock ||\n+                (config.switches.adblock && alreadyVisited > 1 && userFeatures.isPayingMember()));\n     }\n \n     function showAdblockMsg() {\n-        return sharedRules() && !userFeatures.isPayingMember();\n+        var alreadyVisited = storage.local.get('gu.alreadyVisited') || 0;\n+        return detect.getBreakpoint() !== 'mobile' && detect.adblockInUse() && config.switches.adblock && alreadyVisited > 1 && !userFeatures.isPayingMember();","path":"static/src/javascripts/projects/common/modules/commercial/adblock-messages.js","position":23,"original_position":23,"commit_id":"5ef5094b3e290a31d78081b5bca38e9ee2202173","original_commit_id":"5ef5094b3e290a31d78081b5bca38e9ee2202173","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 line is a bit long. Also, I would put less computationally heavy switches at the start, so they can short-circuit the evaluation.","created_at":"2015-11-07T16:49:02Z","updated_at":"2015-11-07T16:49:02Z","html_url":"https://github.com/guardian/frontend/pull/11071#discussion_r44214276","pull_request_url":"https://api.github.com/repos/guardian/frontend/pulls/11071","_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments/44214276"},"html":{"href":"https://github.com/guardian/frontend/pull/11071#discussion_r44214276"},"pull_request":{"href":"https://api.github.com/repos/guardian/frontend/pulls/11071"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/frontend/pulls/11071","id":49963356,"html_url":"https://github.com/guardian/frontend/pull/11071","diff_url":"https://github.com/guardian/frontend/pull/11071.diff","patch_url":"https://github.com/guardian/frontend/pull/11071.patch","issue_url":"https://api.github.com/repos/guardian/frontend/issues/11071","number":11071,"state":"open","locked":false,"title":"Unit tests for adblock messages","user":{"login":"Calanthe","id":489567,"avatar_url":"https://avatars.githubusercontent.com/u/489567?v=3","gravatar_id":"","url":"https://api.github.com/users/Calanthe","html_url":"https://github.com/Calanthe","followers_url":"https://api.github.com/users/Calanthe/followers","following_url":"https://api.github.com/users/Calanthe/following{/other_user}","gists_url":"https://api.github.com/users/Calanthe/gists{/gist_id}","starred_url":"https://api.github.com/users/Calanthe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Calanthe/subscriptions","organizations_url":"https://api.github.com/users/Calanthe/orgs","repos_url":"https://api.github.com/users/Calanthe/repos","events_url":"https://api.github.com/users/Calanthe/events{/privacy}","received_events_url":"https://api.github.com/users/Calanthe/received_events","type":"User","site_admin":false},"body":"While writing them I found out that the logic in `adblock-messages.js` module wasn't working properly for scenario with first time users and when adblock switch was off. In those cases, users shouldn't see adblock messages too.","created_at":"2015-11-06T15:03:35Z","updated_at":"2015-11-07T16:49:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40d3635b3a3210a17f08f1e52b8ea1eb630be725","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/frontend/pulls/11071/commits","review_comments_url":"https://api.github.com/repos/guardian/frontend/pulls/11071/comments","review_comment_url":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/frontend/issues/11071/comments","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/5ef5094b3e290a31d78081b5bca38e9ee2202173","head":{"label":"guardian:unit-tests-adblock-banner","ref":"unit-tests-adblock-banner","sha":"5ef5094b3e290a31d78081b5bca38e9ee2202173","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-11-07T06:22:43Z","pushed_at":"2015-11-06T18:47:09Z","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":518601,"stargazers_count":3008,"watchers_count":3008,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":298,"mirror_url":null,"open_issues_count":47,"forks":298,"open_issues":47,"watchers":3008,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"198bdc1741954ddd80e5bc29a590cf97a8872be9","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-11-07T06:22:43Z","pushed_at":"2015-11-06T18:47:09Z","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":518601,"stargazers_count":3008,"watchers_count":3008,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":298,"mirror_url":null,"open_issues_count":47,"forks":298,"open_issues":47,"watchers":3008,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/11071"},"html":{"href":"https://github.com/guardian/frontend/pull/11071"},"issue":{"href":"https://api.github.com/repos/guardian/frontend/issues/11071"},"comments":{"href":"https://api.github.com/repos/guardian/frontend/issues/11071/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/frontend/pulls/11071/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/frontend/pulls/11071/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/frontend/statuses/5ef5094b3e290a31d78081b5bca38e9ee2202173"}}}}