{"action":"created","comment":{"url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/comments/187459450","pull_request_review_id":119246563,"id":187459450,"diff_hunk":"@@ -249,24 +268,42 @@ class Calendar extends Component {\n \n       So let's update the state with the prepopulated dates\n     */\n-    if (\n-      !this.state.selectedDays.length &&\n-      this.props.input.value &&\n-      this.props.input.value.length\n-    ) {\n-      await this.setState({ selectedDays: this.props.input.value })\n+    let {\n+      input: { value },\n+      dayLimit,\n+    } = this.props\n+\n+    if (!this.state.selectedDays.length && value && value.length) {\n+      await this.setState({ selectedDays: value })\n     }\n \n     const { selectedDays } = this.state\n-    if (selected) {\n+\n+    if (!selected) {\n+      // If we have already selected the maximum number of days,\n+      // add an error message to the internal state and then return early\n+      if (selectedDays.length >= dayLimit) {\n+        await this.setState({\n+          errorMessage: (\n+            <Trans>\n+              You have already selected the maximum number of dates!\n+            </Trans>\n+          ),\n+        })\n+        return\n+      }\n+\n+      // push new day into array of selectedDays\n+      selectedDays.push(day)","path":"web/src/Calendar.js","position":91,"original_position":78,"commit_id":"05d6527c335168398d34911aaf47aaa42d1bc633","original_commit_id":"d76a03154a77253447e0584cdfa46a28ffd4aabd","user":{"login":"pcraig3","id":2454380,"avatar_url":"https://avatars1.githubusercontent.com/u/2454380?v=4","gravatar_id":"","url":"https://api.github.com/users/pcraig3","html_url":"https://github.com/pcraig3","followers_url":"https://api.github.com/users/pcraig3/followers","following_url":"https://api.github.com/users/pcraig3/following{/other_user}","gists_url":"https://api.github.com/users/pcraig3/gists{/gist_id}","starred_url":"https://api.github.com/users/pcraig3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcraig3/subscriptions","organizations_url":"https://api.github.com/users/pcraig3/orgs","repos_url":"https://api.github.com/users/pcraig3/repos","events_url":"https://api.github.com/users/pcraig3/events{/privacy}","received_events_url":"https://api.github.com/users/pcraig3/received_events","type":"User","site_admin":false},"body":"I think it's okay.\r\n\r\n[`onDayClick`](http://react-day-picker.js.org/api/DayPicker#onDayClick) always hands us back a `Date` object as `day`, and our [`makeGMTDate`](https://github.com/cds-snc/ircc-rescheduler/blob/master/web/src/Time.js#L8) function always returns a date whether it gets passed a string or a Date object.","created_at":"2018-05-10T21:02:41Z","updated_at":"2018-05-10T21:02:42Z","html_url":"https://github.com/cds-snc/ircc-rescheduler/pull/100#discussion_r187459450","pull_request_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/comments/187459450"},"html":{"href":"https://github.com/cds-snc/ircc-rescheduler/pull/100#discussion_r187459450"},"pull_request":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100"}},"in_reply_to_id":187367648},"pull_request":{"url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100","id":186458309,"html_url":"https://github.com/cds-snc/ircc-rescheduler/pull/100","diff_url":"https://github.com/cds-snc/ircc-rescheduler/pull/100.diff","patch_url":"https://github.com/cds-snc/ircc-rescheduler/pull/100.patch","issue_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/100","number":100,"state":"open","locked":false,"title":"Enforce maximum number of dates","user":{"login":"pcraig3","id":2454380,"avatar_url":"https://avatars1.githubusercontent.com/u/2454380?v=4","gravatar_id":"","url":"https://api.github.com/users/pcraig3","html_url":"https://github.com/pcraig3","followers_url":"https://api.github.com/users/pcraig3/followers","following_url":"https://api.github.com/users/pcraig3/following{/other_user}","gists_url":"https://api.github.com/users/pcraig3/gists{/gist_id}","starred_url":"https://api.github.com/users/pcraig3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcraig3/subscriptions","organizations_url":"https://api.github.com/users/pcraig3/orgs","repos_url":"https://api.github.com/users/pcraig3/repos","events_url":"https://api.github.com/users/pcraig3/events{/privacy}","received_events_url":"https://api.github.com/users/pcraig3/received_events","type":"User","site_admin":false},"body":"Users must select at least 3 dates, but they cannot select more than 3 dates.\r\n\r\nBefore they select 3, they can't go to the next page.\r\nOnce they have selected 3, they shouldn't be able to select any more.\r\n\r\nThis pull request will restrict users from being able to select more than 3 dates, which is our current limit. If they want a new day, they have to remove an existing day.\r\n\r\nIn this pull request:\r\n- [x] stop users from selecting more than 3 days\r\n- [x] some kind of on-screen warning when they try to select more than 3 days\r\n- [x] unselect a day by removing it from the list\r\n\r\nThis pull request will resolve #87 once it is merged.","created_at":"2018-05-07T20:40:12Z","updated_at":"2018-05-10T21:02:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac1adf1c1584747c50e4adb32dc2fefc87344873","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100/commits","review_comments_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100/comments","review_comment_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/100/comments","statuses_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/statuses/05d6527c335168398d34911aaf47aaa42d1bc633","head":{"label":"cds-snc:theres-three-total","ref":"theres-three-total","sha":"05d6527c335168398d34911aaf47aaa42d1bc633","user":{"login":"cds-snc","id":30166251,"avatar_url":"https://avatars1.githubusercontent.com/u/30166251?v=4","gravatar_id":"","url":"https://api.github.com/users/cds-snc","html_url":"https://github.com/cds-snc","followers_url":"https://api.github.com/users/cds-snc/followers","following_url":"https://api.github.com/users/cds-snc/following{/other_user}","gists_url":"https://api.github.com/users/cds-snc/gists{/gist_id}","starred_url":"https://api.github.com/users/cds-snc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cds-snc/subscriptions","organizations_url":"https://api.github.com/users/cds-snc/orgs","repos_url":"https://api.github.com/users/cds-snc/repos","events_url":"https://api.github.com/users/cds-snc/events{/privacy}","received_events_url":"https://api.github.com/users/cds-snc/received_events","type":"Organization","site_admin":false},"repo":{"id":127961062,"name":"ircc-rescheduler","full_name":"cds-snc/ircc-rescheduler","owner":{"login":"cds-snc","id":30166251,"avatar_url":"https://avatars1.githubusercontent.com/u/30166251?v=4","gravatar_id":"","url":"https://api.github.com/users/cds-snc","html_url":"https://github.com/cds-snc","followers_url":"https://api.github.com/users/cds-snc/followers","following_url":"https://api.github.com/users/cds-snc/following{/other_user}","gists_url":"https://api.github.com/users/cds-snc/gists{/gist_id}","starred_url":"https://api.github.com/users/cds-snc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cds-snc/subscriptions","organizations_url":"https://api.github.com/users/cds-snc/orgs","repos_url":"https://api.github.com/users/cds-snc/repos","events_url":"https://api.github.com/users/cds-snc/events{/privacy}","received_events_url":"https://api.github.com/users/cds-snc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cds-snc/ircc-rescheduler","description":"🙅‍♀️🗓","fork":false,"url":"https://api.github.com/repos/cds-snc/ircc-rescheduler","forks_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/forks","keys_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/teams","hooks_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/hooks","issue_events_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/events{/number}","events_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/events","assignees_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/assignees{/user}","branches_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/branches{/branch}","tags_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/tags","blobs_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/refs{/sha}","trees_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/statuses/{sha}","languages_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/languages","stargazers_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/stargazers","contributors_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/contributors","subscribers_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/subscribers","subscription_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/subscription","commits_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/commits{/sha}","git_commits_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/commits{/sha}","comments_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/comments{/number}","issue_comment_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/comments{/number}","contents_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/contents/{+path}","compare_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/merges","archive_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/downloads","issues_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues{/number}","pulls_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls{/number}","milestones_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/milestones{/number}","notifications_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/labels{/name}","releases_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/releases{/id}","deployments_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/deployments","created_at":"2018-04-03T19:52:25Z","updated_at":"2018-05-10T20:10:20Z","pushed_at":"2018-05-10T20:51:45Z","git_url":"git://github.com/cds-snc/ircc-rescheduler.git","ssh_url":"git@github.com:cds-snc/ircc-rescheduler.git","clone_url":"https://github.com/cds-snc/ircc-rescheduler.git","svn_url":"https://github.com/cds-snc/ircc-rescheduler","homepage":"https://rescheduler.cds-snc.ca/","size":1239,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":15,"watchers":1,"default_branch":"master"}},"base":{"label":"cds-snc:master","ref":"master","sha":"680e57494d0280aa2c019514d428620989401969","user":{"login":"cds-snc","id":30166251,"avatar_url":"https://avatars1.githubusercontent.com/u/30166251?v=4","gravatar_id":"","url":"https://api.github.com/users/cds-snc","html_url":"https://github.com/cds-snc","followers_url":"https://api.github.com/users/cds-snc/followers","following_url":"https://api.github.com/users/cds-snc/following{/other_user}","gists_url":"https://api.github.com/users/cds-snc/gists{/gist_id}","starred_url":"https://api.github.com/users/cds-snc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cds-snc/subscriptions","organizations_url":"https://api.github.com/users/cds-snc/orgs","repos_url":"https://api.github.com/users/cds-snc/repos","events_url":"https://api.github.com/users/cds-snc/events{/privacy}","received_events_url":"https://api.github.com/users/cds-snc/received_events","type":"Organization","site_admin":false},"repo":{"id":127961062,"name":"ircc-rescheduler","full_name":"cds-snc/ircc-rescheduler","owner":{"login":"cds-snc","id":30166251,"avatar_url":"https://avatars1.githubusercontent.com/u/30166251?v=4","gravatar_id":"","url":"https://api.github.com/users/cds-snc","html_url":"https://github.com/cds-snc","followers_url":"https://api.github.com/users/cds-snc/followers","following_url":"https://api.github.com/users/cds-snc/following{/other_user}","gists_url":"https://api.github.com/users/cds-snc/gists{/gist_id}","starred_url":"https://api.github.com/users/cds-snc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cds-snc/subscriptions","organizations_url":"https://api.github.com/users/cds-snc/orgs","repos_url":"https://api.github.com/users/cds-snc/repos","events_url":"https://api.github.com/users/cds-snc/events{/privacy}","received_events_url":"https://api.github.com/users/cds-snc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cds-snc/ircc-rescheduler","description":"🙅‍♀️🗓","fork":false,"url":"https://api.github.com/repos/cds-snc/ircc-rescheduler","forks_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/forks","keys_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/teams","hooks_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/hooks","issue_events_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/events{/number}","events_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/events","assignees_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/assignees{/user}","branches_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/branches{/branch}","tags_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/tags","blobs_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/refs{/sha}","trees_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/statuses/{sha}","languages_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/languages","stargazers_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/stargazers","contributors_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/contributors","subscribers_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/subscribers","subscription_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/subscription","commits_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/commits{/sha}","git_commits_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/git/commits{/sha}","comments_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/comments{/number}","issue_comment_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/comments{/number}","contents_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/contents/{+path}","compare_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/merges","archive_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/downloads","issues_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues{/number}","pulls_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls{/number}","milestones_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/milestones{/number}","notifications_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/labels{/name}","releases_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/releases{/id}","deployments_url":"https://api.github.com/repos/cds-snc/ircc-rescheduler/deployments","created_at":"2018-04-03T19:52:25Z","updated_at":"2018-05-10T20:10:20Z","pushed_at":"2018-05-10T20:51:45Z","git_url":"git://github.com/cds-snc/ircc-rescheduler.git","ssh_url":"git@github.com:cds-snc/ircc-rescheduler.git","clone_url":"https://github.com/cds-snc/ircc-rescheduler.git","svn_url":"https://github.com/cds-snc/ircc-rescheduler","homepage":"https://rescheduler.cds-snc.ca/","size":1239,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":15,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100"},"html":{"href":"https://github.com/cds-snc/ircc-rescheduler/pull/100"},"issue":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/100"},"comments":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/issues/100/comments"},"review_comments":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100/comments"},"review_comment":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/pulls/100/commits"},"statuses":{"href":"https://api.github.com/repos/cds-snc/ircc-rescheduler/statuses/05d6527c335168398d34911aaf47aaa42d1bc633"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"pcraig3"}}