sceyt-chat-react-uikit 1.9.0-beta.17 → 1.9.0-beta.18
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 +304 -269
- package/index.modern.js +304 -269
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -13434,6 +13434,21 @@ function addReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
|
13434
13434
|
});
|
|
13435
13435
|
}
|
|
13436
13436
|
}
|
|
13437
|
+
var removeReactionFromTotals = function removeReactionFromTotals(reactionTotals, reactionKey) {
|
|
13438
|
+
if (reactionTotals === void 0) {
|
|
13439
|
+
reactionTotals = [];
|
|
13440
|
+
}
|
|
13441
|
+
return reactionTotals.reduce(function (totals, reactionTotal) {
|
|
13442
|
+
if (reactionTotal.key !== reactionKey) {
|
|
13443
|
+
totals.push(reactionTotal);
|
|
13444
|
+
} else if (reactionTotal.count > 1) {
|
|
13445
|
+
totals.push(_extends({}, reactionTotal, {
|
|
13446
|
+
count: reactionTotal.count - 1
|
|
13447
|
+
}));
|
|
13448
|
+
}
|
|
13449
|
+
return totals;
|
|
13450
|
+
}, []);
|
|
13451
|
+
};
|
|
13437
13452
|
function removeReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
13438
13453
|
if (messagesMap[channelId]) {
|
|
13439
13454
|
var messageShouldBeUpdated = messagesMap[channelId][message.id];
|
|
@@ -13450,7 +13465,7 @@ function removeReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
|
13450
13465
|
delete messagesMap[channelId][message.tid];
|
|
13451
13466
|
}
|
|
13452
13467
|
messagesMap[channelId][message.id || message.tid] = _extends({}, messageShouldBeUpdated, {
|
|
13453
|
-
reactionTotals:
|
|
13468
|
+
reactionTotals: removeReactionFromTotals(messageShouldBeUpdated.reactionTotals, reaction.key),
|
|
13454
13469
|
userReactions: userReactions
|
|
13455
13470
|
});
|
|
13456
13471
|
}
|
|
@@ -14204,7 +14219,7 @@ var messageSlice = createSlice({
|
|
|
14204
14219
|
});
|
|
14205
14220
|
}
|
|
14206
14221
|
return _extends({}, msg, {
|
|
14207
|
-
reactionTotals:
|
|
14222
|
+
reactionTotals: removeReactionFromTotals(msg.reactionTotals, reaction.key),
|
|
14208
14223
|
userReactions: userReactions
|
|
14209
14224
|
});
|
|
14210
14225
|
}
|
|
@@ -22308,7 +22323,8 @@ function deleteReaction(action) {
|
|
|
22308
22323
|
}
|
|
22309
22324
|
channelUpdateParam = {
|
|
22310
22325
|
userMessageReactions: [],
|
|
22311
|
-
lastReactedMessage: null
|
|
22326
|
+
lastReactedMessage: null,
|
|
22327
|
+
newReactions: []
|
|
22312
22328
|
};
|
|
22313
22329
|
_context40.n = 3;
|
|
22314
22330
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
@@ -23904,7 +23920,7 @@ function MessageSaga() {
|
|
|
23904
23920
|
return effects.takeEvery(CANCEL_CHANNEL_MESSAGE_PROCESSES, cancelChannelMessageProcesses);
|
|
23905
23921
|
case 22:
|
|
23906
23922
|
_context65.n = 23;
|
|
23907
|
-
return effects.
|
|
23923
|
+
return effects.takeLatest(GET_REACTIONS, getReactions);
|
|
23908
23924
|
case 23:
|
|
23909
23925
|
_context65.n = 24;
|
|
23910
23926
|
return effects.takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
|
|
@@ -39825,6 +39841,7 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
39825
39841
|
markPreferredSourceLoaded = _useProgressiveMediaS.markPreferredSourceLoaded;
|
|
39826
39842
|
var isExtractingRef = React.useRef(false);
|
|
39827
39843
|
var hasExtractionFailedRef = React.useRef(false);
|
|
39844
|
+
var previousVideoSourceRef = React.useRef(undefined);
|
|
39828
39845
|
React.useEffect(function () {
|
|
39829
39846
|
if (!videoThumb || downloadedPreviewImage) return;
|
|
39830
39847
|
var cancelled = false;
|
|
@@ -39841,10 +39858,16 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
39841
39858
|
}, [videoThumb, downloadedPreviewImage, dispatch, messageType]);
|
|
39842
39859
|
React.useEffect(function () {
|
|
39843
39860
|
var videoSource = src;
|
|
39844
|
-
|
|
39861
|
+
var canExtractFirstFrame = shouldExtractVideoFirstFrame(file.metadata);
|
|
39862
|
+
if (previousVideoSourceRef.current !== videoSource) {
|
|
39863
|
+
previousVideoSourceRef.current = videoSource;
|
|
39864
|
+
hasExtractionFailedRef.current = false;
|
|
39865
|
+
}
|
|
39866
|
+
if (!videoSource || !canExtractFirstFrame || isExtractingRef.current || hasExtractionFailedRef.current) {
|
|
39867
|
+
return;
|
|
39868
|
+
}
|
|
39845
39869
|
if (attachmentVideoFirstFrame || isPreview && setVideoIsReadyToSend) return;
|
|
39846
39870
|
var frameCacheKey = typeof file.url === 'string' ? file.url : undefined;
|
|
39847
|
-
hasExtractionFailedRef.current = false;
|
|
39848
39871
|
var checkCache = function checkCache() {
|
|
39849
39872
|
try {
|
|
39850
39873
|
var _exit = false;
|
|
@@ -40566,6 +40589,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
40566
40589
|
var _getVideoAttachmentCa = getVideoAttachmentCacheKeys(attachment.url, attachment.metadata),
|
|
40567
40590
|
videoThumb = _getVideoAttachmentCa.videoThumb,
|
|
40568
40591
|
originalVideoCacheKey = _getVideoAttachmentCa.originalVideo;
|
|
40592
|
+
if (sharedOriginalVideoDownload.state === 'completed' && originalVideoDownloadStartedRef.current) {
|
|
40593
|
+
originalVideoDownloadStartedRef.current = false;
|
|
40594
|
+
}
|
|
40569
40595
|
if (typeof originalVideoUrlFromMap === 'string') {
|
|
40570
40596
|
setAttachmentUrl(originalVideoUrlFromMap);
|
|
40571
40597
|
setIsCached(true);
|
|
@@ -40644,7 +40670,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
40644
40670
|
return function () {
|
|
40645
40671
|
cancelled = true;
|
|
40646
40672
|
};
|
|
40647
|
-
}, [attachment.id, attachment.type, attachment.url, attachment.metadata, attachment.attachmentUrl, isDetailsView, originalVideoUrlFromMap, connectionStatus, dispatch, messageType, attachment.size, videoDownloadRetry, isSharedOriginalVideoCancelled]);
|
|
40673
|
+
}, [attachment.id, attachment.type, attachment.url, attachment.metadata, attachment.attachmentUrl, isDetailsView, originalVideoUrlFromMap, connectionStatus, dispatch, messageType, attachment.size, videoDownloadRetry, isSharedOriginalVideoCancelled, sharedOriginalVideoDownload.state]);
|
|
40648
40674
|
var handleResumeOriginalVideoDownload = function handleResumeOriginalVideoDownload(event) {
|
|
40649
40675
|
event.stopPropagation();
|
|
40650
40676
|
if (!attachment.url) return;
|
|
@@ -49421,6 +49447,13 @@ function ReactionsPopup(_ref) {
|
|
|
49421
49447
|
var _useState = React.useState('all'),
|
|
49422
49448
|
activeTabKey = _useState[0],
|
|
49423
49449
|
setActiveTabKey = _useState[1];
|
|
49450
|
+
var reactionTotalsSignature = reactionTotals.map(function (_ref2) {
|
|
49451
|
+
var key = _ref2.key,
|
|
49452
|
+
count = _ref2.count,
|
|
49453
|
+
score = _ref2.score;
|
|
49454
|
+
return key + ":" + count + ":" + score;
|
|
49455
|
+
}).join('|');
|
|
49456
|
+
var reactionTotalsSignatureRef = React.useRef(reactionTotalsSignature);
|
|
49424
49457
|
var _useState2 = React.useState(0),
|
|
49425
49458
|
popupHeight = _useState2[0],
|
|
49426
49459
|
setPopupHeight = _useState2[1];
|
|
@@ -49449,7 +49482,7 @@ function ReactionsPopup(_ref) {
|
|
|
49449
49482
|
}
|
|
49450
49483
|
};
|
|
49451
49484
|
var handleClicks = function handleClicks(e) {
|
|
49452
|
-
if (e.target.closest('.reactions_popup')) {
|
|
49485
|
+
if (e.target.closest('.reactions_popup') || e.target.closest('[data-reactions-container]')) {
|
|
49453
49486
|
return;
|
|
49454
49487
|
}
|
|
49455
49488
|
if (closeIsApproved) {
|
|
@@ -49481,6 +49514,19 @@ function ReactionsPopup(_ref) {
|
|
|
49481
49514
|
handleReactionsPopupClose();
|
|
49482
49515
|
}
|
|
49483
49516
|
}, [reactionTotals]);
|
|
49517
|
+
React.useEffect(function () {
|
|
49518
|
+
if (reactionTotalsSignatureRef.current === reactionTotalsSignature || !reactionTotals.length) {
|
|
49519
|
+
return;
|
|
49520
|
+
}
|
|
49521
|
+
reactionTotalsSignatureRef.current = reactionTotalsSignature;
|
|
49522
|
+
var nextActiveTabKey = activeTabKey !== 'all' && reactionTotals.some(function (reaction) {
|
|
49523
|
+
return reaction.key === activeTabKey;
|
|
49524
|
+
}) ? activeTabKey : 'all';
|
|
49525
|
+
if (nextActiveTabKey !== activeTabKey) {
|
|
49526
|
+
setActiveTabKey(nextActiveTabKey);
|
|
49527
|
+
}
|
|
49528
|
+
handleGetReactions(nextActiveTabKey === 'all' ? undefined : nextActiveTabKey);
|
|
49529
|
+
}, [activeTabKey, reactionTotals, reactionTotalsSignature]);
|
|
49484
49530
|
var reactionsHeight = React.useMemo(function () {
|
|
49485
49531
|
return reactions.length * 50 + 45;
|
|
49486
49532
|
}, [reactions]);
|
|
@@ -55124,21 +55170,6 @@ var Emoji$1 = styled__default.li(_templateObject8$m || (_templateObject8$m = _ta
|
|
|
55124
55170
|
return props.hoverBackgroundColor;
|
|
55125
55171
|
});
|
|
55126
55172
|
|
|
55127
|
-
var isVideoAttachment = function isVideoAttachment(attachment) {
|
|
55128
|
-
var _attachment$data, _attachment$data$type;
|
|
55129
|
-
return attachment.type === attachmentTypes.video || ((_attachment$data = attachment.data) === null || _attachment$data === void 0 ? void 0 : (_attachment$data$type = _attachment$data.type) === null || _attachment$data$type === void 0 ? void 0 : _attachment$data$type.startsWith('video/'));
|
|
55130
|
-
};
|
|
55131
|
-
var waitForMediaAttachmentPreparation = function waitForMediaAttachmentPreparation(attachments, preparations) {
|
|
55132
|
-
try {
|
|
55133
|
-
return Promise.resolve(Promise.all(attachments.filter(function (attachment) {
|
|
55134
|
-
return attachment.type === attachmentTypes.image || isVideoAttachment(attachment);
|
|
55135
|
-
}).map(function (attachment) {
|
|
55136
|
-
return attachment.tid ? preparations.get(attachment.tid) : undefined;
|
|
55137
|
-
}))).then(function () {});
|
|
55138
|
-
} catch (e) {
|
|
55139
|
-
return Promise.reject(e);
|
|
55140
|
-
}
|
|
55141
|
-
};
|
|
55142
55173
|
var mergePreparedAttachmentPatches = function mergePreparedAttachmentPatches(attachments, patches) {
|
|
55143
55174
|
return attachments.map(function (attachment) {
|
|
55144
55175
|
return _extends({}, attachment, attachment.tid ? patches.get(attachment.tid) : undefined);
|
|
@@ -56896,33 +56927,36 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
56896
56927
|
var _useState22 = React.useState(false),
|
|
56897
56928
|
sendMessageIsActive = _useState22[0],
|
|
56898
56929
|
setSendMessageIsActive = _useState22[1];
|
|
56899
|
-
var _useState23 = React.useState(
|
|
56900
|
-
|
|
56901
|
-
|
|
56902
|
-
var _useState24 = React.useState(
|
|
56903
|
-
|
|
56904
|
-
|
|
56930
|
+
var _useState23 = React.useState(false),
|
|
56931
|
+
isSendMessageInFlight = _useState23[0],
|
|
56932
|
+
setIsSendMessageInFlight = _useState23[1];
|
|
56933
|
+
var _useState24 = React.useState([]),
|
|
56934
|
+
attachments = _useState24[0],
|
|
56935
|
+
setAttachments = _useState24[1];
|
|
56905
56936
|
var _useState25 = React.useState(false),
|
|
56906
|
-
|
|
56907
|
-
|
|
56937
|
+
forwardPopupOpen = _useState25[0],
|
|
56938
|
+
setForwardPopupOpen = _useState25[1];
|
|
56908
56939
|
var _useState26 = React.useState(false),
|
|
56909
|
-
|
|
56910
|
-
|
|
56911
|
-
var _useState27 = React.useState(
|
|
56912
|
-
|
|
56913
|
-
|
|
56914
|
-
var _useState28 = React.useState(''),
|
|
56915
|
-
|
|
56916
|
-
|
|
56917
|
-
var _useState29 = React.useState(
|
|
56918
|
-
|
|
56919
|
-
|
|
56920
|
-
var _useState30 = React.useState(
|
|
56921
|
-
|
|
56922
|
-
|
|
56923
|
-
var _useState31 = React.useState(
|
|
56924
|
-
|
|
56925
|
-
|
|
56940
|
+
deletePopupOpen = _useState26[0],
|
|
56941
|
+
setDeletePopupOpen = _useState26[1];
|
|
56942
|
+
var _useState27 = React.useState(false),
|
|
56943
|
+
isIncomingMessage = _useState27[0],
|
|
56944
|
+
setIsIncomingMessage = _useState27[1];
|
|
56945
|
+
var _useState28 = React.useState('.jpg,.jpeg,.png,.gif,.mp4,.mov,.avi,.wmv,.flv,.webm,.jfif'),
|
|
56946
|
+
mediaExtensions = _useState28[0],
|
|
56947
|
+
setMediaExtensions = _useState28[1];
|
|
56948
|
+
var _useState29 = React.useState(''),
|
|
56949
|
+
uploadErrorMessage = _useState29[0],
|
|
56950
|
+
setUploadErrorMessage = _useState29[1];
|
|
56951
|
+
var _useState30 = React.useState(false),
|
|
56952
|
+
viewOnce = _useState30[0],
|
|
56953
|
+
setViewOnce = _useState30[1];
|
|
56954
|
+
var _useState31 = React.useState(areDraftMessagesHydrated()),
|
|
56955
|
+
draftsHydrated = _useState31[0],
|
|
56956
|
+
setDraftsHydrated = _useState31[1];
|
|
56957
|
+
var _useState32 = React.useState(activeChannel.id || ''),
|
|
56958
|
+
composerChannelId = _useState32[0],
|
|
56959
|
+
setComposerChannelId = _useState32[1];
|
|
56926
56960
|
var typingOrRecordingIndicator = useSelector(typingOrRecordingIndicatorArraySelector(activeChannel.id));
|
|
56927
56961
|
var contactsMap = useSelector(contactsMapSelector);
|
|
56928
56962
|
var connectionStatus = useSelector(connectionStatusSelector, reactRedux.shallowEqual);
|
|
@@ -56935,40 +56969,47 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
56935
56969
|
var metadataDebounceRef = React.useRef(null);
|
|
56936
56970
|
var attachmentPreparationPromisesRef = React.useRef(new Map());
|
|
56937
56971
|
var preparedAttachmentPatchesRef = React.useRef(new Map());
|
|
56972
|
+
var isSendMessageInFlightRef = React.useRef(false);
|
|
56938
56973
|
var sendMessageWrapperRef = React.useRef(null);
|
|
56939
56974
|
var restoringDraftRef = React.useRef(false);
|
|
56940
56975
|
var restoredDraftChannelIdRef = React.useRef(null);
|
|
56941
56976
|
var isNavigatingChannelRef = React.useRef(false);
|
|
56942
|
-
var
|
|
56943
|
-
|
|
56944
|
-
|
|
56945
|
-
|
|
56946
|
-
|
|
56947
|
-
|
|
56948
|
-
var
|
|
56949
|
-
|
|
56950
|
-
|
|
56977
|
+
var releaseSendMessageLock = function releaseSendMessageLock() {
|
|
56978
|
+
Promise.resolve().then(function () {
|
|
56979
|
+
isSendMessageInFlightRef.current = false;
|
|
56980
|
+
setIsSendMessageInFlight(false);
|
|
56981
|
+
});
|
|
56982
|
+
};
|
|
56983
|
+
var _useState33 = React.useState(),
|
|
56984
|
+
realEditorState = _useState33[0],
|
|
56985
|
+
setRealEditorState = _useState33[1];
|
|
56986
|
+
var _useState34 = React.useState(null),
|
|
56987
|
+
floatingAnchorElem = _useState34[0],
|
|
56988
|
+
setFloatingAnchorElem = _useState34[1];
|
|
56951
56989
|
var _useState35 = React.useState(false),
|
|
56952
|
-
|
|
56953
|
-
|
|
56954
|
-
var _useState36 = React.useState(
|
|
56955
|
-
|
|
56956
|
-
|
|
56990
|
+
isSmallWidthViewport = _useState35[0],
|
|
56991
|
+
setIsSmallWidthViewport = _useState35[1];
|
|
56992
|
+
var _useState36 = React.useState(false),
|
|
56993
|
+
isScrolling = _useState36[0],
|
|
56994
|
+
setIsScrolling = _useState36[1];
|
|
56957
56995
|
var _useState37 = React.useState(null),
|
|
56958
|
-
|
|
56959
|
-
|
|
56960
|
-
var _useState38 = React.useState(
|
|
56961
|
-
|
|
56962
|
-
|
|
56963
|
-
var _useState39 = React.useState(
|
|
56964
|
-
|
|
56965
|
-
|
|
56996
|
+
linkPreview = _useState37[0],
|
|
56997
|
+
setLinkPreview = _useState37[1];
|
|
56998
|
+
var _useState38 = React.useState(null),
|
|
56999
|
+
detectedUrl = _useState38[0],
|
|
57000
|
+
setDetectedUrl = _useState38[1];
|
|
57001
|
+
var _useState39 = React.useState(new Set()),
|
|
57002
|
+
dismissedUrls = _useState39[0],
|
|
57003
|
+
setDismissedUrls = _useState39[1];
|
|
56966
57004
|
var _useState40 = React.useState(false),
|
|
56967
|
-
|
|
56968
|
-
|
|
57005
|
+
isClosingPreview = _useState40[0],
|
|
57006
|
+
setIsClosingPreview = _useState40[1];
|
|
56969
57007
|
var _useState41 = React.useState(false),
|
|
56970
|
-
|
|
56971
|
-
|
|
57008
|
+
replyLinkPreviewImageFailed = _useState41[0],
|
|
57009
|
+
setReplyLinkPreviewImageFailed = _useState41[1];
|
|
57010
|
+
var _useState42 = React.useState(false),
|
|
57011
|
+
linkPreviewImageFailed = _useState42[0],
|
|
57012
|
+
setLinkPreviewImageFailed = _useState42[1];
|
|
56972
57013
|
var addAttachmentByMenu = showChooseFileAttachment && showChooseMediaAttachment;
|
|
56973
57014
|
var linkify = new LinkifyIt();
|
|
56974
57015
|
var oGMetadata = useSelector(function (state) {
|
|
@@ -57235,178 +57276,167 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57235
57276
|
});
|
|
57236
57277
|
}
|
|
57237
57278
|
}
|
|
57238
|
-
|
|
57239
|
-
if (
|
|
57240
|
-
var _temp5 = function _temp5() {
|
|
57241
|
-
setAttachments([]);
|
|
57242
|
-
attachmentsUpdate = [];
|
|
57243
|
-
removeDraftMessageFromMap(activeChannel.id);
|
|
57244
|
-
dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
|
|
57245
|
-
setViewOnce(false);
|
|
57246
|
-
handleCloseReply();
|
|
57247
|
-
setShouldClearEditor({
|
|
57248
|
-
clear: true
|
|
57249
|
-
});
|
|
57250
|
-
setMentionedUsers([]);
|
|
57251
|
-
setMessageBodyAttributes([]);
|
|
57252
|
-
closePreviewWithAnimation(function () {
|
|
57253
|
-
setDetectedUrl(null);
|
|
57254
|
-
setDismissedUrls(new Set());
|
|
57255
|
-
});
|
|
57256
|
-
dispatch(setCloseSearchChannelsAC(true));
|
|
57257
|
-
};
|
|
57279
|
+
if (shouldSend && !mentionsIsOpen) {
|
|
57280
|
+
if (isSendMessageInFlightRef.current) {
|
|
57258
57281
|
event.preventDefault();
|
|
57259
57282
|
event.stopPropagation();
|
|
57260
|
-
|
|
57261
|
-
|
|
57262
|
-
|
|
57263
|
-
|
|
57264
|
-
|
|
57265
|
-
|
|
57266
|
-
|
|
57267
|
-
|
|
57268
|
-
|
|
57269
|
-
|
|
57270
|
-
|
|
57271
|
-
|
|
57272
|
-
|
|
57273
|
-
|
|
57274
|
-
|
|
57275
|
-
|
|
57276
|
-
|
|
57277
|
-
|
|
57278
|
-
|
|
57279
|
-
|
|
57280
|
-
|
|
57281
|
-
|
|
57282
|
-
|
|
57283
|
-
|
|
57284
|
-
|
|
57285
|
-
|
|
57286
|
-
|
|
57287
|
-
adjustedBodyAttributes.forEach(function (att) {
|
|
57288
|
-
if (att.type === 'mention') {
|
|
57289
|
-
var mentionsToFind = [].concat(mentionedUsers);
|
|
57290
|
-
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
57291
|
-
if (draftMessage) {
|
|
57292
|
-
mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
|
|
57293
|
-
}
|
|
57294
|
-
var mentionToAdd = mentionsToFind.find(function (mention) {
|
|
57295
|
-
return mention.id === att.metadata;
|
|
57296
|
-
});
|
|
57297
|
-
mentionUsersToSend.push(mentionToAdd || {
|
|
57298
|
-
id: att.metadata
|
|
57299
|
-
});
|
|
57300
|
-
}
|
|
57301
|
-
});
|
|
57302
|
-
}
|
|
57303
|
-
messageToSend.mentionedUsers = mentionUsersToSend;
|
|
57304
|
-
if (messageForReply) {
|
|
57305
|
-
messageToSend.parentMessage = messageForReply;
|
|
57306
|
-
}
|
|
57307
|
-
var linkAttachment;
|
|
57308
|
-
if (messageTexToSend) {
|
|
57309
|
-
var _LinkifyIt$match;
|
|
57310
|
-
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
57311
|
-
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
57312
|
-
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
57313
|
-
if (url) {
|
|
57314
|
-
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
57315
|
-
var metadata = {};
|
|
57316
|
-
if (urlMetadata) {
|
|
57317
|
-
var _urlMetadata$og, _urlMetadata$og$favic, _urlMetadata$og2, _urlMetadata$og$descr, _urlMetadata$og3, _urlMetadata$og3$imag, _urlMetadata$og3$imag2, _urlMetadata$og4, _urlMetadata$og$title;
|
|
57318
|
-
if (urlMetadata.imageWidth) metadata.szw = urlMetadata.imageWidth;
|
|
57319
|
-
if (urlMetadata.imageHeight) metadata.szh = urlMetadata.imageHeight;
|
|
57320
|
-
if ((_urlMetadata$og = urlMetadata.og) !== null && _urlMetadata$og !== void 0 && (_urlMetadata$og$favic = _urlMetadata$og.favicon) !== null && _urlMetadata$og$favic !== void 0 && _urlMetadata$og$favic.url) metadata.tur = urlMetadata.og.favicon.url;
|
|
57321
|
-
if ((_urlMetadata$og2 = urlMetadata.og) !== null && _urlMetadata$og2 !== void 0 && _urlMetadata$og2.description) metadata.dsc = (_urlMetadata$og$descr = urlMetadata.og.description) === null || _urlMetadata$og$descr === void 0 ? void 0 : _urlMetadata$og$descr.slice(0, 200);
|
|
57322
|
-
if ((_urlMetadata$og3 = urlMetadata.og) !== null && _urlMetadata$og3 !== void 0 && (_urlMetadata$og3$imag = _urlMetadata$og3.image) !== null && _urlMetadata$og3$imag !== void 0 && (_urlMetadata$og3$imag2 = _urlMetadata$og3$imag[0]) !== null && _urlMetadata$og3$imag2 !== void 0 && _urlMetadata$og3$imag2.url) metadata.iur = urlMetadata.og.image[0].url;
|
|
57323
|
-
if ((_urlMetadata$og4 = urlMetadata.og) !== null && _urlMetadata$og4 !== void 0 && _urlMetadata$og4.title) metadata.ttl = (_urlMetadata$og$title = urlMetadata.og.title) === null || _urlMetadata$og$title === void 0 ? void 0 : _urlMetadata$og$title.slice(0, 100);
|
|
57324
|
-
}
|
|
57325
|
-
if (dismissedUrls.has(url)) {
|
|
57326
|
-
metadata.hld = true;
|
|
57327
|
-
}
|
|
57328
|
-
linkAttachment = _extends({
|
|
57329
|
-
type: attachmentTypes.link,
|
|
57330
|
-
data: url,
|
|
57331
|
-
upload: false
|
|
57332
|
-
}, Object.keys(metadata).length > 0 ? {
|
|
57333
|
-
metadata: metadata,
|
|
57334
|
-
name: metadata.ttl
|
|
57335
|
-
} : {
|
|
57336
|
-
metadata: {
|
|
57337
|
-
hld: true
|
|
57338
|
-
}
|
|
57339
|
-
});
|
|
57340
|
-
}
|
|
57341
|
-
}
|
|
57342
|
-
if (hasSendableTextOrPoll(messageTexToSend, isPoll) && !attachments.length) {
|
|
57343
|
-
if (linkAttachment) {
|
|
57344
|
-
messageToSend.attachments = [linkAttachment];
|
|
57345
|
-
}
|
|
57346
|
-
if (isPoll) {
|
|
57347
|
-
messageToSend.pollDetails = pollDetails;
|
|
57348
|
-
messageToSend.type = 'poll';
|
|
57349
|
-
messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
|
|
57350
|
-
}
|
|
57351
|
-
dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
|
|
57352
|
-
}
|
|
57353
|
-
var _temp = function () {
|
|
57354
|
-
if (attachments.length) {
|
|
57355
|
-
return Promise.resolve(waitForMediaAttachmentPreparation(attachments, attachmentPreparationPromisesRef.current)).then(function () {
|
|
57356
|
-
var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
57357
|
-
messageToSend.attachments = mergePreparedAttachmentPatches(attachments, preparedAttachmentPatchesRef.current).map(function (preparedAttachment) {
|
|
57358
|
-
return {
|
|
57359
|
-
name: preparedAttachment.data.name,
|
|
57360
|
-
data: preparedAttachment.data,
|
|
57361
|
-
attachmentUrl: preparedAttachment.attachmentUrl,
|
|
57362
|
-
tid: preparedAttachment.tid,
|
|
57363
|
-
cachedUrl: preparedAttachment.cachedUrl,
|
|
57364
|
-
upload: preparedAttachment.upload,
|
|
57365
|
-
metadata: preparedAttachment.metadata,
|
|
57366
|
-
type: getOutgoingAttachmentType(preparedAttachment),
|
|
57367
|
-
size: preparedAttachment.size,
|
|
57368
|
-
thumbnailState: preparedAttachment.thumbnailState
|
|
57369
|
-
};
|
|
57370
|
-
});
|
|
57371
|
-
if (viewOnce && canShowViewOnceToggle) {
|
|
57372
|
-
messageToSend.viewOnce = true;
|
|
57373
|
-
}
|
|
57374
|
-
var attachmentsToSent = [].concat(messageToSend.attachments);
|
|
57375
|
-
if (linkAttachment && !messageToSend.viewOnce) {
|
|
57376
|
-
attachmentsToSent.push(linkAttachment);
|
|
57377
|
-
}
|
|
57378
|
-
dispatch(sendMessageAC(_extends({}, messageToSend, {
|
|
57379
|
-
attachments: attachmentsToSent
|
|
57380
|
-
}), activeChannel.id, connectionStatus, sendAsSeparateMessage));
|
|
57381
|
-
attachments.forEach(function (attachment) {
|
|
57382
|
-
attachmentPreparationPromisesRef.current["delete"](attachment.tid);
|
|
57383
|
-
preparedAttachmentPatchesRef.current["delete"](attachment.tid);
|
|
57384
|
-
});
|
|
57385
|
-
});
|
|
57386
|
-
}
|
|
57387
|
-
}();
|
|
57388
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
57283
|
+
return Promise.resolve();
|
|
57284
|
+
}
|
|
57285
|
+
isSendMessageInFlightRef.current = true;
|
|
57286
|
+
setIsSendMessageInFlight(true);
|
|
57287
|
+
event.preventDefault();
|
|
57288
|
+
event.stopPropagation();
|
|
57289
|
+
if (messageToEdit) {
|
|
57290
|
+
handleEditMessage();
|
|
57291
|
+
} else if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
|
|
57292
|
+
var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
|
|
57293
|
+
messageTexToSend = _trimMessageBodyWithA.body,
|
|
57294
|
+
adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
|
|
57295
|
+
var messageToSend = {
|
|
57296
|
+
body: messageTexToSend,
|
|
57297
|
+
bodyAttributes: adjustedBodyAttributes,
|
|
57298
|
+
mentionedUsers: [],
|
|
57299
|
+
attachments: [],
|
|
57300
|
+
type: 'text'
|
|
57301
|
+
};
|
|
57302
|
+
var mentionUsersToSend = [];
|
|
57303
|
+
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
57304
|
+
adjustedBodyAttributes.forEach(function (att) {
|
|
57305
|
+
if (att.type === 'mention') {
|
|
57306
|
+
var mentionsToFind = [].concat(mentionedUsers);
|
|
57307
|
+
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
57308
|
+
if (draftMessage) {
|
|
57309
|
+
mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
|
|
57389
57310
|
}
|
|
57390
|
-
|
|
57391
|
-
|
|
57311
|
+
var mentionToAdd = mentionsToFind.find(function (mention) {
|
|
57312
|
+
return mention.id === att.metadata;
|
|
57313
|
+
});
|
|
57314
|
+
mentionUsersToSend.push(mentionToAdd || {
|
|
57315
|
+
id: att.metadata
|
|
57316
|
+
});
|
|
57317
|
+
}
|
|
57318
|
+
});
|
|
57319
|
+
}
|
|
57320
|
+
messageToSend.mentionedUsers = mentionUsersToSend;
|
|
57321
|
+
if (messageForReply) {
|
|
57322
|
+
messageToSend.parentMessage = messageForReply;
|
|
57323
|
+
}
|
|
57324
|
+
var linkAttachment;
|
|
57325
|
+
if (messageTexToSend) {
|
|
57326
|
+
var _LinkifyIt$match;
|
|
57327
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
57328
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
57329
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
57330
|
+
if (url) {
|
|
57331
|
+
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
57332
|
+
var metadata = {};
|
|
57333
|
+
if (urlMetadata) {
|
|
57334
|
+
var _urlMetadata$og, _urlMetadata$og$favic, _urlMetadata$og2, _urlMetadata$og$descr, _urlMetadata$og3, _urlMetadata$og3$imag, _urlMetadata$og3$imag2, _urlMetadata$og4, _urlMetadata$og$title;
|
|
57335
|
+
if (urlMetadata.imageWidth) metadata.szw = urlMetadata.imageWidth;
|
|
57336
|
+
if (urlMetadata.imageHeight) metadata.szh = urlMetadata.imageHeight;
|
|
57337
|
+
if ((_urlMetadata$og = urlMetadata.og) !== null && _urlMetadata$og !== void 0 && (_urlMetadata$og$favic = _urlMetadata$og.favicon) !== null && _urlMetadata$og$favic !== void 0 && _urlMetadata$og$favic.url) metadata.tur = urlMetadata.og.favicon.url;
|
|
57338
|
+
if ((_urlMetadata$og2 = urlMetadata.og) !== null && _urlMetadata$og2 !== void 0 && _urlMetadata$og2.description) metadata.dsc = (_urlMetadata$og$descr = urlMetadata.og.description) === null || _urlMetadata$og$descr === void 0 ? void 0 : _urlMetadata$og$descr.slice(0, 200);
|
|
57339
|
+
if ((_urlMetadata$og3 = urlMetadata.og) !== null && _urlMetadata$og3 !== void 0 && (_urlMetadata$og3$imag = _urlMetadata$og3.image) !== null && _urlMetadata$og3$imag !== void 0 && (_urlMetadata$og3$imag2 = _urlMetadata$og3$imag[0]) !== null && _urlMetadata$og3$imag2 !== void 0 && _urlMetadata$og3$imag2.url) metadata.iur = urlMetadata.og.image[0].url;
|
|
57340
|
+
if ((_urlMetadata$og4 = urlMetadata.og) !== null && _urlMetadata$og4 !== void 0 && _urlMetadata$og4.title) metadata.ttl = (_urlMetadata$og$title = urlMetadata.og.title) === null || _urlMetadata$og$title === void 0 ? void 0 : _urlMetadata$og$title.slice(0, 100);
|
|
57341
|
+
}
|
|
57342
|
+
if (dismissedUrls.has(url)) {
|
|
57343
|
+
metadata.hld = true;
|
|
57344
|
+
}
|
|
57345
|
+
linkAttachment = _extends({
|
|
57346
|
+
type: attachmentTypes.link,
|
|
57347
|
+
data: url,
|
|
57348
|
+
upload: false
|
|
57349
|
+
}, Object.keys(metadata).length > 0 ? {
|
|
57350
|
+
metadata: metadata,
|
|
57351
|
+
name: metadata.ttl
|
|
57352
|
+
} : {
|
|
57353
|
+
metadata: {
|
|
57354
|
+
hld: true
|
|
57355
|
+
}
|
|
57356
|
+
});
|
|
57392
57357
|
}
|
|
57393
|
-
}
|
|
57394
|
-
|
|
57395
|
-
|
|
57396
|
-
|
|
57397
|
-
if (!inTypingStateTimout) {
|
|
57398
|
-
handleSendTypingState(true, code);
|
|
57358
|
+
}
|
|
57359
|
+
if (hasSendableTextOrPoll(messageTexToSend, isPoll) && !attachments.length) {
|
|
57360
|
+
if (linkAttachment) {
|
|
57361
|
+
messageToSend.attachments = [linkAttachment];
|
|
57399
57362
|
}
|
|
57400
|
-
|
|
57401
|
-
|
|
57363
|
+
if (isPoll) {
|
|
57364
|
+
messageToSend.pollDetails = pollDetails;
|
|
57365
|
+
messageToSend.type = 'poll';
|
|
57366
|
+
messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
|
|
57367
|
+
}
|
|
57368
|
+
dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
|
|
57369
|
+
}
|
|
57370
|
+
if (attachments.length) {
|
|
57371
|
+
var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
57372
|
+
messageToSend.attachments = mergePreparedAttachmentPatches(attachments, preparedAttachmentPatchesRef.current).map(function (preparedAttachment) {
|
|
57373
|
+
return {
|
|
57374
|
+
name: preparedAttachment.data.name,
|
|
57375
|
+
data: preparedAttachment.data,
|
|
57376
|
+
attachmentUrl: preparedAttachment.attachmentUrl,
|
|
57377
|
+
tid: preparedAttachment.tid,
|
|
57378
|
+
cachedUrl: preparedAttachment.cachedUrl,
|
|
57379
|
+
upload: preparedAttachment.upload,
|
|
57380
|
+
metadata: preparedAttachment.metadata,
|
|
57381
|
+
type: getOutgoingAttachmentType(preparedAttachment),
|
|
57382
|
+
size: preparedAttachment.size,
|
|
57383
|
+
thumbnailState: preparedAttachment.thumbnailState
|
|
57384
|
+
};
|
|
57385
|
+
});
|
|
57386
|
+
if (viewOnce && canShowViewOnceToggle) {
|
|
57387
|
+
messageToSend.viewOnce = true;
|
|
57388
|
+
}
|
|
57389
|
+
var attachmentsToSent = [].concat(messageToSend.attachments);
|
|
57390
|
+
if (linkAttachment && !messageToSend.viewOnce) {
|
|
57391
|
+
attachmentsToSent.push(linkAttachment);
|
|
57392
|
+
}
|
|
57393
|
+
dispatch(sendMessageAC(_extends({}, messageToSend, {
|
|
57394
|
+
attachments: attachmentsToSent
|
|
57395
|
+
}), activeChannel.id, connectionStatus, sendAsSeparateMessage));
|
|
57396
|
+
attachments.forEach(function (attachment) {
|
|
57397
|
+
attachmentPreparationPromisesRef.current["delete"](attachment.tid);
|
|
57398
|
+
preparedAttachmentPatchesRef.current["delete"](attachment.tid);
|
|
57399
|
+
});
|
|
57400
|
+
}
|
|
57401
|
+
setMessageText('');
|
|
57402
|
+
fileUploader.current.value = '';
|
|
57403
|
+
if (inTypingState) {
|
|
57404
|
+
handleSendTypingState(false);
|
|
57405
|
+
}
|
|
57406
|
+
clearTimeout(typingTimout);
|
|
57407
|
+
setTypingTimout(undefined);
|
|
57408
|
+
}
|
|
57409
|
+
setAttachments([]);
|
|
57410
|
+
attachmentsUpdate = [];
|
|
57411
|
+
removeDraftMessageFromMap(activeChannel.id);
|
|
57412
|
+
dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
|
|
57413
|
+
setViewOnce(false);
|
|
57414
|
+
handleCloseReply();
|
|
57415
|
+
setShouldClearEditor({
|
|
57416
|
+
clear: true
|
|
57417
|
+
});
|
|
57418
|
+
setMentionedUsers([]);
|
|
57419
|
+
setMessageBodyAttributes([]);
|
|
57420
|
+
closePreviewWithAnimation(function () {
|
|
57421
|
+
setDetectedUrl(null);
|
|
57422
|
+
setDismissedUrls(new Set());
|
|
57423
|
+
});
|
|
57424
|
+
dispatch(setCloseSearchChannelsAC(true));
|
|
57425
|
+
releaseSendMessageLock();
|
|
57426
|
+
} else {
|
|
57427
|
+
if (typingTimout) {
|
|
57428
|
+
if (!inTypingStateTimout) {
|
|
57402
57429
|
handleSendTypingState(true, code);
|
|
57403
57430
|
}
|
|
57404
|
-
|
|
57405
|
-
|
|
57406
|
-
|
|
57431
|
+
clearTimeout(typingTimout);
|
|
57432
|
+
} else {
|
|
57433
|
+
handleSendTypingState(true, code);
|
|
57407
57434
|
}
|
|
57408
|
-
|
|
57409
|
-
|
|
57435
|
+
setTypingTimout(setTimeout(function () {
|
|
57436
|
+
setTypingTimout(0);
|
|
57437
|
+
}, 2000));
|
|
57438
|
+
}
|
|
57439
|
+
return Promise.resolve();
|
|
57410
57440
|
} catch (e) {
|
|
57411
57441
|
return Promise.reject(e);
|
|
57412
57442
|
}
|
|
@@ -57594,14 +57624,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57594
57624
|
filesToProcess.forEach(function (file) {
|
|
57595
57625
|
try {
|
|
57596
57626
|
var validationError = isMediaAttachment ? validateMediaAttachment(file) : null;
|
|
57597
|
-
var
|
|
57627
|
+
var _temp = function () {
|
|
57598
57628
|
if (!validationError) {
|
|
57599
57629
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
57600
57630
|
} else {
|
|
57601
57631
|
showFileUploadError(validationError);
|
|
57602
57632
|
}
|
|
57603
57633
|
}();
|
|
57604
|
-
return Promise.resolve(
|
|
57634
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
57605
57635
|
} catch (e) {
|
|
57606
57636
|
return Promise.reject(e);
|
|
57607
57637
|
}
|
|
@@ -57640,21 +57670,21 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57640
57670
|
try {
|
|
57641
57671
|
var mediaValidationError = validateMediaAttachment(file);
|
|
57642
57672
|
var canAddAsMedia = showChooseMediaAttachment && !mediaValidationError;
|
|
57643
|
-
var
|
|
57673
|
+
var _temp3 = function () {
|
|
57644
57674
|
if (canAddAsMedia) {
|
|
57645
57675
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, true)).then(function () {});
|
|
57646
57676
|
} else {
|
|
57647
|
-
var
|
|
57677
|
+
var _temp4 = function () {
|
|
57648
57678
|
if (showChooseFileAttachment) {
|
|
57649
57679
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, false)).then(function () {});
|
|
57650
57680
|
} else {
|
|
57651
57681
|
showFileUploadError(mediaValidationError || allowedMediaExtensionsErrorMessage || UNSUPPORTED_PASTED_FILE_MESSAGE);
|
|
57652
57682
|
}
|
|
57653
57683
|
}();
|
|
57654
|
-
if (
|
|
57684
|
+
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
57655
57685
|
}
|
|
57656
57686
|
}();
|
|
57657
|
-
return Promise.resolve(
|
|
57687
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
57658
57688
|
} catch (e) {
|
|
57659
57689
|
return Promise.reject(e);
|
|
57660
57690
|
}
|
|
@@ -57790,14 +57820,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57790
57820
|
return setTimeout(function () {
|
|
57791
57821
|
try {
|
|
57792
57822
|
return Promise.resolve(_finallyRethrows(function () {
|
|
57793
|
-
var
|
|
57823
|
+
var _temp11 = function () {
|
|
57794
57824
|
if (fileType === 'image') {
|
|
57795
|
-
var
|
|
57825
|
+
var _temp7 = _catch(function () {
|
|
57796
57826
|
return Promise.resolve(createImageThumbnail(file)).then(function (_ref5) {
|
|
57797
57827
|
var thumbnail = _ref5.thumbnail,
|
|
57798
57828
|
imageWidth = _ref5.imageWidth,
|
|
57799
57829
|
imageHeight = _ref5.imageHeight;
|
|
57800
|
-
var
|
|
57830
|
+
var _temp6 = function () {
|
|
57801
57831
|
if (customUploader) {
|
|
57802
57832
|
return Promise.resolve(resizeImage(file)).then(function (resizedFile) {
|
|
57803
57833
|
var patch = {
|
|
@@ -57812,7 +57842,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57812
57842
|
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
57813
57843
|
});
|
|
57814
57844
|
} else {
|
|
57815
|
-
var
|
|
57845
|
+
var _temp12 = function () {
|
|
57816
57846
|
if (isMediaAttachment && file.type !== 'image/gif') {
|
|
57817
57847
|
return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
|
|
57818
57848
|
var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
|
|
@@ -57843,19 +57873,19 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57843
57873
|
});
|
|
57844
57874
|
}
|
|
57845
57875
|
}();
|
|
57846
|
-
if (
|
|
57876
|
+
if (_temp12 && _temp12.then) return _temp12.then(function () {});
|
|
57847
57877
|
}
|
|
57848
57878
|
}();
|
|
57849
|
-
if (
|
|
57879
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
57850
57880
|
});
|
|
57851
57881
|
}, function (error) {
|
|
57852
57882
|
log.warn('Unable to prepare image attachment preview:', error);
|
|
57853
57883
|
});
|
|
57854
|
-
if (
|
|
57884
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
57855
57885
|
} else {
|
|
57856
|
-
var
|
|
57886
|
+
var _temp13 = function () {
|
|
57857
57887
|
if (fileType === 'video') {
|
|
57858
|
-
var
|
|
57888
|
+
var _temp1 = function _temp1() {
|
|
57859
57889
|
return Promise.resolve(remuxPromise).then(function (uploadFile) {
|
|
57860
57890
|
if (uploadFile !== file) {
|
|
57861
57891
|
updateAttachment({
|
|
@@ -57885,8 +57915,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57885
57915
|
var thumbnailSource = file;
|
|
57886
57916
|
var metadata;
|
|
57887
57917
|
var frame;
|
|
57888
|
-
var
|
|
57889
|
-
function
|
|
57918
|
+
var _temp0 = _catch(function () {
|
|
57919
|
+
function _temp9() {
|
|
57890
57920
|
var _frame2 = frame,
|
|
57891
57921
|
thumb = _frame2.thumb,
|
|
57892
57922
|
width = _frame2.width,
|
|
@@ -57910,7 +57940,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57910
57940
|
dispatch(setUpdateMessageAttachmentAC(thumb, frame.frameBlobUrl));
|
|
57911
57941
|
setVideoIsReadyToSend(tid);
|
|
57912
57942
|
}
|
|
57913
|
-
var
|
|
57943
|
+
var _temp8 = _catch(function () {
|
|
57914
57944
|
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
|
|
57915
57945
|
frame = _getFrame;
|
|
57916
57946
|
});
|
|
@@ -57922,17 +57952,17 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57922
57952
|
});
|
|
57923
57953
|
});
|
|
57924
57954
|
});
|
|
57925
|
-
return
|
|
57955
|
+
return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
|
|
57926
57956
|
}, function (error) {
|
|
57927
57957
|
log.warn('Unable to generate video thumbnail:', error);
|
|
57928
57958
|
});
|
|
57929
|
-
return
|
|
57959
|
+
return _temp0 && _temp0.then ? _temp0.then(_temp1) : _temp1(_temp0);
|
|
57930
57960
|
}
|
|
57931
57961
|
}();
|
|
57932
|
-
if (
|
|
57962
|
+
if (_temp13 && _temp13.then) return _temp13.then(function () {});
|
|
57933
57963
|
}
|
|
57934
57964
|
}();
|
|
57935
|
-
if (
|
|
57965
|
+
if (_temp11 && _temp11.then) return _temp11.then(function () {});
|
|
57936
57966
|
}, function (_wasThrown, _result) {
|
|
57937
57967
|
resolve();
|
|
57938
57968
|
if (_wasThrown) throw _result;
|
|
@@ -57990,14 +58020,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
57990
58020
|
filesToProcess.forEach(function (file) {
|
|
57991
58021
|
try {
|
|
57992
58022
|
var validationError = isMediaAttachment ? validateMediaAttachment(file) : null;
|
|
57993
|
-
var
|
|
58023
|
+
var _temp14 = function () {
|
|
57994
58024
|
if (!validationError) {
|
|
57995
58025
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
57996
58026
|
} else {
|
|
57997
58027
|
showFileUploadError(validationError);
|
|
57998
58028
|
}
|
|
57999
58029
|
}();
|
|
58000
|
-
return Promise.resolve(
|
|
58030
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
|
|
58001
58031
|
} catch (e) {
|
|
58002
58032
|
return Promise.reject(e);
|
|
58003
58033
|
}
|
|
@@ -58347,11 +58377,16 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
58347
58377
|
return linkPreview && linkPreview.metadata && !isDescriptionOnlySymbol((_linkPreview$metadata = linkPreview.metadata.og) === null || _linkPreview$metadata === void 0 ? void 0 : _linkPreview$metadata.description) && (((_linkPreview$metadata2 = linkPreview.metadata.og) === null || _linkPreview$metadata2 === void 0 ? void 0 : _linkPreview$metadata2.title) || ((_linkPreview$metadata3 = linkPreview.metadata.og) === null || _linkPreview$metadata3 === void 0 ? void 0 : _linkPreview$metadata3.description) || ((_linkPreview$metadata4 = linkPreview.metadata.og) === null || _linkPreview$metadata4 === void 0 ? void 0 : (_linkPreview$metadata5 = _linkPreview$metadata4.image) === null || _linkPreview$metadata5 === void 0 ? void 0 : (_linkPreview$metadata6 = _linkPreview$metadata5[0]) === null || _linkPreview$metadata6 === void 0 ? void 0 : _linkPreview$metadata6.url) || ((_linkPreview$metadata7 = linkPreview.metadata.og) === null || _linkPreview$metadata7 === void 0 ? void 0 : (_linkPreview$metadata8 = _linkPreview$metadata7.favicon) === null || _linkPreview$metadata8 === void 0 ? void 0 : _linkPreview$metadata8.url));
|
|
58348
58378
|
}, [linkPreview]);
|
|
58349
58379
|
React.useEffect(function () {
|
|
58350
|
-
if (messageContRef
|
|
58351
|
-
|
|
58352
|
-
|
|
58353
|
-
|
|
58354
|
-
|
|
58380
|
+
if (!messageContRef.current) return undefined;
|
|
58381
|
+
var timeout = setTimeout(function () {
|
|
58382
|
+
var messageContainer = messageContRef.current;
|
|
58383
|
+
if (messageContainer) {
|
|
58384
|
+
dispatch(setSendMessageInputHeightAC(messageContainer.getBoundingClientRect().height));
|
|
58385
|
+
}
|
|
58386
|
+
}, 301);
|
|
58387
|
+
return function () {
|
|
58388
|
+
return clearTimeout(timeout);
|
|
58389
|
+
};
|
|
58355
58390
|
}, [showLinkPreview]);
|
|
58356
58391
|
return /*#__PURE__*/React__default.createElement(SendMessageWrapper, {
|
|
58357
58392
|
ref: sendMessageWrapperRef,
|
|
@@ -58750,11 +58785,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
58750
58785
|
anchorElem: floatingAnchorElem
|
|
58751
58786
|
})))))))), sendMessageIsActive || attachments.length > 0 || !voiceMessage && !((_getAudioRecordingFro2 = getAudioRecordingFromMap(activeChannel === null || activeChannel === void 0 ? void 0 : activeChannel.id)) !== null && _getAudioRecordingFro2 !== void 0 && _getAudioRecordingFro2.file) || messageToEdit ? (/*#__PURE__*/React__default.createElement(SendMessageButton, {
|
|
58752
58787
|
isCustomButton: CustomSendMessageButton,
|
|
58753
|
-
isActive: sendMessageIsActive,
|
|
58788
|
+
isActive: sendMessageIsActive && !isSendMessageInFlight,
|
|
58754
58789
|
order: sendIconOrder,
|
|
58755
58790
|
color: backgroundSections,
|
|
58756
58791
|
height: inputContainerHeight || minHeight,
|
|
58757
|
-
onClick: sendMessageIsActive ? handleSendEditMessage : null,
|
|
58792
|
+
onClick: sendMessageIsActive && !isSendMessageInFlight ? handleSendEditMessage : null,
|
|
58758
58793
|
iconColor: accentColor,
|
|
58759
58794
|
activeColor: accentColor
|
|
58760
58795
|
}, CustomSendMessageButton || /*#__PURE__*/React__default.createElement(SvgSend, null))) : (/*#__PURE__*/React__default.createElement(SendMessageButton, {
|