diff options
-rw-r--r-- | app/models/email.rb | 4 | ||||
-rw-r--r-- | changelogs/unreleased/fix-email-confirmation-addtional-email.yml | 5 | ||||
-rw-r--r-- | spec/features/users/add_email_to_existing_account.rb | 15 |
3 files changed, 24 insertions, 0 deletions
diff --git a/app/models/email.rb b/app/models/email.rb index d6516761f0a..15bdedeac33 100644 --- a/app/models/email.rb +++ b/app/models/email.rb @@ -25,6 +25,10 @@ class Email < ActiveRecord::Base self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email) end + def accept_pending_invitations! + user.accept_pending_invitations! + end + # once email is confirmed, update the gpg signatures def update_invalid_gpg_signatures user.update_invalid_gpg_signatures if confirmed? diff --git a/changelogs/unreleased/fix-email-confirmation-addtional-email.yml b/changelogs/unreleased/fix-email-confirmation-addtional-email.yml new file mode 100644 index 00000000000..56a2efa4d60 --- /dev/null +++ b/changelogs/unreleased/fix-email-confirmation-addtional-email.yml @@ -0,0 +1,5 @@ +--- +title: Fix email confirmation bug when user adds additional email to account +merge_request: 20084 +author: muhammadn +type: fixed diff --git a/spec/features/users/add_email_to_existing_account.rb b/spec/features/users/add_email_to_existing_account.rb new file mode 100644 index 00000000000..4355f769429 --- /dev/null +++ b/spec/features/users/add_email_to_existing_account.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'AdditionalEmailToExistingAccount' do + describe 'add secondary email associated with account' do + let(:user) { create(:user) } + + it 'verifies confirmation of additional email' do + sign_in(user) + + email = create(:email, user: user) + visit email_confirmation_path(confirmation_token: email.confirmation_token) + expect(page).to have_content 'Your email address has been successfully confirmed.' + end + end +end |