From 5de86ad7ed8e59802b60d52b7144c79a5fbbdc72 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 8 Aug 2023 22:44:30 +0200 Subject: [PATCH] FIX: removes useless model reload (#23016) I suspect it was moreover possibly related to a flaky spec: ``` 1) Chat::AutoJoinChannelBatch.call when arguments are valid when channel is found when more than one membership is created publishes an event Failure/Error: subject(:result) { described_class.call(params) } Mocha::ExpectationError: unexpected invocation: Chat::Publisher.publish_new_channel(#, #) unsatisfied expectations: - expected exactly once, invoked never: Chat::Publisher.publish_new_channel(#, [#, #]) satisfied expectations: - allowed any number of times, invoked once: Chat::Action::CreateMembershipsForAutoJoin.call(has_entries({:channel => #, :contract => instance_of(Chat::AutoJoinChannelBatch::Contract)})) - allowed any number of times, invoked never: Chat::ChannelMembershipManager.new(#) - allowed any number of times, invoked never: #.recalculate_user_count(any_parameters) # ./plugins/chat/app/services/chat/auto_join_channel_batch.rb:65:in `publish_new_channel' # ./plugins/chat/app/services/service/base.rb:118:in `instance_exec' # ./plugins/chat/app/services/service/base.rb:118:in `call' # ./plugins/chat/app/services/service/base.rb:368:in `block in run!' # ./plugins/chat/app/services/service/base.rb:368:in `each' # ./plugins/chat/app/services/service/base.rb:368:in `run!' # ./plugins/chat/app/services/service/base.rb:361:in `run' # ./plugins/chat/app/services/service/base.rb:229:in `call' # ./plugins/chat/spec/services/chat/auto_join_channel_batch_spec.rb:50:in `block (3 levels) in
' # ./plugins/chat/spec/services/chat/auto_join_channel_batch_spec.rb:110:in `block (6 levels) in
' # ./spec/rails_helper.rb:393:in `block (2 levels) in ' ``` --- plugins/chat/app/services/chat/auto_join_channel_batch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/chat/app/services/chat/auto_join_channel_batch.rb b/plugins/chat/app/services/chat/auto_join_channel_batch.rb index 7337835f48a..bc5375e9472 100644 --- a/plugins/chat/app/services/chat/auto_join_channel_batch.rb +++ b/plugins/chat/app/services/chat/auto_join_channel_batch.rb @@ -62,7 +62,7 @@ module Chat end def publish_new_channel(channel:, added_user_ids:, **) - ::Chat::Publisher.publish_new_channel(channel.reload, User.where(id: added_user_ids)) + ::Chat::Publisher.publish_new_channel(channel, User.where(id: added_user_ids)) end end end