Don't call discourse hub during user destroy if hub integration is disabled
This commit is contained in:
parent
dc07563c0d
commit
eb151d440b
|
@ -20,7 +20,7 @@ class UserDestroyer
|
||||||
user.destroy.tap do |u|
|
user.destroy.tap do |u|
|
||||||
if u
|
if u
|
||||||
AdminLogger.new(@admin).log_user_deletion(user)
|
AdminLogger.new(@admin).log_user_deletion(user)
|
||||||
DiscourseHub.unregister_nickname(user.username)
|
DiscourseHub.unregister_nickname(user.username) if SiteSetting.call_discourse_hub?
|
||||||
MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id]
|
MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,10 +86,17 @@ describe UserDestroyer do
|
||||||
destroy
|
destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should unregister the nickname as the discourse hub' do
|
it 'should unregister the nickname as the discourse hub if hub integration is enabled' do
|
||||||
|
SiteSetting.stubs(:call_discourse_hub?).returns(true)
|
||||||
DiscourseHub.expects(:unregister_nickname).with(@user.username)
|
DiscourseHub.expects(:unregister_nickname).with(@user.username)
|
||||||
destroy
|
destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should not try to unregister the nickname as the discourse hub if hub integration is disabled' do
|
||||||
|
SiteSetting.stubs(:call_discourse_hub?).returns(false)
|
||||||
|
DiscourseHub.expects(:unregister_nickname).never
|
||||||
|
destroy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and destroy fails' do
|
context 'and destroy fails' do
|
||||||
|
|
Loading…
Reference in New Issue