{"action":"created","comment":{"url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments/61924464","id":61924464,"diff_hunk":"@@ -351,6 +351,26 @@ func (s *SnapUbuntuStoreRepository) getAllPurchases(channel string, auther Authe\n \treturn purchasesByID, nil\n }\n \n+// getMustBuy determines if a snap requires a payment, based on if it is non-free and if the user has already bought it\n+func getMustBuy(prices map[string]float64, purchases []*purchase) bool {\n+\t// if the snap is free, then it doesn't need purchasing\n+\tif len(prices) == 0 {\n+\t\treturn false\n+\t}\n+\n+\t// search through all the purchases for an app to see if there are any\n+\t// that are for the whole app, not in-app.\n+\tfor _, purchase := range purchases {\n+\t\t// nil ItemSKU lets us know the purchase is for the whole app","path":"store/store.go","position":14,"original_position":14,"commit_id":"3efd5dba03282066304fc8e67fa9a73ab568ab71","original_commit_id":"3efd5dba03282066304fc8e67fa9a73ab568ab71","user":{"login":"niemeyer","id":378683,"avatar_url":"https://avatars.githubusercontent.com/u/378683?v=3","gravatar_id":"","url":"https://api.github.com/users/niemeyer","html_url":"https://github.com/niemeyer","followers_url":"https://api.github.com/users/niemeyer/followers","following_url":"https://api.github.com/users/niemeyer/following{/other_user}","gists_url":"https://api.github.com/users/niemeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/niemeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niemeyer/subscriptions","organizations_url":"https://api.github.com/users/niemeyer/orgs","repos_url":"https://api.github.com/users/niemeyer/repos","events_url":"https://api.github.com/users/niemeyer/events{/privacy}","received_events_url":"https://api.github.com/users/niemeyer/received_events","type":"User","site_admin":false},"body":"s/nil/Empty/?","created_at":"2016-05-03T17:48:36Z","updated_at":"2016-05-03T17:48:36Z","html_url":"https://github.com/ubuntu-core/snappy/pull/1121#discussion_r61924464","pull_request_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121","_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments/61924464"},"html":{"href":"https://github.com/ubuntu-core/snappy/pull/1121#discussion_r61924464"},"pull_request":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121"}}},"pull_request":{"url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121","id":68745030,"html_url":"https://github.com/ubuntu-core/snappy/pull/1121","diff_url":"https://github.com/ubuntu-core/snappy/pull/1121.diff","patch_url":"https://github.com/ubuntu-core/snappy/pull/1121.patch","issue_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/1121","number":1121,"state":"open","locked":false,"title":"store: add method to determine if a snap must be bought","user":{"login":"pete-woods","id":152569,"avatar_url":"https://avatars.githubusercontent.com/u/152569?v=3","gravatar_id":"","url":"https://api.github.com/users/pete-woods","html_url":"https://github.com/pete-woods","followers_url":"https://api.github.com/users/pete-woods/followers","following_url":"https://api.github.com/users/pete-woods/following{/other_user}","gists_url":"https://api.github.com/users/pete-woods/gists{/gist_id}","starred_url":"https://api.github.com/users/pete-woods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pete-woods/subscriptions","organizations_url":"https://api.github.com/users/pete-woods/orgs","repos_url":"https://api.github.com/users/pete-woods/repos","events_url":"https://api.github.com/users/pete-woods/events{/privacy}","received_events_url":"https://api.github.com/users/pete-woods/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-03T17:39:47Z","updated_at":"2016-05-03T17:48:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa96f487f1a5cc6d984f917dd7ac7080e577424d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121/commits","review_comments_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121/comments","review_comment_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/1121/comments","statuses_url":"https://api.github.com/repos/ubuntu-core/snappy/statuses/3efd5dba03282066304fc8e67fa9a73ab568ab71","head":{"label":"pete-woods:must-buy","ref":"must-buy","sha":"3efd5dba03282066304fc8e67fa9a73ab568ab71","user":{"login":"pete-woods","id":152569,"avatar_url":"https://avatars.githubusercontent.com/u/152569?v=3","gravatar_id":"","url":"https://api.github.com/users/pete-woods","html_url":"https://github.com/pete-woods","followers_url":"https://api.github.com/users/pete-woods/followers","following_url":"https://api.github.com/users/pete-woods/following{/other_user}","gists_url":"https://api.github.com/users/pete-woods/gists{/gist_id}","starred_url":"https://api.github.com/users/pete-woods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pete-woods/subscriptions","organizations_url":"https://api.github.com/users/pete-woods/orgs","repos_url":"https://api.github.com/users/pete-woods/repos","events_url":"https://api.github.com/users/pete-woods/events{/privacy}","received_events_url":"https://api.github.com/users/pete-woods/received_events","type":"User","site_admin":false},"repo":{"id":51448306,"name":"snappy","full_name":"pete-woods/snappy","owner":{"login":"pete-woods","id":152569,"avatar_url":"https://avatars.githubusercontent.com/u/152569?v=3","gravatar_id":"","url":"https://api.github.com/users/pete-woods","html_url":"https://github.com/pete-woods","followers_url":"https://api.github.com/users/pete-woods/followers","following_url":"https://api.github.com/users/pete-woods/following{/other_user}","gists_url":"https://api.github.com/users/pete-woods/gists{/gist_id}","starred_url":"https://api.github.com/users/pete-woods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pete-woods/subscriptions","organizations_url":"https://api.github.com/users/pete-woods/orgs","repos_url":"https://api.github.com/users/pete-woods/repos","events_url":"https://api.github.com/users/pete-woods/events{/privacy}","received_events_url":"https://api.github.com/users/pete-woods/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pete-woods/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":true,"url":"https://api.github.com/repos/pete-woods/snappy","forks_url":"https://api.github.com/repos/pete-woods/snappy/forks","keys_url":"https://api.github.com/repos/pete-woods/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pete-woods/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pete-woods/snappy/teams","hooks_url":"https://api.github.com/repos/pete-woods/snappy/hooks","issue_events_url":"https://api.github.com/repos/pete-woods/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/pete-woods/snappy/events","assignees_url":"https://api.github.com/repos/pete-woods/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/pete-woods/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/pete-woods/snappy/tags","blobs_url":"https://api.github.com/repos/pete-woods/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pete-woods/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pete-woods/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/pete-woods/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pete-woods/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/pete-woods/snappy/languages","stargazers_url":"https://api.github.com/repos/pete-woods/snappy/stargazers","contributors_url":"https://api.github.com/repos/pete-woods/snappy/contributors","subscribers_url":"https://api.github.com/repos/pete-woods/snappy/subscribers","subscription_url":"https://api.github.com/repos/pete-woods/snappy/subscription","commits_url":"https://api.github.com/repos/pete-woods/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/pete-woods/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/pete-woods/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/pete-woods/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/pete-woods/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/pete-woods/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pete-woods/snappy/merges","archive_url":"https://api.github.com/repos/pete-woods/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pete-woods/snappy/downloads","issues_url":"https://api.github.com/repos/pete-woods/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/pete-woods/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/pete-woods/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/pete-woods/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pete-woods/snappy/labels{/name}","releases_url":"https://api.github.com/repos/pete-woods/snappy/releases{/id}","deployments_url":"https://api.github.com/repos/pete-woods/snappy/deployments","created_at":"2016-02-10T15:05:48Z","updated_at":"2016-02-10T15:05:49Z","pushed_at":"2016-05-03T17:39:24Z","git_url":"git://github.com/pete-woods/snappy.git","ssh_url":"git@github.com:pete-woods/snappy.git","clone_url":"https://github.com/pete-woods/snappy.git","svn_url":"https://github.com/pete-woods/snappy","homepage":null,"size":29357,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ubuntu-core:master","ref":"master","sha":"3e0230b542678a14de73512247864c066ba0de4e","user":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snappy","full_name":"ubuntu-core/snappy","owner":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubuntu-core/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":false,"url":"https://api.github.com/repos/ubuntu-core/snappy","forks_url":"https://api.github.com/repos/ubuntu-core/snappy/forks","keys_url":"https://api.github.com/repos/ubuntu-core/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubuntu-core/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubuntu-core/snappy/teams","hooks_url":"https://api.github.com/repos/ubuntu-core/snappy/hooks","issue_events_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/ubuntu-core/snappy/events","assignees_url":"https://api.github.com/repos/ubuntu-core/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/ubuntu-core/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/ubuntu-core/snappy/tags","blobs_url":"https://api.github.com/repos/ubuntu-core/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubuntu-core/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubuntu-core/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubuntu-core/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubuntu-core/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/ubuntu-core/snappy/languages","stargazers_url":"https://api.github.com/repos/ubuntu-core/snappy/stargazers","contributors_url":"https://api.github.com/repos/ubuntu-core/snappy/contributors","subscribers_url":"https://api.github.com/repos/ubuntu-core/snappy/subscribers","subscription_url":"https://api.github.com/repos/ubuntu-core/snappy/subscription","commits_url":"https://api.github.com/repos/ubuntu-core/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubuntu-core/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubuntu-core/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubuntu-core/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/ubuntu-core/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubuntu-core/snappy/merges","archive_url":"https://api.github.com/repos/ubuntu-core/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubuntu-core/snappy/downloads","issues_url":"https://api.github.com/repos/ubuntu-core/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/ubuntu-core/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/ubuntu-core/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubuntu-core/snappy/labels{/name}","releases_url":"https://api.github.com/repos/ubuntu-core/snappy/releases{/id}","deployments_url":"https://api.github.com/repos/ubuntu-core/snappy/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2016-05-03T13:37:58Z","pushed_at":"2016-05-03T17:39:48Z","git_url":"git://github.com/ubuntu-core/snappy.git","ssh_url":"git@github.com:ubuntu-core/snappy.git","clone_url":"https://github.com/ubuntu-core/snappy.git","svn_url":"https://github.com/ubuntu-core/snappy","homepage":null,"size":30516,"stargazers_count":185,"watchers_count":185,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":9,"forks":39,"open_issues":9,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121"},"html":{"href":"https://github.com/ubuntu-core/snappy/pull/1121"},"issue":{"href":"https://api.github.com/repos/ubuntu-core/snappy/issues/1121"},"comments":{"href":"https://api.github.com/repos/ubuntu-core/snappy/issues/1121/comments"},"review_comments":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121/comments"},"review_comment":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1121/commits"},"statuses":{"href":"https://api.github.com/repos/ubuntu-core/snappy/statuses/3efd5dba03282066304fc8e67fa9a73ab568ab71"}}}}