Merge branch 'next-minor' into develop
This commit is contained in:
commit
44e10a9172
3 changed files with 22 additions and 6 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
* Change email without confirmation when mail is disabled [#7455](https://github.com/diaspora/diaspora/pull/7455)
|
||||||
|
|
||||||
# 0.6.6.0
|
# 0.6.6.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,15 +211,23 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_email(user_data)
|
def change_email(user_data)
|
||||||
@user.unconfirmed_email = user_data[:email]
|
if AppConfig.mail.enable?
|
||||||
if @user.save
|
@user.unconfirmed_email = user_data[:email]
|
||||||
@user.send_confirm_email
|
if @user.save
|
||||||
if @user.unconfirmed_email
|
@user.send_confirm_email
|
||||||
flash.now[:notice] = t("users.update.unconfirmed_email_changed")
|
flash.now[:notice] = t("users.update.unconfirmed_email_changed")
|
||||||
|
else
|
||||||
|
@user.reload # match user object with the database
|
||||||
|
flash.now[:error] = t("users.update.unconfirmed_email_not_changed")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@user.reload # match user object with the database
|
@user.email = user_data[:email]
|
||||||
flash.now[:error] = t("users.update.unconfirmed_email_not_changed")
|
if @user.save
|
||||||
|
flash.now[:notice] = t("users.update.settings_updated")
|
||||||
|
else
|
||||||
|
@user.reload
|
||||||
|
flash.now[:error] = t("users.update.unconfirmed_email_not_changed")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,13 @@ describe UsersController, :type => :controller do
|
||||||
expect(Workers::Mail::ConfirmEmail).to receive(:perform_async).with(@user.id).once
|
expect(Workers::Mail::ConfirmEmail).to receive(:perform_async).with(@user.id).once
|
||||||
put(:update, :id => @user.id, :user => { :email => "my@newemail.com"})
|
put(:update, :id => @user.id, :user => { :email => "my@newemail.com"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "saves unconfirmed_email when podmail is disabled" do
|
||||||
|
AppConfig.mail.enable = false
|
||||||
|
put(:update, id: @user.id, user: {email: "my@newemail.com"})
|
||||||
|
@user.reload
|
||||||
|
expect(@user.email).to eql("my@newemail.com")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "email settings" do
|
describe "email settings" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue