{"action":"created","comment":{"url":"https://api.github.com/repos/rubyforgood/diaper/pulls/comments/330818509","pull_request_review_id":296586252,"id":330818509,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMDgxODUwOQ==","diff_hunk":"@@ -6,11 +6,15 @@\n   <span class=\"input-group-addon\"><%= fa_icon \"envelope\" %></span>\n   <%= f.input_field :email, class: \"form-control\" %>\n <% end %>\n-<%= f.input :password, label: \"Password\", wrapper: :vertical_input_group, required: true, hint: (\"#{@minimum_password_length} characters minimum\" if @minimum_password_length) do %>\n-  <span class=\"input-group-addon\"><%= fa_icon \"lock\" %></span>\n-  <%= f.input_field :password, class: \"form-control\" %>\n+<!-- Only display password fields when not nested within organization form -->\n+<% if @organization.nil? %>","path":"app/views/admin/users/_user_form_fields.html.erb","position":8,"original_position":8,"commit_id":"eca156a17f9a35a1ee845b26f44c92c305d16a95","original_commit_id":"eca156a17f9a35a1ee845b26f44c92c305d16a95","user":{"login":"mdworken","id":31595784,"node_id":"MDQ6VXNlcjMxNTk1Nzg0","avatar_url":"https://avatars0.githubusercontent.com/u/31595784?v=4","gravatar_id":"","url":"https://api.github.com/users/mdworken","html_url":"https://github.com/mdworken","followers_url":"https://api.github.com/users/mdworken/followers","following_url":"https://api.github.com/users/mdworken/following{/other_user}","gists_url":"https://api.github.com/users/mdworken/gists{/gist_id}","starred_url":"https://api.github.com/users/mdworken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdworken/subscriptions","organizations_url":"https://api.github.com/users/mdworken/orgs","repos_url":"https://api.github.com/users/mdworken/repos","events_url":"https://api.github.com/users/mdworken/events{/privacy}","received_events_url":"https://api.github.com/users/mdworken/received_events","type":"User","site_admin":false},"body":"I really like the underlying idea here, but can we make this an even more explicit check by maybe passing in a variable like \"show_password_fields\" from the view calling this partial? I'd be worried that we may eventually define `@organization` for a field where we'd still want to hide this","created_at":"2019-10-02T23:57:48Z","updated_at":"2019-10-02T23:59:44Z","html_url":"https://github.com/rubyforgood/diaper/pull/1247#discussion_r330818509","pull_request_url":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rubyforgood/diaper/pulls/comments/330818509"},"html":{"href":"https://github.com/rubyforgood/diaper/pull/1247#discussion_r330818509"},"pull_request":{"href":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247"}}},"pull_request":{"url":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247","id":323751948,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIzNzUxOTQ4","html_url":"https://github.com/rubyforgood/diaper/pull/1247","diff_url":"https://github.com/rubyforgood/diaper/pull/1247.diff","patch_url":"https://github.com/rubyforgood/diaper/pull/1247.patch","issue_url":"https://api.github.com/repos/rubyforgood/diaper/issues/1247","number":1247,"state":"open","locked":false,"title":"1189 | when creating new org as site admin, do not require PW","user":{"login":"AutumnJ","id":33694669,"node_id":"MDQ6VXNlcjMzNjk0NjY5","avatar_url":"https://avatars1.githubusercontent.com/u/33694669?v=4","gravatar_id":"","url":"https://api.github.com/users/AutumnJ","html_url":"https://github.com/AutumnJ","followers_url":"https://api.github.com/users/AutumnJ/followers","following_url":"https://api.github.com/users/AutumnJ/following{/other_user}","gists_url":"https://api.github.com/users/AutumnJ/gists{/gist_id}","starred_url":"https://api.github.com/users/AutumnJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutumnJ/subscriptions","organizations_url":"https://api.github.com/users/AutumnJ/orgs","repos_url":"https://api.github.com/users/AutumnJ/repos","events_url":"https://api.github.com/users/AutumnJ/events{/privacy}","received_events_url":"https://api.github.com/users/AutumnJ/received_events","type":"User","site_admin":false},"body":"<!--Read comments, before committing pull request read checklist again\r\n\r\n# Checklist:\r\n\r\n- I have performed a self-review of my own code,\r\n- I have commented my code, particularly in hard-to-understand areas,\r\n- I have made corresponding changes to the documentation,\r\n- I have added tests that prove my fix is effective or that my feature works,\r\n- New and existing unit tests pass locally with my changes (\"bundle exec rake\"),\r\n- Title include \"WIP\" if work is in progress.\r\n\r\n-->\r\nResolves #1189  <!--fill issue number-->\r\n\r\n### Description\r\nUpdated `Add New Organization` form to allow for the creation of user in conjunction with organization, _without_ requiring password input (i.e. remove password fields from form without breaking functionality). New user then receives invite email with link they can use to set their password and log in. \r\n\r\nIt is possible to rely on Devise's invitable gem to create the user at the time the invite is sent (via `invite!`). However, it does not validate the record, so if an email address is invalid an error will not be displayed and the user will not receive an invite. As a workaround, I removed the password fields and used `SecureRandom` to generate a temporary password on the backend, so the user record is persisted and validated prior to sending the invite, allowing us to surface meaningful validation errors in the form. This is closest to the previous flow, minimizing the risk of introducing bugs.\r\n\r\n### Type of change\r\n* Breaking change (fix or feature that would cause existing functionality to not work as expected)\r\n\r\n### How Has This Been Tested?\r\nManually tested the following user paths:\r\n* Create organization with user (both organization admin & non-admin) using `Add New Organization` form; used invite link issued via email to create password for new user and log in as user\r\n* Verified editing existing user's password & creating new user with password (`Add a User` form) works as expected (since conditional was added to user form field partial)\r\n\r\nUpdated existing specs to reflect change and verify organization and user can be created together without inputting a user password. \r\n\r\n_May_ want to test creating organization and user in non-local environment just to confirm email invite works as expected and invited users can update their password and log in.\r\n\r\n### Screenshots\r\n**Before**\r\n![image](https://user-images.githubusercontent.com/33694669/66046968-7f42a680-e4ec-11e9-9b22-4b1741f392e3.png)\r\n\r\n**After**\r\n![image](https://user-images.githubusercontent.com/33694669/66046876-473b6380-e4ec-11e9-8b66-6f17579463ba.png)","created_at":"2019-10-02T13:28:22Z","updated_at":"2019-10-02T23:59:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3249b276e0fdc3e7bb771774dd3eead9155b821c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"armahillo","id":502363,"node_id":"MDQ6VXNlcjUwMjM2Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/502363?v=4","gravatar_id":"","url":"https://api.github.com/users/armahillo","html_url":"https://github.com/armahillo","followers_url":"https://api.github.com/users/armahillo/followers","following_url":"https://api.github.com/users/armahillo/following{/other_user}","gists_url":"https://api.github.com/users/armahillo/gists{/gist_id}","starred_url":"https://api.github.com/users/armahillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armahillo/subscriptions","organizations_url":"https://api.github.com/users/armahillo/orgs","repos_url":"https://api.github.com/users/armahillo/repos","events_url":"https://api.github.com/users/armahillo/events{/privacy}","received_events_url":"https://api.github.com/users/armahillo/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247/commits","review_comments_url":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247/comments","review_comment_url":"https://api.github.com/repos/rubyforgood/diaper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubyforgood/diaper/issues/1247/comments","statuses_url":"https://api.github.com/repos/rubyforgood/diaper/statuses/eca156a17f9a35a1ee845b26f44c92c305d16a95","head":{"label":"AutumnJ:1189-new-org-site-admin-no-pw","ref":"1189-new-org-site-admin-no-pw","sha":"eca156a17f9a35a1ee845b26f44c92c305d16a95","user":{"login":"AutumnJ","id":33694669,"node_id":"MDQ6VXNlcjMzNjk0NjY5","avatar_url":"https://avatars1.githubusercontent.com/u/33694669?v=4","gravatar_id":"","url":"https://api.github.com/users/AutumnJ","html_url":"https://github.com/AutumnJ","followers_url":"https://api.github.com/users/AutumnJ/followers","following_url":"https://api.github.com/users/AutumnJ/following{/other_user}","gists_url":"https://api.github.com/users/AutumnJ/gists{/gist_id}","starred_url":"https://api.github.com/users/AutumnJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutumnJ/subscriptions","organizations_url":"https://api.github.com/users/AutumnJ/orgs","repos_url":"https://api.github.com/users/AutumnJ/repos","events_url":"https://api.github.com/users/AutumnJ/events{/privacy}","received_events_url":"https://api.github.com/users/AutumnJ/received_events","type":"User","site_admin":false},"repo":{"id":202597878,"node_id":"MDEwOlJlcG9zaXRvcnkyMDI1OTc4Nzg=","name":"diaper","full_name":"AutumnJ/diaper","private":false,"owner":{"login":"AutumnJ","id":33694669,"node_id":"MDQ6VXNlcjMzNjk0NjY5","avatar_url":"https://avatars1.githubusercontent.com/u/33694669?v=4","gravatar_id":"","url":"https://api.github.com/users/AutumnJ","html_url":"https://github.com/AutumnJ","followers_url":"https://api.github.com/users/AutumnJ/followers","following_url":"https://api.github.com/users/AutumnJ/following{/other_user}","gists_url":"https://api.github.com/users/AutumnJ/gists{/gist_id}","starred_url":"https://api.github.com/users/AutumnJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutumnJ/subscriptions","organizations_url":"https://api.github.com/users/AutumnJ/orgs","repos_url":"https://api.github.com/users/AutumnJ/repos","events_url":"https://api.github.com/users/AutumnJ/events{/privacy}","received_events_url":"https://api.github.com/users/AutumnJ/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AutumnJ/diaper","description":"Diaperbase is an inventory system for diaper banks, to aid them in tracking their inventory and providing statistics about their inventory flows.","fork":true,"url":"https://api.github.com/repos/AutumnJ/diaper","forks_url":"https://api.github.com/repos/AutumnJ/diaper/forks","keys_url":"https://api.github.com/repos/AutumnJ/diaper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AutumnJ/diaper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AutumnJ/diaper/teams","hooks_url":"https://api.github.com/repos/AutumnJ/diaper/hooks","issue_events_url":"https://api.github.com/repos/AutumnJ/diaper/issues/events{/number}","events_url":"https://api.github.com/repos/AutumnJ/diaper/events","assignees_url":"https://api.github.com/repos/AutumnJ/diaper/assignees{/user}","branches_url":"https://api.github.com/repos/AutumnJ/diaper/branches{/branch}","tags_url":"https://api.github.com/repos/AutumnJ/diaper/tags","blobs_url":"https://api.github.com/repos/AutumnJ/diaper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AutumnJ/diaper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AutumnJ/diaper/git/refs{/sha}","trees_url":"https://api.github.com/repos/AutumnJ/diaper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AutumnJ/diaper/statuses/{sha}","languages_url":"https://api.github.com/repos/AutumnJ/diaper/languages","stargazers_url":"https://api.github.com/repos/AutumnJ/diaper/stargazers","contributors_url":"https://api.github.com/repos/AutumnJ/diaper/contributors","subscribers_url":"https://api.github.com/repos/AutumnJ/diaper/subscribers","subscription_url":"https://api.github.com/repos/AutumnJ/diaper/subscription","commits_url":"https://api.github.com/repos/AutumnJ/diaper/commits{/sha}","git_commits_url":"https://api.github.com/repos/AutumnJ/diaper/git/commits{/sha}","comments_url":"https://api.github.com/repos/AutumnJ/diaper/comments{/number}","issue_comment_url":"https://api.github.com/repos/AutumnJ/diaper/issues/comments{/number}","contents_url":"https://api.github.com/repos/AutumnJ/diaper/contents/{+path}","compare_url":"https://api.github.com/repos/AutumnJ/diaper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AutumnJ/diaper/merges","archive_url":"https://api.github.com/repos/AutumnJ/diaper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AutumnJ/diaper/downloads","issues_url":"https://api.github.com/repos/AutumnJ/diaper/issues{/number}","pulls_url":"https://api.github.com/repos/AutumnJ/diaper/pulls{/number}","milestones_url":"https://api.github.com/repos/AutumnJ/diaper/milestones{/number}","notifications_url":"https://api.github.com/repos/AutumnJ/diaper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AutumnJ/diaper/labels{/name}","releases_url":"https://api.github.com/repos/AutumnJ/diaper/releases{/id}","deployments_url":"https://api.github.com/repos/AutumnJ/diaper/deployments","created_at":"2019-08-15T19:13:35Z","updated_at":"2019-08-15T19:13:38Z","pushed_at":"2019-10-02T14:09:02Z","git_url":"git://github.com/AutumnJ/diaper.git","ssh_url":"git@github.com:AutumnJ/diaper.git","clone_url":"https://github.com/AutumnJ/diaper.git","svn_url":"https://github.com/AutumnJ/diaper","homepage":"https://diaper.app","size":23243,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rubyforgood:master","ref":"master","sha":"512cd71746d2a884ab2d72524192742b2317e9a6","user":{"login":"rubyforgood","id":11573263,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTczMjYz","avatar_url":"https://avatars1.githubusercontent.com/u/11573263?v=4","gravatar_id":"","url":"https://api.github.com/users/rubyforgood","html_url":"https://github.com/rubyforgood","followers_url":"https://api.github.com/users/rubyforgood/followers","following_url":"https://api.github.com/users/rubyforgood/following{/other_user}","gists_url":"https://api.github.com/users/rubyforgood/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyforgood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyforgood/subscriptions","organizations_url":"https://api.github.com/users/rubyforgood/orgs","repos_url":"https://api.github.com/users/rubyforgood/repos","events_url":"https://api.github.com/users/rubyforgood/events{/privacy}","received_events_url":"https://api.github.com/users/rubyforgood/received_events","type":"Organization","site_admin":false},"repo":{"id":89035461,"node_id":"MDEwOlJlcG9zaXRvcnk4OTAzNTQ2MQ==","name":"diaper","full_name":"rubyforgood/diaper","private":false,"owner":{"login":"rubyforgood","id":11573263,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTczMjYz","avatar_url":"https://avatars1.githubusercontent.com/u/11573263?v=4","gravatar_id":"","url":"https://api.github.com/users/rubyforgood","html_url":"https://github.com/rubyforgood","followers_url":"https://api.github.com/users/rubyforgood/followers","following_url":"https://api.github.com/users/rubyforgood/following{/other_user}","gists_url":"https://api.github.com/users/rubyforgood/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyforgood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyforgood/subscriptions","organizations_url":"https://api.github.com/users/rubyforgood/orgs","repos_url":"https://api.github.com/users/rubyforgood/repos","events_url":"https://api.github.com/users/rubyforgood/events{/privacy}","received_events_url":"https://api.github.com/users/rubyforgood/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/rubyforgood/diaper","description":"Diaperbase is an inventory system for diaper banks, to aid them in tracking their inventory and providing statistics about their inventory flows.","fork":false,"url":"https://api.github.com/repos/rubyforgood/diaper","forks_url":"https://api.github.com/repos/rubyforgood/diaper/forks","keys_url":"https://api.github.com/repos/rubyforgood/diaper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubyforgood/diaper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubyforgood/diaper/teams","hooks_url":"https://api.github.com/repos/rubyforgood/diaper/hooks","issue_events_url":"https://api.github.com/repos/rubyforgood/diaper/issues/events{/number}","events_url":"https://api.github.com/repos/rubyforgood/diaper/events","assignees_url":"https://api.github.com/repos/rubyforgood/diaper/assignees{/user}","branches_url":"https://api.github.com/repos/rubyforgood/diaper/branches{/branch}","tags_url":"https://api.github.com/repos/rubyforgood/diaper/tags","blobs_url":"https://api.github.com/repos/rubyforgood/diaper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubyforgood/diaper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubyforgood/diaper/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubyforgood/diaper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubyforgood/diaper/statuses/{sha}","languages_url":"https://api.github.com/repos/rubyforgood/diaper/languages","stargazers_url":"https://api.github.com/repos/rubyforgood/diaper/stargazers","contributors_url":"https://api.github.com/repos/rubyforgood/diaper/contributors","subscribers_url":"https://api.github.com/repos/rubyforgood/diaper/subscribers","subscription_url":"https://api.github.com/repos/rubyforgood/diaper/subscription","commits_url":"https://api.github.com/repos/rubyforgood/diaper/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubyforgood/diaper/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubyforgood/diaper/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubyforgood/diaper/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubyforgood/diaper/contents/{+path}","compare_url":"https://api.github.com/repos/rubyforgood/diaper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubyforgood/diaper/merges","archive_url":"https://api.github.com/repos/rubyforgood/diaper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubyforgood/diaper/downloads","issues_url":"https://api.github.com/repos/rubyforgood/diaper/issues{/number}","pulls_url":"https://api.github.com/repos/rubyforgood/diaper/pulls{/number}","milestones_url":"https://api.github.com/repos/rubyforgood/diaper/milestones{/number}","notifications_url":"https://api.github.com/repos/rubyforgood/diaper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubyforgood/diaper/labels{/name}","releases_url":"https://api.github.com/repos/rubyforgood/diaper/releases{/id}","deployments_url":"https://api.github.com/repos/rubyforgood/diaper/deployments","created_at":"2017-04-22T01:11:13Z","updated_at":"2019-10-02T23:41:32Z","pushed_at":"2019-10-02T19:13:20Z","git_url":"git://github.com/rubyforgood/diaper.git","ssh_url":"git@github.com:rubyforgood/diaper.git","clone_url":"https://github.com/rubyforgood/diaper.git","svn_url":"https://github.com/rubyforgood/diaper","homepage":"https://diaper.app","size":23773,"stargazers_count":134,"watchers_count":134,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":156,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":64,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":156,"open_issues":64,"watchers":134,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247"},"html":{"href":"https://github.com/rubyforgood/diaper/pull/1247"},"issue":{"href":"https://api.github.com/repos/rubyforgood/diaper/issues/1247"},"comments":{"href":"https://api.github.com/repos/rubyforgood/diaper/issues/1247/comments"},"review_comments":{"href":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247/comments"},"review_comment":{"href":"https://api.github.com/repos/rubyforgood/diaper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubyforgood/diaper/pulls/1247/commits"},"statuses":{"href":"https://api.github.com/repos/rubyforgood/diaper/statuses/eca156a17f9a35a1ee845b26f44c92c305d16a95"}},"author_association":"NONE"}}
{"actor":{"display_login":"mdworken"}}