polfan-server-js-client 0.2.34 → 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.
@@ -4,7 +4,7 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="New message type" />
7
+ <list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Dedicated event for user status change" />
8
8
  <option name="SHOW_DIALOG" value="false" />
9
9
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
10
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -99,6 +99,8 @@
99
99
  <workItem from="1751050123708" duration="983000" />
100
100
  <workItem from="1751060147554" duration="143000" />
101
101
  <workItem from="1751159757238" duration="782000" />
102
+ <workItem from="1751539766803" duration="1251000" />
103
+ <workItem from="1751551622570" duration="125000" />
102
104
  </task>
103
105
  <task id="LOCAL-00001" summary="Emoticons objects">
104
106
  <option name="closed" value="true" />
@@ -388,7 +390,23 @@
388
390
  <option name="project" value="LOCAL" />
389
391
  <updated>1751160521070</updated>
390
392
  </task>
391
- <option name="localTasksCounter" value="37" />
393
+ <task id="LOCAL-00037" summary="Dedicated event for user status change">
394
+ <option name="closed" value="true" />
395
+ <created>1751547708628</created>
396
+ <option name="number" value="00037" />
397
+ <option name="presentableId" value="LOCAL-00037" />
398
+ <option name="project" value="LOCAL" />
399
+ <updated>1751547708628</updated>
400
+ </task>
401
+ <task id="LOCAL-00038" summary="Dedicated event for user status change">
402
+ <option name="closed" value="true" />
403
+ <created>1751551734548</created>
404
+ <option name="number" value="00038" />
405
+ <option name="presentableId" value="LOCAL-00038" />
406
+ <option name="project" value="LOCAL" />
407
+ <updated>1751551734548</updated>
408
+ </task>
409
+ <option name="localTasksCounter" value="39" />
392
410
  <servers />
393
411
  </component>
394
412
  <component name="TypeScriptGeneratedFilesManager">
@@ -427,6 +445,7 @@
427
445
  <MESSAGE value="Fix package.json exports" />
428
446
  <MESSAGE value="Fix package.json type exports" />
429
447
  <MESSAGE value="New message type" />
430
- <option name="LAST_COMMIT_MESSAGE" value="New message type" />
448
+ <MESSAGE value="Dedicated event for user status change" />
449
+ <option name="LAST_COMMIT_MESSAGE" value="Dedicated event for user status change" />
431
450
  </component>
432
451
  </project>
@@ -1179,11 +1179,20 @@ class RoomsManager {
1179
1179
  handleNewMessage(ev) {
1180
1180
  const topics = this.topics.get(ev.message.location.roomId);
1181
1181
  const topic = topics?.get(ev.message.location.topicId);
1182
- if (topic) {
1183
- topics.set({
1184
- ...topic,
1185
- messageCount: topic.messageCount + 1,
1186
- lastMessage: ev.message
1182
+ if (!topic) {
1183
+ return; // No topic found, nothing to update
1184
+ }
1185
+ const newTopic = {
1186
+ ...topic,
1187
+ messageCount: topic.messageCount + 1,
1188
+ lastMessage: ev.message
1189
+ };
1190
+ topics.set(newTopic);
1191
+ const room = this.list.get(ev.message.location.roomId);
1192
+ if (room.defaultTopic?.id === ev.message.location.topicId) {
1193
+ this.list.set({
1194
+ ...room,
1195
+ defaultTopic: newTopic
1187
1196
  });
1188
1197
  }
1189
1198
  }
@@ -1894,7 +1903,7 @@ class UsersManager {
1894
1903
  users.forEach(newUser => {
1895
1904
  const oldUser = this.users.get(newUser.id);
1896
1905
  if (oldUser && oldUser.online !== newUser.online) {
1897
- this.onlineStatus.emit('changed', newUser);
1906
+ this.onlineStatus.emit('change', newUser);
1898
1907
  }
1899
1908
  });
1900
1909
  this.users.set(...users);