mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 20:18:53 +08:00
Revert "FIX: always trigger the ':user_updated' event"
This reverts commit 519b70ea4692834638e4b95c92b81a2160621681. https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643
This commit is contained in:
parent
e91a631978
commit
19f3b81161
@ -108,7 +108,6 @@ class User < ActiveRecord::Base
|
||||
after_save :expire_old_email_tokens
|
||||
after_save :index_search
|
||||
after_commit :trigger_user_created_event, on: :create
|
||||
after_commit :trigger_user_updated_event, on: :update
|
||||
|
||||
before_destroy do
|
||||
# These tables don't have primary keys, so destroying them with activerecord is tricky:
|
||||
@ -1098,11 +1097,6 @@ class User < ActiveRecord::Base
|
||||
true
|
||||
end
|
||||
|
||||
def trigger_user_updated_event
|
||||
DiscourseEvent.trigger(:user_updated, self)
|
||||
true
|
||||
end
|
||||
|
||||
def set_should_validate_email
|
||||
if self.primary_email
|
||||
self.primary_email.should_validate_email = should_validate_email_address?
|
||||
|
@ -122,6 +122,7 @@ class UserUpdater
|
||||
end
|
||||
end
|
||||
|
||||
DiscourseEvent.trigger(:user_updated, user) if saved
|
||||
saved
|
||||
end
|
||||
|
||||
|
@ -91,15 +91,12 @@ describe User do
|
||||
user.approve(admin)
|
||||
end
|
||||
|
||||
it 'triggers extensibility events' do
|
||||
it 'triggers a extensibility event' do
|
||||
user && admin # bypass the user_created event
|
||||
user_updated_event, user_approved_event = DiscourseEvent.track_events { user.approve(admin) }
|
||||
event = DiscourseEvent.track_events { user.approve(admin) }.first
|
||||
|
||||
expect(user_updated_event[:event_name]).to eq(:user_updated)
|
||||
expect(user_updated_event[:params].first).to eq(user)
|
||||
|
||||
expect(user_approved_event[:event_name]).to eq(:user_approved)
|
||||
expect(user_approved_event[:params].first).to eq(user)
|
||||
expect(event[:event_name]).to eq(:user_approved)
|
||||
expect(event[:params].first).to eq(user)
|
||||
end
|
||||
|
||||
context 'after approval' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user