sceyt-chat-react-uikit 1.8.9-beta.14 → 1.8.9-beta.16
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/components/SendMessageInput/sendMessageUtils.d.ts +1 -0
- package/index.js +45 -22
- package/index.modern.js +45 -22
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hasSendableTextOrPoll: (messageText: string, isPoll: boolean) => boolean;
|
package/index.js
CHANGED
|
@@ -17250,6 +17250,12 @@ var addConfirmedMessageToCache = function addConfirmedMessageToCache(channelId,
|
|
|
17250
17250
|
var getStoredChannel = function getStoredChannel(channelId) {
|
|
17251
17251
|
return getChannelFromMap(channelId) || getChannelFromAllChannels(channelId) || getChannelFromAllChannelsMap(channelId) || null;
|
|
17252
17252
|
};
|
|
17253
|
+
var getReduxChannelLastMessage = function getReduxChannelLastMessage(channelId) {
|
|
17254
|
+
var _find, _store$getState$Chann2;
|
|
17255
|
+
return ((_find = (((_store$getState$Chann2 = store.getState().ChannelReducer) === null || _store$getState$Chann2 === void 0 ? void 0 : _store$getState$Chann2.channels) || []).find(function (channel) {
|
|
17256
|
+
return channel.id === channelId;
|
|
17257
|
+
})) === null || _find === void 0 ? void 0 : _find.lastMessage) || null;
|
|
17258
|
+
};
|
|
17253
17259
|
var shouldReplaceChannelLastMessage = function shouldReplaceChannelLastMessage(channelId, nextLastMessage, sourceMessage) {
|
|
17254
17260
|
var _getStoredChannel2;
|
|
17255
17261
|
return shouldReplaceLastMessage((_getStoredChannel2 = getStoredChannel(channelId)) === null || _getStoredChannel2 === void 0 ? void 0 : _getStoredChannel2.lastMessage, nextLastMessage, sourceMessage);
|
|
@@ -17258,6 +17264,9 @@ var getResolvedChannelLastMessage = function getResolvedChannelLastMessage(chann
|
|
|
17258
17264
|
var _getStoredChannel3;
|
|
17259
17265
|
var currentLastMessage = (_getStoredChannel3 = getStoredChannel(channelId)) === null || _getStoredChannel3 === void 0 ? void 0 : _getStoredChannel3.lastMessage;
|
|
17260
17266
|
if (!(nextLastMessage !== null && nextLastMessage !== void 0 && nextLastMessage.id)) {
|
|
17267
|
+
if (messagesShareReference(currentLastMessage, sourceMessage || nextLastMessage)) {
|
|
17268
|
+
return nextLastMessage;
|
|
17269
|
+
}
|
|
17261
17270
|
return currentLastMessage !== null && currentLastMessage !== void 0 && currentLastMessage.id ? currentLastMessage : null;
|
|
17262
17271
|
}
|
|
17263
17272
|
if (shouldReplaceChannelLastMessage(channelId, nextLastMessage, sourceMessage)) {
|
|
@@ -17574,8 +17583,7 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
17574
17583
|
})();
|
|
17575
17584
|
};
|
|
17576
17585
|
var syncFailedMessageState = /*#__PURE__*/_regenerator().m(function _callee2(channel, messageId, message, shouldKeepInMap) {
|
|
17577
|
-
var
|
|
17578
|
-
var shouldSkipUpdate, activeChannelId, failedMessage, resolvedLastMessage, channelUpdateParam;
|
|
17586
|
+
var shouldSkipUpdate, activeChannelId, failedMessage, resolvedLastMessage, shouldUpdateChannelList, channelUpdateParam;
|
|
17579
17587
|
return _regenerator().w(function (_context10) {
|
|
17580
17588
|
while (1) switch (_context10.n) {
|
|
17581
17589
|
case 0:
|
|
@@ -17604,7 +17612,8 @@ var syncFailedMessageState = /*#__PURE__*/_regenerator().m(function _callee2(cha
|
|
|
17604
17612
|
state: shouldSkipUpdate ? MESSAGE_STATUS.UNMODIFIED : MESSAGE_STATUS.FAILED
|
|
17605
17613
|
});
|
|
17606
17614
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, failedMessage, message);
|
|
17607
|
-
|
|
17615
|
+
shouldUpdateChannelList = lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage);
|
|
17616
|
+
if (!shouldUpdateChannelList) {
|
|
17608
17617
|
_context10.n = 3;
|
|
17609
17618
|
break;
|
|
17610
17619
|
}
|
|
@@ -17950,7 +17959,7 @@ function sendMessage(action) {
|
|
|
17950
17959
|
messagesToSend.push(messageToSend);
|
|
17951
17960
|
case 12:
|
|
17952
17961
|
_loop3 = /*#__PURE__*/_regenerator().m(function _callee4() {
|
|
17953
|
-
var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy,
|
|
17962
|
+
var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy, attachmentIndex, preparedVideoAttachment, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
|
|
17954
17963
|
return _regenerator().w(function (_context12) {
|
|
17955
17964
|
while (1) switch (_context12.p = _context12.n) {
|
|
17956
17965
|
case 0:
|
|
@@ -18131,7 +18140,7 @@ function sendMessage(action) {
|
|
|
18131
18140
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
18132
18141
|
case 18:
|
|
18133
18142
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
18134
|
-
if (!lastMessageNeedsUpdate((
|
|
18143
|
+
if (!lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage)) {
|
|
18135
18144
|
_context12.n = 20;
|
|
18136
18145
|
break;
|
|
18137
18146
|
}
|
|
@@ -18213,7 +18222,7 @@ function sendMessage(action) {
|
|
|
18213
18222
|
}, _marked1, null, [[1, 16]]);
|
|
18214
18223
|
}
|
|
18215
18224
|
function sendTextMessage(action) {
|
|
18216
|
-
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, _channel3, SceytChatClient, createChannelData, mentionedUserIds, attachments, _attachments$, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse$atta,
|
|
18225
|
+
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, _channel3, SceytChatClient, createChannelData, mentionedUserIds, attachments, _attachments$, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse$atta, messageResponse, messageUpdateData, activeChannelId, stringifiedMessageUpdateData, messageToUpdate, resolvedLastMessage, shouldUpdateChannelList, channelUpdateParam, _channel4, isErrorResendable, _t3;
|
|
18217
18226
|
return _regenerator().w(function (_context14) {
|
|
18218
18227
|
while (1) switch (_context14.p = _context14.n) {
|
|
18219
18228
|
case 0:
|
|
@@ -18356,7 +18365,8 @@ function sendTextMessage(action) {
|
|
|
18356
18365
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
18357
18366
|
case 15:
|
|
18358
18367
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
18359
|
-
|
|
18368
|
+
shouldUpdateChannelList = lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage);
|
|
18369
|
+
if (!shouldUpdateChannelList) {
|
|
18360
18370
|
_context14.n = 17;
|
|
18361
18371
|
break;
|
|
18362
18372
|
}
|
|
@@ -18398,7 +18408,7 @@ function sendTextMessage(action) {
|
|
|
18398
18408
|
}
|
|
18399
18409
|
function forwardMessage(action) {
|
|
18400
18410
|
var _message$user;
|
|
18401
|
-
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, messageBuilder, pollDetails, messageToSend, _pendingMessage,
|
|
18411
|
+
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, messageBuilder, pollDetails, messageToSend, _pendingMessage, messageResponse, responseAttachments, messageUpdateData, confirmedForward, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
18402
18412
|
return _regenerator().w(function (_context15) {
|
|
18403
18413
|
while (1) switch (_context15.p = _context15.n) {
|
|
18404
18414
|
case 0:
|
|
@@ -18571,7 +18581,7 @@ function forwardMessage(action) {
|
|
|
18571
18581
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
18572
18582
|
case 13:
|
|
18573
18583
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
18574
|
-
if (!lastMessageNeedsUpdate((
|
|
18584
|
+
if (!lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage)) {
|
|
18575
18585
|
_context15.n = 15;
|
|
18576
18586
|
break;
|
|
18577
18587
|
}
|
|
@@ -18928,7 +18938,7 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
|
|
|
18928
18938
|
}, _callee5, null, [[4, 10]]);
|
|
18929
18939
|
});
|
|
18930
18940
|
var shouldAppendPendingMessages = function shouldAppendPendingMessages(channelOrId, messages, options) {
|
|
18931
|
-
var
|
|
18941
|
+
var _getStoredChannel5, _getStoredChannel5$la, _channelOrId$lastMess;
|
|
18932
18942
|
var channelId = typeof channelOrId === 'string' ? channelOrId : channelOrId === null || channelOrId === void 0 ? void 0 : channelOrId.id;
|
|
18933
18943
|
if (!channelId) {
|
|
18934
18944
|
return false;
|
|
@@ -18940,7 +18950,7 @@ var shouldAppendPendingMessages = function shouldAppendPendingMessages(channelOr
|
|
|
18940
18950
|
return true;
|
|
18941
18951
|
}
|
|
18942
18952
|
var lastConfirmedMessageId = getLastConfirmedMessageId(messages);
|
|
18943
|
-
var latestConfirmedMessageId = typeof channelOrId === 'string' ? (
|
|
18953
|
+
var latestConfirmedMessageId = typeof channelOrId === 'string' ? (_getStoredChannel5 = getStoredChannel(channelOrId)) === null || _getStoredChannel5 === void 0 ? void 0 : (_getStoredChannel5$la = _getStoredChannel5.lastMessage) === null || _getStoredChannel5$la === void 0 ? void 0 : _getStoredChannel5$la.id : channelOrId === null || channelOrId === void 0 ? void 0 : (_channelOrId$lastMess = channelOrId.lastMessage) === null || _channelOrId$lastMess === void 0 ? void 0 : _channelOrId$lastMess.id;
|
|
18944
18954
|
return !!lastConfirmedMessageId && !!latestConfirmedMessageId && lastConfirmedMessageId === latestConfirmedMessageId;
|
|
18945
18955
|
};
|
|
18946
18956
|
var getFilteredPendingMessages = function getFilteredPendingMessages(channelOrId, messages, options) {
|
|
@@ -19378,7 +19388,7 @@ function loadOGMetadataForLinkSaga(action) {
|
|
|
19378
19388
|
}, _marked18);
|
|
19379
19389
|
}
|
|
19380
19390
|
function reloadActiveChannelAfterReconnect(action) {
|
|
19381
|
-
var _store$getState$
|
|
19391
|
+
var _store$getState$Chann3, _reconnectChannel, _action$payload2, channel, _action$payload2$visi, visibleAnchorId, _action$payload2$wasV, wasViewingLatest, _action$payload2$appl, applyVisibleWindow, _action$payload2$isAt, isAtHistoryTop, reconnectChannel, initialSignature, sawChannelsLoading, elapsed, _store$getState$Chann4, snapshot, snapshotSignature, resolvedChannelUpdateData, channelsLoadingState, _resolvedChannelUpdateData, latestSnapshot, _resolvedChannelUpdateData2, reloadAction, _t12;
|
|
19382
19392
|
return _regenerator().w(function (_context25) {
|
|
19383
19393
|
while (1) switch (_context25.p = _context25.n) {
|
|
19384
19394
|
case 0:
|
|
@@ -19392,7 +19402,7 @@ function reloadActiveChannelAfterReconnect(action) {
|
|
|
19392
19402
|
case 1:
|
|
19393
19403
|
reconnectChannel = channel;
|
|
19394
19404
|
initialSignature = getReconnectChannelSignature(channel);
|
|
19395
|
-
sawChannelsLoading = ((_store$getState$
|
|
19405
|
+
sawChannelsLoading = ((_store$getState$Chann3 = store.getState().ChannelReducer) === null || _store$getState$Chann3 === void 0 ? void 0 : _store$getState$Chann3.channelsLoadingState) === LOADING_STATE.LOADING;
|
|
19396
19406
|
elapsed = 0;
|
|
19397
19407
|
case 2:
|
|
19398
19408
|
if (!(elapsed < ACTIVE_CHANNEL_RECONNECT_REFRESH_TIMEOUT_MS)) {
|
|
@@ -19419,7 +19429,7 @@ function reloadActiveChannelAfterReconnect(action) {
|
|
|
19419
19429
|
reconnectChannel = _extends({}, channel, snapshot, resolvedChannelUpdateData);
|
|
19420
19430
|
return _context25.a(3, 7);
|
|
19421
19431
|
case 4:
|
|
19422
|
-
channelsLoadingState = (_store$getState$
|
|
19432
|
+
channelsLoadingState = (_store$getState$Chann4 = store.getState().ChannelReducer) === null || _store$getState$Chann4 === void 0 ? void 0 : _store$getState$Chann4.channelsLoadingState;
|
|
19423
19433
|
if (channelsLoadingState === LOADING_STATE.LOADING) {
|
|
19424
19434
|
sawChannelsLoading = true;
|
|
19425
19435
|
}
|
|
@@ -24099,6 +24109,12 @@ var _marked$2 = /*#__PURE__*/_regenerator().m(handleConnectionStatusChangedEvent
|
|
|
24099
24109
|
var getStoredChannel$1 = function getStoredChannel(channelId) {
|
|
24100
24110
|
return getChannelFromMap(channelId) || getChannelFromAllChannels(channelId) || getChannelFromAllChannelsMap(channelId) || null;
|
|
24101
24111
|
};
|
|
24112
|
+
var getReduxChannelLastMessage$1 = function getReduxChannelLastMessage(channelId) {
|
|
24113
|
+
var _find, _store$getState$Chann;
|
|
24114
|
+
return ((_find = (((_store$getState$Chann = store.getState().ChannelReducer) === null || _store$getState$Chann === void 0 ? void 0 : _store$getState$Chann.channels) || []).find(function (channel) {
|
|
24115
|
+
return channel.id === channelId;
|
|
24116
|
+
})) === null || _find === void 0 ? void 0 : _find.lastMessage) || null;
|
|
24117
|
+
};
|
|
24102
24118
|
var lastMessageNeedsUpdate$1 = function lastMessageNeedsUpdate(currentLastMessage, nextLastMessage) {
|
|
24103
24119
|
if (!nextLastMessage) {
|
|
24104
24120
|
return false;
|
|
@@ -24147,7 +24163,7 @@ var getResolvedChannelLastMessage$1 = function getResolvedChannelLastMessage(cha
|
|
|
24147
24163
|
};
|
|
24148
24164
|
function handleChannelMessageEvent(args, SceytChatClient) {
|
|
24149
24165
|
var _storedChannel$lastMe3, _storedChannel$lastMe4, _store$getState$Messa, _storedChannel$lastMe9, _message$attachments;
|
|
24150
|
-
var channel, message, messageToHandle, channelFilterTypes, activeChannelId, channelExists, channelForAdd, storedChannel, candidateLastMessage, resolvedLastMessage,
|
|
24166
|
+
var channel, message, messageToHandle, channelFilterTypes, activeChannelId, channelExists, channelForAdd, storedChannel, candidateLastMessage, resolvedLastMessage, messages, lastMessageIsInActiveWindow, isSameLastMessage, resolvedLastMessageUpdate, shouldUpdateLastMessage, shouldUpdateReduxLastMessage, _store$getState$Messa2, _storedChannel$lastMe7, visibleMessagesMap, lastMessageIsVisible, messagesHasNext, existingMessage, tabIsActive, channelDataUpdate, groupName, showNotifications, _tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, getFromContacts, state, theme, accentColor, textSecondary, messageBody;
|
|
24151
24167
|
return _regenerator().w(function (_context2) {
|
|
24152
24168
|
while (1) switch (_context2.n) {
|
|
24153
24169
|
case 0:
|
|
@@ -24168,7 +24184,6 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24168
24184
|
storedChannel = getStoredChannel$1(channel.id);
|
|
24169
24185
|
candidateLastMessage = channelForAdd.lastMessage || message;
|
|
24170
24186
|
resolvedLastMessage = message.repliedInThread ? (storedChannel === null || storedChannel === void 0 ? void 0 : storedChannel.lastMessage) || null : getResolvedChannelLastMessage$1(channel.id, candidateLastMessage, message);
|
|
24171
|
-
shouldUpdateLastMessage = lastMessageNeedsUpdate$1(storedChannel === null || storedChannel === void 0 ? void 0 : storedChannel.lastMessage, resolvedLastMessage);
|
|
24172
24187
|
messages = store.getState().MessageReducer.activeChannelMessages;
|
|
24173
24188
|
lastMessageIsInActiveWindow = storedChannel !== null && storedChannel !== void 0 && (_storedChannel$lastMe3 = storedChannel.lastMessage) !== null && _storedChannel$lastMe3 !== void 0 && _storedChannel$lastMe3.id || storedChannel !== null && storedChannel !== void 0 && (_storedChannel$lastMe4 = storedChannel.lastMessage) !== null && _storedChannel$lastMe4 !== void 0 && _storedChannel$lastMe4.tid ? (_store$getState$Messa = store.getState().MessageReducer.activeChannelMessages) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa.some(function (m) {
|
|
24174
24189
|
var _storedChannel$lastMe5, _storedChannel$lastMe6;
|
|
@@ -24180,6 +24195,8 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24180
24195
|
deliveryStatus: message.deliveryStatus,
|
|
24181
24196
|
state: MESSAGE_STATUS.UNMODIFIED
|
|
24182
24197
|
}) : resolvedLastMessage;
|
|
24198
|
+
shouldUpdateLastMessage = lastMessageNeedsUpdate$1(storedChannel === null || storedChannel === void 0 ? void 0 : storedChannel.lastMessage, resolvedLastMessageUpdate);
|
|
24199
|
+
shouldUpdateReduxLastMessage = lastMessageNeedsUpdate$1(getReduxChannelLastMessage$1(channel.id), resolvedLastMessageUpdate);
|
|
24183
24200
|
_context2.n = 2;
|
|
24184
24201
|
return effects.put(addChannelAC(channelForAdd));
|
|
24185
24202
|
case 2:
|
|
@@ -24191,7 +24208,7 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24191
24208
|
_context2.n = 4;
|
|
24192
24209
|
break;
|
|
24193
24210
|
case 3:
|
|
24194
|
-
if (!shouldUpdateLastMessage) {
|
|
24211
|
+
if (!(shouldUpdateLastMessage || shouldUpdateReduxLastMessage)) {
|
|
24195
24212
|
_context2.n = 4;
|
|
24196
24213
|
break;
|
|
24197
24214
|
}
|
|
@@ -24259,7 +24276,7 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24259
24276
|
newReactions: channelForAdd.newReactions,
|
|
24260
24277
|
userMessageReactions: [],
|
|
24261
24278
|
lastReactedMessage: null
|
|
24262
|
-
},
|
|
24279
|
+
}, shouldUpdateReduxLastMessage && resolvedLastMessageUpdate ? {
|
|
24263
24280
|
lastMessage: resolvedLastMessageUpdate
|
|
24264
24281
|
} : {});
|
|
24265
24282
|
if (storedChannel !== null && storedChannel !== void 0 && (_storedChannel$lastMe9 = storedChannel.lastMessage) !== null && _storedChannel$lastMe9 !== void 0 && _storedChannel$lastMe9.id) {
|
|
@@ -26708,7 +26725,7 @@ function getChannels(action) {
|
|
|
26708
26725
|
channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
|
|
26709
26726
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
26710
26727
|
var _store$getState$Chann;
|
|
26711
|
-
var channelId, pendingLastMessage, currentReduxLastMessage,
|
|
26728
|
+
var channelId, pendingLastMessage, currentReduxLastMessage, mappedChannel, serverLastMessage, serverConfirmedPendingMessage, resolvedLastMessage, mapEntry;
|
|
26712
26729
|
return _regenerator().w(function (_context4) {
|
|
26713
26730
|
while (1) switch (_context4.n) {
|
|
26714
26731
|
case 0:
|
|
@@ -26717,10 +26734,12 @@ function getChannels(action) {
|
|
|
26717
26734
|
currentReduxLastMessage = (_store$getState$Chann = store.getState().ChannelReducer.channels.find(function (ch) {
|
|
26718
26735
|
return ch.id === channelId;
|
|
26719
26736
|
})) === null || _store$getState$Chann === void 0 ? void 0 : _store$getState$Chann.lastMessage;
|
|
26720
|
-
resolvedLastMessage = currentReduxLastMessage !== null && currentReduxLastMessage !== void 0 && currentReduxLastMessage.id && !pendingLastMessage.id ? currentReduxLastMessage : pendingLastMessage;
|
|
26721
26737
|
mappedChannel = mappedChannels.find(function (ch) {
|
|
26722
26738
|
return ch.id === channelId;
|
|
26723
26739
|
});
|
|
26740
|
+
serverLastMessage = mappedChannel === null || mappedChannel === void 0 ? void 0 : mappedChannel.lastMessage;
|
|
26741
|
+
serverConfirmedPendingMessage = !!(serverLastMessage !== null && serverLastMessage !== void 0 && serverLastMessage.id) && !!pendingLastMessage.tid && serverLastMessage.tid === pendingLastMessage.tid;
|
|
26742
|
+
resolvedLastMessage = serverConfirmedPendingMessage ? serverLastMessage : currentReduxLastMessage !== null && currentReduxLastMessage !== void 0 && currentReduxLastMessage.id && !pendingLastMessage.id ? currentReduxLastMessage : pendingLastMessage;
|
|
26724
26743
|
if (mappedChannel) {
|
|
26725
26744
|
mappedChannel.lastMessage = resolvedLastMessage;
|
|
26726
26745
|
}
|
|
@@ -53179,6 +53198,10 @@ var SettingItem = styled__default.div(_templateObject9$j || (_templateObject9$j
|
|
|
53179
53198
|
return props.color;
|
|
53180
53199
|
});
|
|
53181
53200
|
|
|
53201
|
+
var hasSendableTextOrPoll = function hasSendableTextOrPoll(messageText, isPoll) {
|
|
53202
|
+
return Boolean(messageText.trim() || isPoll);
|
|
53203
|
+
};
|
|
53204
|
+
|
|
53182
53205
|
var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$k, _templateObject0$i, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$7, _templateObject13$6, _templateObject14$5, _templateObject15$3, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46;
|
|
53183
53206
|
function AutoFocusPlugin(_ref) {
|
|
53184
53207
|
var messageForReply = _ref.messageForReply;
|
|
@@ -53705,7 +53728,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53705
53728
|
type = event.type,
|
|
53706
53729
|
code = event.code;
|
|
53707
53730
|
var isEnter = (code === 'Enter' || code === 'NumpadEnter') && shiftKey === false;
|
|
53708
|
-
var isPoll = pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim();
|
|
53731
|
+
var isPoll = Boolean(pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim());
|
|
53709
53732
|
var messageTextForSend = isPoll ? pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.name.trim() : messageText.trim();
|
|
53710
53733
|
var shouldSend = (isEnter || type === 'click') && (messageToEdit || messageTextForSend || attachments.length && attachments.length > 0);
|
|
53711
53734
|
if (isEnter) {
|
|
@@ -53820,7 +53843,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53820
53843
|
});
|
|
53821
53844
|
}
|
|
53822
53845
|
}
|
|
53823
|
-
if (messageTexToSend
|
|
53846
|
+
if (hasSendableTextOrPoll(messageTexToSend, isPoll) && !attachments.length) {
|
|
53824
53847
|
if (linkAttachment) {
|
|
53825
53848
|
messageToSend.attachments = [linkAttachment];
|
|
53826
53849
|
}
|
package/index.modern.js
CHANGED
|
@@ -17230,6 +17230,12 @@ var addConfirmedMessageToCache = function addConfirmedMessageToCache(channelId,
|
|
|
17230
17230
|
var getStoredChannel = function getStoredChannel(channelId) {
|
|
17231
17231
|
return getChannelFromMap(channelId) || getChannelFromAllChannels(channelId) || getChannelFromAllChannelsMap(channelId) || null;
|
|
17232
17232
|
};
|
|
17233
|
+
var getReduxChannelLastMessage = function getReduxChannelLastMessage(channelId) {
|
|
17234
|
+
var _find, _store$getState$Chann2;
|
|
17235
|
+
return ((_find = (((_store$getState$Chann2 = store.getState().ChannelReducer) === null || _store$getState$Chann2 === void 0 ? void 0 : _store$getState$Chann2.channels) || []).find(function (channel) {
|
|
17236
|
+
return channel.id === channelId;
|
|
17237
|
+
})) === null || _find === void 0 ? void 0 : _find.lastMessage) || null;
|
|
17238
|
+
};
|
|
17233
17239
|
var shouldReplaceChannelLastMessage = function shouldReplaceChannelLastMessage(channelId, nextLastMessage, sourceMessage) {
|
|
17234
17240
|
var _getStoredChannel2;
|
|
17235
17241
|
return shouldReplaceLastMessage((_getStoredChannel2 = getStoredChannel(channelId)) === null || _getStoredChannel2 === void 0 ? void 0 : _getStoredChannel2.lastMessage, nextLastMessage, sourceMessage);
|
|
@@ -17238,6 +17244,9 @@ var getResolvedChannelLastMessage = function getResolvedChannelLastMessage(chann
|
|
|
17238
17244
|
var _getStoredChannel3;
|
|
17239
17245
|
var currentLastMessage = (_getStoredChannel3 = getStoredChannel(channelId)) === null || _getStoredChannel3 === void 0 ? void 0 : _getStoredChannel3.lastMessage;
|
|
17240
17246
|
if (!(nextLastMessage !== null && nextLastMessage !== void 0 && nextLastMessage.id)) {
|
|
17247
|
+
if (messagesShareReference(currentLastMessage, sourceMessage || nextLastMessage)) {
|
|
17248
|
+
return nextLastMessage;
|
|
17249
|
+
}
|
|
17241
17250
|
return currentLastMessage !== null && currentLastMessage !== void 0 && currentLastMessage.id ? currentLastMessage : null;
|
|
17242
17251
|
}
|
|
17243
17252
|
if (shouldReplaceChannelLastMessage(channelId, nextLastMessage, sourceMessage)) {
|
|
@@ -17554,8 +17563,7 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
17554
17563
|
})();
|
|
17555
17564
|
};
|
|
17556
17565
|
var syncFailedMessageState = /*#__PURE__*/_regenerator().m(function _callee2(channel, messageId, message, shouldKeepInMap) {
|
|
17557
|
-
var
|
|
17558
|
-
var shouldSkipUpdate, activeChannelId, failedMessage, resolvedLastMessage, channelUpdateParam;
|
|
17566
|
+
var shouldSkipUpdate, activeChannelId, failedMessage, resolvedLastMessage, shouldUpdateChannelList, channelUpdateParam;
|
|
17559
17567
|
return _regenerator().w(function (_context10) {
|
|
17560
17568
|
while (1) switch (_context10.n) {
|
|
17561
17569
|
case 0:
|
|
@@ -17584,7 +17592,8 @@ var syncFailedMessageState = /*#__PURE__*/_regenerator().m(function _callee2(cha
|
|
|
17584
17592
|
state: shouldSkipUpdate ? MESSAGE_STATUS.UNMODIFIED : MESSAGE_STATUS.FAILED
|
|
17585
17593
|
});
|
|
17586
17594
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, failedMessage, message);
|
|
17587
|
-
|
|
17595
|
+
shouldUpdateChannelList = lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage);
|
|
17596
|
+
if (!shouldUpdateChannelList) {
|
|
17588
17597
|
_context10.n = 3;
|
|
17589
17598
|
break;
|
|
17590
17599
|
}
|
|
@@ -17930,7 +17939,7 @@ function sendMessage(action) {
|
|
|
17930
17939
|
messagesToSend.push(messageToSend);
|
|
17931
17940
|
case 12:
|
|
17932
17941
|
_loop3 = /*#__PURE__*/_regenerator().m(function _callee4() {
|
|
17933
|
-
var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy,
|
|
17942
|
+
var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy, attachmentIndex, preparedVideoAttachment, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
|
|
17934
17943
|
return _regenerator().w(function (_context12) {
|
|
17935
17944
|
while (1) switch (_context12.p = _context12.n) {
|
|
17936
17945
|
case 0:
|
|
@@ -18111,7 +18120,7 @@ function sendMessage(action) {
|
|
|
18111
18120
|
return put(markChannelAsReadAC(channel.id));
|
|
18112
18121
|
case 18:
|
|
18113
18122
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
18114
|
-
if (!lastMessageNeedsUpdate((
|
|
18123
|
+
if (!lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage)) {
|
|
18115
18124
|
_context12.n = 20;
|
|
18116
18125
|
break;
|
|
18117
18126
|
}
|
|
@@ -18193,7 +18202,7 @@ function sendMessage(action) {
|
|
|
18193
18202
|
}, _marked1, null, [[1, 16]]);
|
|
18194
18203
|
}
|
|
18195
18204
|
function sendTextMessage(action) {
|
|
18196
|
-
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, _channel3, SceytChatClient, createChannelData, mentionedUserIds, attachments, _attachments$, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse$atta,
|
|
18205
|
+
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, _channel3, SceytChatClient, createChannelData, mentionedUserIds, attachments, _attachments$, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse$atta, messageResponse, messageUpdateData, activeChannelId, stringifiedMessageUpdateData, messageToUpdate, resolvedLastMessage, shouldUpdateChannelList, channelUpdateParam, _channel4, isErrorResendable, _t3;
|
|
18197
18206
|
return _regenerator().w(function (_context14) {
|
|
18198
18207
|
while (1) switch (_context14.p = _context14.n) {
|
|
18199
18208
|
case 0:
|
|
@@ -18336,7 +18345,8 @@ function sendTextMessage(action) {
|
|
|
18336
18345
|
return put(markChannelAsReadAC(channel.id));
|
|
18337
18346
|
case 15:
|
|
18338
18347
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
18339
|
-
|
|
18348
|
+
shouldUpdateChannelList = lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage);
|
|
18349
|
+
if (!shouldUpdateChannelList) {
|
|
18340
18350
|
_context14.n = 17;
|
|
18341
18351
|
break;
|
|
18342
18352
|
}
|
|
@@ -18378,7 +18388,7 @@ function sendTextMessage(action) {
|
|
|
18378
18388
|
}
|
|
18379
18389
|
function forwardMessage(action) {
|
|
18380
18390
|
var _message$user;
|
|
18381
|
-
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, messageBuilder, pollDetails, messageToSend, _pendingMessage,
|
|
18391
|
+
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, messageBuilder, pollDetails, messageToSend, _pendingMessage, messageResponse, responseAttachments, messageUpdateData, confirmedForward, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
18382
18392
|
return _regenerator().w(function (_context15) {
|
|
18383
18393
|
while (1) switch (_context15.p = _context15.n) {
|
|
18384
18394
|
case 0:
|
|
@@ -18551,7 +18561,7 @@ function forwardMessage(action) {
|
|
|
18551
18561
|
return put(markChannelAsReadAC(channel.id));
|
|
18552
18562
|
case 13:
|
|
18553
18563
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
18554
|
-
if (!lastMessageNeedsUpdate((
|
|
18564
|
+
if (!lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage)) {
|
|
18555
18565
|
_context15.n = 15;
|
|
18556
18566
|
break;
|
|
18557
18567
|
}
|
|
@@ -18908,7 +18918,7 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
|
|
|
18908
18918
|
}, _callee5, null, [[4, 10]]);
|
|
18909
18919
|
});
|
|
18910
18920
|
var shouldAppendPendingMessages = function shouldAppendPendingMessages(channelOrId, messages, options) {
|
|
18911
|
-
var
|
|
18921
|
+
var _getStoredChannel5, _getStoredChannel5$la, _channelOrId$lastMess;
|
|
18912
18922
|
var channelId = typeof channelOrId === 'string' ? channelOrId : channelOrId === null || channelOrId === void 0 ? void 0 : channelOrId.id;
|
|
18913
18923
|
if (!channelId) {
|
|
18914
18924
|
return false;
|
|
@@ -18920,7 +18930,7 @@ var shouldAppendPendingMessages = function shouldAppendPendingMessages(channelOr
|
|
|
18920
18930
|
return true;
|
|
18921
18931
|
}
|
|
18922
18932
|
var lastConfirmedMessageId = getLastConfirmedMessageId(messages);
|
|
18923
|
-
var latestConfirmedMessageId = typeof channelOrId === 'string' ? (
|
|
18933
|
+
var latestConfirmedMessageId = typeof channelOrId === 'string' ? (_getStoredChannel5 = getStoredChannel(channelOrId)) === null || _getStoredChannel5 === void 0 ? void 0 : (_getStoredChannel5$la = _getStoredChannel5.lastMessage) === null || _getStoredChannel5$la === void 0 ? void 0 : _getStoredChannel5$la.id : channelOrId === null || channelOrId === void 0 ? void 0 : (_channelOrId$lastMess = channelOrId.lastMessage) === null || _channelOrId$lastMess === void 0 ? void 0 : _channelOrId$lastMess.id;
|
|
18924
18934
|
return !!lastConfirmedMessageId && !!latestConfirmedMessageId && lastConfirmedMessageId === latestConfirmedMessageId;
|
|
18925
18935
|
};
|
|
18926
18936
|
var getFilteredPendingMessages = function getFilteredPendingMessages(channelOrId, messages, options) {
|
|
@@ -19358,7 +19368,7 @@ function loadOGMetadataForLinkSaga(action) {
|
|
|
19358
19368
|
}, _marked18);
|
|
19359
19369
|
}
|
|
19360
19370
|
function reloadActiveChannelAfterReconnect(action) {
|
|
19361
|
-
var _store$getState$
|
|
19371
|
+
var _store$getState$Chann3, _reconnectChannel, _action$payload2, channel, _action$payload2$visi, visibleAnchorId, _action$payload2$wasV, wasViewingLatest, _action$payload2$appl, applyVisibleWindow, _action$payload2$isAt, isAtHistoryTop, reconnectChannel, initialSignature, sawChannelsLoading, elapsed, _store$getState$Chann4, snapshot, snapshotSignature, resolvedChannelUpdateData, channelsLoadingState, _resolvedChannelUpdateData, latestSnapshot, _resolvedChannelUpdateData2, reloadAction, _t12;
|
|
19362
19372
|
return _regenerator().w(function (_context25) {
|
|
19363
19373
|
while (1) switch (_context25.p = _context25.n) {
|
|
19364
19374
|
case 0:
|
|
@@ -19372,7 +19382,7 @@ function reloadActiveChannelAfterReconnect(action) {
|
|
|
19372
19382
|
case 1:
|
|
19373
19383
|
reconnectChannel = channel;
|
|
19374
19384
|
initialSignature = getReconnectChannelSignature(channel);
|
|
19375
|
-
sawChannelsLoading = ((_store$getState$
|
|
19385
|
+
sawChannelsLoading = ((_store$getState$Chann3 = store.getState().ChannelReducer) === null || _store$getState$Chann3 === void 0 ? void 0 : _store$getState$Chann3.channelsLoadingState) === LOADING_STATE.LOADING;
|
|
19376
19386
|
elapsed = 0;
|
|
19377
19387
|
case 2:
|
|
19378
19388
|
if (!(elapsed < ACTIVE_CHANNEL_RECONNECT_REFRESH_TIMEOUT_MS)) {
|
|
@@ -19399,7 +19409,7 @@ function reloadActiveChannelAfterReconnect(action) {
|
|
|
19399
19409
|
reconnectChannel = _extends({}, channel, snapshot, resolvedChannelUpdateData);
|
|
19400
19410
|
return _context25.a(3, 7);
|
|
19401
19411
|
case 4:
|
|
19402
|
-
channelsLoadingState = (_store$getState$
|
|
19412
|
+
channelsLoadingState = (_store$getState$Chann4 = store.getState().ChannelReducer) === null || _store$getState$Chann4 === void 0 ? void 0 : _store$getState$Chann4.channelsLoadingState;
|
|
19403
19413
|
if (channelsLoadingState === LOADING_STATE.LOADING) {
|
|
19404
19414
|
sawChannelsLoading = true;
|
|
19405
19415
|
}
|
|
@@ -24079,6 +24089,12 @@ var _marked$2 = /*#__PURE__*/_regenerator().m(handleConnectionStatusChangedEvent
|
|
|
24079
24089
|
var getStoredChannel$1 = function getStoredChannel(channelId) {
|
|
24080
24090
|
return getChannelFromMap(channelId) || getChannelFromAllChannels(channelId) || getChannelFromAllChannelsMap(channelId) || null;
|
|
24081
24091
|
};
|
|
24092
|
+
var getReduxChannelLastMessage$1 = function getReduxChannelLastMessage(channelId) {
|
|
24093
|
+
var _find, _store$getState$Chann;
|
|
24094
|
+
return ((_find = (((_store$getState$Chann = store.getState().ChannelReducer) === null || _store$getState$Chann === void 0 ? void 0 : _store$getState$Chann.channels) || []).find(function (channel) {
|
|
24095
|
+
return channel.id === channelId;
|
|
24096
|
+
})) === null || _find === void 0 ? void 0 : _find.lastMessage) || null;
|
|
24097
|
+
};
|
|
24082
24098
|
var lastMessageNeedsUpdate$1 = function lastMessageNeedsUpdate(currentLastMessage, nextLastMessage) {
|
|
24083
24099
|
if (!nextLastMessage) {
|
|
24084
24100
|
return false;
|
|
@@ -24127,7 +24143,7 @@ var getResolvedChannelLastMessage$1 = function getResolvedChannelLastMessage(cha
|
|
|
24127
24143
|
};
|
|
24128
24144
|
function handleChannelMessageEvent(args, SceytChatClient) {
|
|
24129
24145
|
var _storedChannel$lastMe3, _storedChannel$lastMe4, _store$getState$Messa, _storedChannel$lastMe9, _message$attachments;
|
|
24130
|
-
var channel, message, messageToHandle, channelFilterTypes, activeChannelId, channelExists, channelForAdd, storedChannel, candidateLastMessage, resolvedLastMessage,
|
|
24146
|
+
var channel, message, messageToHandle, channelFilterTypes, activeChannelId, channelExists, channelForAdd, storedChannel, candidateLastMessage, resolvedLastMessage, messages, lastMessageIsInActiveWindow, isSameLastMessage, resolvedLastMessageUpdate, shouldUpdateLastMessage, shouldUpdateReduxLastMessage, _store$getState$Messa2, _storedChannel$lastMe7, visibleMessagesMap, lastMessageIsVisible, messagesHasNext, existingMessage, tabIsActive, channelDataUpdate, groupName, showNotifications, _tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, getFromContacts, state, theme, accentColor, textSecondary, messageBody;
|
|
24131
24147
|
return _regenerator().w(function (_context2) {
|
|
24132
24148
|
while (1) switch (_context2.n) {
|
|
24133
24149
|
case 0:
|
|
@@ -24148,7 +24164,6 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24148
24164
|
storedChannel = getStoredChannel$1(channel.id);
|
|
24149
24165
|
candidateLastMessage = channelForAdd.lastMessage || message;
|
|
24150
24166
|
resolvedLastMessage = message.repliedInThread ? (storedChannel === null || storedChannel === void 0 ? void 0 : storedChannel.lastMessage) || null : getResolvedChannelLastMessage$1(channel.id, candidateLastMessage, message);
|
|
24151
|
-
shouldUpdateLastMessage = lastMessageNeedsUpdate$1(storedChannel === null || storedChannel === void 0 ? void 0 : storedChannel.lastMessage, resolvedLastMessage);
|
|
24152
24167
|
messages = store.getState().MessageReducer.activeChannelMessages;
|
|
24153
24168
|
lastMessageIsInActiveWindow = storedChannel !== null && storedChannel !== void 0 && (_storedChannel$lastMe3 = storedChannel.lastMessage) !== null && _storedChannel$lastMe3 !== void 0 && _storedChannel$lastMe3.id || storedChannel !== null && storedChannel !== void 0 && (_storedChannel$lastMe4 = storedChannel.lastMessage) !== null && _storedChannel$lastMe4 !== void 0 && _storedChannel$lastMe4.tid ? (_store$getState$Messa = store.getState().MessageReducer.activeChannelMessages) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa.some(function (m) {
|
|
24154
24169
|
var _storedChannel$lastMe5, _storedChannel$lastMe6;
|
|
@@ -24160,6 +24175,8 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24160
24175
|
deliveryStatus: message.deliveryStatus,
|
|
24161
24176
|
state: MESSAGE_STATUS.UNMODIFIED
|
|
24162
24177
|
}) : resolvedLastMessage;
|
|
24178
|
+
shouldUpdateLastMessage = lastMessageNeedsUpdate$1(storedChannel === null || storedChannel === void 0 ? void 0 : storedChannel.lastMessage, resolvedLastMessageUpdate);
|
|
24179
|
+
shouldUpdateReduxLastMessage = lastMessageNeedsUpdate$1(getReduxChannelLastMessage$1(channel.id), resolvedLastMessageUpdate);
|
|
24163
24180
|
_context2.n = 2;
|
|
24164
24181
|
return put(addChannelAC(channelForAdd));
|
|
24165
24182
|
case 2:
|
|
@@ -24171,7 +24188,7 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24171
24188
|
_context2.n = 4;
|
|
24172
24189
|
break;
|
|
24173
24190
|
case 3:
|
|
24174
|
-
if (!shouldUpdateLastMessage) {
|
|
24191
|
+
if (!(shouldUpdateLastMessage || shouldUpdateReduxLastMessage)) {
|
|
24175
24192
|
_context2.n = 4;
|
|
24176
24193
|
break;
|
|
24177
24194
|
}
|
|
@@ -24239,7 +24256,7 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
24239
24256
|
newReactions: channelForAdd.newReactions,
|
|
24240
24257
|
userMessageReactions: [],
|
|
24241
24258
|
lastReactedMessage: null
|
|
24242
|
-
},
|
|
24259
|
+
}, shouldUpdateReduxLastMessage && resolvedLastMessageUpdate ? {
|
|
24243
24260
|
lastMessage: resolvedLastMessageUpdate
|
|
24244
24261
|
} : {});
|
|
24245
24262
|
if (storedChannel !== null && storedChannel !== void 0 && (_storedChannel$lastMe9 = storedChannel.lastMessage) !== null && _storedChannel$lastMe9 !== void 0 && _storedChannel$lastMe9.id) {
|
|
@@ -26688,7 +26705,7 @@ function getChannels(action) {
|
|
|
26688
26705
|
channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
|
|
26689
26706
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
26690
26707
|
var _store$getState$Chann;
|
|
26691
|
-
var channelId, pendingLastMessage, currentReduxLastMessage,
|
|
26708
|
+
var channelId, pendingLastMessage, currentReduxLastMessage, mappedChannel, serverLastMessage, serverConfirmedPendingMessage, resolvedLastMessage, mapEntry;
|
|
26692
26709
|
return _regenerator().w(function (_context4) {
|
|
26693
26710
|
while (1) switch (_context4.n) {
|
|
26694
26711
|
case 0:
|
|
@@ -26697,10 +26714,12 @@ function getChannels(action) {
|
|
|
26697
26714
|
currentReduxLastMessage = (_store$getState$Chann = store.getState().ChannelReducer.channels.find(function (ch) {
|
|
26698
26715
|
return ch.id === channelId;
|
|
26699
26716
|
})) === null || _store$getState$Chann === void 0 ? void 0 : _store$getState$Chann.lastMessage;
|
|
26700
|
-
resolvedLastMessage = currentReduxLastMessage !== null && currentReduxLastMessage !== void 0 && currentReduxLastMessage.id && !pendingLastMessage.id ? currentReduxLastMessage : pendingLastMessage;
|
|
26701
26717
|
mappedChannel = mappedChannels.find(function (ch) {
|
|
26702
26718
|
return ch.id === channelId;
|
|
26703
26719
|
});
|
|
26720
|
+
serverLastMessage = mappedChannel === null || mappedChannel === void 0 ? void 0 : mappedChannel.lastMessage;
|
|
26721
|
+
serverConfirmedPendingMessage = !!(serverLastMessage !== null && serverLastMessage !== void 0 && serverLastMessage.id) && !!pendingLastMessage.tid && serverLastMessage.tid === pendingLastMessage.tid;
|
|
26722
|
+
resolvedLastMessage = serverConfirmedPendingMessage ? serverLastMessage : currentReduxLastMessage !== null && currentReduxLastMessage !== void 0 && currentReduxLastMessage.id && !pendingLastMessage.id ? currentReduxLastMessage : pendingLastMessage;
|
|
26704
26723
|
if (mappedChannel) {
|
|
26705
26724
|
mappedChannel.lastMessage = resolvedLastMessage;
|
|
26706
26725
|
}
|
|
@@ -53159,6 +53178,10 @@ var SettingItem = styled.div(_templateObject9$j || (_templateObject9$j = _tagged
|
|
|
53159
53178
|
return props.color;
|
|
53160
53179
|
});
|
|
53161
53180
|
|
|
53181
|
+
var hasSendableTextOrPoll = function hasSendableTextOrPoll(messageText, isPoll) {
|
|
53182
|
+
return Boolean(messageText.trim() || isPoll);
|
|
53183
|
+
};
|
|
53184
|
+
|
|
53162
53185
|
var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$k, _templateObject0$i, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$7, _templateObject13$6, _templateObject14$5, _templateObject15$3, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46;
|
|
53163
53186
|
function AutoFocusPlugin(_ref) {
|
|
53164
53187
|
var messageForReply = _ref.messageForReply;
|
|
@@ -53685,7 +53708,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53685
53708
|
type = event.type,
|
|
53686
53709
|
code = event.code;
|
|
53687
53710
|
var isEnter = (code === 'Enter' || code === 'NumpadEnter') && shiftKey === false;
|
|
53688
|
-
var isPoll = pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim();
|
|
53711
|
+
var isPoll = Boolean(pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim());
|
|
53689
53712
|
var messageTextForSend = isPoll ? pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.name.trim() : messageText.trim();
|
|
53690
53713
|
var shouldSend = (isEnter || type === 'click') && (messageToEdit || messageTextForSend || attachments.length && attachments.length > 0);
|
|
53691
53714
|
if (isEnter) {
|
|
@@ -53800,7 +53823,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53800
53823
|
});
|
|
53801
53824
|
}
|
|
53802
53825
|
}
|
|
53803
|
-
if (messageTexToSend
|
|
53826
|
+
if (hasSendableTextOrPoll(messageTexToSend, isPoll) && !attachments.length) {
|
|
53804
53827
|
if (linkAttachment) {
|
|
53805
53828
|
messageToSend.attachments = [linkAttachment];
|
|
53806
53829
|
}
|