mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 04:23:01 +08:00
Fix broken user created event trigger.
This commit is contained in:
parent
5169ef8814
commit
299b92b4d7
|
@ -96,6 +96,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
before_save :update_username_lower
|
before_save :update_username_lower
|
||||||
before_save :ensure_password_is_hashed
|
before_save :ensure_password_is_hashed
|
||||||
|
before_save :setup_trigger_user_created_event
|
||||||
|
|
||||||
after_save :expire_tokens_if_password_changed
|
after_save :expire_tokens_if_password_changed
|
||||||
after_save :automatic_group_membership
|
after_save :automatic_group_membership
|
||||||
|
@ -1064,11 +1065,6 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def trigger_user_created_event
|
|
||||||
DiscourseEvent.trigger(:user_created, self) if self.new_record?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def previous_visit_at_update_required?(timestamp)
|
def previous_visit_at_update_required?(timestamp)
|
||||||
|
@ -1082,6 +1078,16 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
|
|
Loading…
Reference in New Issue
Block a user