polfan-server-js-client 0.4.1 → 0.4.3
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/shelf/Uncommitted_changes_before_Update_at_08_09_2026_17_04_[Changes]/shelved.patch +0 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_08_09_2026_17_04__Changes_.xml +4 -0
- package/.idea/workspace.xml +48 -26
- package/build/index.cjs.js +229 -123
- 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/AbstractChatClient.d.ts +7 -1
- package/build/types/Permissions.d.ts +12 -0
- package/build/types/index.d.ts +2 -2
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +26 -1
- package/build/types/types/src/index.d.ts +3 -3
- package/build/types/types/src/schemes/Message.d.ts +10 -0
- package/build/types/types/src/schemes/Role.d.ts +14 -0
- package/build/types/types/src/schemes/commands/CreateRole.d.ts +1 -0
- package/build/types/types/src/schemes/commands/UpdateRole.d.ts +1 -0
- package/package.json +1 -1
- package/src/AbstractChatClient.ts +12 -0
- package/src/Permissions.ts +3 -0
- package/src/index.ts +2 -1
- package/src/state-tracker/TopicHistoryWindow.ts +121 -42
- package/src/types/src/index.ts +4 -2
- package/src/types/src/schemes/Message.ts +11 -0
- package/src/types/src/schemes/Role.ts +16 -1
- package/src/types/src/schemes/commands/CreateRole.ts +1 -0
- package/src/types/src/schemes/commands/UpdateRole.ts +1 -0
- package/tests/space-roles.test.ts +5 -5
package/build/index.cjs.js
CHANGED
|
@@ -48,6 +48,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
48
48
|
ObservableIndexedObjectCollection: () => (/* reexport */ ObservableIndexedObjectCollection),
|
|
49
49
|
PermissionDefinition: () => (/* reexport */ PermissionDefinition),
|
|
50
50
|
Permissions: () => (/* reexport */ Permissions),
|
|
51
|
+
RoleFlag: () => (/* reexport */ RoleFlag),
|
|
51
52
|
UserStatus: () => (/* reexport */ UserStatus),
|
|
52
53
|
WebApiChatClient: () => (/* reexport */ WebApiChatClient),
|
|
53
54
|
WebSocketChatClient: () => (/* reexport */ WebSocketChatClient),
|
|
@@ -718,6 +719,7 @@ var PromiseRegistry = /*#__PURE__*/function () {
|
|
|
718
719
|
}();
|
|
719
720
|
;// ./src/state-tracker/TopicHistoryWindow.ts
|
|
720
721
|
function TopicHistoryWindow_typeof(o) { "@babel/helpers - typeof"; return TopicHistoryWindow_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, TopicHistoryWindow_typeof(o); }
|
|
722
|
+
function TopicHistoryWindow_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = TopicHistoryWindow_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
721
723
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
722
724
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { TopicHistoryWindow_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
723
725
|
function TopicHistoryWindow_superPropGet(t, o, e, r) { var p = TopicHistoryWindow_get(TopicHistoryWindow_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
@@ -1164,6 +1166,8 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1164
1166
|
_this3.topicId = topicId;
|
|
1165
1167
|
_this3.tracker = tracker;
|
|
1166
1168
|
_this3.internalState.traverseLock = false;
|
|
1169
|
+
_this3.internalState.includeMyReactions = true;
|
|
1170
|
+
_this3.internalState.myReactions = {};
|
|
1167
1171
|
if (bindEvents) {
|
|
1168
1172
|
_this3.tracker.client.on('NewMessage', function (ev) {
|
|
1169
1173
|
return _this3.handleNewMessage(ev);
|
|
@@ -1171,6 +1175,12 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1171
1175
|
_this3.tracker.client.on('MessagesRedacted', function (ev) {
|
|
1172
1176
|
return _this3.handleMessagesRedacted(ev);
|
|
1173
1177
|
});
|
|
1178
|
+
_this3.tracker.client.on('ReactionUpdated', function (ev) {
|
|
1179
|
+
return _this3.handleReactionUpdated(ev);
|
|
1180
|
+
});
|
|
1181
|
+
_this3.tracker.client.on('Reacted', function (ev) {
|
|
1182
|
+
return _this3.handleReacted(ev);
|
|
1183
|
+
});
|
|
1174
1184
|
}
|
|
1175
1185
|
return _this3;
|
|
1176
1186
|
}
|
|
@@ -1189,6 +1199,29 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1189
1199
|
get: function get() {
|
|
1190
1200
|
return this.internalState.traverseLock;
|
|
1191
1201
|
}
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* What the connected user has reacted with, keyed by message id. Kept apart from
|
|
1205
|
+
* the messages, so the history itself is identical for every user.
|
|
1206
|
+
*/
|
|
1207
|
+
}, {
|
|
1208
|
+
key: "myReactions",
|
|
1209
|
+
get: function get() {
|
|
1210
|
+
return this.internalState.myReactions;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Whether the history is fetched together with the reactions of the connected
|
|
1215
|
+
* user. Turn it off only where the active state of a reaction is never rendered.
|
|
1216
|
+
*/
|
|
1217
|
+
}, {
|
|
1218
|
+
key: "includeMyReactions",
|
|
1219
|
+
get: function get() {
|
|
1220
|
+
return this.internalState.includeMyReactions;
|
|
1221
|
+
},
|
|
1222
|
+
set: function set(value) {
|
|
1223
|
+
this.internalState.includeMyReactions = value;
|
|
1224
|
+
}
|
|
1192
1225
|
}, {
|
|
1193
1226
|
key: "setTraverseLock",
|
|
1194
1227
|
value: function () {
|
|
@@ -1324,35 +1357,14 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1324
1357
|
value: function () {
|
|
1325
1358
|
var _fetchItemsAfter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
1326
1359
|
var _this$getAt;
|
|
1327
|
-
var afterId
|
|
1360
|
+
var afterId;
|
|
1328
1361
|
return _regenerator().w(function (_context1) {
|
|
1329
1362
|
while (1) switch (_context1.n) {
|
|
1330
1363
|
case 0:
|
|
1331
|
-
afterId = (_this$getAt = this.getAt(this.length - 1)) === null || _this$getAt === void 0 ? void 0 : _this$getAt.id;
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
}
|
|
1336
|
-
return _context1.a(2, null);
|
|
1337
|
-
case 1:
|
|
1338
|
-
_context1.n = 2;
|
|
1339
|
-
return this.tracker.client.send('GetMessages', {
|
|
1340
|
-
location: {
|
|
1341
|
-
roomId: this.roomId,
|
|
1342
|
-
topicId: this.topicId
|
|
1343
|
-
},
|
|
1344
|
-
after: afterId,
|
|
1345
|
-
limit: this.internalState.fetchLimit
|
|
1346
|
-
});
|
|
1347
|
-
case 2:
|
|
1348
|
-
result = _context1.v;
|
|
1349
|
-
if (!result.error) {
|
|
1350
|
-
_context1.n = 3;
|
|
1351
|
-
break;
|
|
1352
|
-
}
|
|
1353
|
-
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1354
|
-
case 3:
|
|
1355
|
-
return _context1.a(2, result.data.messages);
|
|
1364
|
+
afterId = (_this$getAt = this.getAt(this.length - 1)) === null || _this$getAt === void 0 ? void 0 : _this$getAt.id; // If there is no message to refer, fetch latest
|
|
1365
|
+
return _context1.a(2, afterId ? this.fetchMessages({
|
|
1366
|
+
after: afterId
|
|
1367
|
+
}) : null);
|
|
1356
1368
|
}
|
|
1357
1369
|
}, _callee1, this);
|
|
1358
1370
|
}));
|
|
@@ -1365,28 +1377,12 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1365
1377
|
key: "fetchItemsAround",
|
|
1366
1378
|
value: function () {
|
|
1367
1379
|
var _fetchItemsAround = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(id) {
|
|
1368
|
-
var result;
|
|
1369
1380
|
return _regenerator().w(function (_context10) {
|
|
1370
1381
|
while (1) switch (_context10.n) {
|
|
1371
1382
|
case 0:
|
|
1372
|
-
_context10.
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
roomId: this.roomId,
|
|
1376
|
-
topicId: this.topicId
|
|
1377
|
-
},
|
|
1378
|
-
around: id,
|
|
1379
|
-
limit: this.internalState.fetchLimit
|
|
1380
|
-
});
|
|
1381
|
-
case 1:
|
|
1382
|
-
result = _context10.v;
|
|
1383
|
-
if (!result.error) {
|
|
1384
|
-
_context10.n = 2;
|
|
1385
|
-
break;
|
|
1386
|
-
}
|
|
1387
|
-
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1388
|
-
case 2:
|
|
1389
|
-
return _context10.a(2, result.data.messages);
|
|
1383
|
+
return _context10.a(2, this.fetchMessages({
|
|
1384
|
+
around: id
|
|
1385
|
+
}));
|
|
1390
1386
|
}
|
|
1391
1387
|
}, _callee10, this);
|
|
1392
1388
|
}));
|
|
@@ -1400,35 +1396,14 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1400
1396
|
value: function () {
|
|
1401
1397
|
var _fetchItemsBefore = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
1402
1398
|
var _this$getAt2;
|
|
1403
|
-
var beforeId
|
|
1399
|
+
var beforeId;
|
|
1404
1400
|
return _regenerator().w(function (_context11) {
|
|
1405
1401
|
while (1) switch (_context11.n) {
|
|
1406
1402
|
case 0:
|
|
1407
|
-
beforeId = (_this$getAt2 = this.getAt(0)) === null || _this$getAt2 === void 0 ? void 0 : _this$getAt2.id;
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
}
|
|
1412
|
-
return _context11.a(2, null);
|
|
1413
|
-
case 1:
|
|
1414
|
-
_context11.n = 2;
|
|
1415
|
-
return this.tracker.client.send('GetMessages', {
|
|
1416
|
-
location: {
|
|
1417
|
-
roomId: this.roomId,
|
|
1418
|
-
topicId: this.topicId
|
|
1419
|
-
},
|
|
1420
|
-
before: beforeId,
|
|
1421
|
-
limit: this.internalState.fetchLimit
|
|
1422
|
-
});
|
|
1423
|
-
case 2:
|
|
1424
|
-
result = _context11.v;
|
|
1425
|
-
if (!result.error) {
|
|
1426
|
-
_context11.n = 3;
|
|
1427
|
-
break;
|
|
1428
|
-
}
|
|
1429
|
-
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1430
|
-
case 3:
|
|
1431
|
-
return _context11.a(2, result.data.messages);
|
|
1403
|
+
beforeId = (_this$getAt2 = this.getAt(0)) === null || _this$getAt2 === void 0 ? void 0 : _this$getAt2.id; // If there is no message to refer, fetch latest
|
|
1404
|
+
return _context11.a(2, beforeId ? this.fetchMessages({
|
|
1405
|
+
before: beforeId
|
|
1406
|
+
}) : null);
|
|
1432
1407
|
}
|
|
1433
1408
|
}, _callee11, this);
|
|
1434
1409
|
}));
|
|
@@ -1441,48 +1416,94 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1441
1416
|
key: "fetchLatestItems",
|
|
1442
1417
|
value: function () {
|
|
1443
1418
|
var _fetchLatestItems = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
1444
|
-
var result;
|
|
1445
1419
|
return _regenerator().w(function (_context12) {
|
|
1446
1420
|
while (1) switch (_context12.n) {
|
|
1447
1421
|
case 0:
|
|
1448
|
-
_context12.
|
|
1449
|
-
|
|
1422
|
+
return _context12.a(2, this.fetchMessages({}));
|
|
1423
|
+
}
|
|
1424
|
+
}, _callee12, this);
|
|
1425
|
+
}));
|
|
1426
|
+
function fetchLatestItems() {
|
|
1427
|
+
return _fetchLatestItems.apply(this, arguments);
|
|
1428
|
+
}
|
|
1429
|
+
return fetchLatestItems;
|
|
1430
|
+
}()
|
|
1431
|
+
}, {
|
|
1432
|
+
key: "fetchMessages",
|
|
1433
|
+
value: function () {
|
|
1434
|
+
var _fetchMessages = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(criteria) {
|
|
1435
|
+
var result;
|
|
1436
|
+
return _regenerator().w(function (_context13) {
|
|
1437
|
+
while (1) switch (_context13.n) {
|
|
1438
|
+
case 0:
|
|
1439
|
+
_context13.n = 1;
|
|
1440
|
+
return this.tracker.client.send('GetMessages', _objectSpread({
|
|
1450
1441
|
location: {
|
|
1451
1442
|
roomId: this.roomId,
|
|
1452
1443
|
topicId: this.topicId
|
|
1453
1444
|
},
|
|
1454
|
-
limit: this.internalState.fetchLimit
|
|
1455
|
-
|
|
1445
|
+
limit: this.internalState.fetchLimit,
|
|
1446
|
+
includeMyReactions: this.internalState.includeMyReactions
|
|
1447
|
+
}, criteria));
|
|
1456
1448
|
case 1:
|
|
1457
|
-
result =
|
|
1449
|
+
result = _context13.v;
|
|
1458
1450
|
if (!result.error) {
|
|
1459
|
-
|
|
1451
|
+
_context13.n = 2;
|
|
1460
1452
|
break;
|
|
1461
1453
|
}
|
|
1462
1454
|
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1463
1455
|
case 2:
|
|
1464
|
-
|
|
1456
|
+
this.storeMyReactions(result.data.messages, result.data.myReactions);
|
|
1457
|
+
return _context13.a(2, result.data.messages);
|
|
1465
1458
|
}
|
|
1466
|
-
},
|
|
1459
|
+
}, _callee13, this);
|
|
1467
1460
|
}));
|
|
1468
|
-
function
|
|
1469
|
-
return
|
|
1461
|
+
function fetchMessages(_x5) {
|
|
1462
|
+
return _fetchMessages.apply(this, arguments);
|
|
1470
1463
|
}
|
|
1471
|
-
return
|
|
1464
|
+
return fetchMessages;
|
|
1472
1465
|
}()
|
|
1466
|
+
/**
|
|
1467
|
+
* The response is the truth for every message it covers, so a message it does not
|
|
1468
|
+
* mention has no reaction of this user left on it.
|
|
1469
|
+
*/
|
|
1470
|
+
}, {
|
|
1471
|
+
key: "storeMyReactions",
|
|
1472
|
+
value: function storeMyReactions(messages, myReactions) {
|
|
1473
|
+
if (!this.internalState.includeMyReactions) {
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
var _iterator = TopicHistoryWindow_createForOfIteratorHelper(messages),
|
|
1477
|
+
_step;
|
|
1478
|
+
try {
|
|
1479
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1480
|
+
var message = _step.value;
|
|
1481
|
+
var own = myReactions === null || myReactions === void 0 ? void 0 : myReactions[message.id];
|
|
1482
|
+
if (own !== null && own !== void 0 && own.length) {
|
|
1483
|
+
this.internalState.myReactions[message.id] = own;
|
|
1484
|
+
} else {
|
|
1485
|
+
delete this.internalState.myReactions[message.id];
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
} catch (err) {
|
|
1489
|
+
_iterator.e(err);
|
|
1490
|
+
} finally {
|
|
1491
|
+
_iterator.f();
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1473
1494
|
}, {
|
|
1474
1495
|
key: "getTopic",
|
|
1475
1496
|
value: function () {
|
|
1476
|
-
var _getTopic = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1477
|
-
return _regenerator().w(function (
|
|
1478
|
-
while (1) switch (
|
|
1497
|
+
var _getTopic = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
1498
|
+
return _regenerator().w(function (_context14) {
|
|
1499
|
+
while (1) switch (_context14.n) {
|
|
1479
1500
|
case 0:
|
|
1480
|
-
|
|
1501
|
+
_context14.n = 1;
|
|
1481
1502
|
return this.tracker.rooms.getTopics(this.roomId, [this.topicId]);
|
|
1482
1503
|
case 1:
|
|
1483
|
-
return
|
|
1504
|
+
return _context14.a(2, _context14.v.get(this.topicId));
|
|
1484
1505
|
}
|
|
1485
|
-
},
|
|
1506
|
+
}, _callee14, this);
|
|
1486
1507
|
}));
|
|
1487
1508
|
function getTopic() {
|
|
1488
1509
|
return _getTopic.apply(this, arguments);
|
|
@@ -1492,43 +1513,43 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1492
1513
|
}, {
|
|
1493
1514
|
key: "getLatestMessageId",
|
|
1494
1515
|
value: function () {
|
|
1495
|
-
var _getLatestMessageId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1516
|
+
var _getLatestMessageId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
1496
1517
|
var _yield$this$getTopic;
|
|
1497
1518
|
var _t2, _t3, _t4, _t5;
|
|
1498
|
-
return _regenerator().w(function (
|
|
1499
|
-
while (1) switch (
|
|
1519
|
+
return _regenerator().w(function (_context15) {
|
|
1520
|
+
while (1) switch (_context15.n) {
|
|
1500
1521
|
case 0:
|
|
1501
|
-
|
|
1522
|
+
_context15.n = 1;
|
|
1502
1523
|
return this.getTopic();
|
|
1503
1524
|
case 1:
|
|
1504
|
-
_t4 = _yield$this$getTopic =
|
|
1525
|
+
_t4 = _yield$this$getTopic = _context15.v;
|
|
1505
1526
|
_t3 = _t4 === null;
|
|
1506
1527
|
if (_t3) {
|
|
1507
|
-
|
|
1528
|
+
_context15.n = 2;
|
|
1508
1529
|
break;
|
|
1509
1530
|
}
|
|
1510
1531
|
_t3 = _yield$this$getTopic === void 0;
|
|
1511
1532
|
case 2:
|
|
1512
1533
|
_t2 = _t3;
|
|
1513
1534
|
if (_t2) {
|
|
1514
|
-
|
|
1535
|
+
_context15.n = 3;
|
|
1515
1536
|
break;
|
|
1516
1537
|
}
|
|
1517
1538
|
_t2 = (_yield$this$getTopic = _yield$this$getTopic.lastMessage) === null || _yield$this$getTopic === void 0;
|
|
1518
1539
|
case 3:
|
|
1519
1540
|
if (!_t2) {
|
|
1520
|
-
|
|
1541
|
+
_context15.n = 4;
|
|
1521
1542
|
break;
|
|
1522
1543
|
}
|
|
1523
1544
|
_t5 = void 0;
|
|
1524
|
-
|
|
1545
|
+
_context15.n = 5;
|
|
1525
1546
|
break;
|
|
1526
1547
|
case 4:
|
|
1527
1548
|
_t5 = _yield$this$getTopic.id;
|
|
1528
1549
|
case 5:
|
|
1529
|
-
return
|
|
1550
|
+
return _context15.a(2, _t5);
|
|
1530
1551
|
}
|
|
1531
|
-
},
|
|
1552
|
+
}, _callee15, this);
|
|
1532
1553
|
}));
|
|
1533
1554
|
function getLatestMessageId() {
|
|
1534
1555
|
return _getLatestMessageId.apply(this, arguments);
|
|
@@ -1538,18 +1559,18 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1538
1559
|
}, {
|
|
1539
1560
|
key: "isLatestItemLoaded",
|
|
1540
1561
|
value: function () {
|
|
1541
|
-
var _isLatestItemLoaded = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1562
|
+
var _isLatestItemLoaded = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
1542
1563
|
var lastMessageId;
|
|
1543
|
-
return _regenerator().w(function (
|
|
1544
|
-
while (1) switch (
|
|
1564
|
+
return _regenerator().w(function (_context16) {
|
|
1565
|
+
while (1) switch (_context16.n) {
|
|
1545
1566
|
case 0:
|
|
1546
|
-
|
|
1567
|
+
_context16.n = 1;
|
|
1547
1568
|
return this.getLatestMessageId();
|
|
1548
1569
|
case 1:
|
|
1549
|
-
lastMessageId =
|
|
1550
|
-
return
|
|
1570
|
+
lastMessageId = _context16.v;
|
|
1571
|
+
return _context16.a(2, lastMessageId ? this.has(lastMessageId) : true);
|
|
1551
1572
|
}
|
|
1552
|
-
},
|
|
1573
|
+
}, _callee16, this);
|
|
1553
1574
|
}));
|
|
1554
1575
|
function isLatestItemLoaded() {
|
|
1555
1576
|
return _isLatestItemLoaded.apply(this, arguments);
|
|
@@ -1559,10 +1580,10 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1559
1580
|
}, {
|
|
1560
1581
|
key: "handleNewMessage",
|
|
1561
1582
|
value: function () {
|
|
1562
|
-
var _handleNewMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1583
|
+
var _handleNewMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(ev) {
|
|
1563
1584
|
var originalState;
|
|
1564
|
-
return _regenerator().w(function (
|
|
1565
|
-
while (1) switch (
|
|
1585
|
+
return _regenerator().w(function (_context17) {
|
|
1586
|
+
while (1) switch (_context17.n) {
|
|
1566
1587
|
case 0:
|
|
1567
1588
|
if ([WindowState.LATEST, WindowState.LIVE].includes(this.state) && ev.message.location.roomId === this.roomId && ev.message.location.topicId === this.topicId) {
|
|
1568
1589
|
originalState = this.state;
|
|
@@ -1570,28 +1591,86 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1570
1591
|
this.emitChangeWithDiff(true, originalState);
|
|
1571
1592
|
}
|
|
1572
1593
|
case 1:
|
|
1573
|
-
return
|
|
1594
|
+
return _context17.a(2);
|
|
1574
1595
|
}
|
|
1575
|
-
},
|
|
1596
|
+
}, _callee17, this);
|
|
1576
1597
|
}));
|
|
1577
|
-
function handleNewMessage(
|
|
1598
|
+
function handleNewMessage(_x6) {
|
|
1578
1599
|
return _handleNewMessage.apply(this, arguments);
|
|
1579
1600
|
}
|
|
1580
1601
|
return handleNewMessage;
|
|
1581
1602
|
}()
|
|
1603
|
+
/**
|
|
1604
|
+
* The counter arrives as the global source of truth - only it is overwritten, and
|
|
1605
|
+
* a reaction nobody holds any more (count 0) leaves the message.
|
|
1606
|
+
*/
|
|
1607
|
+
}, {
|
|
1608
|
+
key: "handleReactionUpdated",
|
|
1609
|
+
value: function handleReactionUpdated(ev) {
|
|
1610
|
+
var message = this.get(ev.messageId);
|
|
1611
|
+
if (!message) {
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
var index = message.reactions.findIndex(function (reaction) {
|
|
1615
|
+
return reaction.type === ev.reaction.type && reaction.value === ev.reaction.value;
|
|
1616
|
+
});
|
|
1617
|
+
if (index === -1 && !ev.reaction.count) {
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
var reactions = TopicHistoryWindow_toConsumableArray(message.reactions);
|
|
1621
|
+
if (index === -1) {
|
|
1622
|
+
reactions.push(ev.reaction);
|
|
1623
|
+
} else if (ev.reaction.count) {
|
|
1624
|
+
reactions[index] = ev.reaction; // In place - a pill must not jump around as its counter moves
|
|
1625
|
+
} else {
|
|
1626
|
+
reactions.splice(index, 1);
|
|
1627
|
+
}
|
|
1628
|
+
this.set(_objectSpread(_objectSpread({}, message), {}, {
|
|
1629
|
+
reactions: reactions
|
|
1630
|
+
}));
|
|
1631
|
+
}
|
|
1632
|
+
}, {
|
|
1633
|
+
key: "handleReacted",
|
|
1634
|
+
value: function handleReacted(ev) {
|
|
1635
|
+
var _this$internalState$m;
|
|
1636
|
+
if (!this.has(ev.messageId)) {
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
var _ev$reaction = ev.reaction,
|
|
1640
|
+
type = _ev$reaction.type,
|
|
1641
|
+
value = _ev$reaction.value,
|
|
1642
|
+
isAdded = _ev$reaction.isAdded;
|
|
1643
|
+
var own = ((_this$internalState$m = this.internalState.myReactions[ev.messageId]) !== null && _this$internalState$m !== void 0 ? _this$internalState$m : []).filter(function (reaction) {
|
|
1644
|
+
return reaction.type !== type || reaction.value !== value;
|
|
1645
|
+
});
|
|
1646
|
+
if (isAdded) {
|
|
1647
|
+
own.push({
|
|
1648
|
+
type: type,
|
|
1649
|
+
value: value
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
if (own.length) {
|
|
1653
|
+
this.internalState.myReactions[ev.messageId] = own;
|
|
1654
|
+
} else {
|
|
1655
|
+
delete this.internalState.myReactions[ev.messageId];
|
|
1656
|
+
}
|
|
1657
|
+
this.eventTarget.emit('change', {
|
|
1658
|
+
setItems: [ev.messageId]
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1582
1661
|
}, {
|
|
1583
1662
|
key: "handleMessagesRedacted",
|
|
1584
1663
|
value: function () {
|
|
1585
|
-
var _handleMessagesRedacted = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1664
|
+
var _handleMessagesRedacted = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(ev) {
|
|
1586
1665
|
var refTopicIds;
|
|
1587
|
-
return _regenerator().w(function (
|
|
1588
|
-
while (1) switch (
|
|
1666
|
+
return _regenerator().w(function (_context18) {
|
|
1667
|
+
while (1) switch (_context18.n) {
|
|
1589
1668
|
case 0:
|
|
1590
1669
|
if (!(ev.location.topicId !== this.topicId || ev.location.roomId !== this.roomId)) {
|
|
1591
|
-
|
|
1670
|
+
_context18.n = 1;
|
|
1592
1671
|
break;
|
|
1593
1672
|
}
|
|
1594
|
-
return
|
|
1673
|
+
return _context18.a(2);
|
|
1595
1674
|
case 1:
|
|
1596
1675
|
refTopicIds = this.items.filter(function (msg) {
|
|
1597
1676
|
return msg.topicRef && ev.ids.includes(msg.id);
|
|
@@ -1600,21 +1679,21 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1600
1679
|
});
|
|
1601
1680
|
this["delete"].apply(this, TopicHistoryWindow_toConsumableArray(ev.ids));
|
|
1602
1681
|
if (!(this.length === 0)) {
|
|
1603
|
-
|
|
1682
|
+
_context18.n = 2;
|
|
1604
1683
|
break;
|
|
1605
1684
|
}
|
|
1606
|
-
|
|
1685
|
+
_context18.n = 2;
|
|
1607
1686
|
return this.resetToLatest();
|
|
1608
1687
|
case 2:
|
|
1609
1688
|
if (refTopicIds.length > 0) {
|
|
1610
1689
|
this.eventTarget.emit('reftopicsdeleted', refTopicIds);
|
|
1611
1690
|
}
|
|
1612
1691
|
case 3:
|
|
1613
|
-
return
|
|
1692
|
+
return _context18.a(2);
|
|
1614
1693
|
}
|
|
1615
|
-
},
|
|
1694
|
+
}, _callee18, this);
|
|
1616
1695
|
}));
|
|
1617
|
-
function handleMessagesRedacted(
|
|
1696
|
+
function handleMessagesRedacted(_x7) {
|
|
1618
1697
|
return _handleMessagesRedacted.apply(this, arguments);
|
|
1619
1698
|
}
|
|
1620
1699
|
return handleMessagesRedacted;
|
|
@@ -4240,6 +4319,18 @@ Permissions_defineProperty(Permissions, "list", {
|
|
|
4240
4319
|
AddMembers: {
|
|
4241
4320
|
value: 1 << 20,
|
|
4242
4321
|
maxLayer: Layer.Space
|
|
4322
|
+
},
|
|
4323
|
+
React: {
|
|
4324
|
+
value: 1 << 21,
|
|
4325
|
+
maxLayer: Layer.Topic
|
|
4326
|
+
},
|
|
4327
|
+
CreatePolls: {
|
|
4328
|
+
value: 1 << 22,
|
|
4329
|
+
maxLayer: Layer.Topic
|
|
4330
|
+
},
|
|
4331
|
+
MentionAllRoles: {
|
|
4332
|
+
value: 1 << 23,
|
|
4333
|
+
maxLayer: Layer.Topic
|
|
4243
4334
|
}
|
|
4244
4335
|
});
|
|
4245
4336
|
;// ./src/state-tracker/PermissionsManager.ts
|
|
@@ -6048,6 +6139,21 @@ var FilesClient = /*#__PURE__*/function (_AbstractRestClient) {
|
|
|
6048
6139
|
}()
|
|
6049
6140
|
}]);
|
|
6050
6141
|
}(AbstractRestClient);
|
|
6142
|
+
;// ./src/types/src/schemes/Role.ts
|
|
6143
|
+
/**
|
|
6144
|
+
* Bit flags of a role, stored in {@link Role.flags}.
|
|
6145
|
+
*
|
|
6146
|
+
* - `SeparateOnMembersList` - available holders of the role are listed in their
|
|
6147
|
+
* own group of the members list, headed by the role name.
|
|
6148
|
+
* - `MentionableByEveryone` - anybody may mention the role with notification
|
|
6149
|
+
* effects; without it the mention is decorative only, unless the author holds
|
|
6150
|
+
* the `MentionAllRoles` permission.
|
|
6151
|
+
*/
|
|
6152
|
+
var RoleFlag = /*#__PURE__*/function (RoleFlag) {
|
|
6153
|
+
RoleFlag[RoleFlag["SeparateOnMembersList"] = 1] = "SeparateOnMembersList";
|
|
6154
|
+
RoleFlag[RoleFlag["MentionableByEveryone"] = 2] = "MentionableByEveryone";
|
|
6155
|
+
return RoleFlag;
|
|
6156
|
+
}({});
|
|
6051
6157
|
;// ./src/types/src/schemes/User.ts
|
|
6052
6158
|
/**
|
|
6053
6159
|
* Availability of a user, aggregated over all of their sessions.
|