polfan-server-js-client 0.2.35 → 0.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/workspace.xml +10 -1
- package/build/index.cjs.js +14 -5
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/state-tracker/RoomsManager.ts +15 -6
package/package.json
CHANGED
|
@@ -319,12 +319,21 @@ export class RoomsManager {
|
|
|
319
319
|
const topics = this.topics.get(ev.message.location.roomId);
|
|
320
320
|
const topic = topics?.get(ev.message.location.topicId);
|
|
321
321
|
|
|
322
|
-
if (topic) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
if (!topic) {
|
|
323
|
+
return; // No topic found, nothing to update
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const newTopic = {
|
|
327
|
+
...topic,
|
|
328
|
+
messageCount: topic.messageCount + 1,
|
|
329
|
+
lastMessage: ev.message,
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
topics.set(newTopic);
|
|
333
|
+
const room = this.list.get(ev.message.location.roomId);
|
|
334
|
+
|
|
335
|
+
if (room.defaultTopic?.id === ev.message.location.topicId) {
|
|
336
|
+
this.list.set({ ...room, defaultTopic: newTopic });
|
|
328
337
|
}
|
|
329
338
|
}
|
|
330
339
|
}
|