From 7d4fbcb32e70eda3348ff5b3bdae6959ca108ed5 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 29 Mar 2019 11:11:53 +0100 Subject: [PATCH] Fix unconfirmed users clean-up issues [SCI-3172] --- app/controllers/users/omniauth_callbacks_controller.rb | 2 ++ app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 7b0bff2b9..dcaa55ca1 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -58,6 +58,8 @@ module Users reason: I18n.t('devise.linkedin.failed_to_save')) redirect_to after_omniauth_failure_path_for(resource_name) and return end + # Confirm user + @user.update_column(:confirmed_at, @user.created_at) redirect_to users_sign_up_provider_path(user: @user) end end diff --git a/app/models/user.rb b/app/models/user.rb index 0627847f5..f6ab10aa3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -209,7 +209,7 @@ class User < ApplicationRecord has_many :user_notifications, inverse_of: :user has_many :notifications, through: :user_notifications - has_many :user_system_notifications + has_many :user_system_notifications, dependent: :destroy has_many :system_notifications, through: :user_system_notifications has_many :zip_exports, inverse_of: :user, dependent: :destroy has_many :datatables_teams, class_name: '::Views::Datatables::DatatablesTeam'