Fix new direct message showing with room (#2386)
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Sat, 5 Jul 2025 11:31:15 +0000 (17:01 +0530)
committerGitHub <noreply@github.com>
Sat, 5 Jul 2025 11:31:15 +0000 (21:31 +1000)
as we were mutating the content of m.direct the sdk was comparing old value with new one and preventing update if found equal

src/client/action/room.js

index 90b748104de7f5d8616ecf65d226e02ccad5ed3d..767914b567d2d87c707bb4a7b3d002c10aa58063 100644 (file)
@@ -12,7 +12,7 @@ function addRoomToMDirect(mx, roomId, userId) {
   const mDirectsEvent = mx.getAccountData('m.direct');
   let userIdToRoomIds = {};
 
-  if (typeof mDirectsEvent !== 'undefined') userIdToRoomIds = mDirectsEvent.getContent();
+  if (typeof mDirectsEvent !== 'undefined') userIdToRoomIds = structuredClone(mDirectsEvent.getContent());
 
   // remove it from the lists of any others users
   // (it can only be a DM room for one person)