{"action":"created","comment":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/71224965","id":71224965,"diff_hunk":"@@ -40,6 +40,11 @@ class Section < ActiveRecord::Base\n   LOGIN_TYPE_PICTURE = 'picture'\n   LOGIN_TYPE_WORD = 'word'\n \n+  TYPES = [\n+    TYPE_PD_WORKSHOP = 'pd_workshop'","path":"dashboard/app/models/section.rb","position":5,"original_position":5,"commit_id":"2deb679ccbdce5152e6fa6979323e47996e5aa62","original_commit_id":"2deb679ccbdce5152e6fa6979323e47996e5aa62","user":{"login":"aoby","id":8405316,"avatar_url":"https://avatars.githubusercontent.com/u/8405316?v=3","gravatar_id":"","url":"https://api.github.com/users/aoby","html_url":"https://github.com/aoby","followers_url":"https://api.github.com/users/aoby/followers","following_url":"https://api.github.com/users/aoby/following{/other_user}","gists_url":"https://api.github.com/users/aoby/gists{/gist_id}","starred_url":"https://api.github.com/users/aoby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoby/subscriptions","organizations_url":"https://api.github.com/users/aoby/orgs","repos_url":"https://api.github.com/users/aoby/repos","events_url":"https://api.github.com/users/aoby/events{/privacy}","received_events_url":"https://api.github.com/users/aoby/received_events","type":"User","site_admin":false},"body":"Still, each constant is defined separately and is not referenced as a member of the container array. This pattern is a shorthand for:\r\n\r\n```ruby\r\nTYPE_PD_WORKSHOP = 'pd_workshop'\r\nTYPES = [TYPE_PD_WORKSHOP]\r\n```\r\n\r\nI'm declaring `TYPES` as the list of all options for the validation, similar to [here](https://github.com/code-dot-org/code-dot-org/blob/staging/dashboard/app/models/pd/workshop.rb#L27-L71).\r\n\r\nUnfortunately we can't refer to it as something like `TYPES.PD_WORKSHOP`. If we wanted that, we could use a hash of symbol keys instead of constants? Would this be preferable?\r\n\r\n```ruby\r\nTYPES = {\r\n  pd_workshop: 'pd_workshop'\r\n}\r\n\r\n# referenced by\r\nTYPES[:pd_workshop]\r\n```","created_at":"2016-07-18T20:41:00Z","updated_at":"2016-07-18T20:41:00Z","html_url":"https://github.com/code-dot-org/code-dot-org/pull/9548#discussion_r71224965","pull_request_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548","_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/71224965"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/9548#discussion_r71224965"},"pull_request":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548"}}},"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548","id":77692690,"html_url":"https://github.com/code-dot-org/code-dot-org/pull/9548","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/9548.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/9548.patch","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9548","number":9548,"state":"open","locked":false,"title":"Added confirmation page for joining pd workshop sections.","user":{"login":"aoby","id":8405316,"avatar_url":"https://avatars.githubusercontent.com/u/8405316?v=3","gravatar_id":"","url":"https://api.github.com/users/aoby","html_url":"https://github.com/aoby","followers_url":"https://api.github.com/users/aoby/followers","following_url":"https://api.github.com/users/aoby/following{/other_user}","gists_url":"https://api.github.com/users/aoby/gists{/gist_id}","starred_url":"https://api.github.com/users/aoby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoby/subscriptions","organizations_url":"https://api.github.com/users/aoby/orgs","repos_url":"https://api.github.com/users/aoby/repos","events_url":"https://api.github.com/users/aoby/events{/privacy}","received_events_url":"https://api.github.com/users/aoby/received_events","type":"User","site_admin":false},"body":"Now, joining a workshop session behaves differently from joining a normal class section.\r\n\r\n1. If not logged in, the user will be redirected to the normal login page, rather than the custom section new user page. This could perhaps be improved further (in a subsequent change) by adding a support for a default user type and setting it to teacher for an even better workflow for new users.\r\n\r\n2. Once logged in, a confirmation page will display. This will be pre-populated with the existing enrollment form, or with user details (name & email) if no enrollment exists:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/8405316/16861489/00353b08-49f6-11e6-94de-8dc3f7858f75.png)\r\n\r\nIf an email exists for the user, it will be locked in this form, with a tooltip that it can be changed in account settings. However, if there is no email (student account, or former student account turned teacher before we required email) it will be open. Then, email is required, and the hash of the supplied email must match the user's hashed_email or it will display an error. Once it matches, the student user will be converted to teacher and the plaintext email set.\r\n\r\n@breville FYI I moved the workshop enrollment form into a partial, shared by this and the existing new enrollment view. I also removed the requirement for enrollment.school until we can solidify that and require district, and I removed the  * for district and school on the form since they are not actually required yet.\r\n","created_at":"2016-07-15T23:47:32Z","updated_at":"2016-07-18T20:41:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2d3e0b3772f8897995e29c2e38d3487b7c98dc1","assignee":{"login":"tanyaparker","id":1920530,"avatar_url":"https://avatars.githubusercontent.com/u/1920530?v=3","gravatar_id":"","url":"https://api.github.com/users/tanyaparker","html_url":"https://github.com/tanyaparker","followers_url":"https://api.github.com/users/tanyaparker/followers","following_url":"https://api.github.com/users/tanyaparker/following{/other_user}","gists_url":"https://api.github.com/users/tanyaparker/gists{/gist_id}","starred_url":"https://api.github.com/users/tanyaparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanyaparker/subscriptions","organizations_url":"https://api.github.com/users/tanyaparker/orgs","repos_url":"https://api.github.com/users/tanyaparker/repos","events_url":"https://api.github.com/users/tanyaparker/events{/privacy}","received_events_url":"https://api.github.com/users/tanyaparker/received_events","type":"User","site_admin":false},"assignees":[{"login":"tanyaparker","id":1920530,"avatar_url":"https://avatars.githubusercontent.com/u/1920530?v=3","gravatar_id":"","url":"https://api.github.com/users/tanyaparker","html_url":"https://github.com/tanyaparker","followers_url":"https://api.github.com/users/tanyaparker/followers","following_url":"https://api.github.com/users/tanyaparker/following{/other_user}","gists_url":"https://api.github.com/users/tanyaparker/gists{/gist_id}","starred_url":"https://api.github.com/users/tanyaparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanyaparker/subscriptions","organizations_url":"https://api.github.com/users/tanyaparker/orgs","repos_url":"https://api.github.com/users/tanyaparker/repos","events_url":"https://api.github.com/users/tanyaparker/events{/privacy}","received_events_url":"https://api.github.com/users/tanyaparker/received_events","type":"User","site_admin":false},{"login":"breville","id":2205926,"avatar_url":"https://avatars.githubusercontent.com/u/2205926?v=3","gravatar_id":"","url":"https://api.github.com/users/breville","html_url":"https://github.com/breville","followers_url":"https://api.github.com/users/breville/followers","following_url":"https://api.github.com/users/breville/following{/other_user}","gists_url":"https://api.github.com/users/breville/gists{/gist_id}","starred_url":"https://api.github.com/users/breville/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breville/subscriptions","organizations_url":"https://api.github.com/users/breville/orgs","repos_url":"https://api.github.com/users/breville/repos","events_url":"https://api.github.com/users/breville/events{/privacy}","received_events_url":"https://api.github.com/users/breville/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548/commits","review_comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548/comments","review_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9548/comments","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/2deb679ccbdce5152e6fa6979323e47996e5aa62","head":{"label":"code-dot-org:pd-workshop-join-section-confirmation","ref":"pd-workshop-join-section-confirmation","sha":"2deb679ccbdce5152e6fa6979323e47996e5aa62","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","deployments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/deployments","created_at":"2014-09-20T00:46:11Z","updated_at":"2016-07-18T04:51:38Z","pushed_at":"2016-07-18T20:40:04Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":4793987,"stargazers_count":126,"watchers_count":126,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":77,"mirror_url":null,"open_issues_count":46,"forks":77,"open_issues":46,"watchers":126,"default_branch":"staging"}},"base":{"label":"code-dot-org:staging","ref":"staging","sha":"29acf58104b5317cfc78ee47ecad51ad0d9aa59b","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","deployments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/deployments","created_at":"2014-09-20T00:46:11Z","updated_at":"2016-07-18T04:51:38Z","pushed_at":"2016-07-18T20:40:04Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":4793987,"stargazers_count":126,"watchers_count":126,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":77,"mirror_url":null,"open_issues_count":46,"forks":77,"open_issues":46,"watchers":126,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/9548"},"issue":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9548"},"comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9548/comments"},"review_comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548/comments"},"review_comment":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9548/commits"},"statuses":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/2deb679ccbdce5152e6fa6979323e47996e5aa62"}}}}
{"actor":{"display_login":"aoby"}}