{"action":"created","comment":{"url":"https://api.github.com/repos/resin-io/etcher/pulls/comments/93299918","pull_request_review_id":13824595,"id":93299918,"diff_hunk":"@@ -94,15 +95,15 @@ const storeReducer = (state, action) => {\n \n         const drive = _.first(action.data);\n \n-        if (_.every([\n-\n-          // TODO: Reuse from SelectionStateModel.isDriveValid()\n-          state.getIn([ 'selection', 'image', 'size' ], 0) <= drive.size,\n+        // Even if there's no image selectected, we need to call `isDriveValid`\n+        // to check if the drive is locked, and `{}` works fine with it\n+        const image = state.getIn([ 'selection', 'image' ], {","path":"lib/gui/models/store.js","position":18,"original_position":18,"commit_id":"266738e5f6f6fd06a3b165849e5eedf1a9649a7e","original_commit_id":"266738e5f6f6fd06a3b165849e5eedf1a9649a7e","user":{"login":"jviotti","id":2192773,"avatar_url":"https://avatars.githubusercontent.com/u/2192773?v=3","gravatar_id":"","url":"https://api.github.com/users/jviotti","html_url":"https://github.com/jviotti","followers_url":"https://api.github.com/users/jviotti/followers","following_url":"https://api.github.com/users/jviotti/following{/other_user}","gists_url":"https://api.github.com/users/jviotti/gists{/gist_id}","starred_url":"https://api.github.com/users/jviotti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jviotti/subscriptions","organizations_url":"https://api.github.com/users/jviotti/orgs","repos_url":"https://api.github.com/users/jviotti/repos","events_url":"https://api.github.com/users/jviotti/events{/privacy}","received_events_url":"https://api.github.com/users/jviotti/received_events","type":"User","site_admin":false},"body":"I wonder if just for clarity, we should let this be `undefined` if it doesn't exist, and move the \"empty object\" workaround to the places that actually need it:\r\n\r\n```js\r\nif (_.every([\r\n    constraints.isDriveValid(drive, image || {}),\r\n    constraints.isDriveSizeRecommended(drive, image || {})\r\n ]))\r\n```\r\n\r\nThis would prevent us from accidentally relying on an empty object representing the lack of an image in the store.","created_at":"2016-12-20T18:49:10Z","updated_at":"2016-12-20T18:49:10Z","html_url":"https://github.com/resin-io/etcher/pull/982#discussion_r93299918","pull_request_url":"https://api.github.com/repos/resin-io/etcher/pulls/982","_links":{"self":{"href":"https://api.github.com/repos/resin-io/etcher/pulls/comments/93299918"},"html":{"href":"https://github.com/resin-io/etcher/pull/982#discussion_r93299918"},"pull_request":{"href":"https://api.github.com/repos/resin-io/etcher/pulls/982"}}},"pull_request":{"url":"https://api.github.com/repos/resin-io/etcher/pulls/982","id":98489105,"html_url":"https://github.com/resin-io/etcher/pull/982","diff_url":"https://github.com/resin-io/etcher/pull/982.diff","patch_url":"https://github.com/resin-io/etcher/pull/982.patch","issue_url":"https://api.github.com/repos/resin-io/etcher/issues/982","number":982,"state":"open","locked":false,"title":"Extract CLI/GUI shared functionality","user":{"login":"stefan-mihaila","id":2217136,"avatar_url":"https://avatars.githubusercontent.com/u/2217136?v=3","gravatar_id":"","url":"https://api.github.com/users/stefan-mihaila","html_url":"https://github.com/stefan-mihaila","followers_url":"https://api.github.com/users/stefan-mihaila/followers","following_url":"https://api.github.com/users/stefan-mihaila/following{/other_user}","gists_url":"https://api.github.com/users/stefan-mihaila/gists{/gist_id}","starred_url":"https://api.github.com/users/stefan-mihaila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefan-mihaila/subscriptions","organizations_url":"https://api.github.com/users/stefan-mihaila/orgs","repos_url":"https://api.github.com/users/stefan-mihaila/repos","events_url":"https://api.github.com/users/stefan-mihaila/events{/privacy}","received_events_url":"https://api.github.com/users/stefan-mihaila/received_events","type":"User","site_admin":false},"body":"- refactor: `isSystemDrive` is `false` if `system` property undefined\r\n\r\n    Change-Type: patch\r\n\r\n- refactor: `drive-constraints` - throw when image is undefined\r\n\r\n    The default behaviour was to pretend that we're all good if the if\r\n    the image is not specified. We're not using this \"feature\", and\r\n    it can be dangerous if we forget to pass in the image.\r\n\r\n    Change-Type: patch\r\n\r\n- refactor: extract additional methods to drive-constraints\r\n\r\n    Change-Type: patch\r\n\r\n- refactor: Use singleton object for `DriveConstraints`\r\n\r\n    Change-Type: patch\r\n\r\n- refactor: extract state independent methods from `SelectionStateModel`\r\n\r\n    `SelectionStateModel`'s methods `isSystemDrive` and `isDriveLocked`\r\n    don't depend on application state. They have been extracted in a different\r\n    AngularJS service: `DriveConstraintsModel`. The new service's actual\r\n    implementation is in `lib/src`, in order to be reused by the CLI.\r\n\r\n    Change-Type: patch\r\n\r\n- refactor: rename `lib/src` to `lib/shared`\r\n\r\n    Change-Type: patch\r\n\r\n- refactor: use `drive-constraints` in `store.js`\r\n\r\n    Change-Type: patch","created_at":"2016-12-18T22:01:24Z","updated_at":"2016-12-20T18:49:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2923dbaf91ee3fe6707934592fa4a3ef3367c255","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/resin-io/etcher/pulls/982/commits","review_comments_url":"https://api.github.com/repos/resin-io/etcher/pulls/982/comments","review_comment_url":"https://api.github.com/repos/resin-io/etcher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/resin-io/etcher/issues/982/comments","statuses_url":"https://api.github.com/repos/resin-io/etcher/statuses/266738e5f6f6fd06a3b165849e5eedf1a9649a7e","head":{"label":"resin-io:cli-gui-shared-functionality","ref":"cli-gui-shared-functionality","sha":"266738e5f6f6fd06a3b165849e5eedf1a9649a7e","user":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"repo":{"id":45055693,"name":"etcher","full_name":"resin-io/etcher","owner":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/resin-io/etcher","description":"Flash OS images to SD cards & USB drives, safely and easily.","fork":false,"url":"https://api.github.com/repos/resin-io/etcher","forks_url":"https://api.github.com/repos/resin-io/etcher/forks","keys_url":"https://api.github.com/repos/resin-io/etcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/resin-io/etcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/resin-io/etcher/teams","hooks_url":"https://api.github.com/repos/resin-io/etcher/hooks","issue_events_url":"https://api.github.com/repos/resin-io/etcher/issues/events{/number}","events_url":"https://api.github.com/repos/resin-io/etcher/events","assignees_url":"https://api.github.com/repos/resin-io/etcher/assignees{/user}","branches_url":"https://api.github.com/repos/resin-io/etcher/branches{/branch}","tags_url":"https://api.github.com/repos/resin-io/etcher/tags","blobs_url":"https://api.github.com/repos/resin-io/etcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/resin-io/etcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/resin-io/etcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/resin-io/etcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/resin-io/etcher/statuses/{sha}","languages_url":"https://api.github.com/repos/resin-io/etcher/languages","stargazers_url":"https://api.github.com/repos/resin-io/etcher/stargazers","contributors_url":"https://api.github.com/repos/resin-io/etcher/contributors","subscribers_url":"https://api.github.com/repos/resin-io/etcher/subscribers","subscription_url":"https://api.github.com/repos/resin-io/etcher/subscription","commits_url":"https://api.github.com/repos/resin-io/etcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/resin-io/etcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/resin-io/etcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/resin-io/etcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/resin-io/etcher/contents/{+path}","compare_url":"https://api.github.com/repos/resin-io/etcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/resin-io/etcher/merges","archive_url":"https://api.github.com/repos/resin-io/etcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/resin-io/etcher/downloads","issues_url":"https://api.github.com/repos/resin-io/etcher/issues{/number}","pulls_url":"https://api.github.com/repos/resin-io/etcher/pulls{/number}","milestones_url":"https://api.github.com/repos/resin-io/etcher/milestones{/number}","notifications_url":"https://api.github.com/repos/resin-io/etcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/resin-io/etcher/labels{/name}","releases_url":"https://api.github.com/repos/resin-io/etcher/releases{/id}","deployments_url":"https://api.github.com/repos/resin-io/etcher/deployments","created_at":"2015-10-27T16:53:23Z","updated_at":"2016-12-20T16:31:27Z","pushed_at":"2016-12-20T17:39:57Z","git_url":"git://github.com/resin-io/etcher.git","ssh_url":"git@github.com:resin-io/etcher.git","clone_url":"https://github.com/resin-io/etcher.git","svn_url":"https://github.com/resin-io/etcher","homepage":"https://etcher.io","size":11341,"stargazers_count":1471,"watchers_count":1471,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":77,"forks":84,"open_issues":77,"watchers":1471,"default_branch":"master"}},"base":{"label":"resin-io:master","ref":"master","sha":"d7e1fe09fc7512d1866a49ca72a28882b376888b","user":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"repo":{"id":45055693,"name":"etcher","full_name":"resin-io/etcher","owner":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/resin-io/etcher","description":"Flash OS images to SD cards & USB drives, safely and easily.","fork":false,"url":"https://api.github.com/repos/resin-io/etcher","forks_url":"https://api.github.com/repos/resin-io/etcher/forks","keys_url":"https://api.github.com/repos/resin-io/etcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/resin-io/etcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/resin-io/etcher/teams","hooks_url":"https://api.github.com/repos/resin-io/etcher/hooks","issue_events_url":"https://api.github.com/repos/resin-io/etcher/issues/events{/number}","events_url":"https://api.github.com/repos/resin-io/etcher/events","assignees_url":"https://api.github.com/repos/resin-io/etcher/assignees{/user}","branches_url":"https://api.github.com/repos/resin-io/etcher/branches{/branch}","tags_url":"https://api.github.com/repos/resin-io/etcher/tags","blobs_url":"https://api.github.com/repos/resin-io/etcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/resin-io/etcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/resin-io/etcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/resin-io/etcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/resin-io/etcher/statuses/{sha}","languages_url":"https://api.github.com/repos/resin-io/etcher/languages","stargazers_url":"https://api.github.com/repos/resin-io/etcher/stargazers","contributors_url":"https://api.github.com/repos/resin-io/etcher/contributors","subscribers_url":"https://api.github.com/repos/resin-io/etcher/subscribers","subscription_url":"https://api.github.com/repos/resin-io/etcher/subscription","commits_url":"https://api.github.com/repos/resin-io/etcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/resin-io/etcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/resin-io/etcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/resin-io/etcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/resin-io/etcher/contents/{+path}","compare_url":"https://api.github.com/repos/resin-io/etcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/resin-io/etcher/merges","archive_url":"https://api.github.com/repos/resin-io/etcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/resin-io/etcher/downloads","issues_url":"https://api.github.com/repos/resin-io/etcher/issues{/number}","pulls_url":"https://api.github.com/repos/resin-io/etcher/pulls{/number}","milestones_url":"https://api.github.com/repos/resin-io/etcher/milestones{/number}","notifications_url":"https://api.github.com/repos/resin-io/etcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/resin-io/etcher/labels{/name}","releases_url":"https://api.github.com/repos/resin-io/etcher/releases{/id}","deployments_url":"https://api.github.com/repos/resin-io/etcher/deployments","created_at":"2015-10-27T16:53:23Z","updated_at":"2016-12-20T16:31:27Z","pushed_at":"2016-12-20T17:39:57Z","git_url":"git://github.com/resin-io/etcher.git","ssh_url":"git@github.com:resin-io/etcher.git","clone_url":"https://github.com/resin-io/etcher.git","svn_url":"https://github.com/resin-io/etcher","homepage":"https://etcher.io","size":11341,"stargazers_count":1471,"watchers_count":1471,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":77,"forks":84,"open_issues":77,"watchers":1471,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/resin-io/etcher/pulls/982"},"html":{"href":"https://github.com/resin-io/etcher/pull/982"},"issue":{"href":"https://api.github.com/repos/resin-io/etcher/issues/982"},"comments":{"href":"https://api.github.com/repos/resin-io/etcher/issues/982/comments"},"review_comments":{"href":"https://api.github.com/repos/resin-io/etcher/pulls/982/comments"},"review_comment":{"href":"https://api.github.com/repos/resin-io/etcher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/resin-io/etcher/pulls/982/commits"},"statuses":{"href":"https://api.github.com/repos/resin-io/etcher/statuses/266738e5f6f6fd06a3b165849e5eedf1a9649a7e"}}}}
{"actor":{"display_login":"jviotti"}}