Fix broken user created event trigger.

This commit is contained in:
Guo Xiang Tan 2017-03-16 15:36:27 +08:00
parent 5169ef8814
commit 299b92b4d7

View File

@ -96,6 +96,7 @@ class User < ActiveRecord::Base
before_save :update_username_lower
before_save :ensure_password_is_hashed
before_save :setup_trigger_user_created_event
after_save :expire_tokens_if_password_changed
after_save :automatic_group_membership
@ -1064,11 +1065,6 @@ class User < ActiveRecord::Base
end
end
def trigger_user_created_event
DiscourseEvent.trigger(:user_created, self) if self.new_record?
true
end
private
def previous_visit_at_update_required?(timestamp)
@ -1082,6 +1078,16 @@ class User < ActiveRecord::Base
end
end
def setup_trigger_user_created_event
@trigger_user_created_event = self.new_record?
true
end
def trigger_user_created_event
DiscourseEvent.trigger(:user_created, self) if @trigger_user_created_event
true
end
end
# == Schema Information