polfan-server-js-client 0.1.99913 → 0.1.99915

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/build/index.js CHANGED
@@ -974,13 +974,13 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
974
974
  * @internal
975
975
  */
976
976
  TopicHistoryWindow_createClass(TopicHistoryWindow, [{
977
- key: "_setTopicReference",
978
- value: function _setTopicReference(ref) {
979
- var refMessage = this.get(ref.messageId);
977
+ key: "_updateMessageReference",
978
+ value: function _updateMessageReference(refTopic) {
979
+ var refMessage = this.get(refTopic.refMessage.id);
980
980
  if (refMessage) {
981
981
  // Update referenced topic ID in message
982
982
  this.set(_objectSpread(_objectSpread({}, refMessage), {}, {
983
- topicRef: ref.topicId
983
+ topicRef: refTopic.id
984
984
  }));
985
985
  }
986
986
  }
@@ -992,7 +992,7 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
992
992
  while (1) {
993
993
  switch (_context5.prev = _context5.next) {
994
994
  case 0:
995
- if ([WindowState.LATEST, WindowState.LIVE].includes(this.state) && ev.location.roomId === this.roomId && ev.location.topicId === this.topicId) {
995
+ if ([WindowState.LATEST, WindowState.LIVE].includes(this.state) && ev.message.location.roomId === this.roomId && ev.message.location.topicId === this.topicId) {
996
996
  this.addItems([ev.message], 'tail');
997
997
  }
998
998
  case 1:
@@ -1342,13 +1342,9 @@ var RoomMessagesHistory = /*#__PURE__*/function () {
1342
1342
  this.historyWindows.set([topic.id, new TopicHistoryWindow(this.room.id, topic.id, this.tracker)]);
1343
1343
 
1344
1344
  // If new topic refers to some message from this room, update other structures
1345
- if (topic.messageRef) {
1346
- var refHistoryWindow = this.historyWindows.get(topic.messageRef.topicId);
1347
- refHistoryWindow._setTopicReference({
1348
- topicId: topic.id,
1349
- // Reverse the reference
1350
- messageId: topic.messageRef.messageId
1351
- });
1345
+ if (topic.refMessage) {
1346
+ var refHistoryWindow = this.historyWindows.get(topic.refMessage.location.topicId);
1347
+ refHistoryWindow === null || refHistoryWindow === void 0 ? void 0 : refHistoryWindow._updateMessageReference(topic);
1352
1348
  }
1353
1349
  }
1354
1350
  }]);
@@ -1813,8 +1809,8 @@ var MessagesManager = /*#__PURE__*/function () {
1813
1809
  key: "updateLocallyFollowedTopicOnNewMessage",
1814
1810
  value: function updateLocallyFollowedTopicOnNewMessage(ev) {
1815
1811
  var _this$tracker$me;
1816
- var roomFollowedTopics = this.followedTopics.get(ev.location.roomId);
1817
- var followedTopic = roomFollowedTopics === null || roomFollowedTopics === void 0 ? void 0 : roomFollowedTopics.get(ev.location.topicId);
1812
+ var roomFollowedTopics = this.followedTopics.get(ev.message.location.roomId);
1813
+ var followedTopic = roomFollowedTopics === null || roomFollowedTopics === void 0 ? void 0 : roomFollowedTopics.get(ev.message.location.topicId);
1818
1814
  if (!roomFollowedTopics || !followedTopic) {
1819
1815
  // Skip if we don't follow this room or targeted topic
1820
1816
  return;
@@ -2388,8 +2384,8 @@ var RoomsManager = /*#__PURE__*/function () {
2388
2384
  }, {
2389
2385
  key: "handleNewMessage",
2390
2386
  value: function handleNewMessage(ev) {
2391
- var topics = this.topics.get(ev.location.roomId);
2392
- var topic = topics === null || topics === void 0 ? void 0 : topics.get(ev.location.topicId);
2387
+ var topics = this.topics.get(ev.message.location.roomId);
2388
+ var topic = topics === null || topics === void 0 ? void 0 : topics.get(ev.message.location.topicId);
2393
2389
  if (topic) {
2394
2390
  topics.set(RoomsManager_objectSpread(RoomsManager_objectSpread({}, topic), {}, {
2395
2391
  messageCount: topic.messageCount + 1,