-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added method for managers to update a user's email #1363
base: master
Are you sure you want to change the base?
Added method for managers to update a user's email #1363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some comments, also the design I see in the gif is not the one in the issue...Please review the requirements and in case you've questions ask us :)
@@ -1,3 +1,4 @@ | |||
<h2><%= t("management.account.show.title") %></h2> | |||
|
|||
<%= render 'management/users/erase_user_account' %> | |||
<%= render 'management/users/edit_user_account' %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a block to check if the user has email, as it's warned in the issue's "Notes" section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the notes section warns about users without email, in that case the form will appear empty.
Maybe there is something that I don't understand, but any user can have an email even if they don't have one at the moment, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right @raul-fuentes. The edit_user_account
form should always be displayed as scenarios are:
- User has an email: Manager should be able to change it
- User does not have an email: Manager should be able to set a value for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the actual behaviour, should I remark it some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's good 👍 I just wrote it as "I think.." because I needed to double check it afterwards
@@ -1,9 +1,11 @@ | |||
<%= link_to t("management.users.erase_account_link"), "#", class: "button hollow alert js-toggle-link", data: { "toggle-selector" => "#erase-account-form" } %> | |||
<%= link_to t("management.users.erase_account_link"), "#", class: "button hollow alert js-toggle-link edit-account-form", data: { "toggle-selector" => "#erase-account-form" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would indent this element more like this one here to make it more readable.
config/locales/en/management.yml
Outdated
@@ -121,6 +121,8 @@ en: | |||
erase_account_confirm: Are you sure you want to erase the account? This action can not be undone | |||
erase_warning: This action can not be undone. Please make sure you want to erase this account. | |||
erase_submit: Delete account | |||
edit_account: Edit account |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the email is the only field we're changing here...I would go for an "Edit email" and "Update email"
config/locales/es/management.yml
Outdated
@@ -121,6 +121,8 @@ es: | |||
erase_account_confirm: '¿Seguro que quieres borrar a este usuario? Esta acción no se puede deshacer' | |||
erase_warning: Esta acción no se puede deshacer. Por favor asegúrese de que quiere eliminar esta cuenta. | |||
erase_submit: Borrar cuenta | |||
edit_account: Editar cuenta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the comment above.
7be4f9c
to
16bdde3
Compare
@raul-fuentes after changing the "Edit account" texts that maria requested, you're missing some changes in the specs expectations as well https://travis-ci.org/AyuntamientoMadrid/consul/jobs/355308112 at |
16bdde3
to
a1b1c2e
Compare
@raul-fuentes it's always a good idea to comment on the PR so we can notice requested changes has been applied 👍 we don't cycle through all pending changes PR's refreshing to see if there are changes. |
Thanks for the advise, I 'll do it from now on |
I'm sorry to contradict decabeza's mockups, but after reviewing consuldemocracy#2500 as well, this is going to get crazy if we keep adding more and more options as ajax forms that appear and dissapear as a toggle We're talking about a section that is used by Public Workers only:
So with @decabeza 's agreement I'm proposing to: 1- Create a submenu under "Edit user account" menu item with "Edit Email" title. That menu will display the email change form (✅ working as expected) and nothing more Also with this we can avoid those |
c696efd
to
c899d16
Compare
As you can see #1370 was merged and some conflicts appeared (nothing serious as far as I have seen). Your PR has a fix for an spec that was failing in itziar's 👍, and the "Change user" red link 👌 . But it would be nice it you could merge from his changes the "Dropdown" effect that the her PR added: |
c899d16
to
8751cfc
Compare
@bertocq all the requested changes are done. Just one thing. Its correct or is too long and maybe its better to show it in a green warn square like the warning before deleting an account? |
@raul-fuentes yes I was thinking about an square below the "Cuenta de usuario" title.
|
8751cfc
to
1cb7d2c
Compare
@bertocq here are the new changes. |
Great @raul-fuentes ! Only left the merge conflicts |
1cb7d2c
to
7ddd2b6
Compare
@bertocq, also merged the conflicts |
There are some spec/i18n_spec.rb and spec/features/management/users_spec.rb test failures raul :( |
7ddd2b6
to
a16c4b1
Compare
Hello @bertocq I just saw Travis a moment ago! |
7dc5477
to
5c0fdfb
Compare
PR updated! |
5c0fdfb
to
40e21de
Compare
@@ -72,7 +72,7 @@ | |||
expect(user.date_of_birth).to have_content Date.new(1980, 12, 31) | |||
end | |||
|
|||
scenario 'Delete a level 2 user account from document verification page', :js do | |||
scenario 'Delete a level 2 user account from document verification page', js: true do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
|
||
click_button "Update email" | ||
|
||
expect(page).to have_content 'has already been taken' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
|
||
click_link "Edit email" | ||
|
||
fill_in 'user_email', with: user1.email |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
|
||
end | ||
|
||
scenario 'Update user email errors', :js do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
|
||
click_button "Update email" | ||
|
||
expect(user.reload.unconfirmed_email).to eq '[email protected]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
|
||
click_link "Edit email" | ||
|
||
fill_in 'user_email', with: '[email protected]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
@@ -104,4 +113,37 @@ | |||
expect(page).to have_css("div.for-print-only", text: 'another_new_password', visible: false) | |||
end | |||
|
|||
scenario 'Update user email', :js do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
end | ||
|
||
accept_alert do | ||
within '#erase-account-form' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
user = create(:user, :level_two) | ||
login_managed_user(user) | ||
|
||
visit management_account_path | ||
|
||
click_link "Delete user" | ||
accept_confirm { click_link "Delete account" } | ||
within '.is-active' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
|
||
expect(page).to have_content "No verified user logged in yet" | ||
end | ||
|
||
scenario 'Delete a user account', :js do | ||
scenario 'Delete user account', :js do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
References
consuldemocracy#2499
Objectives
Added method and interface for a manager user to change emails of confirmed users
Visual Changes
Notes
none