mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
Add user_updated event to webhooks.
This commit is contained in:
parent
53086fdb98
commit
69330f8bc2
@ -71,7 +71,7 @@ class WebHook < ActiveRecord::Base
|
||||
WebHook.enqueue_topic_hooks(:topic_edited, post.topic) if post.is_first_post? && topic_changed
|
||||
end
|
||||
|
||||
%i(user_created user_approved).each do |event|
|
||||
%i(user_created user_approved user_updated).each do |event|
|
||||
DiscourseEvent.on(event) do |user|
|
||||
WebHook.enqueue_hooks(:user, user_id: user.id, event_name: event.to_s)
|
||||
end
|
||||
|
@ -98,7 +98,9 @@ class UserUpdater
|
||||
update_muted_users(attributes[:muted_usernames])
|
||||
end
|
||||
|
||||
(!save_options || user.user_option.save) && user_profile.save && user.save
|
||||
saved = (!save_options || user.user_option.save) && user_profile.save && user.save
|
||||
DiscourseEvent.trigger(:user_updated, user) if saved
|
||||
saved
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2573,7 +2573,7 @@ en:
|
||||
details: "When there is a new reply, edit, deleted or recovered."
|
||||
user_event:
|
||||
name: "User Event"
|
||||
details: "When a user is created or approved."
|
||||
details: "When a user is created, approved or updated."
|
||||
delivery_status:
|
||||
title: "Delivery Status"
|
||||
inactive: "Inactive"
|
||||
|
@ -131,7 +131,7 @@ describe WebHook do
|
||||
PostDestroyer.new(user, post2).recover
|
||||
end
|
||||
|
||||
it 'should enqueue the right hooks for user creation events' do
|
||||
it 'should enqueue the right hooks for user events' do
|
||||
WebHook.expects(:enqueue_hooks).once
|
||||
user
|
||||
|
||||
@ -140,6 +140,9 @@ describe WebHook do
|
||||
|
||||
WebHook.expects(:enqueue_hooks).once
|
||||
user.approve(admin)
|
||||
|
||||
WebHook.expects(:enqueue_hooks).once
|
||||
UserUpdater.new(admin, user).update(username: 'testing123')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user