mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
optimize enqueuing activation email code
This commit is contained in:
parent
0b01d0e95d
commit
6c997b65d9
|
@ -650,7 +650,7 @@ class UsersController < ApplicationController
|
|||
|
||||
def enqueue_activation_email
|
||||
@email_token ||= @user.email_tokens.create(email: @user.email)
|
||||
Jobs.enqueue_in(1.second, :critical_user_email, type: :signup, user_id: @user.id, email_token: @email_token.token)
|
||||
Jobs.enqueue(:critical_user_email, type: :signup, user_id: @user.id, email_token: @email_token.token, to_address: @user.email)
|
||||
end
|
||||
|
||||
def search_users
|
||||
|
|
|
@ -1498,7 +1498,7 @@ describe UsersController do
|
|||
unconfirmed_email_user = Fabricate(:user, active: true)
|
||||
unconfirmed_email_user.email_tokens.create(email: unconfirmed_email_user.email)
|
||||
session[SessionController::ACTIVATE_USER_KEY] = unconfirmed_email_user.id
|
||||
Jobs.expects(:enqueue).with(:critical_user_email, has_entries(type: :signup))
|
||||
Jobs.expects(:enqueue).with(:critical_user_email, has_entries(type: :signup, to_address: unconfirmed_email_user.email))
|
||||
xhr :post, :send_activation_email, username: unconfirmed_email_user.username
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
|
Loading…
Reference in New Issue
Block a user