polfan-server-js-client 0.2.95 → 0.2.96
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 +16 -17
- package/build/index.cjs.js +180 -152
- 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/MessagesManager.ts +18 -9
package/build/index.cjs.js
CHANGED
|
@@ -1797,63 +1797,88 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1797
1797
|
}, {
|
|
1798
1798
|
key: "cacheSpaceFollowedTopics",
|
|
1799
1799
|
value: (function () {
|
|
1800
|
-
var _cacheSpaceFollowedTopics = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
1800
|
+
var _cacheSpaceFollowedTopics = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee3(spaceId) {
|
|
1801
1801
|
var _this2 = this;
|
|
1802
|
-
var roomIds,
|
|
1803
|
-
return MessagesManager_regenerator().w(function (
|
|
1804
|
-
while (1) switch (
|
|
1802
|
+
var rooms, roomIds, isAlreadyCached, spaceRegistryKey, _t;
|
|
1803
|
+
return MessagesManager_regenerator().w(function (_context3) {
|
|
1804
|
+
while (1) switch (_context3.n) {
|
|
1805
1805
|
case 0:
|
|
1806
1806
|
_t = spaceId;
|
|
1807
1807
|
if (!_t) {
|
|
1808
|
-
|
|
1808
|
+
_context3.n = 2;
|
|
1809
1809
|
break;
|
|
1810
1810
|
}
|
|
1811
|
-
|
|
1811
|
+
_context3.n = 1;
|
|
1812
1812
|
return this.tracker.spaces.get();
|
|
1813
1813
|
case 1:
|
|
1814
|
-
_t = !
|
|
1814
|
+
_t = !_context3.v.has(spaceId);
|
|
1815
1815
|
case 2:
|
|
1816
1816
|
if (!_t) {
|
|
1817
|
-
|
|
1817
|
+
_context3.n = 3;
|
|
1818
1818
|
break;
|
|
1819
1819
|
}
|
|
1820
1820
|
throw new Error("You are not in space ".concat(spaceId));
|
|
1821
1821
|
case 3:
|
|
1822
|
-
|
|
1822
|
+
_context3.n = 4;
|
|
1823
1823
|
return this.tracker.rooms.get();
|
|
1824
1824
|
case 4:
|
|
1825
|
-
|
|
1826
|
-
|
|
1825
|
+
rooms = _context3.v;
|
|
1826
|
+
roomIds = spaceId ? rooms.findBy('spaceId', spaceId).items.map(function (r) {
|
|
1827
|
+
return r.id;
|
|
1828
|
+
}) : rooms.items.filter(function (r) {
|
|
1829
|
+
return !r.spaceId;
|
|
1830
|
+
}).map(function (r) {
|
|
1831
|
+
return r.id;
|
|
1827
1832
|
});
|
|
1828
1833
|
if (roomIds.length) {
|
|
1829
|
-
|
|
1834
|
+
_context3.n = 5;
|
|
1830
1835
|
break;
|
|
1831
1836
|
}
|
|
1832
|
-
return
|
|
1837
|
+
return _context3.a(2);
|
|
1833
1838
|
case 5:
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
spaceId: spaceId
|
|
1837
|
-
}
|
|
1838
|
-
});
|
|
1839
|
-
roomIds.forEach(function (roomId) {
|
|
1840
|
-
return _this2.followedTopicsPromises.register(resultPromise, roomId);
|
|
1839
|
+
isAlreadyCached = roomIds.every(function (roomId) {
|
|
1840
|
+
return _this2.followedTopics.has(roomId);
|
|
1841
1841
|
});
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
case 6:
|
|
1845
|
-
result = _context2.v;
|
|
1846
|
-
if (!result.error) {
|
|
1847
|
-
_context2.n = 7;
|
|
1842
|
+
if (!isAlreadyCached) {
|
|
1843
|
+
_context3.n = 6;
|
|
1848
1844
|
break;
|
|
1849
1845
|
}
|
|
1850
|
-
|
|
1846
|
+
return _context3.a(2);
|
|
1847
|
+
case 6:
|
|
1848
|
+
spaceRegistryKey = "space_fetch_".concat(spaceId || 'spaceless');
|
|
1849
|
+
if (this.followedTopicsPromises.notExist(spaceRegistryKey)) {
|
|
1850
|
+
this.followedTopicsPromises.registerByFunction(/*#__PURE__*/MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee2() {
|
|
1851
|
+
var result;
|
|
1852
|
+
return MessagesManager_regenerator().w(function (_context2) {
|
|
1853
|
+
while (1) switch (_context2.n) {
|
|
1854
|
+
case 0:
|
|
1855
|
+
_context2.n = 1;
|
|
1856
|
+
return _this2.tracker.client.send('GetFollowedTopics', {
|
|
1857
|
+
location: {
|
|
1858
|
+
spaceId: spaceId
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
case 1:
|
|
1862
|
+
result = _context2.v;
|
|
1863
|
+
if (!result.error) {
|
|
1864
|
+
_context2.n = 2;
|
|
1865
|
+
break;
|
|
1866
|
+
}
|
|
1867
|
+
throw result.error;
|
|
1868
|
+
case 2:
|
|
1869
|
+
_this2.setFollowedTopicsArray(roomIds, result.data.followedTopics);
|
|
1870
|
+
case 3:
|
|
1871
|
+
return _context2.a(2);
|
|
1872
|
+
}
|
|
1873
|
+
}, _callee2);
|
|
1874
|
+
})), spaceRegistryKey);
|
|
1875
|
+
}
|
|
1876
|
+
_context3.n = 7;
|
|
1877
|
+
return this.followedTopicsPromises.get(spaceRegistryKey);
|
|
1851
1878
|
case 7:
|
|
1852
|
-
|
|
1853
|
-
case 8:
|
|
1854
|
-
return _context2.a(2);
|
|
1879
|
+
return _context3.a(2);
|
|
1855
1880
|
}
|
|
1856
|
-
},
|
|
1881
|
+
}, _callee3, this);
|
|
1857
1882
|
}));
|
|
1858
1883
|
function cacheSpaceFollowedTopics(_x2) {
|
|
1859
1884
|
return _cacheSpaceFollowedTopics.apply(this, arguments);
|
|
@@ -1868,57 +1893,57 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1868
1893
|
}, {
|
|
1869
1894
|
key: "getRoomFollowedTopics",
|
|
1870
1895
|
value: (function () {
|
|
1871
|
-
var _getRoomFollowedTopics = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
1896
|
+
var _getRoomFollowedTopics = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee5(roomId) {
|
|
1872
1897
|
var _this3 = this;
|
|
1873
|
-
return MessagesManager_regenerator().w(function (
|
|
1874
|
-
while (1) switch (
|
|
1898
|
+
return MessagesManager_regenerator().w(function (_context5) {
|
|
1899
|
+
while (1) switch (_context5.n) {
|
|
1875
1900
|
case 0:
|
|
1876
|
-
|
|
1901
|
+
_context5.n = 1;
|
|
1877
1902
|
return this.tracker.rooms.get();
|
|
1878
1903
|
case 1:
|
|
1879
|
-
if (
|
|
1880
|
-
|
|
1904
|
+
if (_context5.v.has(roomId)) {
|
|
1905
|
+
_context5.n = 2;
|
|
1881
1906
|
break;
|
|
1882
1907
|
}
|
|
1883
|
-
return
|
|
1908
|
+
return _context5.a(2, undefined);
|
|
1884
1909
|
case 2:
|
|
1885
1910
|
if (this.followedTopics.has(roomId)) {
|
|
1886
|
-
|
|
1911
|
+
_context5.n = 3;
|
|
1887
1912
|
break;
|
|
1888
1913
|
}
|
|
1889
1914
|
if (this.followedTopicsPromises.notExist(roomId)) {
|
|
1890
|
-
this.followedTopicsPromises.registerByFunction(/*#__PURE__*/MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
1915
|
+
this.followedTopicsPromises.registerByFunction(/*#__PURE__*/MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee4() {
|
|
1891
1916
|
var result;
|
|
1892
|
-
return MessagesManager_regenerator().w(function (
|
|
1893
|
-
while (1) switch (
|
|
1917
|
+
return MessagesManager_regenerator().w(function (_context4) {
|
|
1918
|
+
while (1) switch (_context4.n) {
|
|
1894
1919
|
case 0:
|
|
1895
|
-
|
|
1920
|
+
_context4.n = 1;
|
|
1896
1921
|
return _this3.tracker.client.send('GetFollowedTopics', {
|
|
1897
1922
|
location: {
|
|
1898
1923
|
roomId: roomId
|
|
1899
1924
|
}
|
|
1900
1925
|
});
|
|
1901
1926
|
case 1:
|
|
1902
|
-
result =
|
|
1927
|
+
result = _context4.v;
|
|
1903
1928
|
if (!result.error) {
|
|
1904
|
-
|
|
1929
|
+
_context4.n = 2;
|
|
1905
1930
|
break;
|
|
1906
1931
|
}
|
|
1907
1932
|
throw result.error;
|
|
1908
1933
|
case 2:
|
|
1909
1934
|
_this3.setFollowedTopicsArray([roomId], result.data.followedTopics);
|
|
1910
1935
|
case 3:
|
|
1911
|
-
return
|
|
1936
|
+
return _context4.a(2);
|
|
1912
1937
|
}
|
|
1913
|
-
},
|
|
1938
|
+
}, _callee4);
|
|
1914
1939
|
})), roomId);
|
|
1915
1940
|
}
|
|
1916
|
-
|
|
1941
|
+
_context5.n = 3;
|
|
1917
1942
|
return this.followedTopicsPromises.get(roomId);
|
|
1918
1943
|
case 3:
|
|
1919
|
-
return
|
|
1944
|
+
return _context5.a(2, this.followedTopics.get(roomId));
|
|
1920
1945
|
}
|
|
1921
|
-
},
|
|
1946
|
+
}, _callee5, this);
|
|
1922
1947
|
}));
|
|
1923
1948
|
function getRoomFollowedTopics(_x3) {
|
|
1924
1949
|
return _getRoomFollowedTopics.apply(this, arguments);
|
|
@@ -1932,56 +1957,56 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1932
1957
|
}, {
|
|
1933
1958
|
key: "ackRoom",
|
|
1934
1959
|
value: (function () {
|
|
1935
|
-
var _ackRoom = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
1960
|
+
var _ackRoom = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee6(roomId) {
|
|
1936
1961
|
var collection, _iterator, _step, followedTopic, _t2;
|
|
1937
|
-
return MessagesManager_regenerator().w(function (
|
|
1938
|
-
while (1) switch (
|
|
1962
|
+
return MessagesManager_regenerator().w(function (_context6) {
|
|
1963
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
1939
1964
|
case 0:
|
|
1940
|
-
|
|
1965
|
+
_context6.n = 1;
|
|
1941
1966
|
return this.getRoomFollowedTopics(roomId);
|
|
1942
1967
|
case 1:
|
|
1943
|
-
collection =
|
|
1968
|
+
collection = _context6.v;
|
|
1944
1969
|
if (collection) {
|
|
1945
|
-
|
|
1970
|
+
_context6.n = 2;
|
|
1946
1971
|
break;
|
|
1947
1972
|
}
|
|
1948
|
-
return
|
|
1973
|
+
return _context6.a(2);
|
|
1949
1974
|
case 2:
|
|
1950
1975
|
_iterator = MessagesManager_createForOfIteratorHelper(collection.items);
|
|
1951
|
-
|
|
1976
|
+
_context6.p = 3;
|
|
1952
1977
|
_iterator.s();
|
|
1953
1978
|
case 4:
|
|
1954
1979
|
if ((_step = _iterator.n()).done) {
|
|
1955
|
-
|
|
1980
|
+
_context6.n = 6;
|
|
1956
1981
|
break;
|
|
1957
1982
|
}
|
|
1958
1983
|
followedTopic = _step.value;
|
|
1959
1984
|
if (!followedTopic.isUnread) {
|
|
1960
|
-
|
|
1985
|
+
_context6.n = 5;
|
|
1961
1986
|
break;
|
|
1962
1987
|
}
|
|
1963
|
-
|
|
1988
|
+
_context6.n = 5;
|
|
1964
1989
|
return this.tracker.client.send('Ack', {
|
|
1965
1990
|
location: followedTopic.location
|
|
1966
1991
|
});
|
|
1967
1992
|
case 5:
|
|
1968
|
-
|
|
1993
|
+
_context6.n = 4;
|
|
1969
1994
|
break;
|
|
1970
1995
|
case 6:
|
|
1971
|
-
|
|
1996
|
+
_context6.n = 8;
|
|
1972
1997
|
break;
|
|
1973
1998
|
case 7:
|
|
1974
|
-
|
|
1975
|
-
_t2 =
|
|
1999
|
+
_context6.p = 7;
|
|
2000
|
+
_t2 = _context6.v;
|
|
1976
2001
|
_iterator.e(_t2);
|
|
1977
2002
|
case 8:
|
|
1978
|
-
|
|
2003
|
+
_context6.p = 8;
|
|
1979
2004
|
_iterator.f();
|
|
1980
|
-
return
|
|
2005
|
+
return _context6.f(8);
|
|
1981
2006
|
case 9:
|
|
1982
|
-
return
|
|
2007
|
+
return _context6.a(2);
|
|
1983
2008
|
}
|
|
1984
|
-
},
|
|
2009
|
+
}, _callee6, this, [[3, 7, 8, 9]]);
|
|
1985
2010
|
}));
|
|
1986
2011
|
function ackRoom(_x4) {
|
|
1987
2012
|
return _ackRoom.apply(this, arguments);
|
|
@@ -1996,142 +2021,145 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1996
2021
|
}, {
|
|
1997
2022
|
key: "summarizeUnreadMessages",
|
|
1998
2023
|
value: (function () {
|
|
1999
|
-
var _summarizeUnreadMessages = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
2024
|
+
var _summarizeUnreadMessages = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee7(location) {
|
|
2000
2025
|
var cacheKey, roomIds, targetTopicId, rooms, mentionCount, isUnread, _iterator2, _step2, roomId, collection, _iterator3, _step3, _topic$mentionCount, topic, result, _t3, _t4;
|
|
2001
|
-
return MessagesManager_regenerator().w(function (
|
|
2002
|
-
while (1) switch (
|
|
2026
|
+
return MessagesManager_regenerator().w(function (_context7) {
|
|
2027
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
2003
2028
|
case 0:
|
|
2004
2029
|
cacheKey = location.topicId ? "topic:".concat(location.roomId, ":").concat(location.topicId) : location.roomId ? "room:".concat(location.roomId) : location.spaceId ? "space:".concat(location.spaceId) : 'spaceless';
|
|
2005
2030
|
if (!this.unreadSummariesCache.has(cacheKey)) {
|
|
2006
|
-
|
|
2031
|
+
_context7.n = 1;
|
|
2007
2032
|
break;
|
|
2008
2033
|
}
|
|
2009
|
-
return
|
|
2034
|
+
return _context7.a(2, this.unreadSummariesCache.get(cacheKey));
|
|
2010
2035
|
case 1:
|
|
2011
2036
|
roomIds = [];
|
|
2012
|
-
|
|
2037
|
+
_context7.n = 2;
|
|
2013
2038
|
return this.tracker.rooms.get();
|
|
2014
2039
|
case 2:
|
|
2015
|
-
rooms =
|
|
2040
|
+
rooms = _context7.v;
|
|
2016
2041
|
if (!location.topicId) {
|
|
2017
|
-
|
|
2042
|
+
_context7.n = 4;
|
|
2018
2043
|
break;
|
|
2019
2044
|
}
|
|
2020
2045
|
if (location.roomId) {
|
|
2021
|
-
|
|
2046
|
+
_context7.n = 3;
|
|
2022
2047
|
break;
|
|
2023
2048
|
}
|
|
2024
2049
|
throw new Error("roomId is required when querying by topicId");
|
|
2025
2050
|
case 3:
|
|
2026
2051
|
roomIds = [location.roomId];
|
|
2027
2052
|
targetTopicId = location.topicId;
|
|
2028
|
-
|
|
2053
|
+
_context7.n = 9;
|
|
2029
2054
|
break;
|
|
2030
2055
|
case 4:
|
|
2031
2056
|
if (!location.roomId) {
|
|
2032
|
-
|
|
2057
|
+
_context7.n = 5;
|
|
2033
2058
|
break;
|
|
2034
2059
|
}
|
|
2035
2060
|
roomIds = [location.roomId];
|
|
2036
|
-
|
|
2061
|
+
_context7.n = 9;
|
|
2037
2062
|
break;
|
|
2038
2063
|
case 5:
|
|
2039
2064
|
if (!location.spaceId) {
|
|
2040
|
-
|
|
2065
|
+
_context7.n = 7;
|
|
2041
2066
|
break;
|
|
2042
2067
|
}
|
|
2043
|
-
|
|
2068
|
+
_context7.n = 6;
|
|
2044
2069
|
return this.cacheSpaceFollowedTopics(location.spaceId);
|
|
2045
2070
|
case 6:
|
|
2046
2071
|
roomIds = rooms.findBy('spaceId', location.spaceId).items.map(function (r) {
|
|
2047
2072
|
return r.id;
|
|
2048
2073
|
});
|
|
2049
|
-
|
|
2074
|
+
_context7.n = 9;
|
|
2050
2075
|
break;
|
|
2051
2076
|
case 7:
|
|
2077
|
+
_context7.n = 8;
|
|
2078
|
+
return this.cacheSpaceFollowedTopics(null);
|
|
2079
|
+
case 8:
|
|
2052
2080
|
roomIds = rooms.items.filter(function (r) {
|
|
2053
2081
|
return !r.spaceId;
|
|
2054
2082
|
}).map(function (r) {
|
|
2055
2083
|
return r.id;
|
|
2056
2084
|
});
|
|
2057
|
-
case
|
|
2085
|
+
case 9:
|
|
2058
2086
|
mentionCount = 0;
|
|
2059
2087
|
isUnread = false;
|
|
2060
2088
|
_iterator2 = MessagesManager_createForOfIteratorHelper(roomIds);
|
|
2061
|
-
|
|
2089
|
+
_context7.p = 10;
|
|
2062
2090
|
_iterator2.s();
|
|
2063
|
-
case
|
|
2091
|
+
case 11:
|
|
2064
2092
|
if ((_step2 = _iterator2.n()).done) {
|
|
2065
|
-
|
|
2093
|
+
_context7.n = 22;
|
|
2066
2094
|
break;
|
|
2067
2095
|
}
|
|
2068
2096
|
roomId = _step2.value;
|
|
2069
|
-
|
|
2097
|
+
_context7.n = 12;
|
|
2070
2098
|
return this.getRoomFollowedTopics(roomId);
|
|
2071
|
-
case
|
|
2072
|
-
collection =
|
|
2099
|
+
case 12:
|
|
2100
|
+
collection = _context7.v;
|
|
2073
2101
|
if (collection) {
|
|
2074
|
-
|
|
2102
|
+
_context7.n = 13;
|
|
2075
2103
|
break;
|
|
2076
2104
|
}
|
|
2077
|
-
return
|
|
2078
|
-
case
|
|
2105
|
+
return _context7.a(3, 21);
|
|
2106
|
+
case 13:
|
|
2079
2107
|
_iterator3 = MessagesManager_createForOfIteratorHelper(collection.items);
|
|
2080
|
-
|
|
2108
|
+
_context7.p = 14;
|
|
2081
2109
|
_iterator3.s();
|
|
2082
|
-
case
|
|
2110
|
+
case 15:
|
|
2083
2111
|
if ((_step3 = _iterator3.n()).done) {
|
|
2084
|
-
|
|
2112
|
+
_context7.n = 18;
|
|
2085
2113
|
break;
|
|
2086
2114
|
}
|
|
2087
2115
|
topic = _step3.value;
|
|
2088
2116
|
if (!(targetTopicId && topic.location.topicId !== targetTopicId)) {
|
|
2089
|
-
|
|
2117
|
+
_context7.n = 16;
|
|
2090
2118
|
break;
|
|
2091
2119
|
}
|
|
2092
|
-
return
|
|
2093
|
-
case
|
|
2120
|
+
return _context7.a(3, 17);
|
|
2121
|
+
case 16:
|
|
2094
2122
|
if (topic.isUnread) {
|
|
2095
2123
|
isUnread = true;
|
|
2096
2124
|
}
|
|
2097
2125
|
mentionCount += (_topic$mentionCount = topic.mentionCount) !== null && _topic$mentionCount !== void 0 ? _topic$mentionCount : 0;
|
|
2098
|
-
case 16:
|
|
2099
|
-
_context6.n = 14;
|
|
2100
|
-
break;
|
|
2101
2126
|
case 17:
|
|
2102
|
-
|
|
2127
|
+
_context7.n = 15;
|
|
2103
2128
|
break;
|
|
2104
2129
|
case 18:
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
_iterator3.e(_t3);
|
|
2130
|
+
_context7.n = 20;
|
|
2131
|
+
break;
|
|
2108
2132
|
case 19:
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2133
|
+
_context7.p = 19;
|
|
2134
|
+
_t3 = _context7.v;
|
|
2135
|
+
_iterator3.e(_t3);
|
|
2112
2136
|
case 20:
|
|
2113
|
-
|
|
2114
|
-
|
|
2137
|
+
_context7.p = 20;
|
|
2138
|
+
_iterator3.f();
|
|
2139
|
+
return _context7.f(20);
|
|
2115
2140
|
case 21:
|
|
2116
|
-
|
|
2141
|
+
_context7.n = 11;
|
|
2117
2142
|
break;
|
|
2118
2143
|
case 22:
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
_iterator2.e(_t4);
|
|
2144
|
+
_context7.n = 24;
|
|
2145
|
+
break;
|
|
2122
2146
|
case 23:
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2147
|
+
_context7.p = 23;
|
|
2148
|
+
_t4 = _context7.v;
|
|
2149
|
+
_iterator2.e(_t4);
|
|
2126
2150
|
case 24:
|
|
2151
|
+
_context7.p = 24;
|
|
2152
|
+
_iterator2.f();
|
|
2153
|
+
return _context7.f(24);
|
|
2154
|
+
case 25:
|
|
2127
2155
|
result = {
|
|
2128
2156
|
mentionCount: mentionCount,
|
|
2129
2157
|
isUnread: isUnread
|
|
2130
2158
|
};
|
|
2131
2159
|
this.unreadSummariesCache.set(cacheKey, result);
|
|
2132
|
-
return
|
|
2160
|
+
return _context7.a(2, result);
|
|
2133
2161
|
}
|
|
2134
|
-
},
|
|
2162
|
+
}, _callee7, this, [[14, 19, 20, 21], [10, 23, 24, 25]]);
|
|
2135
2163
|
}));
|
|
2136
2164
|
function summarizeUnreadMessages(_x5) {
|
|
2137
2165
|
return _summarizeUnreadMessages.apply(this, arguments);
|
|
@@ -2164,35 +2192,35 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2164
2192
|
}, {
|
|
2165
2193
|
key: "_resolveLastMessage",
|
|
2166
2194
|
value: (function () {
|
|
2167
|
-
var _resolveLastMessage2 = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
2195
|
+
var _resolveLastMessage2 = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee8(location) {
|
|
2168
2196
|
var message, _result$data, result;
|
|
2169
|
-
return MessagesManager_regenerator().w(function (
|
|
2170
|
-
while (1) switch (
|
|
2197
|
+
return MessagesManager_regenerator().w(function (_context8) {
|
|
2198
|
+
while (1) switch (_context8.n) {
|
|
2171
2199
|
case 0:
|
|
2172
|
-
|
|
2200
|
+
_context8.n = 1;
|
|
2173
2201
|
return this.getRoomHistory(location.roomId).then(function (roomHistory) {
|
|
2174
2202
|
return roomHistory === null || roomHistory === void 0 ? void 0 : roomHistory.getMessagesWindow(location.topicId, true);
|
|
2175
2203
|
}).then(function (historyWindow) {
|
|
2176
2204
|
return (historyWindow === null || historyWindow === void 0 ? void 0 : historyWindow.hasLatest) && historyWindow.getAt(historyWindow.length - 1);
|
|
2177
2205
|
});
|
|
2178
2206
|
case 1:
|
|
2179
|
-
message =
|
|
2207
|
+
message = _context8.v;
|
|
2180
2208
|
if (message) {
|
|
2181
|
-
|
|
2209
|
+
_context8.n = 3;
|
|
2182
2210
|
break;
|
|
2183
2211
|
}
|
|
2184
|
-
|
|
2212
|
+
_context8.n = 2;
|
|
2185
2213
|
return this.tracker.client.send('GetMessages', {
|
|
2186
2214
|
location: location,
|
|
2187
2215
|
limit: 1
|
|
2188
2216
|
});
|
|
2189
2217
|
case 2:
|
|
2190
|
-
result =
|
|
2218
|
+
result = _context8.v;
|
|
2191
2219
|
message = (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.messages[0];
|
|
2192
2220
|
case 3:
|
|
2193
|
-
return
|
|
2221
|
+
return _context8.a(2, message || null);
|
|
2194
2222
|
}
|
|
2195
|
-
},
|
|
2223
|
+
}, _callee8, this);
|
|
2196
2224
|
}));
|
|
2197
2225
|
function _resolveLastMessage(_x6) {
|
|
2198
2226
|
return _resolveLastMessage2.apply(this, arguments);
|
|
@@ -2318,16 +2346,16 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2318
2346
|
}, {
|
|
2319
2347
|
key: "handleNewTopic",
|
|
2320
2348
|
value: function () {
|
|
2321
|
-
var _handleNewTopic = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
2349
|
+
var _handleNewTopic = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee9(ev) {
|
|
2322
2350
|
var result, followedTopic;
|
|
2323
|
-
return MessagesManager_regenerator().w(function (
|
|
2324
|
-
while (1) switch (
|
|
2351
|
+
return MessagesManager_regenerator().w(function (_context9) {
|
|
2352
|
+
while (1) switch (_context9.n) {
|
|
2325
2353
|
case 0:
|
|
2326
2354
|
if (!this.followedTopics.has(ev.roomId)) {
|
|
2327
|
-
|
|
2355
|
+
_context9.n = 2;
|
|
2328
2356
|
break;
|
|
2329
2357
|
}
|
|
2330
|
-
|
|
2358
|
+
_context9.n = 1;
|
|
2331
2359
|
return this.tracker.client.send('GetFollowedTopics', {
|
|
2332
2360
|
location: {
|
|
2333
2361
|
roomId: ev.roomId,
|
|
@@ -2335,16 +2363,16 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2335
2363
|
}
|
|
2336
2364
|
});
|
|
2337
2365
|
case 1:
|
|
2338
|
-
result =
|
|
2366
|
+
result = _context9.v;
|
|
2339
2367
|
followedTopic = result.data.followedTopics[0];
|
|
2340
2368
|
if (followedTopic) {
|
|
2341
2369
|
this.followedTopics.get(ev.roomId).set(followedTopic);
|
|
2342
2370
|
this.invalidateUnreadSummaries(ev.roomId, ev.topic.id);
|
|
2343
2371
|
}
|
|
2344
2372
|
case 2:
|
|
2345
|
-
return
|
|
2373
|
+
return _context9.a(2);
|
|
2346
2374
|
}
|
|
2347
|
-
},
|
|
2375
|
+
}, _callee9, this);
|
|
2348
2376
|
}));
|
|
2349
2377
|
function handleNewTopic(_x7) {
|
|
2350
2378
|
return _handleNewTopic.apply(this, arguments);
|
|
@@ -2374,23 +2402,23 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2374
2402
|
}, {
|
|
2375
2403
|
key: "updateLocallyFollowedTopicOnNewMessage",
|
|
2376
2404
|
value: function () {
|
|
2377
|
-
var _updateLocallyFollowedTopicOnNewMessage = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function
|
|
2405
|
+
var _updateLocallyFollowedTopicOnNewMessage = MessagesManager_asyncToGenerator(/*#__PURE__*/MessagesManager_regenerator().m(function _callee0(ev) {
|
|
2378
2406
|
var _this$tracker$me;
|
|
2379
2407
|
var roomFollowedTopics, followedTopic, isMe, update, _member$spaceMember$r, _member$spaceMember, member, roleIds, mentionHandlers, mentionExists;
|
|
2380
|
-
return MessagesManager_regenerator().w(function (
|
|
2381
|
-
while (1) switch (
|
|
2408
|
+
return MessagesManager_regenerator().w(function (_context0) {
|
|
2409
|
+
while (1) switch (_context0.n) {
|
|
2382
2410
|
case 0:
|
|
2383
2411
|
roomFollowedTopics = this.followedTopics.get(ev.message.location.roomId);
|
|
2384
2412
|
followedTopic = roomFollowedTopics === null || roomFollowedTopics === void 0 ? void 0 : roomFollowedTopics.get(ev.message.location.topicId);
|
|
2385
2413
|
if (!(!roomFollowedTopics || !followedTopic || ev.message.type === 'Ephemeral')) {
|
|
2386
|
-
|
|
2414
|
+
_context0.n = 1;
|
|
2387
2415
|
break;
|
|
2388
2416
|
}
|
|
2389
|
-
return
|
|
2417
|
+
return _context0.a(2);
|
|
2390
2418
|
case 1:
|
|
2391
2419
|
isMe = ev.message.author.user.id === ((_this$tracker$me = this.tracker.me) === null || _this$tracker$me === void 0 ? void 0 : _this$tracker$me.id);
|
|
2392
2420
|
if (!isMe) {
|
|
2393
|
-
|
|
2421
|
+
_context0.n = 2;
|
|
2394
2422
|
break;
|
|
2395
2423
|
}
|
|
2396
2424
|
// Reset missed messages count if new message is authored by me
|
|
@@ -2398,17 +2426,17 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2398
2426
|
missed: 0,
|
|
2399
2427
|
lastAckMessageId: ev.message.id
|
|
2400
2428
|
};
|
|
2401
|
-
|
|
2429
|
+
_context0.n = 5;
|
|
2402
2430
|
break;
|
|
2403
2431
|
case 2:
|
|
2404
2432
|
if (!(ev.message.type === 'Text')) {
|
|
2405
|
-
|
|
2433
|
+
_context0.n = 4;
|
|
2406
2434
|
break;
|
|
2407
2435
|
}
|
|
2408
|
-
|
|
2436
|
+
_context0.n = 3;
|
|
2409
2437
|
return this.tracker.rooms.getMe(ev.message.location.roomId);
|
|
2410
2438
|
case 3:
|
|
2411
|
-
member =
|
|
2439
|
+
member = _context0.v;
|
|
2412
2440
|
roleIds = [].concat(MessagesManager_toConsumableArray((_member$spaceMember$r = (_member$spaceMember = member.spaceMember) === null || _member$spaceMember === void 0 ? void 0 : _member$spaceMember.roles) !== null && _member$spaceMember$r !== void 0 ? _member$spaceMember$r : []), MessagesManager_toConsumableArray(member.roles));
|
|
2413
2441
|
mentionHandlers = [].concat(MessagesManager_toConsumableArray(roleIds.map(function (id) {
|
|
2414
2442
|
return "<@&".concat(id, ">");
|
|
@@ -2421,7 +2449,7 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2421
2449
|
isUnread: true,
|
|
2422
2450
|
mentionCount: followedTopic.mentionCount + (mentionExists ? 1 : 0)
|
|
2423
2451
|
};
|
|
2424
|
-
|
|
2452
|
+
_context0.n = 5;
|
|
2425
2453
|
break;
|
|
2426
2454
|
case 4:
|
|
2427
2455
|
// ...or just mark as unread.
|
|
@@ -2433,9 +2461,9 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
2433
2461
|
roomFollowedTopics.set(MessagesManager_objectSpread(MessagesManager_objectSpread({}, followedTopic), update));
|
|
2434
2462
|
this.invalidateUnreadSummaries(ev.message.location.roomId, ev.message.location.topicId);
|
|
2435
2463
|
case 6:
|
|
2436
|
-
return
|
|
2464
|
+
return _context0.a(2);
|
|
2437
2465
|
}
|
|
2438
|
-
},
|
|
2466
|
+
}, _callee0, this);
|
|
2439
2467
|
}));
|
|
2440
2468
|
function updateLocallyFollowedTopicOnNewMessage(_x8) {
|
|
2441
2469
|
return _updateLocallyFollowedTopicOnNewMessage.apply(this, arguments);
|