mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
Merge pull request #4293 from jasonk357/4031-change-user-email-alert
Improve user email change flash alert message
This commit is contained in:
@@ -46,7 +46,12 @@ module Spree
|
||||
@user.spree_roles = roles.reject(&:blank?).collect{ |r| Spree::Role.find(r) }
|
||||
end
|
||||
|
||||
flash.now[:success] = Spree.t(:account_updated)
|
||||
message = if new_email_unconfirmed?
|
||||
Spree.t(:email_updated)
|
||||
else
|
||||
Spree.t(:account_updated)
|
||||
end
|
||||
flash.now[:success] = message
|
||||
end
|
||||
render :edit
|
||||
end
|
||||
@@ -126,6 +131,10 @@ module Spree
|
||||
def load_roles
|
||||
@roles = Spree::Role.scoped
|
||||
end
|
||||
|
||||
def new_email_unconfirmed?
|
||||
params[:user][:email] != @user.email
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2943,6 +2943,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
email: Email
|
||||
# TODO: remove 'account_updated' key once we get to Spree 2.0
|
||||
account_updated: "Account updated!"
|
||||
email_updated: "The account will be updated once the new email is confirmed."
|
||||
my_account: "My account"
|
||||
date: "Date"
|
||||
time: "Time"
|
||||
|
||||
@@ -64,6 +64,13 @@ feature "Managing users" do
|
||||
|
||||
expect(page).to have_content("Account updated")
|
||||
end
|
||||
|
||||
it "should let me edit the user email" do
|
||||
fill_in "Email", with: "newemail@example.org"
|
||||
click_button "Update"
|
||||
|
||||
expect(page).to have_content("The account will be updated once the new email is confirmed.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user