polfan-server-js-client 0.2.89 → 0.2.90
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 +15 -13
- package/build/index.cjs.js +100 -22
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/state-tracker/MessagesManager.d.ts +6 -1
- package/build/types/state-tracker/RoomMessagesHistory.d.ts +3 -1
- package/package.json +1 -1
- package/src/state-tracker/MessagesManager.ts +31 -2
- package/src/state-tracker/RoomMessagesHistory.ts +4 -2
- package/src/state-tracker/RoomsManager.ts +5 -6
package/.idea/workspace.xml
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
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="
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Update Topic on redacted message">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/MessagesManager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/MessagesManager.ts" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/RoomMessagesHistory.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/RoomMessagesHistory.ts" afterDir="false" />
|
|
8
10
|
<change beforePath="$PROJECT_DIR$/src/state-tracker/RoomsManager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/RoomsManager.ts" afterDir="false" />
|
|
9
11
|
</list>
|
|
10
12
|
<option name="SHOW_DIALOG" value="false" />
|
|
@@ -190,15 +192,7 @@
|
|
|
190
192
|
<workItem from="1776327180094" duration="5055000" />
|
|
191
193
|
<workItem from="1777136687009" duration="3369000" />
|
|
192
194
|
<workItem from="1777301595900" duration="1696000" />
|
|
193
|
-
<workItem from="1778067371586" duration="
|
|
194
|
-
</task>
|
|
195
|
-
<task id="LOCAL-00039" summary="Fix update the latest message in a room default topic">
|
|
196
|
-
<option name="closed" value="true" />
|
|
197
|
-
<created>1751562062024</created>
|
|
198
|
-
<option name="number" value="00039" />
|
|
199
|
-
<option name="presentableId" value="LOCAL-00039" />
|
|
200
|
-
<option name="project" value="LOCAL" />
|
|
201
|
-
<updated>1751562062024</updated>
|
|
195
|
+
<workItem from="1778067371586" duration="4596000" />
|
|
202
196
|
</task>
|
|
203
197
|
<task id="LOCAL-00040" summary="Adapt FilesClient to new files API">
|
|
204
198
|
<option name="closed" value="true" />
|
|
@@ -584,7 +578,15 @@
|
|
|
584
578
|
<option name="project" value="LOCAL" />
|
|
585
579
|
<updated>1778068934825</updated>
|
|
586
580
|
</task>
|
|
587
|
-
<
|
|
581
|
+
<task id="LOCAL-00088" summary="Update Topic on redacted message">
|
|
582
|
+
<option name="closed" value="true" />
|
|
583
|
+
<created>1778069870246</created>
|
|
584
|
+
<option name="number" value="00088" />
|
|
585
|
+
<option name="presentableId" value="LOCAL-00088" />
|
|
586
|
+
<option name="project" value="LOCAL" />
|
|
587
|
+
<updated>1778069870246</updated>
|
|
588
|
+
</task>
|
|
589
|
+
<option name="localTasksCounter" value="89" />
|
|
588
590
|
<servers />
|
|
589
591
|
</component>
|
|
590
592
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -602,7 +604,6 @@
|
|
|
602
604
|
</option>
|
|
603
605
|
</component>
|
|
604
606
|
<component name="VcsManagerConfiguration">
|
|
605
|
-
<MESSAGE value="Collection integration with React JS rework" />
|
|
606
607
|
<MESSAGE value="Update deps and improve library building" />
|
|
607
608
|
<MESSAGE value="Improvements and fixes to collection mirroring" />
|
|
608
609
|
<MESSAGE value="Align to custom colors and nicks protocol changes" />
|
|
@@ -627,7 +628,8 @@
|
|
|
627
628
|
<MESSAGE value="Adjust to ban changes" />
|
|
628
629
|
<MESSAGE value="TopicHistoryWindow retainRatio and event handling improvements" />
|
|
629
630
|
<MESSAGE value="Remove removed message from Topic last message" />
|
|
630
|
-
<
|
|
631
|
+
<MESSAGE value="Update Topic on redacted message" />
|
|
632
|
+
<option name="LAST_COMMIT_MESSAGE" value="Update Topic on redacted message" />
|
|
631
633
|
</component>
|
|
632
634
|
<component name="XSLT-Support.FileAssociations.UIState">
|
|
633
635
|
<expand />
|
package/build/index.cjs.js
CHANGED
|
@@ -1442,16 +1442,21 @@ var RoomMessagesHistory = /*#__PURE__*/function () {
|
|
|
1442
1442
|
|
|
1443
1443
|
/**
|
|
1444
1444
|
* Returns a history window object for the given topic ID, allowing you to view message history.
|
|
1445
|
+
* @param topicId
|
|
1446
|
+
* @param peek If true, do not create a cache for this topic and do not allow it to collect new messages.
|
|
1445
1447
|
*/
|
|
1446
1448
|
return RoomMessagesHistory_createClass(RoomMessagesHistory, [{
|
|
1447
1449
|
key: "getMessagesWindow",
|
|
1448
1450
|
value: (function () {
|
|
1449
1451
|
var _getMessagesWindow = RoomMessagesHistory_asyncToGenerator(/*#__PURE__*/RoomMessagesHistory_regenerator().m(function _callee(topicId) {
|
|
1450
|
-
var
|
|
1452
|
+
var peek,
|
|
1453
|
+
topic,
|
|
1454
|
+
_args = arguments;
|
|
1451
1455
|
return RoomMessagesHistory_regenerator().w(function (_context) {
|
|
1452
1456
|
while (1) switch (_context.n) {
|
|
1453
1457
|
case 0:
|
|
1454
|
-
|
|
1458
|
+
peek = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
1459
|
+
if (!(!this.historyWindows.has(topicId) && !peek)) {
|
|
1455
1460
|
_context.n = 2;
|
|
1456
1461
|
break;
|
|
1457
1462
|
}
|
|
@@ -1905,6 +1910,49 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1905
1910
|
}
|
|
1906
1911
|
(_this$followedTopics$ = this.followedTopics.get(roomId)) === null || _this$followedTopics$ === void 0 || _this$followedTopics$["delete"].apply(_this$followedTopics$, topicIds);
|
|
1907
1912
|
}
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* For internal use.
|
|
1916
|
+
* @internal
|
|
1917
|
+
*/
|
|
1918
|
+
}, {
|
|
1919
|
+
key: "_resolveLastMessage",
|
|
1920
|
+
value: (function () {
|
|
1921
|
+
var _resolveLastMessage2 = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee7(location) {
|
|
1922
|
+
var message, _result$data, result;
|
|
1923
|
+
return MessagesManager_regenerator().w(function (_context7) {
|
|
1924
|
+
while (1) switch (_context7.n) {
|
|
1925
|
+
case 0:
|
|
1926
|
+
_context7.n = 1;
|
|
1927
|
+
return this.getRoomHistory(location.roomId).then(function (roomHistory) {
|
|
1928
|
+
return roomHistory === null || roomHistory === void 0 ? void 0 : roomHistory.getMessagesWindow(location.topicId, true);
|
|
1929
|
+
}).then(function (historyWindow) {
|
|
1930
|
+
return (historyWindow === null || historyWindow === void 0 ? void 0 : historyWindow.hasLatest) && historyWindow.getAt(historyWindow.length - 1);
|
|
1931
|
+
});
|
|
1932
|
+
case 1:
|
|
1933
|
+
message = _context7.v;
|
|
1934
|
+
if (message) {
|
|
1935
|
+
_context7.n = 3;
|
|
1936
|
+
break;
|
|
1937
|
+
}
|
|
1938
|
+
_context7.n = 2;
|
|
1939
|
+
return this.tracker.client.send('GetMessages', {
|
|
1940
|
+
location: location,
|
|
1941
|
+
limit: 1
|
|
1942
|
+
});
|
|
1943
|
+
case 2:
|
|
1944
|
+
result = _context7.v;
|
|
1945
|
+
message = (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.messages[0];
|
|
1946
|
+
case 3:
|
|
1947
|
+
return _context7.a(2, message || null);
|
|
1948
|
+
}
|
|
1949
|
+
}, _callee7, this);
|
|
1950
|
+
}));
|
|
1951
|
+
function _resolveLastMessage(_x6) {
|
|
1952
|
+
return _resolveLastMessage2.apply(this, arguments);
|
|
1953
|
+
}
|
|
1954
|
+
return _resolveLastMessage;
|
|
1955
|
+
}())
|
|
1908
1956
|
}, {
|
|
1909
1957
|
key: "createHistoryForNewRoom",
|
|
1910
1958
|
value: function createHistoryForNewRoom(room) {
|
|
@@ -1953,16 +2001,16 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1953
2001
|
}, {
|
|
1954
2002
|
key: "handleNewTopic",
|
|
1955
2003
|
value: function () {
|
|
1956
|
-
var _handleNewTopic = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
2004
|
+
var _handleNewTopic = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee8(ev) {
|
|
1957
2005
|
var result, followedTopic;
|
|
1958
|
-
return MessagesManager_regenerator().w(function (
|
|
1959
|
-
while (1) switch (
|
|
2006
|
+
return MessagesManager_regenerator().w(function (_context8) {
|
|
2007
|
+
while (1) switch (_context8.n) {
|
|
1960
2008
|
case 0:
|
|
1961
2009
|
if (!this.followedTopics.has(ev.roomId)) {
|
|
1962
|
-
|
|
2010
|
+
_context8.n = 2;
|
|
1963
2011
|
break;
|
|
1964
2012
|
}
|
|
1965
|
-
|
|
2013
|
+
_context8.n = 1;
|
|
1966
2014
|
return this.tracker.client.send('GetFollowedTopics', {
|
|
1967
2015
|
location: {
|
|
1968
2016
|
roomId: ev.roomId,
|
|
@@ -1970,17 +2018,17 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1970
2018
|
}
|
|
1971
2019
|
});
|
|
1972
2020
|
case 1:
|
|
1973
|
-
result =
|
|
2021
|
+
result = _context8.v;
|
|
1974
2022
|
followedTopic = result.data.followedTopics[0];
|
|
1975
2023
|
if (followedTopic) {
|
|
1976
2024
|
this.followedTopics.get(ev.roomId).set(followedTopic);
|
|
1977
2025
|
}
|
|
1978
2026
|
case 2:
|
|
1979
|
-
return
|
|
2027
|
+
return _context8.a(2);
|
|
1980
2028
|
}
|
|
1981
|
-
},
|
|
2029
|
+
}, _callee8, this);
|
|
1982
2030
|
}));
|
|
1983
|
-
function handleNewTopic(
|
|
2031
|
+
function handleNewTopic(_x7) {
|
|
1984
2032
|
return _handleNewTopic.apply(this, arguments);
|
|
1985
2033
|
}
|
|
1986
2034
|
return handleNewTopic;
|
|
@@ -2639,18 +2687,48 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
2639
2687
|
}
|
|
2640
2688
|
}, {
|
|
2641
2689
|
key: "handleMessagesRedacted",
|
|
2642
|
-
value: function
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2690
|
+
value: function () {
|
|
2691
|
+
var _handleMessagesRedacted = RoomsManager_asyncToGenerator(/*#__PURE__*/RoomsManager_regenerator().m(function _callee6(ev) {
|
|
2692
|
+
var topics, topic, messageCount, lastMessage, _t2;
|
|
2693
|
+
return RoomsManager_regenerator().w(function (_context6) {
|
|
2694
|
+
while (1) switch (_context6.n) {
|
|
2695
|
+
case 0:
|
|
2696
|
+
// Remove redacted messages from topic and update metadata
|
|
2697
|
+
topics = this.topics.get(ev.location.roomId);
|
|
2698
|
+
topic = topics === null || topics === void 0 ? void 0 : topics.get(ev.location.topicId);
|
|
2699
|
+
if (!topic) {
|
|
2700
|
+
_context6.n = 4;
|
|
2701
|
+
break;
|
|
2702
|
+
}
|
|
2703
|
+
messageCount = Math.max(topic.messageCount - ev.ids.length, 0);
|
|
2704
|
+
if (!(messageCount > 0)) {
|
|
2705
|
+
_context6.n = 2;
|
|
2706
|
+
break;
|
|
2707
|
+
}
|
|
2708
|
+
_context6.n = 1;
|
|
2709
|
+
return this.messages._resolveLastMessage(ev.location);
|
|
2710
|
+
case 1:
|
|
2711
|
+
_t2 = _context6.v;
|
|
2712
|
+
_context6.n = 3;
|
|
2713
|
+
break;
|
|
2714
|
+
case 2:
|
|
2715
|
+
_t2 = null;
|
|
2716
|
+
case 3:
|
|
2717
|
+
lastMessage = _t2;
|
|
2718
|
+
topics.set(RoomsManager_objectSpread(RoomsManager_objectSpread({}, topic), {}, {
|
|
2719
|
+
messageCount: messageCount,
|
|
2720
|
+
lastMessage: lastMessage
|
|
2721
|
+
}));
|
|
2722
|
+
case 4:
|
|
2723
|
+
return _context6.a(2);
|
|
2724
|
+
}
|
|
2725
|
+
}, _callee6, this);
|
|
2726
|
+
}));
|
|
2727
|
+
function handleMessagesRedacted(_x5) {
|
|
2728
|
+
return _handleMessagesRedacted.apply(this, arguments);
|
|
2652
2729
|
}
|
|
2653
|
-
|
|
2730
|
+
return handleMessagesRedacted;
|
|
2731
|
+
}()
|
|
2654
2732
|
}]);
|
|
2655
2733
|
}();
|
|
2656
2734
|
;// ./src/state-tracker/functions.ts
|