mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: Replace User.unstage and User#unstage API with User#unstage! (#8906)
* DEV: Replace User.unstage and User#unstage API with User#unstage! Quoting @SamSaffron: > User.unstage mixes concerns of both unstaging users and updating params which is fragile/surprising. > u.unstage destroys notifications and raises a user_unstaged event prior to the user becoming unstaged and the user object being saved. User#unstage! no longer updates user attributes and saves the object before triggering the `user_unstaged` event. * Update one more spec * Assign attributes after unstaging
This commit is contained in:
@ -113,8 +113,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||
|
||||
# automatically activate/unstage any account if a provider marked the email valid
|
||||
if @auth_result.email_valid && @auth_result.email == user.email
|
||||
user.unstage
|
||||
user.save
|
||||
user.unstage!
|
||||
|
||||
if !user.active || !user.email_confirmed?
|
||||
user.update!(password: SecureRandom.hex)
|
||||
|
Reference in New Issue
Block a user