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
|
||||
|
||||
## Features
|
||||
* Change email without confirmation when mail is disabled [#7455](https://github.com/diaspora/diaspora/pull/7455)
|
||||
|
||||
# 0.6.6.0
|
||||
|
||||
|
|
|
|||
|
|
@ -211,15 +211,23 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def change_email(user_data)
|
||||
@user.unconfirmed_email = user_data[:email]
|
||||
if @user.save
|
||||
@user.send_confirm_email
|
||||
if @user.unconfirmed_email
|
||||
if AppConfig.mail.enable?
|
||||
@user.unconfirmed_email = user_data[:email]
|
||||
if @user.save
|
||||
@user.send_confirm_email
|
||||
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
|
||||
else
|
||||
@user.reload # match user object with the database
|
||||
flash.now[:error] = t("users.update.unconfirmed_email_not_changed")
|
||||
@user.email = user_data[:email]
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -203,6 +203,13 @@ describe UsersController, :type => :controller do
|
|||
expect(Workers::Mail::ConfirmEmail).to receive(:perform_async).with(@user.id).once
|
||||
put(:update, :id => @user.id, :user => { :email => "my@newemail.com"})
|
||||
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
|
||||
|
||||
describe "email settings" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue