From 4272eb7ffc7b89fe9d293962a0433a91e3dea58f Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 27 Oct 2021 15:01:41 +0200 Subject: [PATCH] FIX: prevents a circular json error in tests (#14738) The flow goes from: - getting current user object - creating a POJO using some of the current user keys - passing this POJO around, which end up being used in message bus - the processing fn associated ens up doing User.create on this object will both create a User object, but also inject store in it, store is holding a reference to currentUser Object and... BOOM, we have an object holding a reference to the same object, which JSON.stringify used in prepareBody of pretender doesn't like. --- .../javascripts/discourse/tests/helpers/presence-pretender.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/tests/helpers/presence-pretender.js b/app/assets/javascripts/discourse/tests/helpers/presence-pretender.js index eb356a153af..7afc731e5f1 100644 --- a/app/assets/javascripts/discourse/tests/helpers/presence-pretender.js +++ b/app/assets/javascripts/discourse/tests/helpers/presence-pretender.js @@ -48,7 +48,7 @@ export function joinChannel(name, user) { publishToMessageBus( `/presence${name}`, { - entering_users: [user], + entering_users: [Object.assign({}, user)], }, 0, channel.last_message_id