sceyt-chat-react-uikit 1.8.8-beta.17 → 1.8.8-beta.19
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/index.js +578 -282
- package/index.modern.js +578 -282
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8498,6 +8498,31 @@ var getAllowEditDeleteIncomingMessage = function getAllowEditDeleteIncomingMessa
|
|
|
8498
8498
|
var compareMessageBodyAttributes = function compareMessageBodyAttributes(attributes1, attributes2) {
|
|
8499
8499
|
return JSON.stringify(attributes1) === JSON.stringify(attributes2);
|
|
8500
8500
|
};
|
|
8501
|
+
var trimMessageBodyWithAttributes = function trimMessageBodyWithAttributes(text, attributes) {
|
|
8502
|
+
var body = text.trim();
|
|
8503
|
+
var leadingTrim = text.length - text.trimStart().length;
|
|
8504
|
+
var bodyAttributes = (attributes || []).map(function (att) {
|
|
8505
|
+
var offset = att.offset - leadingTrim;
|
|
8506
|
+
var length = att.length;
|
|
8507
|
+
if (offset < 0) {
|
|
8508
|
+
length += offset;
|
|
8509
|
+
offset = 0;
|
|
8510
|
+
}
|
|
8511
|
+
if (offset + length > body.length) {
|
|
8512
|
+
length = body.length - offset;
|
|
8513
|
+
}
|
|
8514
|
+
return _extends({}, att, {
|
|
8515
|
+
offset: offset,
|
|
8516
|
+
length: length
|
|
8517
|
+
});
|
|
8518
|
+
}).filter(function (att) {
|
|
8519
|
+
return att.length > 0 && att.offset >= 0 && att.offset < body.length;
|
|
8520
|
+
});
|
|
8521
|
+
return {
|
|
8522
|
+
body: body,
|
|
8523
|
+
bodyAttributes: bodyAttributes
|
|
8524
|
+
};
|
|
8525
|
+
};
|
|
8501
8526
|
var bodyAttributesMapByType = {
|
|
8502
8527
|
1: ['bold'],
|
|
8503
8528
|
2: ['italic'],
|
|
@@ -12096,9 +12121,20 @@ function getLatestMessagesFromMap(channelId, limit) {
|
|
|
12096
12121
|
return !!m.id || m.tid;
|
|
12097
12122
|
}).sort(compareMessagesForList).slice(-limit);
|
|
12098
12123
|
}
|
|
12099
|
-
function
|
|
12124
|
+
function getLatestContiguousMessagesFromMap(channelId, limit) {
|
|
12100
12125
|
var _loadedSegmentsMap$ch;
|
|
12101
12126
|
var latestSegment = (_loadedSegmentsMap$ch = loadedSegmentsMap[channelId]) === null || _loadedSegmentsMap$ch === void 0 ? void 0 : _loadedSegmentsMap$ch.at(-1);
|
|
12127
|
+
var messages = Object.values(messagesMap[channelId] || {}).filter(function (m) {
|
|
12128
|
+
return !!m.id || m.tid;
|
|
12129
|
+
});
|
|
12130
|
+
var contiguousMessages = latestSegment ? messages.filter(function (m) {
|
|
12131
|
+
return !m.id || compareMessageIds(m.id, latestSegment.startId) >= 0 && compareMessageIds(m.id, latestSegment.endId) <= 0;
|
|
12132
|
+
}) : messages;
|
|
12133
|
+
return contiguousMessages.sort(compareMessagesForList).slice(-limit);
|
|
12134
|
+
}
|
|
12135
|
+
function getLatestCachedConfirmedMessageId(channelId) {
|
|
12136
|
+
var _loadedSegmentsMap$ch2;
|
|
12137
|
+
var latestSegment = (_loadedSegmentsMap$ch2 = loadedSegmentsMap[channelId]) === null || _loadedSegmentsMap$ch2 === void 0 ? void 0 : _loadedSegmentsMap$ch2.at(-1);
|
|
12102
12138
|
if (latestSegment !== null && latestSegment !== void 0 && latestSegment.endId) {
|
|
12103
12139
|
return latestSegment.endId;
|
|
12104
12140
|
}
|
|
@@ -16014,6 +16050,10 @@ var SDKErrorTypeEnum = {
|
|
|
16014
16050
|
Authentication: {
|
|
16015
16051
|
value: 'Authentication',
|
|
16016
16052
|
isResendable: true
|
|
16053
|
+
},
|
|
16054
|
+
AttachmentUnavailable: {
|
|
16055
|
+
value: 'AttachmentUnavailable',
|
|
16056
|
+
isResendable: false
|
|
16017
16057
|
}
|
|
16018
16058
|
};
|
|
16019
16059
|
var fromValue = function fromValue(value) {
|
|
@@ -16031,6 +16071,11 @@ var isResendableError = function isResendableError(value) {
|
|
|
16031
16071
|
var errorType = fromValue(value);
|
|
16032
16072
|
return (_errorType$isResendab = errorType === null || errorType === void 0 ? void 0 : errorType.isResendable) != null ? _errorType$isResendab : true;
|
|
16033
16073
|
};
|
|
16074
|
+
var createAttachmentUnavailableError = function createAttachmentUnavailableError(message) {
|
|
16075
|
+
var error = new Error(message);
|
|
16076
|
+
error.type = SDKErrorTypeEnum.AttachmentUnavailable.value;
|
|
16077
|
+
return error;
|
|
16078
|
+
};
|
|
16034
16079
|
|
|
16035
16080
|
var _excluded$1 = ["lastMessage"];
|
|
16036
16081
|
var _marked = /*#__PURE__*/_regenerator().m(setMessageListLoading),
|
|
@@ -16093,6 +16138,8 @@ var _marked = /*#__PURE__*/_regenerator().m(setMessageListLoading),
|
|
|
16093
16138
|
_marked56 = /*#__PURE__*/_regenerator().m(loadMorePollVotes),
|
|
16094
16139
|
_marked57 = /*#__PURE__*/_regenerator().m(refreshCacheAroundMessage),
|
|
16095
16140
|
_marked58 = /*#__PURE__*/_regenerator().m(MessageSaga);
|
|
16141
|
+
var MAX_AUTO_RESEND_ATTEMPTS = 5;
|
|
16142
|
+
var autoResendAttempts = new Map();
|
|
16096
16143
|
var loadMoreMessagesInFlight = new Set();
|
|
16097
16144
|
var prefetchInFlight = new Set();
|
|
16098
16145
|
var queuedPrefetchRequests = new Map();
|
|
@@ -16316,6 +16363,7 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
16316
16363
|
try {
|
|
16317
16364
|
return Promise.resolve(Promise.all(attachments.map(function (attachment) {
|
|
16318
16365
|
try {
|
|
16366
|
+
var _attachment$url, _attachment$url$type;
|
|
16319
16367
|
var _temp10 = function _temp10() {
|
|
16320
16368
|
function _temp0() {
|
|
16321
16369
|
store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.SUCCESS, attachment.tid));
|
|
@@ -16337,14 +16385,15 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
16337
16385
|
return attachmentToSend;
|
|
16338
16386
|
}
|
|
16339
16387
|
var _temp9 = function () {
|
|
16340
|
-
if (!attachment.cachedUrl &&
|
|
16388
|
+
if (!attachment.cachedUrl && fileType === 'image') {
|
|
16341
16389
|
return _catch(function () {
|
|
16342
16390
|
var _temp2 = function () {
|
|
16343
16391
|
if (blobLocal && blobLocal.type.startsWith('image/')) {
|
|
16392
|
+
var _attachment, _attachment2;
|
|
16344
16393
|
var file = attachment.url instanceof File ? attachment.url : new File([attachment.url], attachment.name || 'image', {
|
|
16345
16394
|
type: attachment.url.type || blobLocal.type
|
|
16346
16395
|
});
|
|
16347
|
-
var _calculateRenderedIma = calculateRenderedImageWidth((attachment === null ||
|
|
16396
|
+
var _calculateRenderedIma = calculateRenderedImageWidth(((_attachment = attachment) === null || _attachment === void 0 ? void 0 : _attachment.metadata.szw) || 1280, ((_attachment2 = attachment) === null || _attachment2 === void 0 ? void 0 : _attachment2.metadata.szh) || 1080),
|
|
16348
16397
|
newWidth = _calculateRenderedIma[0],
|
|
16349
16398
|
newHeight = _calculateRenderedIma[1];
|
|
16350
16399
|
return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref) {
|
|
@@ -16382,10 +16431,11 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
16382
16431
|
});
|
|
16383
16432
|
} else {
|
|
16384
16433
|
var _temp11 = function () {
|
|
16385
|
-
if (!attachment.cachedUrl &&
|
|
16434
|
+
if (!attachment.cachedUrl && fileType === 'video') {
|
|
16386
16435
|
var _temp7 = function () {
|
|
16387
16436
|
if (blobLocal) {
|
|
16388
|
-
var
|
|
16437
|
+
var _attachment3, _attachment4;
|
|
16438
|
+
var _calculateRenderedIma2 = calculateRenderedImageWidth(((_attachment3 = attachment) === null || _attachment3 === void 0 ? void 0 : _attachment3.metadata.szw) || 1280, ((_attachment4 = attachment) === null || _attachment4 === void 0 ? void 0 : _attachment4.metadata.szh) || 1080),
|
|
16389
16439
|
newWidth = _calculateRenderedIma2[0],
|
|
16390
16440
|
newHeight = _calculateRenderedIma2[1];
|
|
16391
16441
|
return Promise.resolve(getVideoFirstFrame(blobLocal, newWidth, newHeight)).then(function (result) {
|
|
@@ -16443,7 +16493,19 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
16443
16493
|
total = _ref2.total;
|
|
16444
16494
|
store.dispatch(updateAttachmentUploadingProgressAC(loaded, total, attachment.tid));
|
|
16445
16495
|
};
|
|
16446
|
-
|
|
16496
|
+
if (!attachment.cachedUrl && !(attachment.url instanceof Blob)) {
|
|
16497
|
+
var _getPendingAttachment;
|
|
16498
|
+
var pendingFile = (_getPendingAttachment = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment === void 0 ? void 0 : _getPendingAttachment.file;
|
|
16499
|
+
if (pendingFile instanceof Blob) {
|
|
16500
|
+
attachment = _extends({}, attachment, {
|
|
16501
|
+
url: pendingFile,
|
|
16502
|
+
data: pendingFile
|
|
16503
|
+
});
|
|
16504
|
+
} else {
|
|
16505
|
+
throw createAttachmentUnavailableError("Attachment file for tid " + attachment.tid + " is no longer available for upload");
|
|
16506
|
+
}
|
|
16507
|
+
}
|
|
16508
|
+
var fileType = (_attachment$url = attachment.url) === null || _attachment$url === void 0 ? void 0 : (_attachment$url$type = _attachment$url.type) === null || _attachment$url$type === void 0 ? void 0 : _attachment$url$type.split('/')[0];
|
|
16447
16509
|
var fileSize = attachment.size;
|
|
16448
16510
|
var filePath;
|
|
16449
16511
|
var uriLocal;
|
|
@@ -16946,11 +17008,19 @@ function sendMessage(action) {
|
|
|
16946
17008
|
break;
|
|
16947
17009
|
}
|
|
16948
17010
|
_loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
16949
|
-
var attachment, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, messageForSend, _pending;
|
|
17011
|
+
var attachment, _getPendingAttachment2, pendingFile, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, messageForSend, _pending;
|
|
16950
17012
|
return _regenerator().w(function (_context11) {
|
|
16951
17013
|
while (1) switch (_context11.n) {
|
|
16952
17014
|
case 0:
|
|
16953
17015
|
attachment = mediaAttachments[i];
|
|
17016
|
+
if (customUploader && !attachment.cachedUrl && !(attachment.data instanceof Blob)) {
|
|
17017
|
+
pendingFile = (_getPendingAttachment2 = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment2 === void 0 ? void 0 : _getPendingAttachment2.file;
|
|
17018
|
+
if (pendingFile instanceof Blob) {
|
|
17019
|
+
attachment = _extends({}, attachment, {
|
|
17020
|
+
data: pendingFile
|
|
17021
|
+
});
|
|
17022
|
+
}
|
|
17023
|
+
}
|
|
16954
17024
|
if (attachment.cachedUrl) {
|
|
16955
17025
|
uri = attachment.cachedUrl;
|
|
16956
17026
|
}
|
|
@@ -17251,6 +17321,9 @@ function sendMessage(action) {
|
|
|
17251
17321
|
return effects.call(channel.sendMessage, messageToSend);
|
|
17252
17322
|
case 5:
|
|
17253
17323
|
messageResponse = _context12.v;
|
|
17324
|
+
if (messageToSend.tid) {
|
|
17325
|
+
autoResendAttempts["delete"](messageToSend.tid);
|
|
17326
|
+
}
|
|
17254
17327
|
if (!customUploader) {
|
|
17255
17328
|
_context12.n = 10;
|
|
17256
17329
|
break;
|
|
@@ -17783,12 +17856,17 @@ function forwardMessage(action) {
|
|
|
17783
17856
|
}
|
|
17784
17857
|
function resendMessage(action) {
|
|
17785
17858
|
var _message$attachments;
|
|
17786
|
-
var payload,
|
|
17859
|
+
var payload, payloadMessage, connectionState, channelId, liveMessage, message, attachments, sendAttachmentsAsSeparateMessage, isVoiceMessage;
|
|
17787
17860
|
return _regenerator().w(function (_context16) {
|
|
17788
17861
|
while (1) switch (_context16.n) {
|
|
17789
17862
|
case 0:
|
|
17790
17863
|
payload = action.payload;
|
|
17791
|
-
|
|
17864
|
+
payloadMessage = payload.message, connectionState = payload.connectionState, channelId = payload.channelId;
|
|
17865
|
+
liveMessage = payloadMessage !== null && payloadMessage !== void 0 && payloadMessage.tid || payloadMessage !== null && payloadMessage !== void 0 && payloadMessage.id ? getMessageFromMap(channelId, payloadMessage.tid || payloadMessage.id) : null;
|
|
17866
|
+
message = liveMessage || payloadMessage;
|
|
17867
|
+
if (message !== null && message !== void 0 && message.tid || message !== null && message !== void 0 && message.id) {
|
|
17868
|
+
autoResendAttempts["delete"](message.tid || message.id);
|
|
17869
|
+
}
|
|
17792
17870
|
attachments = message === null || message === void 0 ? void 0 : (_message$attachments = message.attachments) === null || _message$attachments === void 0 ? void 0 : _message$attachments.filter(function (att) {
|
|
17793
17871
|
return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
|
|
17794
17872
|
});
|
|
@@ -17983,7 +18061,7 @@ function editMessage(action) {
|
|
|
17983
18061
|
}, _marked14, null, [[0, 8]]);
|
|
17984
18062
|
}
|
|
17985
18063
|
var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connectionState) {
|
|
17986
|
-
var pendingMessagesMap, channelId, _iterator3, _step3, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9;
|
|
18064
|
+
var pendingMessagesMap, channelId, _iterator3, _step3, _msg$attachments, msg, attachments, resendKey, attempts, pendingPollActionsMap, _t7, _t8, _t9;
|
|
17987
18065
|
return _regenerator().w(function (_context19) {
|
|
17988
18066
|
while (1) switch (_context19.p = _context19.n) {
|
|
17989
18067
|
case 0:
|
|
@@ -17991,26 +18069,41 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
|
|
|
17991
18069
|
_t7 = _regeneratorKeys(pendingMessagesMap);
|
|
17992
18070
|
case 1:
|
|
17993
18071
|
if ((_t8 = _t7()).done) {
|
|
17994
|
-
_context19.n =
|
|
18072
|
+
_context19.n = 13;
|
|
17995
18073
|
break;
|
|
17996
18074
|
}
|
|
17997
18075
|
channelId = _t8.value;
|
|
17998
18076
|
_iterator3 = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
17999
18077
|
case 2:
|
|
18000
18078
|
if ((_step3 = _iterator3()).done) {
|
|
18001
|
-
_context19.n =
|
|
18079
|
+
_context19.n = 12;
|
|
18002
18080
|
break;
|
|
18003
18081
|
}
|
|
18004
18082
|
msg = _step3.value;
|
|
18005
18083
|
attachments = msg === null || msg === void 0 ? void 0 : (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
18006
18084
|
return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
|
|
18007
18085
|
});
|
|
18008
|
-
|
|
18086
|
+
resendKey = (msg === null || msg === void 0 ? void 0 : msg.tid) || (msg === null || msg === void 0 ? void 0 : msg.id);
|
|
18087
|
+
if (!resendKey) {
|
|
18088
|
+
_context19.n = 4;
|
|
18089
|
+
break;
|
|
18090
|
+
}
|
|
18091
|
+
attempts = autoResendAttempts.get(resendKey) || 0;
|
|
18092
|
+
if (!(attempts >= MAX_AUTO_RESEND_ATTEMPTS)) {
|
|
18093
|
+
_context19.n = 3;
|
|
18094
|
+
break;
|
|
18095
|
+
}
|
|
18096
|
+
log.info("Skipping auto-resend of message " + resendKey + " after " + attempts + " failed attempts");
|
|
18097
|
+
return _context19.a(3, 11);
|
|
18098
|
+
case 3:
|
|
18099
|
+
autoResendAttempts.set(resendKey, attempts + 1);
|
|
18100
|
+
case 4:
|
|
18101
|
+
_context19.p = 4;
|
|
18009
18102
|
if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
|
|
18010
|
-
_context19.n =
|
|
18103
|
+
_context19.n = 6;
|
|
18011
18104
|
break;
|
|
18012
18105
|
}
|
|
18013
|
-
_context19.n =
|
|
18106
|
+
_context19.n = 5;
|
|
18014
18107
|
return effects.call(forwardMessage, {
|
|
18015
18108
|
type: RESEND_MESSAGE,
|
|
18016
18109
|
payload: {
|
|
@@ -18020,15 +18113,15 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
|
|
|
18020
18113
|
isForward: true
|
|
18021
18114
|
}
|
|
18022
18115
|
});
|
|
18023
|
-
case 4:
|
|
18024
|
-
_context19.n = 8;
|
|
18025
|
-
break;
|
|
18026
18116
|
case 5:
|
|
18117
|
+
_context19.n = 9;
|
|
18118
|
+
break;
|
|
18119
|
+
case 6:
|
|
18027
18120
|
if (!(attachments && attachments.length > 0)) {
|
|
18028
|
-
_context19.n =
|
|
18121
|
+
_context19.n = 8;
|
|
18029
18122
|
break;
|
|
18030
18123
|
}
|
|
18031
|
-
_context19.n =
|
|
18124
|
+
_context19.n = 7;
|
|
18032
18125
|
return effects.call(sendMessage, {
|
|
18033
18126
|
type: RESEND_MESSAGE,
|
|
18034
18127
|
payload: {
|
|
@@ -18038,11 +18131,11 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
|
|
|
18038
18131
|
sendAttachmentsAsSeparateMessage: false
|
|
18039
18132
|
}
|
|
18040
18133
|
});
|
|
18041
|
-
case 6:
|
|
18042
|
-
_context19.n = 8;
|
|
18043
|
-
break;
|
|
18044
18134
|
case 7:
|
|
18045
|
-
_context19.n =
|
|
18135
|
+
_context19.n = 9;
|
|
18136
|
+
break;
|
|
18137
|
+
case 8:
|
|
18138
|
+
_context19.n = 9;
|
|
18046
18139
|
return effects.call(sendTextMessage, {
|
|
18047
18140
|
type: RESEND_MESSAGE,
|
|
18048
18141
|
payload: {
|
|
@@ -18051,31 +18144,31 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
|
|
|
18051
18144
|
channelId: channelId
|
|
18052
18145
|
}
|
|
18053
18146
|
});
|
|
18054
|
-
case 8:
|
|
18055
|
-
_context19.n = 10;
|
|
18056
|
-
break;
|
|
18057
18147
|
case 9:
|
|
18058
|
-
_context19.
|
|
18148
|
+
_context19.n = 11;
|
|
18149
|
+
break;
|
|
18150
|
+
case 10:
|
|
18151
|
+
_context19.p = 10;
|
|
18059
18152
|
_t9 = _context19.v;
|
|
18060
18153
|
log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t9);
|
|
18061
|
-
case
|
|
18154
|
+
case 11:
|
|
18062
18155
|
_context19.n = 2;
|
|
18063
18156
|
break;
|
|
18064
|
-
case
|
|
18157
|
+
case 12:
|
|
18065
18158
|
_context19.n = 1;
|
|
18066
18159
|
break;
|
|
18067
|
-
case
|
|
18160
|
+
case 13:
|
|
18068
18161
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
18069
18162
|
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
18070
|
-
_context19.n =
|
|
18163
|
+
_context19.n = 14;
|
|
18071
18164
|
break;
|
|
18072
18165
|
}
|
|
18073
|
-
_context19.n =
|
|
18166
|
+
_context19.n = 14;
|
|
18074
18167
|
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
18075
|
-
case
|
|
18168
|
+
case 14:
|
|
18076
18169
|
return _context19.a(2);
|
|
18077
18170
|
}
|
|
18078
|
-
}, _callee5, null, [[
|
|
18171
|
+
}, _callee5, null, [[4, 10]]);
|
|
18079
18172
|
});
|
|
18080
18173
|
var shouldAppendPendingMessages = function shouldAppendPendingMessages(channelOrId, messages, options) {
|
|
18081
18174
|
var _getStoredChannel9, _getStoredChannel9$la, _channelOrId$lastMess;
|
|
@@ -18300,7 +18393,7 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
|
|
|
18300
18393
|
getFromServer = true;
|
|
18301
18394
|
}
|
|
18302
18395
|
return /*#__PURE__*/_regenerator().m(function _callee6() {
|
|
18303
|
-
var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j,
|
|
18396
|
+
var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j, _attachment5, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
|
|
18304
18397
|
return _regenerator().w(function (_context22) {
|
|
18305
18398
|
while (1) switch (_context22.n) {
|
|
18306
18399
|
case 0:
|
|
@@ -18329,13 +18422,13 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
|
|
|
18329
18422
|
_context22.n = 6;
|
|
18330
18423
|
break;
|
|
18331
18424
|
}
|
|
18332
|
-
|
|
18333
|
-
if (!(
|
|
18425
|
+
_attachment5 = message.attachments[j];
|
|
18426
|
+
if (!(_attachment5.type === attachmentTypes.link)) {
|
|
18334
18427
|
_context22.n = 4;
|
|
18335
18428
|
break;
|
|
18336
18429
|
}
|
|
18337
18430
|
if (!firstAttachment) {
|
|
18338
|
-
firstAttachment =
|
|
18431
|
+
firstAttachment = _attachment5;
|
|
18339
18432
|
}
|
|
18340
18433
|
_context22.n = 5;
|
|
18341
18434
|
break;
|
|
@@ -19412,7 +19505,7 @@ function loadDefaultMessages(action) {
|
|
|
19412
19505
|
case 4:
|
|
19413
19506
|
messageQuery = _t24;
|
|
19414
19507
|
query.messageQuery = messageQuery;
|
|
19415
|
-
cachedMessages =
|
|
19508
|
+
cachedMessages = getLatestContiguousMessagesFromMap(channel.id, MESSAGES_MAX_PAGE_COUNT);
|
|
19416
19509
|
if (!(cachedMessages && cachedMessages.length)) {
|
|
19417
19510
|
_context32.n = 9;
|
|
19418
19511
|
break;
|
|
@@ -19716,7 +19809,7 @@ function getMessagesQuery(action) {
|
|
|
19716
19809
|
_context33.n = 22;
|
|
19717
19810
|
break;
|
|
19718
19811
|
case 17:
|
|
19719
|
-
cachedMessages =
|
|
19812
|
+
cachedMessages = getLatestContiguousMessagesFromMap(channel.id, MESSAGES_MAX_PAGE_COUNT);
|
|
19720
19813
|
cacheIsCurrent = !networkChanged && cachedMessages.length > 0 && getLastConfirmedMessageId(cachedMessages) === ((_channel$lastMessage1 = channel.lastMessage) === null || _channel$lastMessage1 === void 0 ? void 0 : _channel$lastMessage1.id);
|
|
19721
19814
|
if (!cacheIsCurrent) {
|
|
19722
19815
|
_context33.n = 18;
|
|
@@ -25292,52 +25385,81 @@ function watchForEvents() {
|
|
|
25292
25385
|
}, _marked8$1);
|
|
25293
25386
|
}
|
|
25294
25387
|
|
|
25388
|
+
var READ_MESSAGE_LOG_KEY_ALIASES = {
|
|
25389
|
+
source: 's',
|
|
25390
|
+
channelId: 'ch',
|
|
25391
|
+
readAll: 'ra',
|
|
25392
|
+
messageIds: 'mi',
|
|
25393
|
+
messageId: 'm',
|
|
25394
|
+
connectionStatus: 'cs',
|
|
25395
|
+
attempts: 'at',
|
|
25396
|
+
retryDelayMs: 'rd',
|
|
25397
|
+
requestedMessageIds: 'rq',
|
|
25398
|
+
confirmedMessageIds: 'cf',
|
|
25399
|
+
isVisible: 'iv',
|
|
25400
|
+
alreadyRead: 'ar',
|
|
25401
|
+
disableAutoReadTracking: 'da',
|
|
25402
|
+
isTabActive: 'ta',
|
|
25403
|
+
newMessageCount: 'nm',
|
|
25404
|
+
queued: 'q',
|
|
25405
|
+
localRef: 'lr',
|
|
25406
|
+
visibleCandidateIds: 'vc',
|
|
25407
|
+
unreadScrollTo: 'us',
|
|
25408
|
+
pendingFrameScheduled: 'pf'
|
|
25409
|
+
};
|
|
25410
|
+
var compactReadMessageLogData = function compactReadMessageLogData(data) {
|
|
25411
|
+
return JSON.stringify(Object.fromEntries(Object.entries(data).map(function (_ref) {
|
|
25412
|
+
var key = _ref[0],
|
|
25413
|
+
value = _ref[1];
|
|
25414
|
+
return [READ_MESSAGE_LOG_KEY_ALIASES[key] || key.slice(0, 2), value];
|
|
25415
|
+
})));
|
|
25416
|
+
};
|
|
25417
|
+
|
|
25295
25418
|
var _marked$3 = /*#__PURE__*/_regenerator().m(applyChannelReadProgress),
|
|
25296
|
-
_marked2$3 = /*#__PURE__*/_regenerator().m(
|
|
25297
|
-
_marked3$2 = /*#__PURE__*/_regenerator().m(
|
|
25298
|
-
_marked4$2 = /*#__PURE__*/_regenerator().m(
|
|
25299
|
-
_marked5$2 = /*#__PURE__*/_regenerator().m(
|
|
25300
|
-
_marked6$2 = /*#__PURE__*/_regenerator().m(
|
|
25301
|
-
_marked7$2 = /*#__PURE__*/_regenerator().m(
|
|
25302
|
-
_marked8$2 = /*#__PURE__*/_regenerator().m(
|
|
25303
|
-
_marked9$1 = /*#__PURE__*/_regenerator().m(
|
|
25304
|
-
_marked0$1 = /*#__PURE__*/_regenerator().m(
|
|
25305
|
-
_marked1$1 = /*#__PURE__*/_regenerator().m(
|
|
25306
|
-
_marked10$1 = /*#__PURE__*/_regenerator().m(
|
|
25307
|
-
_marked11$1 = /*#__PURE__*/_regenerator().m(
|
|
25308
|
-
_marked12$1 = /*#__PURE__*/_regenerator().m(
|
|
25309
|
-
_marked13$1 = /*#__PURE__*/_regenerator().m(
|
|
25310
|
-
_marked14$1 = /*#__PURE__*/_regenerator().m(
|
|
25311
|
-
_marked15$1 = /*#__PURE__*/_regenerator().m(
|
|
25312
|
-
_marked16$1 = /*#__PURE__*/_regenerator().m(
|
|
25313
|
-
_marked17$1 = /*#__PURE__*/_regenerator().m(
|
|
25314
|
-
_marked18$1 = /*#__PURE__*/_regenerator().m(
|
|
25315
|
-
_marked19$1 = /*#__PURE__*/_regenerator().m(
|
|
25316
|
-
_marked20$1 = /*#__PURE__*/_regenerator().m(
|
|
25317
|
-
_marked21$1 = /*#__PURE__*/_regenerator().m(
|
|
25318
|
-
_marked22$1 = /*#__PURE__*/_regenerator().m(
|
|
25319
|
-
_marked23$1 = /*#__PURE__*/_regenerator().m(
|
|
25320
|
-
_marked24$1 = /*#__PURE__*/_regenerator().m(
|
|
25321
|
-
_marked25$1 = /*#__PURE__*/_regenerator().m(
|
|
25322
|
-
_marked26$1 = /*#__PURE__*/_regenerator().m(
|
|
25323
|
-
_marked27$1 = /*#__PURE__*/_regenerator().m(
|
|
25324
|
-
_marked28$1 = /*#__PURE__*/_regenerator().m(
|
|
25325
|
-
_marked29$1 = /*#__PURE__*/_regenerator().m(
|
|
25326
|
-
_marked30$1 = /*#__PURE__*/_regenerator().m(
|
|
25327
|
-
_marked31$1 = /*#__PURE__*/_regenerator().m(
|
|
25328
|
-
_marked32$1 = /*#__PURE__*/_regenerator().m(
|
|
25329
|
-
_marked33$1 = /*#__PURE__*/_regenerator().m(
|
|
25330
|
-
_marked34$1 = /*#__PURE__*/_regenerator().m(
|
|
25331
|
-
_marked35$1 = /*#__PURE__*/_regenerator().m(
|
|
25332
|
-
_marked36$1 = /*#__PURE__*/_regenerator().m(
|
|
25333
|
-
_marked37$1 = /*#__PURE__*/_regenerator().m(
|
|
25334
|
-
_marked38$1 = /*#__PURE__*/_regenerator().m(
|
|
25335
|
-
_marked39$1 = /*#__PURE__*/_regenerator().m(
|
|
25336
|
-
_marked40$1 = /*#__PURE__*/_regenerator().m(
|
|
25337
|
-
_marked41$1 = /*#__PURE__*/_regenerator().m(
|
|
25338
|
-
_marked42$1 = /*#__PURE__*/_regenerator().m(
|
|
25339
|
-
_marked43$1 = /*#__PURE__*/_regenerator().m(
|
|
25340
|
-
_marked44$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
|
|
25419
|
+
_marked2$3 = /*#__PURE__*/_regenerator().m(createChannel),
|
|
25420
|
+
_marked3$2 = /*#__PURE__*/_regenerator().m(getChannels),
|
|
25421
|
+
_marked4$2 = /*#__PURE__*/_regenerator().m(searchChannels),
|
|
25422
|
+
_marked5$2 = /*#__PURE__*/_regenerator().m(getChannelsForForward),
|
|
25423
|
+
_marked6$2 = /*#__PURE__*/_regenerator().m(searchChannelsForForward),
|
|
25424
|
+
_marked7$2 = /*#__PURE__*/_regenerator().m(channelsLoadMore),
|
|
25425
|
+
_marked8$2 = /*#__PURE__*/_regenerator().m(getChannelMentions),
|
|
25426
|
+
_marked9$1 = /*#__PURE__*/_regenerator().m(channelsForForwardLoadMore),
|
|
25427
|
+
_marked0$1 = /*#__PURE__*/_regenerator().m(markMessagesRead),
|
|
25428
|
+
_marked1$1 = /*#__PURE__*/_regenerator().m(markVoiceMessageAsPlayed),
|
|
25429
|
+
_marked10$1 = /*#__PURE__*/_regenerator().m(updateMessageAsOpened),
|
|
25430
|
+
_marked11$1 = /*#__PURE__*/_regenerator().m(markMessageAsOpened),
|
|
25431
|
+
_marked12$1 = /*#__PURE__*/_regenerator().m(markMessagesDelivered),
|
|
25432
|
+
_marked13$1 = /*#__PURE__*/_regenerator().m(switchChannel),
|
|
25433
|
+
_marked14$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOff),
|
|
25434
|
+
_marked15$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOn),
|
|
25435
|
+
_marked16$1 = /*#__PURE__*/_regenerator().m(markChannelAsRead),
|
|
25436
|
+
_marked17$1 = /*#__PURE__*/_regenerator().m(resendPendingChannelReads),
|
|
25437
|
+
_marked18$1 = /*#__PURE__*/_regenerator().m(markChannelAsUnRead),
|
|
25438
|
+
_marked19$1 = /*#__PURE__*/_regenerator().m(pinChannel),
|
|
25439
|
+
_marked20$1 = /*#__PURE__*/_regenerator().m(unpinChannel),
|
|
25440
|
+
_marked21$1 = /*#__PURE__*/_regenerator().m(removeChannelCaches),
|
|
25441
|
+
_marked22$1 = /*#__PURE__*/_regenerator().m(leaveChannel),
|
|
25442
|
+
_marked23$1 = /*#__PURE__*/_regenerator().m(deletePendingDeleteChannels),
|
|
25443
|
+
_marked24$1 = /*#__PURE__*/_regenerator().m(deleteChannel),
|
|
25444
|
+
_marked25$1 = /*#__PURE__*/_regenerator().m(blockChannel),
|
|
25445
|
+
_marked26$1 = /*#__PURE__*/_regenerator().m(updateChannel),
|
|
25446
|
+
_marked27$1 = /*#__PURE__*/_regenerator().m(checkUsersStatus),
|
|
25447
|
+
_marked28$1 = /*#__PURE__*/_regenerator().m(sendTyping),
|
|
25448
|
+
_marked29$1 = /*#__PURE__*/_regenerator().m(sendRecording),
|
|
25449
|
+
_marked30$1 = /*#__PURE__*/_regenerator().m(clearHistory),
|
|
25450
|
+
_marked31$1 = /*#__PURE__*/_regenerator().m(deleteAllMessages),
|
|
25451
|
+
_marked32$1 = /*#__PURE__*/_regenerator().m(joinChannel),
|
|
25452
|
+
_marked33$1 = /*#__PURE__*/_regenerator().m(watchForChannelEvents),
|
|
25453
|
+
_marked34$1 = /*#__PURE__*/_regenerator().m(createChannelInviteKey),
|
|
25454
|
+
_marked35$1 = /*#__PURE__*/_regenerator().m(getChannelInviteKeys),
|
|
25455
|
+
_marked36$1 = /*#__PURE__*/_regenerator().m(regenerateChannelInviteKey),
|
|
25456
|
+
_marked37$1 = /*#__PURE__*/_regenerator().m(updateChannelInviteKey),
|
|
25457
|
+
_marked38$1 = /*#__PURE__*/_regenerator().m(getChannelByInviteKey),
|
|
25458
|
+
_marked39$1 = /*#__PURE__*/_regenerator().m(joinChannelWithInviteKey),
|
|
25459
|
+
_marked40$1 = /*#__PURE__*/_regenerator().m(setMessageRetentionPeriod),
|
|
25460
|
+
_marked41$1 = /*#__PURE__*/_regenerator().m(getChannelsWithUser),
|
|
25461
|
+
_marked42$1 = /*#__PURE__*/_regenerator().m(loadMoreMutualChannels),
|
|
25462
|
+
_marked43$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
|
|
25341
25463
|
var getUniqueMessageIds = function getUniqueMessageIds(messageIds) {
|
|
25342
25464
|
if (messageIds === void 0) {
|
|
25343
25465
|
messageIds = [];
|
|
@@ -25439,80 +25561,104 @@ function applyChannelReadProgress(channelId, updateData) {
|
|
|
25439
25561
|
var shouldKeepQueuedPendingRead = function shouldKeepQueuedPendingRead(error) {
|
|
25440
25562
|
return isResendableError(error === null || error === void 0 ? void 0 : error.type);
|
|
25441
25563
|
};
|
|
25442
|
-
function
|
|
25443
|
-
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
|
|
25452
|
-
|
|
25453
|
-
|
|
25454
|
-
|
|
25455
|
-
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
25478
|
-
|
|
25479
|
-
|
|
25480
|
-
|
|
25481
|
-
|
|
25482
|
-
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
_context2.
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25564
|
+
var getReadMarkerLogContext = function getReadMarkerLogContext(pendingRead, source, messageIds) {
|
|
25565
|
+
return {
|
|
25566
|
+
source: source,
|
|
25567
|
+
channelId: pendingRead.channelId,
|
|
25568
|
+
readAll: pendingRead.readAll,
|
|
25569
|
+
messageIds: messageIds
|
|
25570
|
+
};
|
|
25571
|
+
};
|
|
25572
|
+
function confirmDisplayedRead(channel, pendingRead, source) {
|
|
25573
|
+
if (source === void 0) {
|
|
25574
|
+
source = 'initial';
|
|
25575
|
+
}
|
|
25576
|
+
return /*#__PURE__*/_regenerator().m(function _callee() {
|
|
25577
|
+
var messageIds, logContext, attempt, connectionStatus, messageListMarker, _t;
|
|
25578
|
+
return _regenerator().w(function (_context2) {
|
|
25579
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
25580
|
+
case 0:
|
|
25581
|
+
messageIds = getUniqueMessageIds(pendingRead.messageIds);
|
|
25582
|
+
logContext = getReadMarkerLogContext(pendingRead, source, messageIds);
|
|
25583
|
+
attempt = 0;
|
|
25584
|
+
case 1:
|
|
25585
|
+
if (!(attempt <= READ_MARKER_RETRY_DELAYS_MS.length)) {
|
|
25586
|
+
_context2.n = 10;
|
|
25587
|
+
break;
|
|
25588
|
+
}
|
|
25589
|
+
connectionStatus = store.getState().UserReducer.connectionStatus;
|
|
25590
|
+
if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
|
|
25591
|
+
_context2.n = 2;
|
|
25592
|
+
break;
|
|
25593
|
+
}
|
|
25594
|
+
log.warn('[READ_MESSAGE] Queued read marker because connection is not ready', compactReadMessageLogData(_extends({}, logContext, {
|
|
25595
|
+
connectionStatus: connectionStatus
|
|
25596
|
+
})));
|
|
25597
|
+
return _context2.a(2, {
|
|
25598
|
+
status: 'queued'
|
|
25599
|
+
});
|
|
25600
|
+
case 2:
|
|
25601
|
+
_context2.p = 2;
|
|
25602
|
+
if (!pendingRead.readAll) {
|
|
25603
|
+
_context2.n = 4;
|
|
25604
|
+
break;
|
|
25605
|
+
}
|
|
25606
|
+
_context2.n = 3;
|
|
25607
|
+
return effects.call(channel.markAsRead);
|
|
25608
|
+
case 3:
|
|
25609
|
+
return _context2.a(2, {
|
|
25610
|
+
status: 'success'
|
|
25611
|
+
});
|
|
25612
|
+
case 4:
|
|
25613
|
+
_context2.n = 5;
|
|
25614
|
+
return effects.call(channel.markMessagesAsDisplayed, messageIds);
|
|
25615
|
+
case 5:
|
|
25616
|
+
messageListMarker = _context2.v;
|
|
25617
|
+
return _context2.a(2, {
|
|
25618
|
+
status: 'success',
|
|
25619
|
+
messageListMarker: messageListMarker
|
|
25620
|
+
});
|
|
25621
|
+
case 6:
|
|
25622
|
+
_context2.p = 6;
|
|
25623
|
+
_t = _context2.v;
|
|
25624
|
+
if (shouldKeepQueuedPendingRead(_t)) {
|
|
25625
|
+
_context2.n = 7;
|
|
25626
|
+
break;
|
|
25627
|
+
}
|
|
25628
|
+
log.error(_t, '[READ_MESSAGE] Dropping read marker after non-resendable error', compactReadMessageLogData(logContext));
|
|
25629
|
+
return _context2.a(2, {
|
|
25630
|
+
status: 'drop',
|
|
25631
|
+
error: _t
|
|
25632
|
+
});
|
|
25633
|
+
case 7:
|
|
25634
|
+
if (!(attempt === READ_MARKER_RETRY_DELAYS_MS.length)) {
|
|
25635
|
+
_context2.n = 8;
|
|
25636
|
+
break;
|
|
25637
|
+
}
|
|
25638
|
+
log.error(_t, '[READ_MESSAGE] Exhausted read marker retries; keeping queued for replay', compactReadMessageLogData(_extends({}, logContext, {
|
|
25639
|
+
attempts: attempt + 1
|
|
25640
|
+
})));
|
|
25641
|
+
return _context2.a(2, {
|
|
25642
|
+
status: 'queued',
|
|
25643
|
+
error: _t
|
|
25644
|
+
});
|
|
25645
|
+
case 8:
|
|
25646
|
+
log.warn(_t, "[READ_MESSAGE] Retrying read marker (" + (attempt + 1) + "/" + READ_MARKER_RETRY_DELAYS_MS.length + ")", compactReadMessageLogData(_extends({}, logContext, {
|
|
25647
|
+
retryDelayMs: READ_MARKER_RETRY_DELAYS_MS[attempt]
|
|
25648
|
+
})));
|
|
25649
|
+
_context2.n = 9;
|
|
25650
|
+
return effects.call(waitForReadMarkerRetry, READ_MARKER_RETRY_DELAYS_MS[attempt]);
|
|
25651
|
+
case 9:
|
|
25652
|
+
attempt++;
|
|
25653
|
+
_context2.n = 1;
|
|
25497
25654
|
break;
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
return effects.call(waitForReadMarkerRetry, READ_MARKER_RETRY_DELAYS_MS[attempt]);
|
|
25506
|
-
case 9:
|
|
25507
|
-
attempt++;
|
|
25508
|
-
_context2.n = 1;
|
|
25509
|
-
break;
|
|
25510
|
-
case 10:
|
|
25511
|
-
return _context2.a(2, {
|
|
25512
|
-
status: 'queued'
|
|
25513
|
-
});
|
|
25514
|
-
}
|
|
25515
|
-
}, _marked2$3, null, [[2, 6]]);
|
|
25655
|
+
case 10:
|
|
25656
|
+
return _context2.a(2, {
|
|
25657
|
+
status: 'queued'
|
|
25658
|
+
});
|
|
25659
|
+
}
|
|
25660
|
+
}, _callee, null, [[2, 6]]);
|
|
25661
|
+
})();
|
|
25516
25662
|
}
|
|
25517
25663
|
function createChannel(action) {
|
|
25518
25664
|
var payload, channelData, dontCreateIfNotExists, callback, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, whoDoesNotAdded, checkChannelExist, messageToSend, _allChannels, _memberId, _t2;
|
|
@@ -25710,7 +25856,7 @@ function createChannel(action) {
|
|
|
25710
25856
|
case 19:
|
|
25711
25857
|
return _context3.a(2);
|
|
25712
25858
|
}
|
|
25713
|
-
},
|
|
25859
|
+
}, _marked2$3, null, [[0, 18]]);
|
|
25714
25860
|
}
|
|
25715
25861
|
function getChannels(action) {
|
|
25716
25862
|
var _params$filter, _types, _activeChannel, _mappedChannels, _mappedChannels3, _mappedChannels4, payload, params, SceytChatClient, connectionStatus, channelQueryBuilder, channelTypesFilter, types, limit, channelQuery, channelsData, channelList, channelId, activeChannel, pendingLastMessages, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, _loop, _i, _Object$keys, _Object$keys2, _Object$keys3, _mappedChannels2, channelMessageMap, _iterator, _step, _lastMsg$userMarkers, ch, lastMsg, _activeChannel2, _activeChannel3, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, totalAllChannelsAdded, i, _connectionStatus, allChannelsData, allChannelList, _t3, _t4, _t5;
|
|
@@ -25808,7 +25954,7 @@ function getChannels(action) {
|
|
|
25808
25954
|
_yield$call = _context5.v;
|
|
25809
25955
|
mappedChannels = _yield$call.channels;
|
|
25810
25956
|
channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
|
|
25811
|
-
_loop = /*#__PURE__*/_regenerator().m(function
|
|
25957
|
+
_loop = /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
25812
25958
|
var _store$getState$Chann;
|
|
25813
25959
|
var channelId, pendingLastMessage, currentReduxLastMessage, resolvedLastMessage, mappedChannel, mapEntry;
|
|
25814
25960
|
return _regenerator().w(function (_context4) {
|
|
@@ -25835,7 +25981,7 @@ function getChannels(action) {
|
|
|
25835
25981
|
case 1:
|
|
25836
25982
|
return _context4.a(2);
|
|
25837
25983
|
}
|
|
25838
|
-
},
|
|
25984
|
+
}, _callee2);
|
|
25839
25985
|
});
|
|
25840
25986
|
_i = 0, _Object$keys = Object.keys(pendingLastMessages);
|
|
25841
25987
|
case 14:
|
|
@@ -26029,7 +26175,7 @@ function getChannels(action) {
|
|
|
26029
26175
|
case 38:
|
|
26030
26176
|
return _context5.a(2);
|
|
26031
26177
|
}
|
|
26032
|
-
},
|
|
26178
|
+
}, _marked3$2, null, [[27, 30], [1, 37]]);
|
|
26033
26179
|
}
|
|
26034
26180
|
function searchChannels(action) {
|
|
26035
26181
|
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator2, _step2, channel, channelQuery, channelsData, _iterator3, _step3, _channel, channelsToAdd, _t6;
|
|
@@ -26162,7 +26308,7 @@ function searchChannels(action) {
|
|
|
26162
26308
|
case 8:
|
|
26163
26309
|
return _context6.a(2);
|
|
26164
26310
|
}
|
|
26165
|
-
},
|
|
26311
|
+
}, _marked4$2, null, [[0, 7]]);
|
|
26166
26312
|
}
|
|
26167
26313
|
function getChannelsForForward() {
|
|
26168
26314
|
var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t7;
|
|
@@ -26220,7 +26366,7 @@ function getChannelsForForward() {
|
|
|
26220
26366
|
case 9:
|
|
26221
26367
|
return _context7.a(2);
|
|
26222
26368
|
}
|
|
26223
|
-
},
|
|
26369
|
+
}, _marked5$2, null, [[0, 8]]);
|
|
26224
26370
|
}
|
|
26225
26371
|
function searchChannelsForForward(action) {
|
|
26226
26372
|
var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator4, _step4, channel, channelQuery, channelsData, _iterator5, _step5, _channel2, channelsToAdd, _t8;
|
|
@@ -26352,7 +26498,7 @@ function searchChannelsForForward(action) {
|
|
|
26352
26498
|
case 8:
|
|
26353
26499
|
return _context8.a(2);
|
|
26354
26500
|
}
|
|
26355
|
-
},
|
|
26501
|
+
}, _marked6$2, null, [[0, 7]]);
|
|
26356
26502
|
}
|
|
26357
26503
|
function channelsLoadMore(action) {
|
|
26358
26504
|
var _mappedChannels5, _mappedChannels7, _mappedChannels8, payload, limit, channelQuery, channelsData, channelList, _yield$call3, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys4, _mappedChannels6, channelMessageMap, _t9;
|
|
@@ -26473,7 +26619,7 @@ function channelsLoadMore(action) {
|
|
|
26473
26619
|
case 13:
|
|
26474
26620
|
return _context9.a(2);
|
|
26475
26621
|
}
|
|
26476
|
-
},
|
|
26622
|
+
}, _marked7$2, null, [[1, 12]]);
|
|
26477
26623
|
}
|
|
26478
26624
|
function getChannelMentions(action) {
|
|
26479
26625
|
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t0;
|
|
@@ -26510,7 +26656,7 @@ function getChannelMentions(action) {
|
|
|
26510
26656
|
case 5:
|
|
26511
26657
|
return _context0.a(2);
|
|
26512
26658
|
}
|
|
26513
|
-
},
|
|
26659
|
+
}, _marked8$2, null, [[0, 4]]);
|
|
26514
26660
|
}
|
|
26515
26661
|
function channelsForForwardLoadMore(action) {
|
|
26516
26662
|
var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t1;
|
|
@@ -26561,10 +26707,10 @@ function channelsForForwardLoadMore(action) {
|
|
|
26561
26707
|
case 8:
|
|
26562
26708
|
return _context1.a(2);
|
|
26563
26709
|
}
|
|
26564
|
-
},
|
|
26710
|
+
}, _marked9$1, null, [[0, 7]]);
|
|
26565
26711
|
}
|
|
26566
26712
|
function markMessagesRead(action) {
|
|
26567
|
-
var payload, channelId, messageIds, requestedMessageIds,
|
|
26713
|
+
var payload, channelId, messageIds, requestedMessageIds, _confirmation$message, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead, readMessageIds, _iterator6, _step6, _confirmation$message2, _confirmation$message3, messageId, updateParams, _t10;
|
|
26568
26714
|
return _regenerator().w(function (_context10) {
|
|
26569
26715
|
while (1) switch (_context10.p = _context10.n) {
|
|
26570
26716
|
case 0:
|
|
@@ -26575,57 +26721,85 @@ function markMessagesRead(action) {
|
|
|
26575
26721
|
_context10.n = 1;
|
|
26576
26722
|
break;
|
|
26577
26723
|
}
|
|
26724
|
+
log.warn('[READ_MESSAGE] Skipping read marker because message id list is empty', compactReadMessageLogData({
|
|
26725
|
+
source: 'initial',
|
|
26726
|
+
channelId: channelId,
|
|
26727
|
+
readAll: false,
|
|
26728
|
+
messageIds: messageIds
|
|
26729
|
+
}));
|
|
26578
26730
|
return _context10.a(2);
|
|
26579
26731
|
case 1:
|
|
26580
26732
|
_context10.p = 1;
|
|
26733
|
+
log.info('[READ_MESSAGE] Received markMessagesRead action', compactReadMessageLogData({
|
|
26734
|
+
source: 'initial',
|
|
26735
|
+
channelId: channelId,
|
|
26736
|
+
readAll: false,
|
|
26737
|
+
messageIds: requestedMessageIds
|
|
26738
|
+
}));
|
|
26581
26739
|
_context10.n = 2;
|
|
26582
26740
|
return effects.call(getStoredChannel$2, channelId);
|
|
26583
26741
|
case 2:
|
|
26584
26742
|
channel = _context10.v;
|
|
26585
|
-
if (
|
|
26586
|
-
_context10.n =
|
|
26743
|
+
if (channel) {
|
|
26744
|
+
_context10.n = 3;
|
|
26587
26745
|
break;
|
|
26588
26746
|
}
|
|
26747
|
+
log.warn('[READ_MESSAGE] Cannot mark messages as read because channel was not found', compactReadMessageLogData({
|
|
26748
|
+
channelId: channelId,
|
|
26749
|
+
messageIds: requestedMessageIds
|
|
26750
|
+
}));
|
|
26751
|
+
return _context10.a(2);
|
|
26752
|
+
case 3:
|
|
26589
26753
|
optimisticUpdate = deriveChannelReadProgressUpdate({
|
|
26590
26754
|
channel: channel,
|
|
26591
26755
|
messageIds: requestedMessageIds
|
|
26592
26756
|
});
|
|
26593
|
-
_context10.n =
|
|
26757
|
+
_context10.n = 4;
|
|
26594
26758
|
return effects.call(applyChannelReadProgress, channel.id, optimisticUpdate);
|
|
26595
|
-
case
|
|
26759
|
+
case 4:
|
|
26596
26760
|
pendingRead = setPendingChannelRead({
|
|
26597
26761
|
channelId: channel.id,
|
|
26598
26762
|
messageIds: requestedMessageIds
|
|
26599
26763
|
});
|
|
26600
|
-
_context10.n =
|
|
26601
|
-
return effects.call(confirmDisplayedRead, channel, pendingRead);
|
|
26602
|
-
case
|
|
26764
|
+
_context10.n = 5;
|
|
26765
|
+
return effects.call(confirmDisplayedRead, channel, pendingRead, 'initial');
|
|
26766
|
+
case 5:
|
|
26603
26767
|
confirmation = _context10.v;
|
|
26604
26768
|
if (!(confirmation.status === 'success')) {
|
|
26605
|
-
_context10.n =
|
|
26769
|
+
_context10.n = 6;
|
|
26606
26770
|
break;
|
|
26607
26771
|
}
|
|
26608
26772
|
queuedPendingRead = getPendingChannelRead(channel.id);
|
|
26609
26773
|
if ((queuedPendingRead === null || queuedPendingRead === void 0 ? void 0 : queuedPendingRead.queuedAt) === (pendingRead === null || pendingRead === void 0 ? void 0 : pendingRead.queuedAt)) {
|
|
26610
26774
|
removePendingChannelRead(channel.id);
|
|
26611
26775
|
}
|
|
26612
|
-
_context10.n =
|
|
26776
|
+
_context10.n = 8;
|
|
26613
26777
|
break;
|
|
26614
|
-
case
|
|
26778
|
+
case 6:
|
|
26615
26779
|
if (!(confirmation.status === 'drop')) {
|
|
26616
|
-
_context10.n =
|
|
26780
|
+
_context10.n = 7;
|
|
26617
26781
|
break;
|
|
26618
26782
|
}
|
|
26619
|
-
|
|
26620
|
-
|
|
26621
|
-
|
|
26783
|
+
_queuedPendingRead = getPendingChannelRead(channel.id);
|
|
26784
|
+
if ((_queuedPendingRead === null || _queuedPendingRead === void 0 ? void 0 : _queuedPendingRead.queuedAt) === (pendingRead === null || pendingRead === void 0 ? void 0 : pendingRead.queuedAt)) {
|
|
26785
|
+
removePendingChannelRead(channel.id);
|
|
26786
|
+
}
|
|
26622
26787
|
return _context10.a(2);
|
|
26623
26788
|
case 7:
|
|
26789
|
+
return _context10.a(2);
|
|
26790
|
+
case 8:
|
|
26624
26791
|
readMessageIds = getUniqueMessageIds(((_confirmation$message = confirmation.messageListMarker) === null || _confirmation$message === void 0 ? void 0 : _confirmation$message.messageIds) || requestedMessageIds);
|
|
26792
|
+
log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
|
|
26793
|
+
source: 'initial',
|
|
26794
|
+
channelId: channel.id,
|
|
26795
|
+
readAll: false,
|
|
26796
|
+
requestedMessageIds: requestedMessageIds,
|
|
26797
|
+
confirmedMessageIds: readMessageIds
|
|
26798
|
+
}));
|
|
26625
26799
|
_iterator6 = _createForOfIteratorHelperLoose(readMessageIds);
|
|
26626
|
-
case
|
|
26800
|
+
case 9:
|
|
26627
26801
|
if ((_step6 = _iterator6()).done) {
|
|
26628
|
-
_context10.n =
|
|
26802
|
+
_context10.n = 12;
|
|
26629
26803
|
break;
|
|
26630
26804
|
}
|
|
26631
26805
|
messageId = _step6.value;
|
|
@@ -26638,27 +26812,27 @@ function markMessagesRead(action) {
|
|
|
26638
26812
|
name: MESSAGE_DELIVERY_STATUS.READ
|
|
26639
26813
|
}]
|
|
26640
26814
|
};
|
|
26641
|
-
_context10.n =
|
|
26815
|
+
_context10.n = 10;
|
|
26642
26816
|
return effects.put(updateMessageAC(messageId, updateParams));
|
|
26643
|
-
case
|
|
26817
|
+
case 10:
|
|
26644
26818
|
updateMessageOnMap(channel.id, {
|
|
26645
26819
|
messageId: messageId,
|
|
26646
26820
|
params: updateParams
|
|
26647
26821
|
});
|
|
26648
|
-
case 10:
|
|
26649
|
-
_context10.n = 8;
|
|
26650
|
-
break;
|
|
26651
26822
|
case 11:
|
|
26652
|
-
_context10.n =
|
|
26823
|
+
_context10.n = 9;
|
|
26653
26824
|
break;
|
|
26654
26825
|
case 12:
|
|
26655
|
-
_context10.
|
|
26826
|
+
_context10.n = 14;
|
|
26827
|
+
break;
|
|
26828
|
+
case 13:
|
|
26829
|
+
_context10.p = 13;
|
|
26656
26830
|
_t10 = _context10.v;
|
|
26657
26831
|
log.error(_t10, '[READ_MESSAGE] Error on mark messages read');
|
|
26658
|
-
case
|
|
26832
|
+
case 14:
|
|
26659
26833
|
return _context10.a(2);
|
|
26660
26834
|
}
|
|
26661
|
-
},
|
|
26835
|
+
}, _marked0$1, null, [[1, 13]]);
|
|
26662
26836
|
}
|
|
26663
26837
|
function markVoiceMessageAsPlayed(action) {
|
|
26664
26838
|
var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator7, _step7, messageId, updateParams, _t11;
|
|
@@ -26729,7 +26903,7 @@ function markVoiceMessageAsPlayed(action) {
|
|
|
26729
26903
|
case 9:
|
|
26730
26904
|
return _context11.a(2);
|
|
26731
26905
|
}
|
|
26732
|
-
},
|
|
26906
|
+
}, _marked1$1, null, [[1, 8]]);
|
|
26733
26907
|
}
|
|
26734
26908
|
function updateMessageAsOpened(action) {
|
|
26735
26909
|
var payload, channelId, messageListMarker, connectionStatus, channel, _iterator8, _step8, messageId, updateParams;
|
|
@@ -26788,7 +26962,7 @@ function updateMessageAsOpened(action) {
|
|
|
26788
26962
|
case 6:
|
|
26789
26963
|
return _context12.a(2);
|
|
26790
26964
|
}
|
|
26791
|
-
},
|
|
26965
|
+
}, _marked10$1);
|
|
26792
26966
|
}
|
|
26793
26967
|
function markMessageAsOpened(action) {
|
|
26794
26968
|
var payload, channelId, messageIds, shouldUpdateMessage, connectionStatus, channel, messageListMarker, _t12;
|
|
@@ -26839,7 +27013,7 @@ function markMessageAsOpened(action) {
|
|
|
26839
27013
|
case 6:
|
|
26840
27014
|
return _context13.a(2);
|
|
26841
27015
|
}
|
|
26842
|
-
},
|
|
27016
|
+
}, _marked11$1, null, [[1, 5]]);
|
|
26843
27017
|
}
|
|
26844
27018
|
function markMessagesDelivered(action) {
|
|
26845
27019
|
var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator9, _step9, messageId, updateParams, _t13;
|
|
@@ -26910,7 +27084,7 @@ function markMessagesDelivered(action) {
|
|
|
26910
27084
|
case 9:
|
|
26911
27085
|
return _context14.a(2);
|
|
26912
27086
|
}
|
|
26913
|
-
},
|
|
27087
|
+
}, _marked12$1, null, [[1, 8]]);
|
|
26914
27088
|
}
|
|
26915
27089
|
function switchChannel(action) {
|
|
26916
27090
|
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t14;
|
|
@@ -27006,7 +27180,7 @@ function switchChannel(action) {
|
|
|
27006
27180
|
case 17:
|
|
27007
27181
|
return _context15.a(2);
|
|
27008
27182
|
}
|
|
27009
|
-
},
|
|
27183
|
+
}, _marked13$1, null, [[0, 16]]);
|
|
27010
27184
|
}
|
|
27011
27185
|
function notificationsTurnOff(action) {
|
|
27012
27186
|
var expireTime, activeChannelId, channel, updatedChannel, _t15;
|
|
@@ -27046,7 +27220,7 @@ function notificationsTurnOff(action) {
|
|
|
27046
27220
|
case 7:
|
|
27047
27221
|
return _context16.a(2);
|
|
27048
27222
|
}
|
|
27049
|
-
},
|
|
27223
|
+
}, _marked14$1, null, [[3, 6]]);
|
|
27050
27224
|
}
|
|
27051
27225
|
function notificationsTurnOn() {
|
|
27052
27226
|
var activeChannelId, channel, updatedChannel, _t16;
|
|
@@ -27085,15 +27259,21 @@ function notificationsTurnOn() {
|
|
|
27085
27259
|
case 7:
|
|
27086
27260
|
return _context17.a(2);
|
|
27087
27261
|
}
|
|
27088
|
-
},
|
|
27262
|
+
}, _marked15$1, null, [[3, 6]]);
|
|
27089
27263
|
}
|
|
27090
27264
|
function markChannelAsRead(action) {
|
|
27091
|
-
var channelId, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _t17;
|
|
27265
|
+
var channelId, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead2, _t17;
|
|
27092
27266
|
return _regenerator().w(function (_context18) {
|
|
27093
27267
|
while (1) switch (_context18.p = _context18.n) {
|
|
27094
27268
|
case 0:
|
|
27095
27269
|
_context18.p = 0;
|
|
27096
27270
|
channelId = action.payload.channelId;
|
|
27271
|
+
log.info('[READ_MESSAGE] Received markChannelAsRead action', compactReadMessageLogData({
|
|
27272
|
+
source: 'initial',
|
|
27273
|
+
channelId: channelId,
|
|
27274
|
+
readAll: true,
|
|
27275
|
+
messageIds: []
|
|
27276
|
+
}));
|
|
27097
27277
|
_context18.n = 1;
|
|
27098
27278
|
return effects.call(getStoredChannel$2, channelId);
|
|
27099
27279
|
case 1:
|
|
@@ -27102,6 +27282,9 @@ function markChannelAsRead(action) {
|
|
|
27102
27282
|
_context18.n = 2;
|
|
27103
27283
|
break;
|
|
27104
27284
|
}
|
|
27285
|
+
log.warn('[READ_MESSAGE] Cannot mark channel as read because channel was not found', compactReadMessageLogData({
|
|
27286
|
+
channelId: channelId
|
|
27287
|
+
}));
|
|
27105
27288
|
return _context18.a(2);
|
|
27106
27289
|
case 2:
|
|
27107
27290
|
optimisticUpdate = deriveChannelReadProgressUpdate({
|
|
@@ -27116,7 +27299,7 @@ function markChannelAsRead(action) {
|
|
|
27116
27299
|
readAll: true
|
|
27117
27300
|
});
|
|
27118
27301
|
_context18.n = 4;
|
|
27119
|
-
return effects.call(confirmDisplayedRead, channel, pendingRead);
|
|
27302
|
+
return effects.call(confirmDisplayedRead, channel, pendingRead, 'initial');
|
|
27120
27303
|
case 4:
|
|
27121
27304
|
confirmation = _context18.v;
|
|
27122
27305
|
if (!(confirmation.status === 'success')) {
|
|
@@ -27127,22 +27310,31 @@ function markChannelAsRead(action) {
|
|
|
27127
27310
|
if ((queuedPendingRead === null || queuedPendingRead === void 0 ? void 0 : queuedPendingRead.queuedAt) === (pendingRead === null || pendingRead === void 0 ? void 0 : pendingRead.queuedAt)) {
|
|
27128
27311
|
removePendingChannelRead(channel.id);
|
|
27129
27312
|
}
|
|
27313
|
+
log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
|
|
27314
|
+
source: 'initial',
|
|
27315
|
+
channelId: channel.id,
|
|
27316
|
+
readAll: true,
|
|
27317
|
+
requestedMessageIds: [],
|
|
27318
|
+
confirmedMessageIds: []
|
|
27319
|
+
}));
|
|
27130
27320
|
return _context18.a(2);
|
|
27131
27321
|
case 5:
|
|
27132
27322
|
if (confirmation.status === 'drop') {
|
|
27133
|
-
|
|
27323
|
+
_queuedPendingRead2 = getPendingChannelRead(channel.id);
|
|
27324
|
+
if ((_queuedPendingRead2 === null || _queuedPendingRead2 === void 0 ? void 0 : _queuedPendingRead2.queuedAt) === (pendingRead === null || pendingRead === void 0 ? void 0 : pendingRead.queuedAt)) {
|
|
27325
|
+
removePendingChannelRead(channel.id);
|
|
27326
|
+
}
|
|
27134
27327
|
}
|
|
27135
|
-
log.error(confirmation.error, 'Error in set channel unread');
|
|
27136
27328
|
_context18.n = 7;
|
|
27137
27329
|
break;
|
|
27138
27330
|
case 6:
|
|
27139
27331
|
_context18.p = 6;
|
|
27140
27332
|
_t17 = _context18.v;
|
|
27141
|
-
log.error(_t17, 'Error
|
|
27333
|
+
log.error(_t17, '[READ_MESSAGE] Error on mark channel as read');
|
|
27142
27334
|
case 7:
|
|
27143
27335
|
return _context18.a(2);
|
|
27144
27336
|
}
|
|
27145
|
-
},
|
|
27337
|
+
}, _marked16$1, null, [[0, 6]]);
|
|
27146
27338
|
}
|
|
27147
27339
|
function resendPendingChannelReads(action) {
|
|
27148
27340
|
var connectionState, pendingReads, _iterator0, _step0, pendingRead, currentPendingRead, channel, confirmation, latestPendingRead, _confirmation$message4, readMessageIds, _iterator1, _step1, _confirmation$message5, _confirmation$message6, messageId, updateParams, _t18;
|
|
@@ -27163,7 +27355,7 @@ function resendPendingChannelReads(action) {
|
|
|
27163
27355
|
_iterator0 = _createForOfIteratorHelperLoose(pendingReads);
|
|
27164
27356
|
case 2:
|
|
27165
27357
|
if ((_step0 = _iterator0()).done) {
|
|
27166
|
-
_context19.n =
|
|
27358
|
+
_context19.n = 16;
|
|
27167
27359
|
break;
|
|
27168
27360
|
}
|
|
27169
27361
|
pendingRead = _step0.value;
|
|
@@ -27178,14 +27370,20 @@ function resendPendingChannelReads(action) {
|
|
|
27178
27370
|
_context19.n = 4;
|
|
27179
27371
|
break;
|
|
27180
27372
|
}
|
|
27181
|
-
return _context19.a(3,
|
|
27373
|
+
return _context19.a(3, 15);
|
|
27182
27374
|
case 4:
|
|
27183
27375
|
if (!(!pendingRead.readAll && !pendingRead.messageIds.length)) {
|
|
27184
27376
|
_context19.n = 5;
|
|
27185
27377
|
break;
|
|
27186
27378
|
}
|
|
27379
|
+
log.warn('[READ_MESSAGE] Dropping queued replay because it has no message ids', compactReadMessageLogData({
|
|
27380
|
+
source: 'replay',
|
|
27381
|
+
channelId: pendingRead.channelId,
|
|
27382
|
+
readAll: pendingRead.readAll,
|
|
27383
|
+
messageIds: pendingRead.messageIds
|
|
27384
|
+
}));
|
|
27187
27385
|
removePendingChannelRead(pendingRead.channelId);
|
|
27188
|
-
return _context19.a(3,
|
|
27386
|
+
return _context19.a(3, 15);
|
|
27189
27387
|
case 5:
|
|
27190
27388
|
_context19.n = 6;
|
|
27191
27389
|
return effects.call(getStoredChannel$2, pendingRead.channelId);
|
|
@@ -27195,11 +27393,18 @@ function resendPendingChannelReads(action) {
|
|
|
27195
27393
|
_context19.n = 7;
|
|
27196
27394
|
break;
|
|
27197
27395
|
}
|
|
27396
|
+
log.warn('[READ_MESSAGE] Dropping queued replay because channel was not found', compactReadMessageLogData({
|
|
27397
|
+
source: 'replay',
|
|
27398
|
+
channelId: pendingRead.channelId,
|
|
27399
|
+
readAll: pendingRead.readAll,
|
|
27400
|
+
messageIds: pendingRead.messageIds
|
|
27401
|
+
}));
|
|
27198
27402
|
removePendingChannelRead(pendingRead.channelId);
|
|
27199
|
-
return _context19.a(3,
|
|
27403
|
+
return _context19.a(3, 15);
|
|
27200
27404
|
case 7:
|
|
27405
|
+
log.info('[READ_MESSAGE] Replaying queued read marker', compactReadMessageLogData(getReadMarkerLogContext(pendingRead, 'replay', pendingRead.messageIds)));
|
|
27201
27406
|
_context19.n = 8;
|
|
27202
|
-
return effects.call(confirmDisplayedRead, channel, pendingRead);
|
|
27407
|
+
return effects.call(confirmDisplayedRead, channel, pendingRead, 'replay');
|
|
27203
27408
|
case 8:
|
|
27204
27409
|
confirmation = _context19.v;
|
|
27205
27410
|
latestPendingRead = getPendingChannelRead(pendingRead.channelId);
|
|
@@ -27207,16 +27412,23 @@ function resendPendingChannelReads(action) {
|
|
|
27207
27412
|
_context19.n = 9;
|
|
27208
27413
|
break;
|
|
27209
27414
|
}
|
|
27210
|
-
return _context19.a(3,
|
|
27415
|
+
return _context19.a(3, 15);
|
|
27211
27416
|
case 9:
|
|
27212
27417
|
if (confirmation.status === 'success' || confirmation.status === 'drop') {
|
|
27213
27418
|
removePendingChannelRead(pendingRead.channelId);
|
|
27214
27419
|
}
|
|
27215
27420
|
if (!(confirmation.status === 'success' && !pendingRead.readAll)) {
|
|
27216
|
-
_context19.n =
|
|
27421
|
+
_context19.n = 14;
|
|
27217
27422
|
break;
|
|
27218
27423
|
}
|
|
27219
27424
|
readMessageIds = getUniqueMessageIds(((_confirmation$message4 = confirmation.messageListMarker) === null || _confirmation$message4 === void 0 ? void 0 : _confirmation$message4.messageIds) || pendingRead.messageIds);
|
|
27425
|
+
log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
|
|
27426
|
+
source: 'replay',
|
|
27427
|
+
channelId: channel.id,
|
|
27428
|
+
readAll: false,
|
|
27429
|
+
requestedMessageIds: pendingRead.messageIds,
|
|
27430
|
+
confirmedMessageIds: readMessageIds
|
|
27431
|
+
}));
|
|
27220
27432
|
_iterator1 = _createForOfIteratorHelperLoose(readMessageIds);
|
|
27221
27433
|
case 10:
|
|
27222
27434
|
if ((_step1 = _iterator1()).done) {
|
|
@@ -27244,19 +27456,32 @@ function resendPendingChannelReads(action) {
|
|
|
27244
27456
|
_context19.n = 10;
|
|
27245
27457
|
break;
|
|
27246
27458
|
case 13:
|
|
27247
|
-
_context19.n =
|
|
27459
|
+
_context19.n = 15;
|
|
27248
27460
|
break;
|
|
27249
27461
|
case 14:
|
|
27250
|
-
|
|
27251
|
-
|
|
27462
|
+
if (confirmation.status === 'success' && pendingRead.readAll) {
|
|
27463
|
+
log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
|
|
27464
|
+
source: 'replay',
|
|
27465
|
+
channelId: channel.id,
|
|
27466
|
+
readAll: true,
|
|
27467
|
+
requestedMessageIds: [],
|
|
27468
|
+
confirmedMessageIds: []
|
|
27469
|
+
}));
|
|
27470
|
+
}
|
|
27252
27471
|
case 15:
|
|
27253
|
-
_context19.
|
|
27472
|
+
_context19.n = 2;
|
|
27473
|
+
break;
|
|
27474
|
+
case 16:
|
|
27475
|
+
_context19.n = 18;
|
|
27476
|
+
break;
|
|
27477
|
+
case 17:
|
|
27478
|
+
_context19.p = 17;
|
|
27254
27479
|
_t18 = _context19.v;
|
|
27255
27480
|
log.error(_t18, '[READ_MESSAGE] Error on resend pending channel reads');
|
|
27256
|
-
case
|
|
27481
|
+
case 18:
|
|
27257
27482
|
return _context19.a(2);
|
|
27258
27483
|
}
|
|
27259
|
-
},
|
|
27484
|
+
}, _marked17$1, null, [[0, 17]]);
|
|
27260
27485
|
}
|
|
27261
27486
|
function markChannelAsUnRead(action) {
|
|
27262
27487
|
var channelId, channel, _t19;
|
|
@@ -27292,7 +27517,7 @@ function markChannelAsUnRead(action) {
|
|
|
27292
27517
|
case 5:
|
|
27293
27518
|
return _context20.a(2);
|
|
27294
27519
|
}
|
|
27295
|
-
},
|
|
27520
|
+
}, _marked18$1, null, [[0, 4]]);
|
|
27296
27521
|
}
|
|
27297
27522
|
function pinChannel(action) {
|
|
27298
27523
|
var channelId, channel, updatedChannel, _t20;
|
|
@@ -27329,7 +27554,7 @@ function pinChannel(action) {
|
|
|
27329
27554
|
case 5:
|
|
27330
27555
|
return _context21.a(2);
|
|
27331
27556
|
}
|
|
27332
|
-
},
|
|
27557
|
+
}, _marked19$1, null, [[0, 4]]);
|
|
27333
27558
|
}
|
|
27334
27559
|
function unpinChannel(action) {
|
|
27335
27560
|
var channelId, channel, updatedChannel, _t21;
|
|
@@ -27366,7 +27591,7 @@ function unpinChannel(action) {
|
|
|
27366
27591
|
case 5:
|
|
27367
27592
|
return _context22.a(2);
|
|
27368
27593
|
}
|
|
27369
|
-
},
|
|
27594
|
+
}, _marked20$1, null, [[0, 4]]);
|
|
27370
27595
|
}
|
|
27371
27596
|
function removeChannelCaches(action) {
|
|
27372
27597
|
var payload, channelId, activeChannelId, activeChannel;
|
|
@@ -27401,7 +27626,7 @@ function removeChannelCaches(action) {
|
|
|
27401
27626
|
case 4:
|
|
27402
27627
|
return _context23.a(2);
|
|
27403
27628
|
}
|
|
27404
|
-
},
|
|
27629
|
+
}, _marked21$1);
|
|
27405
27630
|
}
|
|
27406
27631
|
function leaveChannel(action) {
|
|
27407
27632
|
var payload, channelId, channel, messageBuilder, messageToSend, _t22;
|
|
@@ -27453,7 +27678,7 @@ function leaveChannel(action) {
|
|
|
27453
27678
|
case 7:
|
|
27454
27679
|
return _context24.a(2);
|
|
27455
27680
|
}
|
|
27456
|
-
},
|
|
27681
|
+
}, _marked22$1, null, [[0, 6]]);
|
|
27457
27682
|
}
|
|
27458
27683
|
function deletePendingDeleteChannels() {
|
|
27459
27684
|
var pendingDeleteChannels, _iterator10, _step10, channel, resendableError, _t23;
|
|
@@ -27497,7 +27722,7 @@ function deletePendingDeleteChannels() {
|
|
|
27497
27722
|
case 9:
|
|
27498
27723
|
return _context25.a(2);
|
|
27499
27724
|
}
|
|
27500
|
-
},
|
|
27725
|
+
}, _marked23$1, null, [[2, 7]]);
|
|
27501
27726
|
}
|
|
27502
27727
|
function deleteChannel(action) {
|
|
27503
27728
|
var payload, channelId, channel, activeChannelId, lastChannel, _t24;
|
|
@@ -27591,7 +27816,7 @@ function deleteChannel(action) {
|
|
|
27591
27816
|
case 19:
|
|
27592
27817
|
return _context26.a(2);
|
|
27593
27818
|
}
|
|
27594
|
-
},
|
|
27819
|
+
}, _marked24$1, null, [[0, 18]]);
|
|
27595
27820
|
}
|
|
27596
27821
|
function blockChannel(action) {
|
|
27597
27822
|
var payload, channelId, channel, _t25;
|
|
@@ -27630,7 +27855,7 @@ function blockChannel(action) {
|
|
|
27630
27855
|
case 6:
|
|
27631
27856
|
return _context27.a(2);
|
|
27632
27857
|
}
|
|
27633
|
-
},
|
|
27858
|
+
}, _marked25$1, null, [[0, 5]]);
|
|
27634
27859
|
}
|
|
27635
27860
|
function updateChannel(action) {
|
|
27636
27861
|
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, onUpdateChannel, _channel3, _channel4, _channel5, fields, updatedChannel, _t26;
|
|
@@ -27727,7 +27952,7 @@ function updateChannel(action) {
|
|
|
27727
27952
|
case 9:
|
|
27728
27953
|
return _context28.a(2);
|
|
27729
27954
|
}
|
|
27730
|
-
},
|
|
27955
|
+
}, _marked26$1, null, [[0, 8]]);
|
|
27731
27956
|
}
|
|
27732
27957
|
function checkUsersStatus() {
|
|
27733
27958
|
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t27;
|
|
@@ -27778,7 +28003,7 @@ function checkUsersStatus() {
|
|
|
27778
28003
|
case 7:
|
|
27779
28004
|
return _context29.a(2);
|
|
27780
28005
|
}
|
|
27781
|
-
},
|
|
28006
|
+
}, _marked27$1, null, [[0, 6]]);
|
|
27782
28007
|
}
|
|
27783
28008
|
function sendTyping(action) {
|
|
27784
28009
|
var state, activeChannelId, channel, _t28;
|
|
@@ -27821,7 +28046,7 @@ function sendTyping(action) {
|
|
|
27821
28046
|
case 8:
|
|
27822
28047
|
return _context30.a(2);
|
|
27823
28048
|
}
|
|
27824
|
-
},
|
|
28049
|
+
}, _marked28$1, null, [[3, 7]]);
|
|
27825
28050
|
}
|
|
27826
28051
|
function sendRecording(action) {
|
|
27827
28052
|
var _action$payload, state, channelId, channel, _t29;
|
|
@@ -27864,7 +28089,7 @@ function sendRecording(action) {
|
|
|
27864
28089
|
case 7:
|
|
27865
28090
|
return _context31.a(2);
|
|
27866
28091
|
}
|
|
27867
|
-
},
|
|
28092
|
+
}, _marked29$1, null, [[2, 6]]);
|
|
27868
28093
|
}
|
|
27869
28094
|
function clearHistory(action) {
|
|
27870
28095
|
var payload, channelId, channel, activeChannelId, groupName, _t30;
|
|
@@ -27934,7 +28159,7 @@ function clearHistory(action) {
|
|
|
27934
28159
|
case 10:
|
|
27935
28160
|
return _context32.a(2);
|
|
27936
28161
|
}
|
|
27937
|
-
},
|
|
28162
|
+
}, _marked30$1, null, [[0, 9]]);
|
|
27938
28163
|
}
|
|
27939
28164
|
function deleteAllMessages(action) {
|
|
27940
28165
|
var payload, channelId, channel, activeChannelId, groupName, _t31;
|
|
@@ -28007,7 +28232,7 @@ function deleteAllMessages(action) {
|
|
|
28007
28232
|
case 11:
|
|
28008
28233
|
return _context33.a(2);
|
|
28009
28234
|
}
|
|
28010
|
-
},
|
|
28235
|
+
}, _marked31$1, null, [[0, 10]]);
|
|
28011
28236
|
}
|
|
28012
28237
|
function joinChannel(action) {
|
|
28013
28238
|
var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t32;
|
|
@@ -28060,7 +28285,7 @@ function joinChannel(action) {
|
|
|
28060
28285
|
case 10:
|
|
28061
28286
|
return _context34.a(2);
|
|
28062
28287
|
}
|
|
28063
|
-
},
|
|
28288
|
+
}, _marked32$1, null, [[0, 9]]);
|
|
28064
28289
|
}
|
|
28065
28290
|
function watchForChannelEvents() {
|
|
28066
28291
|
return _regenerator().w(function (_context35) {
|
|
@@ -28071,7 +28296,7 @@ function watchForChannelEvents() {
|
|
|
28071
28296
|
case 1:
|
|
28072
28297
|
return _context35.a(2);
|
|
28073
28298
|
}
|
|
28074
|
-
},
|
|
28299
|
+
}, _marked33$1);
|
|
28075
28300
|
}
|
|
28076
28301
|
function createChannelInviteKey(action) {
|
|
28077
28302
|
var payload, channelId, _SceytChatClient9, channel, inviteKey, _t33;
|
|
@@ -28113,7 +28338,7 @@ function createChannelInviteKey(action) {
|
|
|
28113
28338
|
case 5:
|
|
28114
28339
|
return _context36.a(2);
|
|
28115
28340
|
}
|
|
28116
|
-
},
|
|
28341
|
+
}, _marked34$1, null, [[0, 4]]);
|
|
28117
28342
|
}
|
|
28118
28343
|
function getChannelInviteKeys(action) {
|
|
28119
28344
|
var payload, channelId, channel, inviteKeys, _t34;
|
|
@@ -28150,7 +28375,7 @@ function getChannelInviteKeys(action) {
|
|
|
28150
28375
|
case 5:
|
|
28151
28376
|
return _context37.a(2);
|
|
28152
28377
|
}
|
|
28153
|
-
},
|
|
28378
|
+
}, _marked35$1, null, [[0, 4]]);
|
|
28154
28379
|
}
|
|
28155
28380
|
function regenerateChannelInviteKey(action) {
|
|
28156
28381
|
var payload, channelId, key, deletePermanently, channel, inviteKey, _t35;
|
|
@@ -28191,7 +28416,7 @@ function regenerateChannelInviteKey(action) {
|
|
|
28191
28416
|
case 5:
|
|
28192
28417
|
return _context38.a(2);
|
|
28193
28418
|
}
|
|
28194
|
-
},
|
|
28419
|
+
}, _marked36$1, null, [[0, 4]]);
|
|
28195
28420
|
}
|
|
28196
28421
|
function updateChannelInviteKey(action) {
|
|
28197
28422
|
var channelInviteKeys, channelId, payload, payloadChannelId, key, accessPriorHistory, expiresAt, maxUses, channel, copiedChannelInviteKeys, _t36;
|
|
@@ -28251,7 +28476,7 @@ function updateChannelInviteKey(action) {
|
|
|
28251
28476
|
case 6:
|
|
28252
28477
|
return _context39.a(2);
|
|
28253
28478
|
}
|
|
28254
|
-
},
|
|
28479
|
+
}, _marked37$1, null, [[1, 5]]);
|
|
28255
28480
|
}
|
|
28256
28481
|
function getChannelByInviteKey(action) {
|
|
28257
28482
|
var _channel$, _channel$2, payload, key, _SceytChatClient0, channel, _t37;
|
|
@@ -28302,7 +28527,7 @@ function getChannelByInviteKey(action) {
|
|
|
28302
28527
|
case 8:
|
|
28303
28528
|
return _context40.a(2);
|
|
28304
28529
|
}
|
|
28305
|
-
},
|
|
28530
|
+
}, _marked38$1, null, [[0, 6]]);
|
|
28306
28531
|
}
|
|
28307
28532
|
function joinChannelWithInviteKey(action) {
|
|
28308
28533
|
var payload, key, _SceytChatClient1, user, channel, messageToSend, _t38;
|
|
@@ -28346,7 +28571,7 @@ function joinChannelWithInviteKey(action) {
|
|
|
28346
28571
|
case 7:
|
|
28347
28572
|
return _context41.a(2);
|
|
28348
28573
|
}
|
|
28349
|
-
},
|
|
28574
|
+
}, _marked39$1, null, [[0, 6]]);
|
|
28350
28575
|
}
|
|
28351
28576
|
function setMessageRetentionPeriod(action) {
|
|
28352
28577
|
var payload, channelId, periodInMilliseconds, channel, messageToSend, _t39;
|
|
@@ -28399,7 +28624,7 @@ function setMessageRetentionPeriod(action) {
|
|
|
28399
28624
|
case 6:
|
|
28400
28625
|
return _context42.a(2);
|
|
28401
28626
|
}
|
|
28402
|
-
},
|
|
28627
|
+
}, _marked40$1, null, [[0, 5]]);
|
|
28403
28628
|
}
|
|
28404
28629
|
function getChannelsWithUser(action) {
|
|
28405
28630
|
var payload, userId, _SceytChatClient10, channelsQueryBuilder, channelsQuery, channelsData, channels, _t40;
|
|
@@ -28462,7 +28687,7 @@ function getChannelsWithUser(action) {
|
|
|
28462
28687
|
case 12:
|
|
28463
28688
|
return _context43.a(2);
|
|
28464
28689
|
}
|
|
28465
|
-
},
|
|
28690
|
+
}, _marked41$1, null, [[2, 9, 10, 12]]);
|
|
28466
28691
|
}
|
|
28467
28692
|
function loadMoreMutualChannels(action) {
|
|
28468
28693
|
var payload, limit, mutualChannelsQuery, channelsData, _t41;
|
|
@@ -28520,7 +28745,7 @@ function loadMoreMutualChannels(action) {
|
|
|
28520
28745
|
case 11:
|
|
28521
28746
|
return _context44.a(2);
|
|
28522
28747
|
}
|
|
28523
|
-
},
|
|
28748
|
+
}, _marked42$1, null, [[1, 8, 9, 11]]);
|
|
28524
28749
|
}
|
|
28525
28750
|
function ChannelsSaga() {
|
|
28526
28751
|
return _regenerator().w(function (_context45) {
|
|
@@ -28654,7 +28879,7 @@ function ChannelsSaga() {
|
|
|
28654
28879
|
case 42:
|
|
28655
28880
|
return _context45.a(2);
|
|
28656
28881
|
}
|
|
28657
|
-
},
|
|
28882
|
+
}, _marked43$1);
|
|
28658
28883
|
}
|
|
28659
28884
|
|
|
28660
28885
|
var _marked$4 = /*#__PURE__*/_regenerator().m(getMembers),
|
|
@@ -30641,19 +30866,10 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
30641
30866
|
var handleUserInteraction = function handleUserInteraction() {
|
|
30642
30867
|
requestPermissionOnUserInteraction();
|
|
30643
30868
|
};
|
|
30644
|
-
var
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
dispatch(browserTabIsActiveAC(true));
|
|
30649
|
-
}
|
|
30650
|
-
};
|
|
30651
|
-
var handleFocusChange = function handleFocusChange(focus) {
|
|
30652
|
-
if (focus) {
|
|
30653
|
-
dispatch(browserTabIsActiveAC(true));
|
|
30654
|
-
} else {
|
|
30655
|
-
dispatch(browserTabIsActiveAC(false));
|
|
30656
|
-
}
|
|
30869
|
+
var syncBrowserTabIsActive = function syncBrowserTabIsActive() {
|
|
30870
|
+
var isVisible = hidden ? !document[hidden] : document.visibilityState !== 'hidden';
|
|
30871
|
+
var isFocused = typeof document.hasFocus === 'function' ? document.hasFocus() : true;
|
|
30872
|
+
dispatch(browserTabIsActiveAC(isVisible && isFocused));
|
|
30657
30873
|
};
|
|
30658
30874
|
React.useEffect(function () {
|
|
30659
30875
|
log.info('client is changed.... ', client);
|
|
@@ -30735,24 +30951,23 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
30735
30951
|
setBlobUrlEvictListener(function (keys) {
|
|
30736
30952
|
return dispatch(removeAttachmentUpdatedEntriesAC(keys));
|
|
30737
30953
|
});
|
|
30738
|
-
var handleWindowFocus = function handleWindowFocus() {
|
|
30739
|
-
return handleFocusChange(true);
|
|
30740
|
-
};
|
|
30741
|
-
var handleWindowBlur = function handleWindowBlur() {
|
|
30742
|
-
return handleFocusChange(false);
|
|
30743
|
-
};
|
|
30744
30954
|
if (showNotifications) {
|
|
30745
30955
|
initializeNotifications();
|
|
30746
30956
|
window.sceytTabNotifications = null;
|
|
30747
30957
|
window.sceytTabUrl = window.location.href;
|
|
30748
|
-
window.addEventListener('focus', handleWindowFocus);
|
|
30749
|
-
window.addEventListener('blur', handleWindowBlur);
|
|
30750
30958
|
}
|
|
30751
|
-
|
|
30959
|
+
window.addEventListener('focus', syncBrowserTabIsActive);
|
|
30960
|
+
window.addEventListener('blur', syncBrowserTabIsActive);
|
|
30961
|
+
if (visibilityChange) {
|
|
30962
|
+
document.addEventListener(visibilityChange, syncBrowserTabIsActive, false);
|
|
30963
|
+
}
|
|
30964
|
+
syncBrowserTabIsActive();
|
|
30752
30965
|
return function () {
|
|
30753
|
-
window.removeEventListener('focus',
|
|
30754
|
-
window.removeEventListener('blur',
|
|
30755
|
-
|
|
30966
|
+
window.removeEventListener('focus', syncBrowserTabIsActive);
|
|
30967
|
+
window.removeEventListener('blur', syncBrowserTabIsActive);
|
|
30968
|
+
if (visibilityChange) {
|
|
30969
|
+
document.removeEventListener(visibilityChange, syncBrowserTabIsActive);
|
|
30970
|
+
}
|
|
30756
30971
|
clearMessagesMap();
|
|
30757
30972
|
setActiveChannelId('');
|
|
30758
30973
|
destroyChannelsMap();
|
|
@@ -44821,10 +45036,49 @@ var Message$1 = function Message(_ref) {
|
|
|
44821
45036
|
var alreadyRead = !!(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
|
|
44822
45037
|
return marker.name === MESSAGE_DELIVERY_STATUS.READ;
|
|
44823
45038
|
}));
|
|
44824
|
-
|
|
45039
|
+
var shouldSendReadMarker = isVisible && message.incoming && !alreadyRead && !disableAutoReadTracking && isTabActive && !!channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED;
|
|
45040
|
+
if (message.incoming && isVisible) {
|
|
45041
|
+
if (shouldSendReadMarker) {
|
|
45042
|
+
log.info('[READ_MESSAGE] Message auto-read gate passed', compactReadMessageLogData({
|
|
45043
|
+
source: 'message',
|
|
45044
|
+
channelId: channel.id,
|
|
45045
|
+
messageId: message.id,
|
|
45046
|
+
isVisible: isVisible,
|
|
45047
|
+
alreadyRead: alreadyRead,
|
|
45048
|
+
disableAutoReadTracking: disableAutoReadTracking,
|
|
45049
|
+
isTabActive: isTabActive,
|
|
45050
|
+
newMessageCount: channel.newMessageCount || 0,
|
|
45051
|
+
connectionStatus: connectionStatus,
|
|
45052
|
+
queued: !!queueReadMarker
|
|
45053
|
+
}));
|
|
45054
|
+
} else {
|
|
45055
|
+
log.info('[READ_MESSAGE] Message auto-read gate blocked', compactReadMessageLogData({
|
|
45056
|
+
source: 'message',
|
|
45057
|
+
channelId: channel.id,
|
|
45058
|
+
messageId: message.id,
|
|
45059
|
+
isVisible: isVisible,
|
|
45060
|
+
alreadyRead: alreadyRead,
|
|
45061
|
+
disableAutoReadTracking: disableAutoReadTracking,
|
|
45062
|
+
isTabActive: isTabActive,
|
|
45063
|
+
newMessageCount: channel.newMessageCount || 0,
|
|
45064
|
+
connectionStatus: connectionStatus
|
|
45065
|
+
}));
|
|
45066
|
+
}
|
|
45067
|
+
}
|
|
45068
|
+
if (shouldSendReadMarker) {
|
|
44825
45069
|
if (queueReadMarker) {
|
|
45070
|
+
log.info('[READ_MESSAGE] Queueing read marker from Message component', compactReadMessageLogData({
|
|
45071
|
+
source: 'message',
|
|
45072
|
+
channelId: channel.id,
|
|
45073
|
+
messageId: message.id
|
|
45074
|
+
}));
|
|
44826
45075
|
queueReadMarker(channel.id, message.id);
|
|
44827
45076
|
} else {
|
|
45077
|
+
log.info('[READ_MESSAGE] Dispatching read marker directly from Message component', compactReadMessageLogData({
|
|
45078
|
+
source: 'message',
|
|
45079
|
+
channelId: channel.id,
|
|
45080
|
+
messageId: message.id
|
|
45081
|
+
}));
|
|
44828
45082
|
dispatch(markMessagesAsReadAC(channel.id, [message.id]));
|
|
44829
45083
|
}
|
|
44830
45084
|
}
|
|
@@ -44867,6 +45121,14 @@ var Message$1 = function Message(_ref) {
|
|
|
44867
45121
|
}, [dispatch, selectionIsActive]);
|
|
44868
45122
|
React.useEffect(function () {
|
|
44869
45123
|
if (isVisible) {
|
|
45124
|
+
if (message.incoming) {
|
|
45125
|
+
log.info('[READ_MESSAGE] Message row became visible', compactReadMessageLogData({
|
|
45126
|
+
source: 'message',
|
|
45127
|
+
channelId: channel.id,
|
|
45128
|
+
messageId: message.id,
|
|
45129
|
+
localRef: message.tid || message.id || ''
|
|
45130
|
+
}));
|
|
45131
|
+
}
|
|
44870
45132
|
if (setLastVisibleMessageId) {
|
|
44871
45133
|
setLastVisibleMessageId(message);
|
|
44872
45134
|
}
|
|
@@ -45876,6 +46138,14 @@ function useChatController(_ref5) {
|
|
|
45876
46138
|
}, [clearJumpScrollingLock]);
|
|
45877
46139
|
var queueVisibleUnreadCheck = React.useCallback(function () {
|
|
45878
46140
|
if (pendingVisibleUnreadFrameRef.current !== null || unreadScrollTo || !tabIsActive) {
|
|
46141
|
+
if (!tabIsActive) {
|
|
46142
|
+
log.info('[READ_MESSAGE] Visible unread scan skipped because tab is inactive', compactReadMessageLogData({
|
|
46143
|
+
source: 'controller',
|
|
46144
|
+
channelId: channel.id,
|
|
46145
|
+
unreadScrollTo: unreadScrollTo,
|
|
46146
|
+
pendingFrameScheduled: pendingVisibleUnreadFrameRef.current !== null
|
|
46147
|
+
}));
|
|
46148
|
+
}
|
|
45879
46149
|
return;
|
|
45880
46150
|
}
|
|
45881
46151
|
pendingVisibleUnreadFrameRef.current = requestAnimationFrame(function () {
|
|
@@ -45910,13 +46180,35 @@ function useChatController(_ref5) {
|
|
|
45910
46180
|
var ids = visibleUnreadMessages.filter(isUnreadIncomingMessage).map(function (message) {
|
|
45911
46181
|
return message.id;
|
|
45912
46182
|
});
|
|
46183
|
+
if (visibleUnreadMessages.length && !ids.length) {
|
|
46184
|
+
log.info('[READ_MESSAGE] Visible unread scan found messages, but none were unread incoming', compactReadMessageLogData({
|
|
46185
|
+
source: 'controller',
|
|
46186
|
+
channelId: channel.id,
|
|
46187
|
+
visibleCandidateIds: visibleUnreadMessages.map(function (message) {
|
|
46188
|
+
return message.id;
|
|
46189
|
+
})
|
|
46190
|
+
}));
|
|
46191
|
+
}
|
|
45913
46192
|
if (!ids.length || !channel.id || !channel.newMessageCount) {
|
|
46193
|
+
if (ids.length && (!channel.id || !channel.newMessageCount)) {
|
|
46194
|
+
log.info('[READ_MESSAGE] Visible unread scan blocked before dispatch', compactReadMessageLogData({
|
|
46195
|
+
source: 'controller',
|
|
46196
|
+
channelId: channel.id,
|
|
46197
|
+
messageIds: ids,
|
|
46198
|
+
newMessageCount: channel.newMessageCount || 0
|
|
46199
|
+
}));
|
|
46200
|
+
}
|
|
45914
46201
|
return;
|
|
45915
46202
|
}
|
|
45916
46203
|
ids.forEach(function (id) {
|
|
45917
46204
|
visibleUnreadReportedRef.current.add(id);
|
|
45918
46205
|
});
|
|
45919
46206
|
registerLocallyReadUnreadMessages(ids.length);
|
|
46207
|
+
log.info('[READ_MESSAGE] Dispatching read marker from visible unread scan', compactReadMessageLogData({
|
|
46208
|
+
source: 'controller',
|
|
46209
|
+
channelId: channel.id,
|
|
46210
|
+
messageIds: ids
|
|
46211
|
+
}));
|
|
45920
46212
|
dispatch(markMessagesAsReadAC(channel.id, ids));
|
|
45921
46213
|
});
|
|
45922
46214
|
}, [channel.id, channel.lastDisplayedMessageId, channel.newMessageCount, dispatch, hasNext, messages, registerLocallyReadUnreadMessages, unreadScrollTo, tabIsActive]);
|
|
@@ -52382,17 +52674,19 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52382
52674
|
if (messageToEdit) {
|
|
52383
52675
|
handleEditMessage();
|
|
52384
52676
|
} else if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
|
|
52385
|
-
var
|
|
52677
|
+
var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
|
|
52678
|
+
messageTexToSend = _trimMessageBodyWithA.body,
|
|
52679
|
+
adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
|
|
52386
52680
|
var messageToSend = {
|
|
52387
52681
|
body: messageTexToSend,
|
|
52388
|
-
bodyAttributes:
|
|
52682
|
+
bodyAttributes: adjustedBodyAttributes,
|
|
52389
52683
|
mentionedUsers: [],
|
|
52390
52684
|
attachments: [],
|
|
52391
52685
|
type: 'text'
|
|
52392
52686
|
};
|
|
52393
52687
|
var mentionUsersToSend = [];
|
|
52394
|
-
if (
|
|
52395
|
-
|
|
52688
|
+
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
52689
|
+
adjustedBodyAttributes.forEach(function (att) {
|
|
52396
52690
|
if (att.type === 'mention') {
|
|
52397
52691
|
var mentionsToFind = [].concat(mentionedUsers);
|
|
52398
52692
|
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
@@ -52520,12 +52814,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52520
52814
|
}
|
|
52521
52815
|
};
|
|
52522
52816
|
var handleEditMessage = function handleEditMessage() {
|
|
52523
|
-
var
|
|
52817
|
+
var _trimMessageBodyWithA2 = trimMessageBodyWithAttributes(editMessageText, messageBodyAttributes),
|
|
52818
|
+
messageTexToSend = _trimMessageBodyWithA2.body,
|
|
52819
|
+
adjustedBodyAttributes = _trimMessageBodyWithA2.bodyAttributes;
|
|
52524
52820
|
var hasTextChanged = messageTexToSend !== messageToEdit.body;
|
|
52525
52821
|
var normalizeAttrs = function normalizeAttrs(attrs) {
|
|
52526
52822
|
return !attrs || attrs.length === 0 ? [] : attrs;
|
|
52527
52823
|
};
|
|
52528
|
-
var hasAttributesChanged = !compareMessageBodyAttributes(normalizeAttrs(
|
|
52824
|
+
var hasAttributesChanged = !compareMessageBodyAttributes(normalizeAttrs(adjustedBodyAttributes), normalizeAttrs(messageToEdit.bodyAttributes));
|
|
52529
52825
|
if (!hasTextChanged && !hasAttributesChanged) {
|
|
52530
52826
|
handleCloseEditMode();
|
|
52531
52827
|
return;
|
|
@@ -52569,8 +52865,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52569
52865
|
var mentionedUsersPositions = [];
|
|
52570
52866
|
var mentionUsersToSend = [];
|
|
52571
52867
|
if (mentionedUsers && mentionedUsers.length) {
|
|
52572
|
-
if (
|
|
52573
|
-
|
|
52868
|
+
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
52869
|
+
adjustedBodyAttributes.forEach(function (att) {
|
|
52574
52870
|
if (att.type === 'mention') {
|
|
52575
52871
|
var mentionsToFind = [].concat(mentionedUsers);
|
|
52576
52872
|
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
@@ -52592,7 +52888,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52592
52888
|
var messageToSend = _extends({}, messageToEdit, {
|
|
52593
52889
|
attachments: updatedAttachments,
|
|
52594
52890
|
metadata: mentionedUsersPositions,
|
|
52595
|
-
bodyAttributes:
|
|
52891
|
+
bodyAttributes: adjustedBodyAttributes,
|
|
52596
52892
|
mentionedUsers: mentionUsersToSend,
|
|
52597
52893
|
body: messageTexToSend
|
|
52598
52894
|
});
|