sceyt-chat-react-uikit 1.8.8-beta.5 → 1.8.8-beta.7
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 +179 -118
- package/index.modern.js +179 -119
- package/messageUtils/index.d.ts +5 -1
- package/messageUtils/index.test.d.ts +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9289,7 +9289,8 @@ var channelSlice = createSlice({
|
|
|
9289
9289
|
config = _action$payload3.config,
|
|
9290
9290
|
channelId = _action$payload3.channelId,
|
|
9291
9291
|
moveUp = _action$payload3.moveUp,
|
|
9292
|
-
sort = _action$payload3.sort
|
|
9292
|
+
sort = _action$payload3.sort,
|
|
9293
|
+
add = _action$payload3.add;
|
|
9293
9294
|
if (moveUp) {
|
|
9294
9295
|
var updateChannel;
|
|
9295
9296
|
var updatedChannels = state.channels.filter(function (chan) {
|
|
@@ -9298,8 +9299,8 @@ var channelSlice = createSlice({
|
|
|
9298
9299
|
}
|
|
9299
9300
|
return chan.id !== channelId;
|
|
9300
9301
|
});
|
|
9301
|
-
if (updateChannel) {
|
|
9302
|
-
updateChannel = _extends({}, updateChannel, config);
|
|
9302
|
+
if (updateChannel || add) {
|
|
9303
|
+
updateChannel = _extends({}, updateChannel || {}, config);
|
|
9303
9304
|
state.channels = sortChannelByLastMessage([updateChannel].concat(updatedChannels));
|
|
9304
9305
|
}
|
|
9305
9306
|
} else {
|
|
@@ -13565,12 +13566,13 @@ var updateChannelAC = function updateChannelAC(channelId, config) {
|
|
|
13565
13566
|
}
|
|
13566
13567
|
};
|
|
13567
13568
|
};
|
|
13568
|
-
var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort) {
|
|
13569
|
+
var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort, add) {
|
|
13569
13570
|
return updateChannelData({
|
|
13570
13571
|
config: config,
|
|
13571
13572
|
channelId: channelId,
|
|
13572
13573
|
moveUp: moveUp,
|
|
13573
|
-
sort: sort
|
|
13574
|
+
sort: sort,
|
|
13575
|
+
add: add
|
|
13574
13576
|
});
|
|
13575
13577
|
};
|
|
13576
13578
|
var updateChannelsMembersAC = function updateChannelsMembersAC(members) {
|
|
@@ -16667,7 +16669,7 @@ function sendTextMessage(action) {
|
|
|
16667
16669
|
}
|
|
16668
16670
|
function forwardMessage(action) {
|
|
16669
16671
|
var _message$user;
|
|
16670
|
-
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
16672
|
+
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
16671
16673
|
return _regenerator().w(function (_context15) {
|
|
16672
16674
|
while (1) switch (_context15.p = _context15.n) {
|
|
16673
16675
|
case 0:
|
|
@@ -16686,12 +16688,12 @@ function forwardMessage(action) {
|
|
|
16686
16688
|
case 2:
|
|
16687
16689
|
channel = _context15.v;
|
|
16688
16690
|
if (channel) {
|
|
16689
|
-
_context15.n =
|
|
16691
|
+
_context15.n = 7;
|
|
16690
16692
|
break;
|
|
16691
16693
|
}
|
|
16692
16694
|
channel = getChannelFromAllChannels(channelId) || null;
|
|
16693
16695
|
if (channel) {
|
|
16694
|
-
_context15.n =
|
|
16696
|
+
_context15.n = 5;
|
|
16695
16697
|
break;
|
|
16696
16698
|
}
|
|
16697
16699
|
_SceytChatClient = getClient();
|
|
@@ -16699,26 +16701,37 @@ function forwardMessage(action) {
|
|
|
16699
16701
|
return effects.call(_SceytChatClient.getChannel, channelId);
|
|
16700
16702
|
case 3:
|
|
16701
16703
|
channel = _context15.v;
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16704
|
+
if (!channel) {
|
|
16705
|
+
_context15.n = 4;
|
|
16706
|
+
break;
|
|
16705
16707
|
}
|
|
16708
|
+
setChannelInMap(channel);
|
|
16709
|
+
addChannelToAllChannels(_extends({}, channel));
|
|
16710
|
+
parsedChannel = JSON.parse(JSON.stringify(channel));
|
|
16711
|
+
_context15.n = 4;
|
|
16712
|
+
return effects.put(addChannelAC(parsedChannel));
|
|
16713
|
+
case 4:
|
|
16714
|
+
_context15.n = 6;
|
|
16715
|
+
break;
|
|
16716
|
+
case 5:
|
|
16717
|
+
setChannelInMap(channel);
|
|
16718
|
+
case 6:
|
|
16706
16719
|
if (!channel) {
|
|
16707
16720
|
channel = getChannelFromAllChannelsMap(channelId);
|
|
16708
16721
|
}
|
|
16709
|
-
case
|
|
16722
|
+
case 7:
|
|
16710
16723
|
if (channel) {
|
|
16711
|
-
_context15.n =
|
|
16724
|
+
_context15.n = 8;
|
|
16712
16725
|
break;
|
|
16713
16726
|
}
|
|
16714
16727
|
throw new Error('Channel not found');
|
|
16715
|
-
case
|
|
16728
|
+
case 8:
|
|
16716
16729
|
mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
|
|
16717
16730
|
return member.id;
|
|
16718
16731
|
}) : [];
|
|
16719
16732
|
attachments = message.attachments;
|
|
16720
16733
|
if ((channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC) && !(channel.userRole === 'admin' || channel.userRole === 'owner')) {
|
|
16721
|
-
_context15.n =
|
|
16734
|
+
_context15.n = 17;
|
|
16722
16735
|
break;
|
|
16723
16736
|
}
|
|
16724
16737
|
if (message.attachments && message.attachments.length && action.type !== RESEND_MESSAGE) {
|
|
@@ -16766,51 +16779,51 @@ function forwardMessage(action) {
|
|
|
16766
16779
|
pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
|
|
16767
16780
|
}
|
|
16768
16781
|
if (!pendingMessage) {
|
|
16769
|
-
_context15.n =
|
|
16782
|
+
_context15.n = 10;
|
|
16770
16783
|
break;
|
|
16771
16784
|
}
|
|
16772
16785
|
if (!(action.type !== RESEND_MESSAGE)) {
|
|
16773
|
-
_context15.n =
|
|
16786
|
+
_context15.n = 10;
|
|
16774
16787
|
break;
|
|
16775
16788
|
}
|
|
16776
|
-
_context15.n =
|
|
16789
|
+
_context15.n = 9;
|
|
16777
16790
|
return effects.call(loadOGMetadataForLinkMessages, [pendingMessage], true);
|
|
16778
|
-
case
|
|
16779
|
-
_context15.n =
|
|
16791
|
+
case 9:
|
|
16792
|
+
_context15.n = 10;
|
|
16780
16793
|
return effects.call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward);
|
|
16781
|
-
case
|
|
16794
|
+
case 10:
|
|
16782
16795
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
16783
|
-
_context15.n =
|
|
16796
|
+
_context15.n = 16;
|
|
16784
16797
|
break;
|
|
16785
16798
|
}
|
|
16786
|
-
_context15.n =
|
|
16799
|
+
_context15.n = 11;
|
|
16787
16800
|
return effects.call(channel.sendMessage, _extends({}, messageToSend, isNotShowOwnMessageForward ? {
|
|
16788
16801
|
forwardingDetails: null
|
|
16789
16802
|
} : {}));
|
|
16790
|
-
case
|
|
16803
|
+
case 11:
|
|
16791
16804
|
messageResponse = _context15.v;
|
|
16792
16805
|
messageUpdateData = _extends({}, messageResponse, {
|
|
16793
16806
|
channelId: channel.id
|
|
16794
16807
|
});
|
|
16795
16808
|
if (!(channelId === activeChannelId)) {
|
|
16796
|
-
_context15.n =
|
|
16809
|
+
_context15.n = 12;
|
|
16797
16810
|
break;
|
|
16798
16811
|
}
|
|
16799
|
-
_context15.n =
|
|
16812
|
+
_context15.n = 12;
|
|
16800
16813
|
return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
|
|
16801
|
-
case
|
|
16814
|
+
case 12:
|
|
16802
16815
|
addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
|
|
16803
16816
|
messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
|
|
16804
16817
|
if (!channel.unread) {
|
|
16805
|
-
_context15.n =
|
|
16818
|
+
_context15.n = 13;
|
|
16806
16819
|
break;
|
|
16807
16820
|
}
|
|
16808
|
-
_context15.n =
|
|
16821
|
+
_context15.n = 13;
|
|
16809
16822
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
16810
|
-
case
|
|
16823
|
+
case 13:
|
|
16811
16824
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
16812
16825
|
if (!lastMessageNeedsUpdate((_getStoredChannel8 = getStoredChannel(channel.id)) === null || _getStoredChannel8 === void 0 ? void 0 : _getStoredChannel8.lastMessage, resolvedLastMessage)) {
|
|
16813
|
-
_context15.n =
|
|
16826
|
+
_context15.n = 15;
|
|
16814
16827
|
break;
|
|
16815
16828
|
}
|
|
16816
16829
|
updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
|
|
@@ -16818,36 +16831,36 @@ function forwardMessage(action) {
|
|
|
16818
16831
|
lastMessage: resolvedLastMessage,
|
|
16819
16832
|
lastReactedMessage: null
|
|
16820
16833
|
};
|
|
16821
|
-
_context15.n =
|
|
16822
|
-
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
16823
|
-
case 12:
|
|
16824
|
-
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
16825
|
-
case 13:
|
|
16826
|
-
_context15.n = 15;
|
|
16827
|
-
break;
|
|
16834
|
+
_context15.n = 14;
|
|
16835
|
+
return effects.put(updateChannelDataAC(channel.id, _extends({}, channel, channelUpdateParam), true, false, true));
|
|
16828
16836
|
case 14:
|
|
16829
|
-
|
|
16837
|
+
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
16830
16838
|
case 15:
|
|
16831
|
-
_context15.n =
|
|
16839
|
+
_context15.n = 17;
|
|
16832
16840
|
break;
|
|
16833
16841
|
case 16:
|
|
16834
|
-
|
|
16842
|
+
throw new Error('Connection required to forward message');
|
|
16843
|
+
case 17:
|
|
16844
|
+
_context15.n = 20;
|
|
16845
|
+
break;
|
|
16846
|
+
case 18:
|
|
16847
|
+
_context15.p = 18;
|
|
16835
16848
|
_t4 = _context15.v;
|
|
16836
16849
|
isErrorResendable = isResendableError(_t4 === null || _t4 === void 0 ? void 0 : _t4.type);
|
|
16837
16850
|
if (!((_channel5 = channel) !== null && _channel5 !== void 0 && _channel5.id && messageTid)) {
|
|
16838
|
-
_context15.n =
|
|
16851
|
+
_context15.n = 19;
|
|
16839
16852
|
break;
|
|
16840
16853
|
}
|
|
16841
|
-
_context15.n =
|
|
16854
|
+
_context15.n = 19;
|
|
16842
16855
|
return effects.call(syncFailedMessageState, channel, messageTid, pendingMessage || _extends({}, message, {
|
|
16843
16856
|
tid: messageTid
|
|
16844
16857
|
}), isErrorResendable);
|
|
16845
|
-
case
|
|
16858
|
+
case 19:
|
|
16846
16859
|
log.error('error on forward message ... ', _t4);
|
|
16847
|
-
case
|
|
16860
|
+
case 20:
|
|
16848
16861
|
return _context15.a(2);
|
|
16849
16862
|
}
|
|
16850
|
-
}, _marked11, null, [[1,
|
|
16863
|
+
}, _marked11, null, [[1, 18]]);
|
|
16851
16864
|
}
|
|
16852
16865
|
function resendMessage(action) {
|
|
16853
16866
|
var _message$attachments;
|
|
@@ -20930,7 +20943,7 @@ function loadMorePollVotes(action) {
|
|
|
20930
20943
|
}
|
|
20931
20944
|
var REFRESH_WINDOW_HALF = 30;
|
|
20932
20945
|
function refreshCacheAroundMessage(action) {
|
|
20933
|
-
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20946
|
+
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, currentActiveMessages, currentActiveConfirmedMessages, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20934
20947
|
return _regenerator().w(function (_context63) {
|
|
20935
20948
|
while (1) switch (_context63.p = _context63.n) {
|
|
20936
20949
|
case 0:
|
|
@@ -21032,8 +21045,18 @@ function refreshCacheAroundMessage(action) {
|
|
|
21032
21045
|
_context63.n = 13;
|
|
21033
21046
|
return effects.call(loadOGMetadataForLinkMessages, loadedMessages, true);
|
|
21034
21047
|
case 13:
|
|
21048
|
+
currentActiveMessages = store.getState().MessageReducer.activeChannelMessages || [];
|
|
21049
|
+
currentActiveConfirmedMessages = currentActiveMessages.filter(function (message) {
|
|
21050
|
+
return !!message.id;
|
|
21051
|
+
});
|
|
21052
|
+
if (sameConfirmedWindow(currentActiveConfirmedMessages, activeConfirmedMessages)) {
|
|
21053
|
+
_context63.n = 14;
|
|
21054
|
+
break;
|
|
21055
|
+
}
|
|
21056
|
+
return _context63.a(2);
|
|
21057
|
+
case 14:
|
|
21035
21058
|
if (!sameConfirmedWindow(activeConfirmedMessages, loadedMessages)) {
|
|
21036
|
-
_context63.n =
|
|
21059
|
+
_context63.n = 16;
|
|
21037
21060
|
break;
|
|
21038
21061
|
}
|
|
21039
21062
|
activeById = new Map(activeConfirmedMessages.map(function (currentMessage) {
|
|
@@ -21046,44 +21069,44 @@ function refreshCacheAroundMessage(action) {
|
|
|
21046
21069
|
return JSON.stringify(existing) !== JSON.stringify(loaded);
|
|
21047
21070
|
});
|
|
21048
21071
|
if (!(changed.length > 0)) {
|
|
21049
|
-
_context63.n =
|
|
21072
|
+
_context63.n = 15;
|
|
21050
21073
|
break;
|
|
21051
21074
|
}
|
|
21052
|
-
_context63.n =
|
|
21075
|
+
_context63.n = 15;
|
|
21053
21076
|
return effects.put(patchMessagesAC(changed));
|
|
21054
|
-
case 14:
|
|
21055
|
-
return _context63.a(2);
|
|
21056
21077
|
case 15:
|
|
21078
|
+
return _context63.a(2);
|
|
21079
|
+
case 16:
|
|
21057
21080
|
if (applyVisibleWindow) {
|
|
21058
|
-
_context63.n =
|
|
21081
|
+
_context63.n = 17;
|
|
21059
21082
|
break;
|
|
21060
21083
|
}
|
|
21061
21084
|
return _context63.a(2);
|
|
21062
|
-
case 16:
|
|
21063
|
-
_context63.n = 17;
|
|
21064
|
-
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21065
21085
|
case 17:
|
|
21086
|
+
_context63.n = 18;
|
|
21087
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21088
|
+
case 18:
|
|
21066
21089
|
filteredPendingMessages = getFilteredPendingMessages(channelId, loadedMessages);
|
|
21067
21090
|
if (!(filteredPendingMessages.length > 0)) {
|
|
21068
|
-
_context63.n =
|
|
21091
|
+
_context63.n = 20;
|
|
21069
21092
|
break;
|
|
21070
21093
|
}
|
|
21071
|
-
_context63.n = 18;
|
|
21072
|
-
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21073
|
-
case 18:
|
|
21074
21094
|
_context63.n = 19;
|
|
21075
|
-
return effects.
|
|
21095
|
+
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21076
21096
|
case 19:
|
|
21077
|
-
_context63.n =
|
|
21078
|
-
|
|
21097
|
+
_context63.n = 20;
|
|
21098
|
+
return effects.call(loadOGMetadataForLinkMessages, filteredPendingMessages, true);
|
|
21079
21099
|
case 20:
|
|
21080
|
-
_context63.
|
|
21100
|
+
_context63.n = 22;
|
|
21101
|
+
break;
|
|
21102
|
+
case 21:
|
|
21103
|
+
_context63.p = 21;
|
|
21081
21104
|
_t55 = _context63.v;
|
|
21082
21105
|
log.error('error in refreshCacheAroundMessage', _t55);
|
|
21083
|
-
case
|
|
21106
|
+
case 22:
|
|
21084
21107
|
return _context63.a(2);
|
|
21085
21108
|
}
|
|
21086
|
-
}, _marked57, null, [[0,
|
|
21109
|
+
}, _marked57, null, [[0, 21]]);
|
|
21087
21110
|
}
|
|
21088
21111
|
function MessageSaga() {
|
|
21089
21112
|
return _regenerator().w(function (_context64) {
|
|
@@ -21976,6 +21999,42 @@ var MessageStatusIcon = function MessageStatusIcon(_ref) {
|
|
|
21976
21999
|
});
|
|
21977
22000
|
}
|
|
21978
22001
|
};
|
|
22002
|
+
function extractUrlMatches(text) {
|
|
22003
|
+
var results = [];
|
|
22004
|
+
var protocolRegex = /https?:\/\/\S+/g;
|
|
22005
|
+
var m;
|
|
22006
|
+
while ((m = protocolRegex.exec(text)) !== null) {
|
|
22007
|
+
results.push({
|
|
22008
|
+
text: m[0],
|
|
22009
|
+
url: m[0],
|
|
22010
|
+
index: m.index
|
|
22011
|
+
});
|
|
22012
|
+
}
|
|
22013
|
+
var linkifyResults = new LinkifyIt().match(text);
|
|
22014
|
+
if (linkifyResults) {
|
|
22015
|
+
for (var _iterator = _createForOfIteratorHelperLoose(linkifyResults), _step; !(_step = _iterator()).done;) {
|
|
22016
|
+
var lm = _step.value;
|
|
22017
|
+
if (lm.schema === '') {
|
|
22018
|
+
results.push({
|
|
22019
|
+
text: lm.text,
|
|
22020
|
+
url: lm.url.replace(/^http:\/\//, 'https://'),
|
|
22021
|
+
index: lm.index
|
|
22022
|
+
});
|
|
22023
|
+
}
|
|
22024
|
+
}
|
|
22025
|
+
}
|
|
22026
|
+
results.sort(function (a, b) {
|
|
22027
|
+
return a.index - b.index;
|
|
22028
|
+
});
|
|
22029
|
+
return results.length > 0 ? results.map(function (_ref2) {
|
|
22030
|
+
var text = _ref2.text,
|
|
22031
|
+
url = _ref2.url;
|
|
22032
|
+
return {
|
|
22033
|
+
text: text,
|
|
22034
|
+
url: url
|
|
22035
|
+
};
|
|
22036
|
+
}) : null;
|
|
22037
|
+
}
|
|
21979
22038
|
var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInviteLink, onInviteLinkClick) {
|
|
21980
22039
|
if (target === void 0) {
|
|
21981
22040
|
target = '_blank';
|
|
@@ -22024,26 +22083,25 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
|
|
|
22024
22083
|
});
|
|
22025
22084
|
return newMessageText || textPart;
|
|
22026
22085
|
};
|
|
22027
|
-
var MessageTextFormat = function MessageTextFormat(
|
|
22028
|
-
var text =
|
|
22029
|
-
message =
|
|
22030
|
-
contactsMap =
|
|
22031
|
-
getFromContacts =
|
|
22032
|
-
isLastMessage =
|
|
22033
|
-
asSampleText =
|
|
22034
|
-
accentColor =
|
|
22035
|
-
textSecondary =
|
|
22036
|
-
onMentionNameClick =
|
|
22037
|
-
shouldOpenUserProfileForMention =
|
|
22038
|
-
unsupportedMessage =
|
|
22039
|
-
|
|
22040
|
-
target =
|
|
22041
|
-
|
|
22042
|
-
isInviteLink =
|
|
22043
|
-
onInviteLinkClick =
|
|
22086
|
+
var MessageTextFormat = function MessageTextFormat(_ref3) {
|
|
22087
|
+
var text = _ref3.text,
|
|
22088
|
+
message = _ref3.message,
|
|
22089
|
+
contactsMap = _ref3.contactsMap,
|
|
22090
|
+
getFromContacts = _ref3.getFromContacts,
|
|
22091
|
+
isLastMessage = _ref3.isLastMessage,
|
|
22092
|
+
asSampleText = _ref3.asSampleText,
|
|
22093
|
+
accentColor = _ref3.accentColor,
|
|
22094
|
+
textSecondary = _ref3.textSecondary,
|
|
22095
|
+
onMentionNameClick = _ref3.onMentionNameClick,
|
|
22096
|
+
shouldOpenUserProfileForMention = _ref3.shouldOpenUserProfileForMention,
|
|
22097
|
+
unsupportedMessage = _ref3.unsupportedMessage,
|
|
22098
|
+
_ref3$target = _ref3.target,
|
|
22099
|
+
target = _ref3$target === void 0 ? '_blank' : _ref3$target,
|
|
22100
|
+
_ref3$isInviteLink = _ref3.isInviteLink,
|
|
22101
|
+
isInviteLink = _ref3$isInviteLink === void 0 ? false : _ref3$isInviteLink,
|
|
22102
|
+
onInviteLinkClick = _ref3.onInviteLinkClick;
|
|
22044
22103
|
try {
|
|
22045
22104
|
var messageText = [];
|
|
22046
|
-
var linkify = new LinkifyIt();
|
|
22047
22105
|
var messageBodyAttributes = message.bodyAttributes && JSON.parse(JSON.stringify(message.bodyAttributes));
|
|
22048
22106
|
if (unsupportedMessage) {
|
|
22049
22107
|
return 'This message is not supported. Update your app to view this message.';
|
|
@@ -22056,12 +22114,12 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22056
22114
|
var attributeOffset = attribute.offset;
|
|
22057
22115
|
try {
|
|
22058
22116
|
var firstPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(nextPartIndex || 0, attributeOffset) : '');
|
|
22059
|
-
var firstPartMatch = firstPart ?
|
|
22117
|
+
var firstPartMatch = firstPart ? extractUrlMatches(firstPart) : null;
|
|
22060
22118
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
22061
22119
|
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22062
22120
|
}
|
|
22063
22121
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
22064
|
-
var secondPartMatch = secondPart ?
|
|
22122
|
+
var secondPartMatch = secondPart ? extractUrlMatches(secondPart) : null;
|
|
22065
22123
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
22066
22124
|
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22067
22125
|
}
|
|
@@ -22121,7 +22179,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22121
22179
|
} else {
|
|
22122
22180
|
nextPartIndex = attributeOffset + attribute.length;
|
|
22123
22181
|
var _textPart = "" + text.slice(attributeOffset, attributeOffset + attribute.length);
|
|
22124
|
-
var match =
|
|
22182
|
+
var match = extractUrlMatches(_textPart);
|
|
22125
22183
|
var newTextPart = _textPart;
|
|
22126
22184
|
if (!isLastMessage && !asSampleText && match) {
|
|
22127
22185
|
newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
|
|
@@ -22138,7 +22196,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22138
22196
|
}
|
|
22139
22197
|
});
|
|
22140
22198
|
} else {
|
|
22141
|
-
var match =
|
|
22199
|
+
var match = extractUrlMatches(text);
|
|
22142
22200
|
if (!isLastMessage && !asSampleText && match) {
|
|
22143
22201
|
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
22144
22202
|
}
|
|
@@ -44139,6 +44197,7 @@ function useChatController(_ref5) {
|
|
|
44139
44197
|
var viewIsAtLatestRef = React.useRef(true);
|
|
44140
44198
|
var jumpLockUntilRef = React.useRef(0);
|
|
44141
44199
|
var jumpLockModeRef = React.useRef(null);
|
|
44200
|
+
var jumpLockHighWaterMarkRef = React.useRef(0);
|
|
44142
44201
|
var jumpUnlockTimeoutRef = React.useRef(null);
|
|
44143
44202
|
var isJumping = React.useRef(false);
|
|
44144
44203
|
var currentJumpIdRef = React.useRef(0);
|
|
@@ -44345,6 +44404,7 @@ function useChatController(_ref5) {
|
|
|
44345
44404
|
var clearJumpScrollingLock = React.useCallback(function () {
|
|
44346
44405
|
jumpLockUntilRef.current = 0;
|
|
44347
44406
|
jumpLockModeRef.current = null;
|
|
44407
|
+
jumpLockHighWaterMarkRef.current = 0;
|
|
44348
44408
|
historyLoadArmedRef.current = true;
|
|
44349
44409
|
latestLoadArmedRef.current = true;
|
|
44350
44410
|
if (historyArmTimerRef.current !== null) {
|
|
@@ -44362,9 +44422,11 @@ function useChatController(_ref5) {
|
|
|
44362
44422
|
isJumping.current = false;
|
|
44363
44423
|
}, []);
|
|
44364
44424
|
var lockJumpScrolling = React.useCallback(function (smooth, mode) {
|
|
44425
|
+
var _scrollRef$current$sc, _scrollRef$current;
|
|
44365
44426
|
var lockDuration = smooth ? JUMP_SCROLL_LOCK_MS : 250;
|
|
44366
44427
|
jumpLockUntilRef.current = Date.now() + lockDuration;
|
|
44367
44428
|
jumpLockModeRef.current = mode;
|
|
44429
|
+
jumpLockHighWaterMarkRef.current = (_scrollRef$current$sc = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop) != null ? _scrollRef$current$sc : 0;
|
|
44368
44430
|
if (jumpUnlockTimeoutRef.current !== null) {
|
|
44369
44431
|
clearTimeout(jumpUnlockTimeoutRef.current);
|
|
44370
44432
|
}
|
|
@@ -44653,6 +44715,7 @@ function useChatController(_ref5) {
|
|
|
44653
44715
|
restoreRef.current = null;
|
|
44654
44716
|
pendingNewestCountRef.current = 0;
|
|
44655
44717
|
setPendingNewestCount(0);
|
|
44718
|
+
unreadRestoreCompletedRef.current = true;
|
|
44656
44719
|
var container = scrollRef.current;
|
|
44657
44720
|
var currentChannelId = (_channelRef$current = channelRef.current) === null || _channelRef$current === void 0 ? void 0 : _channelRef$current.id;
|
|
44658
44721
|
var pendingLatestServerSync = ((_pendingLatestJumpRef = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef === void 0 ? void 0 : _pendingLatestJumpRef.channelId) === currentChannelId && ((_pendingLatestJumpRef2 = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef2 === void 0 ? void 0 : _pendingLatestJumpRef2.needsServerSync);
|
|
@@ -45127,7 +45190,8 @@ function useChatController(_ref5) {
|
|
|
45127
45190
|
if (isJumping.current) {
|
|
45128
45191
|
return;
|
|
45129
45192
|
}
|
|
45130
|
-
|
|
45193
|
+
var jumpLockActive = Date.now() < jumpLockUntilRef.current;
|
|
45194
|
+
if (!jumpLockActive && currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
|
|
45131
45195
|
currentScrollTop = historyEdgeScrollTop;
|
|
45132
45196
|
}
|
|
45133
45197
|
if (currentScrollTop !== container.scrollTop) {
|
|
@@ -45135,9 +45199,14 @@ function useChatController(_ref5) {
|
|
|
45135
45199
|
}
|
|
45136
45200
|
var distanceFromLatest = latestEdgeScrollTop - currentScrollTop;
|
|
45137
45201
|
lastMeasuredLatestEdgeRef.current = latestEdgeScrollTop;
|
|
45138
|
-
if (
|
|
45202
|
+
if (jumpLockActive) {
|
|
45203
|
+
jumpLockHighWaterMarkRef.current = Math.max(jumpLockHighWaterMarkRef.current, currentScrollTop);
|
|
45139
45204
|
if (jumpLockModeRef.current === 'latest' && distanceFromLatest > PRELOAD_RESET_PX) {
|
|
45140
|
-
|
|
45205
|
+
if (currentScrollTop < jumpLockHighWaterMarkRef.current - PRELOAD_RESET_PX) {
|
|
45206
|
+
clearJumpScrollingLock();
|
|
45207
|
+
} else {
|
|
45208
|
+
return;
|
|
45209
|
+
}
|
|
45141
45210
|
} else {
|
|
45142
45211
|
return;
|
|
45143
45212
|
}
|
|
@@ -45386,12 +45455,12 @@ function useChatController(_ref5) {
|
|
|
45386
45455
|
}, [channel.id, clearScrollIdleTimer, dispatch]);
|
|
45387
45456
|
var departingChannelId = activeChannelIdRef.current;
|
|
45388
45457
|
if (departingChannelId) {
|
|
45389
|
-
var _scrollRef$current$
|
|
45458
|
+
var _scrollRef$current$sc2, _scrollRef$current2;
|
|
45390
45459
|
var currentMessages = messagesRef.current;
|
|
45391
45460
|
var startId = getFirstConfirmedMessageId(currentMessages);
|
|
45392
45461
|
var endId = getLastConfirmedMessageId(currentMessages);
|
|
45393
45462
|
var anchorId = lastVisibleAnchorIdRef.current;
|
|
45394
|
-
var scrollTop = (_scrollRef$current$
|
|
45463
|
+
var scrollTop = (_scrollRef$current$sc2 = (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollTop) != null ? _scrollRef$current$sc2 : 0;
|
|
45395
45464
|
if (startId && endId && anchorId) {
|
|
45396
45465
|
var confirmedMessages = currentMessages.filter(function (m) {
|
|
45397
45466
|
return !!m.id;
|
|
@@ -45513,6 +45582,7 @@ function useChatController(_ref5) {
|
|
|
45513
45582
|
restoreRef.current = null;
|
|
45514
45583
|
viewIsAtLatestRef.current = true;
|
|
45515
45584
|
setIsViewingLatest(true);
|
|
45585
|
+
lockJumpScrolling(true, 'latest');
|
|
45516
45586
|
scrollToLatestEdge(container, 'smooth');
|
|
45517
45587
|
rememberLatestEdge();
|
|
45518
45588
|
return;
|
|
@@ -45573,7 +45643,7 @@ function useChatController(_ref5) {
|
|
|
45573
45643
|
}
|
|
45574
45644
|
rememberLatestEdge();
|
|
45575
45645
|
}
|
|
45576
|
-
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive]);
|
|
45646
|
+
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive, lockJumpScrolling]);
|
|
45577
45647
|
React.useEffect(function () {
|
|
45578
45648
|
if (!unreadScrollTo || !unreadMessageId || !messages.length || unreadRestoreCompletedRef.current) {
|
|
45579
45649
|
return;
|
|
@@ -45822,16 +45892,6 @@ function useChatController(_ref5) {
|
|
|
45822
45892
|
return m.sortKey === latestLocalRef || m.localRef === latestLocalRef;
|
|
45823
45893
|
});
|
|
45824
45894
|
var shouldShow = !isLatestInView || !isViewingLatest && (pendingNewestCount > 0 || !!scrollToMentionedMessage);
|
|
45825
|
-
console.log('[scrollToNewMsg]', {
|
|
45826
|
-
latestLocalRef: latestLocalRef,
|
|
45827
|
-
isLatestInView: !!isLatestInView,
|
|
45828
|
-
isViewingLatest: isViewingLatest,
|
|
45829
|
-
pendingNewestCount: pendingNewestCount,
|
|
45830
|
-
scrollToMentionedMessage: scrollToMentionedMessage,
|
|
45831
|
-
shouldShow: shouldShow,
|
|
45832
|
-
showScrollToNewMessageButton: showScrollToNewMessageButton,
|
|
45833
|
-
latestVisibleMessages: latestVisibleMessages
|
|
45834
|
-
});
|
|
45835
45895
|
if (showScrollToNewMessageButton !== shouldShow) {
|
|
45836
45896
|
dispatch(showScrollToNewMessageButtonAC(shouldShow));
|
|
45837
45897
|
}
|
|
@@ -50738,10 +50798,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50738
50798
|
editorState.read(function () {
|
|
50739
50799
|
var root = lexical.$getRoot();
|
|
50740
50800
|
var textContent = root.getTextContent();
|
|
50741
|
-
var
|
|
50742
|
-
|
|
50743
|
-
|
|
50744
|
-
|
|
50801
|
+
var protocolMatch = /https?:\/\/\S+/.exec(textContent);
|
|
50802
|
+
var linkifyMatchResult = !protocolMatch ? linkify.match(textContent) : null;
|
|
50803
|
+
var firstUrl = protocolMatch ? protocolMatch[0] : linkifyMatchResult !== null && linkifyMatchResult !== void 0 && linkifyMatchResult[0] ? linkifyMatchResult[0].schema === '' ? linkifyMatchResult[0].url.replace(/^http:\/\//, 'https://') : linkifyMatchResult[0].url : null;
|
|
50804
|
+
if (firstUrl) {
|
|
50745
50805
|
if (firstUrl !== detectedUrl) {
|
|
50746
50806
|
closePreviewWithAnimation(function () {
|
|
50747
50807
|
if (!dismissedUrls.has(firstUrl)) {
|
|
@@ -50901,11 +50961,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50901
50961
|
}
|
|
50902
50962
|
var linkAttachment;
|
|
50903
50963
|
if (messageTexToSend) {
|
|
50904
|
-
var
|
|
50905
|
-
var
|
|
50906
|
-
|
|
50907
|
-
|
|
50908
|
-
|
|
50964
|
+
var _LinkifyIt$match;
|
|
50965
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
50966
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
50967
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
50968
|
+
if (url) {
|
|
50909
50969
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
50910
50970
|
var metadata = {};
|
|
50911
50971
|
if (urlMetadata) {
|
|
@@ -51020,11 +51080,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
51020
51080
|
if (messageTexToSend) {
|
|
51021
51081
|
var linkAttachment;
|
|
51022
51082
|
if (messageTexToSend) {
|
|
51023
|
-
var
|
|
51024
|
-
var
|
|
51025
|
-
|
|
51026
|
-
|
|
51027
|
-
|
|
51083
|
+
var _LinkifyIt$match2;
|
|
51084
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
51085
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match2 = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match2 === void 0 ? void 0 : _LinkifyIt$match2[0] : null;
|
|
51086
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
51087
|
+
if (url) {
|
|
51028
51088
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
51029
51089
|
var metadata = {};
|
|
51030
51090
|
if (urlMetadata) {
|
|
@@ -58005,6 +58065,7 @@ exports.SendMessage = SendMessageInput;
|
|
|
58005
58065
|
exports.THEME_COLORS = THEME_COLORS;
|
|
58006
58066
|
exports.blockUsers = blockUsers;
|
|
58007
58067
|
exports.createOrGetDirectChannel = createOrGetDirectChannel;
|
|
58068
|
+
exports.extractUrlMatches = extractUrlMatches;
|
|
58008
58069
|
exports.handleGetMessage = handleGetMessage;
|
|
58009
58070
|
exports.handleSendMessage = handleSendMessage;
|
|
58010
58071
|
exports.switchChannelActiveChannel = switchChannelActiveChannel;
|
package/index.modern.js
CHANGED
|
@@ -9288,7 +9288,8 @@ var channelSlice = createSlice({
|
|
|
9288
9288
|
config = _action$payload3.config,
|
|
9289
9289
|
channelId = _action$payload3.channelId,
|
|
9290
9290
|
moveUp = _action$payload3.moveUp,
|
|
9291
|
-
sort = _action$payload3.sort
|
|
9291
|
+
sort = _action$payload3.sort,
|
|
9292
|
+
add = _action$payload3.add;
|
|
9292
9293
|
if (moveUp) {
|
|
9293
9294
|
var updateChannel;
|
|
9294
9295
|
var updatedChannels = state.channels.filter(function (chan) {
|
|
@@ -9297,8 +9298,8 @@ var channelSlice = createSlice({
|
|
|
9297
9298
|
}
|
|
9298
9299
|
return chan.id !== channelId;
|
|
9299
9300
|
});
|
|
9300
|
-
if (updateChannel) {
|
|
9301
|
-
updateChannel = _extends({}, updateChannel, config);
|
|
9301
|
+
if (updateChannel || add) {
|
|
9302
|
+
updateChannel = _extends({}, updateChannel || {}, config);
|
|
9302
9303
|
state.channels = sortChannelByLastMessage([updateChannel].concat(updatedChannels));
|
|
9303
9304
|
}
|
|
9304
9305
|
} else {
|
|
@@ -13564,12 +13565,13 @@ var updateChannelAC = function updateChannelAC(channelId, config) {
|
|
|
13564
13565
|
}
|
|
13565
13566
|
};
|
|
13566
13567
|
};
|
|
13567
|
-
var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort) {
|
|
13568
|
+
var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort, add) {
|
|
13568
13569
|
return updateChannelData({
|
|
13569
13570
|
config: config,
|
|
13570
13571
|
channelId: channelId,
|
|
13571
13572
|
moveUp: moveUp,
|
|
13572
|
-
sort: sort
|
|
13573
|
+
sort: sort,
|
|
13574
|
+
add: add
|
|
13573
13575
|
});
|
|
13574
13576
|
};
|
|
13575
13577
|
var updateChannelsMembersAC = function updateChannelsMembersAC(members) {
|
|
@@ -16666,7 +16668,7 @@ function sendTextMessage(action) {
|
|
|
16666
16668
|
}
|
|
16667
16669
|
function forwardMessage(action) {
|
|
16668
16670
|
var _message$user;
|
|
16669
|
-
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
16671
|
+
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
16670
16672
|
return _regenerator().w(function (_context15) {
|
|
16671
16673
|
while (1) switch (_context15.p = _context15.n) {
|
|
16672
16674
|
case 0:
|
|
@@ -16685,12 +16687,12 @@ function forwardMessage(action) {
|
|
|
16685
16687
|
case 2:
|
|
16686
16688
|
channel = _context15.v;
|
|
16687
16689
|
if (channel) {
|
|
16688
|
-
_context15.n =
|
|
16690
|
+
_context15.n = 7;
|
|
16689
16691
|
break;
|
|
16690
16692
|
}
|
|
16691
16693
|
channel = getChannelFromAllChannels(channelId) || null;
|
|
16692
16694
|
if (channel) {
|
|
16693
|
-
_context15.n =
|
|
16695
|
+
_context15.n = 5;
|
|
16694
16696
|
break;
|
|
16695
16697
|
}
|
|
16696
16698
|
_SceytChatClient = getClient();
|
|
@@ -16698,26 +16700,37 @@ function forwardMessage(action) {
|
|
|
16698
16700
|
return call(_SceytChatClient.getChannel, channelId);
|
|
16699
16701
|
case 3:
|
|
16700
16702
|
channel = _context15.v;
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16703
|
+
if (!channel) {
|
|
16704
|
+
_context15.n = 4;
|
|
16705
|
+
break;
|
|
16704
16706
|
}
|
|
16707
|
+
setChannelInMap(channel);
|
|
16708
|
+
addChannelToAllChannels(_extends({}, channel));
|
|
16709
|
+
parsedChannel = JSON.parse(JSON.stringify(channel));
|
|
16710
|
+
_context15.n = 4;
|
|
16711
|
+
return put(addChannelAC(parsedChannel));
|
|
16712
|
+
case 4:
|
|
16713
|
+
_context15.n = 6;
|
|
16714
|
+
break;
|
|
16715
|
+
case 5:
|
|
16716
|
+
setChannelInMap(channel);
|
|
16717
|
+
case 6:
|
|
16705
16718
|
if (!channel) {
|
|
16706
16719
|
channel = getChannelFromAllChannelsMap(channelId);
|
|
16707
16720
|
}
|
|
16708
|
-
case
|
|
16721
|
+
case 7:
|
|
16709
16722
|
if (channel) {
|
|
16710
|
-
_context15.n =
|
|
16723
|
+
_context15.n = 8;
|
|
16711
16724
|
break;
|
|
16712
16725
|
}
|
|
16713
16726
|
throw new Error('Channel not found');
|
|
16714
|
-
case
|
|
16727
|
+
case 8:
|
|
16715
16728
|
mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
|
|
16716
16729
|
return member.id;
|
|
16717
16730
|
}) : [];
|
|
16718
16731
|
attachments = message.attachments;
|
|
16719
16732
|
if ((channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC) && !(channel.userRole === 'admin' || channel.userRole === 'owner')) {
|
|
16720
|
-
_context15.n =
|
|
16733
|
+
_context15.n = 17;
|
|
16721
16734
|
break;
|
|
16722
16735
|
}
|
|
16723
16736
|
if (message.attachments && message.attachments.length && action.type !== RESEND_MESSAGE) {
|
|
@@ -16765,51 +16778,51 @@ function forwardMessage(action) {
|
|
|
16765
16778
|
pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
|
|
16766
16779
|
}
|
|
16767
16780
|
if (!pendingMessage) {
|
|
16768
|
-
_context15.n =
|
|
16781
|
+
_context15.n = 10;
|
|
16769
16782
|
break;
|
|
16770
16783
|
}
|
|
16771
16784
|
if (!(action.type !== RESEND_MESSAGE)) {
|
|
16772
|
-
_context15.n =
|
|
16785
|
+
_context15.n = 10;
|
|
16773
16786
|
break;
|
|
16774
16787
|
}
|
|
16775
|
-
_context15.n =
|
|
16788
|
+
_context15.n = 9;
|
|
16776
16789
|
return call(loadOGMetadataForLinkMessages, [pendingMessage], true);
|
|
16777
|
-
case
|
|
16778
|
-
_context15.n =
|
|
16790
|
+
case 9:
|
|
16791
|
+
_context15.n = 10;
|
|
16779
16792
|
return call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward);
|
|
16780
|
-
case
|
|
16793
|
+
case 10:
|
|
16781
16794
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
16782
|
-
_context15.n =
|
|
16795
|
+
_context15.n = 16;
|
|
16783
16796
|
break;
|
|
16784
16797
|
}
|
|
16785
|
-
_context15.n =
|
|
16798
|
+
_context15.n = 11;
|
|
16786
16799
|
return call(channel.sendMessage, _extends({}, messageToSend, isNotShowOwnMessageForward ? {
|
|
16787
16800
|
forwardingDetails: null
|
|
16788
16801
|
} : {}));
|
|
16789
|
-
case
|
|
16802
|
+
case 11:
|
|
16790
16803
|
messageResponse = _context15.v;
|
|
16791
16804
|
messageUpdateData = _extends({}, messageResponse, {
|
|
16792
16805
|
channelId: channel.id
|
|
16793
16806
|
});
|
|
16794
16807
|
if (!(channelId === activeChannelId)) {
|
|
16795
|
-
_context15.n =
|
|
16808
|
+
_context15.n = 12;
|
|
16796
16809
|
break;
|
|
16797
16810
|
}
|
|
16798
|
-
_context15.n =
|
|
16811
|
+
_context15.n = 12;
|
|
16799
16812
|
return put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
|
|
16800
|
-
case
|
|
16813
|
+
case 12:
|
|
16801
16814
|
addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
|
|
16802
16815
|
messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
|
|
16803
16816
|
if (!channel.unread) {
|
|
16804
|
-
_context15.n =
|
|
16817
|
+
_context15.n = 13;
|
|
16805
16818
|
break;
|
|
16806
16819
|
}
|
|
16807
|
-
_context15.n =
|
|
16820
|
+
_context15.n = 13;
|
|
16808
16821
|
return put(markChannelAsReadAC(channel.id));
|
|
16809
|
-
case
|
|
16822
|
+
case 13:
|
|
16810
16823
|
resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
|
|
16811
16824
|
if (!lastMessageNeedsUpdate((_getStoredChannel8 = getStoredChannel(channel.id)) === null || _getStoredChannel8 === void 0 ? void 0 : _getStoredChannel8.lastMessage, resolvedLastMessage)) {
|
|
16812
|
-
_context15.n =
|
|
16825
|
+
_context15.n = 15;
|
|
16813
16826
|
break;
|
|
16814
16827
|
}
|
|
16815
16828
|
updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
|
|
@@ -16817,36 +16830,36 @@ function forwardMessage(action) {
|
|
|
16817
16830
|
lastMessage: resolvedLastMessage,
|
|
16818
16831
|
lastReactedMessage: null
|
|
16819
16832
|
};
|
|
16820
|
-
_context15.n =
|
|
16821
|
-
return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
16822
|
-
case 12:
|
|
16823
|
-
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
16824
|
-
case 13:
|
|
16825
|
-
_context15.n = 15;
|
|
16826
|
-
break;
|
|
16833
|
+
_context15.n = 14;
|
|
16834
|
+
return put(updateChannelDataAC(channel.id, _extends({}, channel, channelUpdateParam), true, false, true));
|
|
16827
16835
|
case 14:
|
|
16828
|
-
|
|
16836
|
+
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
16829
16837
|
case 15:
|
|
16830
|
-
_context15.n =
|
|
16838
|
+
_context15.n = 17;
|
|
16831
16839
|
break;
|
|
16832
16840
|
case 16:
|
|
16833
|
-
|
|
16841
|
+
throw new Error('Connection required to forward message');
|
|
16842
|
+
case 17:
|
|
16843
|
+
_context15.n = 20;
|
|
16844
|
+
break;
|
|
16845
|
+
case 18:
|
|
16846
|
+
_context15.p = 18;
|
|
16834
16847
|
_t4 = _context15.v;
|
|
16835
16848
|
isErrorResendable = isResendableError(_t4 === null || _t4 === void 0 ? void 0 : _t4.type);
|
|
16836
16849
|
if (!((_channel5 = channel) !== null && _channel5 !== void 0 && _channel5.id && messageTid)) {
|
|
16837
|
-
_context15.n =
|
|
16850
|
+
_context15.n = 19;
|
|
16838
16851
|
break;
|
|
16839
16852
|
}
|
|
16840
|
-
_context15.n =
|
|
16853
|
+
_context15.n = 19;
|
|
16841
16854
|
return call(syncFailedMessageState, channel, messageTid, pendingMessage || _extends({}, message, {
|
|
16842
16855
|
tid: messageTid
|
|
16843
16856
|
}), isErrorResendable);
|
|
16844
|
-
case
|
|
16857
|
+
case 19:
|
|
16845
16858
|
log.error('error on forward message ... ', _t4);
|
|
16846
|
-
case
|
|
16859
|
+
case 20:
|
|
16847
16860
|
return _context15.a(2);
|
|
16848
16861
|
}
|
|
16849
|
-
}, _marked11, null, [[1,
|
|
16862
|
+
}, _marked11, null, [[1, 18]]);
|
|
16850
16863
|
}
|
|
16851
16864
|
function resendMessage(action) {
|
|
16852
16865
|
var _message$attachments;
|
|
@@ -20929,7 +20942,7 @@ function loadMorePollVotes(action) {
|
|
|
20929
20942
|
}
|
|
20930
20943
|
var REFRESH_WINDOW_HALF = 30;
|
|
20931
20944
|
function refreshCacheAroundMessage(action) {
|
|
20932
|
-
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20945
|
+
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, currentActiveMessages, currentActiveConfirmedMessages, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20933
20946
|
return _regenerator().w(function (_context63) {
|
|
20934
20947
|
while (1) switch (_context63.p = _context63.n) {
|
|
20935
20948
|
case 0:
|
|
@@ -21031,8 +21044,18 @@ function refreshCacheAroundMessage(action) {
|
|
|
21031
21044
|
_context63.n = 13;
|
|
21032
21045
|
return call(loadOGMetadataForLinkMessages, loadedMessages, true);
|
|
21033
21046
|
case 13:
|
|
21047
|
+
currentActiveMessages = store.getState().MessageReducer.activeChannelMessages || [];
|
|
21048
|
+
currentActiveConfirmedMessages = currentActiveMessages.filter(function (message) {
|
|
21049
|
+
return !!message.id;
|
|
21050
|
+
});
|
|
21051
|
+
if (sameConfirmedWindow(currentActiveConfirmedMessages, activeConfirmedMessages)) {
|
|
21052
|
+
_context63.n = 14;
|
|
21053
|
+
break;
|
|
21054
|
+
}
|
|
21055
|
+
return _context63.a(2);
|
|
21056
|
+
case 14:
|
|
21034
21057
|
if (!sameConfirmedWindow(activeConfirmedMessages, loadedMessages)) {
|
|
21035
|
-
_context63.n =
|
|
21058
|
+
_context63.n = 16;
|
|
21036
21059
|
break;
|
|
21037
21060
|
}
|
|
21038
21061
|
activeById = new Map(activeConfirmedMessages.map(function (currentMessage) {
|
|
@@ -21045,44 +21068,44 @@ function refreshCacheAroundMessage(action) {
|
|
|
21045
21068
|
return JSON.stringify(existing) !== JSON.stringify(loaded);
|
|
21046
21069
|
});
|
|
21047
21070
|
if (!(changed.length > 0)) {
|
|
21048
|
-
_context63.n =
|
|
21071
|
+
_context63.n = 15;
|
|
21049
21072
|
break;
|
|
21050
21073
|
}
|
|
21051
|
-
_context63.n =
|
|
21074
|
+
_context63.n = 15;
|
|
21052
21075
|
return put(patchMessagesAC(changed));
|
|
21053
|
-
case 14:
|
|
21054
|
-
return _context63.a(2);
|
|
21055
21076
|
case 15:
|
|
21077
|
+
return _context63.a(2);
|
|
21078
|
+
case 16:
|
|
21056
21079
|
if (applyVisibleWindow) {
|
|
21057
|
-
_context63.n =
|
|
21080
|
+
_context63.n = 17;
|
|
21058
21081
|
break;
|
|
21059
21082
|
}
|
|
21060
21083
|
return _context63.a(2);
|
|
21061
|
-
case 16:
|
|
21062
|
-
_context63.n = 17;
|
|
21063
|
-
return put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21064
21084
|
case 17:
|
|
21085
|
+
_context63.n = 18;
|
|
21086
|
+
return put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21087
|
+
case 18:
|
|
21065
21088
|
filteredPendingMessages = getFilteredPendingMessages(channelId, loadedMessages);
|
|
21066
21089
|
if (!(filteredPendingMessages.length > 0)) {
|
|
21067
|
-
_context63.n =
|
|
21090
|
+
_context63.n = 20;
|
|
21068
21091
|
break;
|
|
21069
21092
|
}
|
|
21070
|
-
_context63.n = 18;
|
|
21071
|
-
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21072
|
-
case 18:
|
|
21073
21093
|
_context63.n = 19;
|
|
21074
|
-
return
|
|
21094
|
+
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21075
21095
|
case 19:
|
|
21076
|
-
_context63.n =
|
|
21077
|
-
|
|
21096
|
+
_context63.n = 20;
|
|
21097
|
+
return call(loadOGMetadataForLinkMessages, filteredPendingMessages, true);
|
|
21078
21098
|
case 20:
|
|
21079
|
-
_context63.
|
|
21099
|
+
_context63.n = 22;
|
|
21100
|
+
break;
|
|
21101
|
+
case 21:
|
|
21102
|
+
_context63.p = 21;
|
|
21080
21103
|
_t55 = _context63.v;
|
|
21081
21104
|
log.error('error in refreshCacheAroundMessage', _t55);
|
|
21082
|
-
case
|
|
21105
|
+
case 22:
|
|
21083
21106
|
return _context63.a(2);
|
|
21084
21107
|
}
|
|
21085
|
-
}, _marked57, null, [[0,
|
|
21108
|
+
}, _marked57, null, [[0, 21]]);
|
|
21086
21109
|
}
|
|
21087
21110
|
function MessageSaga() {
|
|
21088
21111
|
return _regenerator().w(function (_context64) {
|
|
@@ -21975,6 +21998,42 @@ var MessageStatusIcon = function MessageStatusIcon(_ref) {
|
|
|
21975
21998
|
});
|
|
21976
21999
|
}
|
|
21977
22000
|
};
|
|
22001
|
+
function extractUrlMatches(text) {
|
|
22002
|
+
var results = [];
|
|
22003
|
+
var protocolRegex = /https?:\/\/\S+/g;
|
|
22004
|
+
var m;
|
|
22005
|
+
while ((m = protocolRegex.exec(text)) !== null) {
|
|
22006
|
+
results.push({
|
|
22007
|
+
text: m[0],
|
|
22008
|
+
url: m[0],
|
|
22009
|
+
index: m.index
|
|
22010
|
+
});
|
|
22011
|
+
}
|
|
22012
|
+
var linkifyResults = new LinkifyIt().match(text);
|
|
22013
|
+
if (linkifyResults) {
|
|
22014
|
+
for (var _iterator = _createForOfIteratorHelperLoose(linkifyResults), _step; !(_step = _iterator()).done;) {
|
|
22015
|
+
var lm = _step.value;
|
|
22016
|
+
if (lm.schema === '') {
|
|
22017
|
+
results.push({
|
|
22018
|
+
text: lm.text,
|
|
22019
|
+
url: lm.url.replace(/^http:\/\//, 'https://'),
|
|
22020
|
+
index: lm.index
|
|
22021
|
+
});
|
|
22022
|
+
}
|
|
22023
|
+
}
|
|
22024
|
+
}
|
|
22025
|
+
results.sort(function (a, b) {
|
|
22026
|
+
return a.index - b.index;
|
|
22027
|
+
});
|
|
22028
|
+
return results.length > 0 ? results.map(function (_ref2) {
|
|
22029
|
+
var text = _ref2.text,
|
|
22030
|
+
url = _ref2.url;
|
|
22031
|
+
return {
|
|
22032
|
+
text: text,
|
|
22033
|
+
url: url
|
|
22034
|
+
};
|
|
22035
|
+
}) : null;
|
|
22036
|
+
}
|
|
21978
22037
|
var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInviteLink, onInviteLinkClick) {
|
|
21979
22038
|
if (target === void 0) {
|
|
21980
22039
|
target = '_blank';
|
|
@@ -22023,26 +22082,25 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
|
|
|
22023
22082
|
});
|
|
22024
22083
|
return newMessageText || textPart;
|
|
22025
22084
|
};
|
|
22026
|
-
var MessageTextFormat = function MessageTextFormat(
|
|
22027
|
-
var text =
|
|
22028
|
-
message =
|
|
22029
|
-
contactsMap =
|
|
22030
|
-
getFromContacts =
|
|
22031
|
-
isLastMessage =
|
|
22032
|
-
asSampleText =
|
|
22033
|
-
accentColor =
|
|
22034
|
-
textSecondary =
|
|
22035
|
-
onMentionNameClick =
|
|
22036
|
-
shouldOpenUserProfileForMention =
|
|
22037
|
-
unsupportedMessage =
|
|
22038
|
-
|
|
22039
|
-
target =
|
|
22040
|
-
|
|
22041
|
-
isInviteLink =
|
|
22042
|
-
onInviteLinkClick =
|
|
22085
|
+
var MessageTextFormat = function MessageTextFormat(_ref3) {
|
|
22086
|
+
var text = _ref3.text,
|
|
22087
|
+
message = _ref3.message,
|
|
22088
|
+
contactsMap = _ref3.contactsMap,
|
|
22089
|
+
getFromContacts = _ref3.getFromContacts,
|
|
22090
|
+
isLastMessage = _ref3.isLastMessage,
|
|
22091
|
+
asSampleText = _ref3.asSampleText,
|
|
22092
|
+
accentColor = _ref3.accentColor,
|
|
22093
|
+
textSecondary = _ref3.textSecondary,
|
|
22094
|
+
onMentionNameClick = _ref3.onMentionNameClick,
|
|
22095
|
+
shouldOpenUserProfileForMention = _ref3.shouldOpenUserProfileForMention,
|
|
22096
|
+
unsupportedMessage = _ref3.unsupportedMessage,
|
|
22097
|
+
_ref3$target = _ref3.target,
|
|
22098
|
+
target = _ref3$target === void 0 ? '_blank' : _ref3$target,
|
|
22099
|
+
_ref3$isInviteLink = _ref3.isInviteLink,
|
|
22100
|
+
isInviteLink = _ref3$isInviteLink === void 0 ? false : _ref3$isInviteLink,
|
|
22101
|
+
onInviteLinkClick = _ref3.onInviteLinkClick;
|
|
22043
22102
|
try {
|
|
22044
22103
|
var messageText = [];
|
|
22045
|
-
var linkify = new LinkifyIt();
|
|
22046
22104
|
var messageBodyAttributes = message.bodyAttributes && JSON.parse(JSON.stringify(message.bodyAttributes));
|
|
22047
22105
|
if (unsupportedMessage) {
|
|
22048
22106
|
return 'This message is not supported. Update your app to view this message.';
|
|
@@ -22055,12 +22113,12 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22055
22113
|
var attributeOffset = attribute.offset;
|
|
22056
22114
|
try {
|
|
22057
22115
|
var firstPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(nextPartIndex || 0, attributeOffset) : '');
|
|
22058
|
-
var firstPartMatch = firstPart ?
|
|
22116
|
+
var firstPartMatch = firstPart ? extractUrlMatches(firstPart) : null;
|
|
22059
22117
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
22060
22118
|
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22061
22119
|
}
|
|
22062
22120
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
22063
|
-
var secondPartMatch = secondPart ?
|
|
22121
|
+
var secondPartMatch = secondPart ? extractUrlMatches(secondPart) : null;
|
|
22064
22122
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
22065
22123
|
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22066
22124
|
}
|
|
@@ -22120,7 +22178,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22120
22178
|
} else {
|
|
22121
22179
|
nextPartIndex = attributeOffset + attribute.length;
|
|
22122
22180
|
var _textPart = "" + text.slice(attributeOffset, attributeOffset + attribute.length);
|
|
22123
|
-
var match =
|
|
22181
|
+
var match = extractUrlMatches(_textPart);
|
|
22124
22182
|
var newTextPart = _textPart;
|
|
22125
22183
|
if (!isLastMessage && !asSampleText && match) {
|
|
22126
22184
|
newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
|
|
@@ -22137,7 +22195,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22137
22195
|
}
|
|
22138
22196
|
});
|
|
22139
22197
|
} else {
|
|
22140
|
-
var match =
|
|
22198
|
+
var match = extractUrlMatches(text);
|
|
22141
22199
|
if (!isLastMessage && !asSampleText && match) {
|
|
22142
22200
|
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
22143
22201
|
}
|
|
@@ -44138,6 +44196,7 @@ function useChatController(_ref5) {
|
|
|
44138
44196
|
var viewIsAtLatestRef = useRef(true);
|
|
44139
44197
|
var jumpLockUntilRef = useRef(0);
|
|
44140
44198
|
var jumpLockModeRef = useRef(null);
|
|
44199
|
+
var jumpLockHighWaterMarkRef = useRef(0);
|
|
44141
44200
|
var jumpUnlockTimeoutRef = useRef(null);
|
|
44142
44201
|
var isJumping = useRef(false);
|
|
44143
44202
|
var currentJumpIdRef = useRef(0);
|
|
@@ -44344,6 +44403,7 @@ function useChatController(_ref5) {
|
|
|
44344
44403
|
var clearJumpScrollingLock = useCallback(function () {
|
|
44345
44404
|
jumpLockUntilRef.current = 0;
|
|
44346
44405
|
jumpLockModeRef.current = null;
|
|
44406
|
+
jumpLockHighWaterMarkRef.current = 0;
|
|
44347
44407
|
historyLoadArmedRef.current = true;
|
|
44348
44408
|
latestLoadArmedRef.current = true;
|
|
44349
44409
|
if (historyArmTimerRef.current !== null) {
|
|
@@ -44361,9 +44421,11 @@ function useChatController(_ref5) {
|
|
|
44361
44421
|
isJumping.current = false;
|
|
44362
44422
|
}, []);
|
|
44363
44423
|
var lockJumpScrolling = useCallback(function (smooth, mode) {
|
|
44424
|
+
var _scrollRef$current$sc, _scrollRef$current;
|
|
44364
44425
|
var lockDuration = smooth ? JUMP_SCROLL_LOCK_MS : 250;
|
|
44365
44426
|
jumpLockUntilRef.current = Date.now() + lockDuration;
|
|
44366
44427
|
jumpLockModeRef.current = mode;
|
|
44428
|
+
jumpLockHighWaterMarkRef.current = (_scrollRef$current$sc = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop) != null ? _scrollRef$current$sc : 0;
|
|
44367
44429
|
if (jumpUnlockTimeoutRef.current !== null) {
|
|
44368
44430
|
clearTimeout(jumpUnlockTimeoutRef.current);
|
|
44369
44431
|
}
|
|
@@ -44652,6 +44714,7 @@ function useChatController(_ref5) {
|
|
|
44652
44714
|
restoreRef.current = null;
|
|
44653
44715
|
pendingNewestCountRef.current = 0;
|
|
44654
44716
|
setPendingNewestCount(0);
|
|
44717
|
+
unreadRestoreCompletedRef.current = true;
|
|
44655
44718
|
var container = scrollRef.current;
|
|
44656
44719
|
var currentChannelId = (_channelRef$current = channelRef.current) === null || _channelRef$current === void 0 ? void 0 : _channelRef$current.id;
|
|
44657
44720
|
var pendingLatestServerSync = ((_pendingLatestJumpRef = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef === void 0 ? void 0 : _pendingLatestJumpRef.channelId) === currentChannelId && ((_pendingLatestJumpRef2 = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef2 === void 0 ? void 0 : _pendingLatestJumpRef2.needsServerSync);
|
|
@@ -45126,7 +45189,8 @@ function useChatController(_ref5) {
|
|
|
45126
45189
|
if (isJumping.current) {
|
|
45127
45190
|
return;
|
|
45128
45191
|
}
|
|
45129
|
-
|
|
45192
|
+
var jumpLockActive = Date.now() < jumpLockUntilRef.current;
|
|
45193
|
+
if (!jumpLockActive && currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
|
|
45130
45194
|
currentScrollTop = historyEdgeScrollTop;
|
|
45131
45195
|
}
|
|
45132
45196
|
if (currentScrollTop !== container.scrollTop) {
|
|
@@ -45134,9 +45198,14 @@ function useChatController(_ref5) {
|
|
|
45134
45198
|
}
|
|
45135
45199
|
var distanceFromLatest = latestEdgeScrollTop - currentScrollTop;
|
|
45136
45200
|
lastMeasuredLatestEdgeRef.current = latestEdgeScrollTop;
|
|
45137
|
-
if (
|
|
45201
|
+
if (jumpLockActive) {
|
|
45202
|
+
jumpLockHighWaterMarkRef.current = Math.max(jumpLockHighWaterMarkRef.current, currentScrollTop);
|
|
45138
45203
|
if (jumpLockModeRef.current === 'latest' && distanceFromLatest > PRELOAD_RESET_PX) {
|
|
45139
|
-
|
|
45204
|
+
if (currentScrollTop < jumpLockHighWaterMarkRef.current - PRELOAD_RESET_PX) {
|
|
45205
|
+
clearJumpScrollingLock();
|
|
45206
|
+
} else {
|
|
45207
|
+
return;
|
|
45208
|
+
}
|
|
45140
45209
|
} else {
|
|
45141
45210
|
return;
|
|
45142
45211
|
}
|
|
@@ -45385,12 +45454,12 @@ function useChatController(_ref5) {
|
|
|
45385
45454
|
}, [channel.id, clearScrollIdleTimer, dispatch]);
|
|
45386
45455
|
var departingChannelId = activeChannelIdRef.current;
|
|
45387
45456
|
if (departingChannelId) {
|
|
45388
|
-
var _scrollRef$current$
|
|
45457
|
+
var _scrollRef$current$sc2, _scrollRef$current2;
|
|
45389
45458
|
var currentMessages = messagesRef.current;
|
|
45390
45459
|
var startId = getFirstConfirmedMessageId(currentMessages);
|
|
45391
45460
|
var endId = getLastConfirmedMessageId(currentMessages);
|
|
45392
45461
|
var anchorId = lastVisibleAnchorIdRef.current;
|
|
45393
|
-
var scrollTop = (_scrollRef$current$
|
|
45462
|
+
var scrollTop = (_scrollRef$current$sc2 = (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollTop) != null ? _scrollRef$current$sc2 : 0;
|
|
45394
45463
|
if (startId && endId && anchorId) {
|
|
45395
45464
|
var confirmedMessages = currentMessages.filter(function (m) {
|
|
45396
45465
|
return !!m.id;
|
|
@@ -45512,6 +45581,7 @@ function useChatController(_ref5) {
|
|
|
45512
45581
|
restoreRef.current = null;
|
|
45513
45582
|
viewIsAtLatestRef.current = true;
|
|
45514
45583
|
setIsViewingLatest(true);
|
|
45584
|
+
lockJumpScrolling(true, 'latest');
|
|
45515
45585
|
scrollToLatestEdge(container, 'smooth');
|
|
45516
45586
|
rememberLatestEdge();
|
|
45517
45587
|
return;
|
|
@@ -45572,7 +45642,7 @@ function useChatController(_ref5) {
|
|
|
45572
45642
|
}
|
|
45573
45643
|
rememberLatestEdge();
|
|
45574
45644
|
}
|
|
45575
|
-
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive]);
|
|
45645
|
+
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive, lockJumpScrolling]);
|
|
45576
45646
|
useEffect(function () {
|
|
45577
45647
|
if (!unreadScrollTo || !unreadMessageId || !messages.length || unreadRestoreCompletedRef.current) {
|
|
45578
45648
|
return;
|
|
@@ -45821,16 +45891,6 @@ function useChatController(_ref5) {
|
|
|
45821
45891
|
return m.sortKey === latestLocalRef || m.localRef === latestLocalRef;
|
|
45822
45892
|
});
|
|
45823
45893
|
var shouldShow = !isLatestInView || !isViewingLatest && (pendingNewestCount > 0 || !!scrollToMentionedMessage);
|
|
45824
|
-
console.log('[scrollToNewMsg]', {
|
|
45825
|
-
latestLocalRef: latestLocalRef,
|
|
45826
|
-
isLatestInView: !!isLatestInView,
|
|
45827
|
-
isViewingLatest: isViewingLatest,
|
|
45828
|
-
pendingNewestCount: pendingNewestCount,
|
|
45829
|
-
scrollToMentionedMessage: scrollToMentionedMessage,
|
|
45830
|
-
shouldShow: shouldShow,
|
|
45831
|
-
showScrollToNewMessageButton: showScrollToNewMessageButton,
|
|
45832
|
-
latestVisibleMessages: latestVisibleMessages
|
|
45833
|
-
});
|
|
45834
45894
|
if (showScrollToNewMessageButton !== shouldShow) {
|
|
45835
45895
|
dispatch(showScrollToNewMessageButtonAC(shouldShow));
|
|
45836
45896
|
}
|
|
@@ -50737,10 +50797,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50737
50797
|
editorState.read(function () {
|
|
50738
50798
|
var root = $getRoot();
|
|
50739
50799
|
var textContent = root.getTextContent();
|
|
50740
|
-
var
|
|
50741
|
-
|
|
50742
|
-
|
|
50743
|
-
|
|
50800
|
+
var protocolMatch = /https?:\/\/\S+/.exec(textContent);
|
|
50801
|
+
var linkifyMatchResult = !protocolMatch ? linkify.match(textContent) : null;
|
|
50802
|
+
var firstUrl = protocolMatch ? protocolMatch[0] : linkifyMatchResult !== null && linkifyMatchResult !== void 0 && linkifyMatchResult[0] ? linkifyMatchResult[0].schema === '' ? linkifyMatchResult[0].url.replace(/^http:\/\//, 'https://') : linkifyMatchResult[0].url : null;
|
|
50803
|
+
if (firstUrl) {
|
|
50744
50804
|
if (firstUrl !== detectedUrl) {
|
|
50745
50805
|
closePreviewWithAnimation(function () {
|
|
50746
50806
|
if (!dismissedUrls.has(firstUrl)) {
|
|
@@ -50900,11 +50960,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50900
50960
|
}
|
|
50901
50961
|
var linkAttachment;
|
|
50902
50962
|
if (messageTexToSend) {
|
|
50903
|
-
var
|
|
50904
|
-
var
|
|
50905
|
-
|
|
50906
|
-
|
|
50907
|
-
|
|
50963
|
+
var _LinkifyIt$match;
|
|
50964
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
50965
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
50966
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
50967
|
+
if (url) {
|
|
50908
50968
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
50909
50969
|
var metadata = {};
|
|
50910
50970
|
if (urlMetadata) {
|
|
@@ -51019,11 +51079,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
51019
51079
|
if (messageTexToSend) {
|
|
51020
51080
|
var linkAttachment;
|
|
51021
51081
|
if (messageTexToSend) {
|
|
51022
|
-
var
|
|
51023
|
-
var
|
|
51024
|
-
|
|
51025
|
-
|
|
51026
|
-
|
|
51082
|
+
var _LinkifyIt$match2;
|
|
51083
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
51084
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match2 = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match2 === void 0 ? void 0 : _LinkifyIt$match2[0] : null;
|
|
51085
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
51086
|
+
if (url) {
|
|
51027
51087
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
51028
51088
|
var metadata = {};
|
|
51029
51089
|
if (urlMetadata) {
|
|
@@ -57978,5 +58038,5 @@ var unBlockUsers = function unBlockUsers(userIds, callback) {
|
|
|
57978
58038
|
});
|
|
57979
58039
|
};
|
|
57980
58040
|
|
|
57981
|
-
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, ForwardMessagePopup, FrequentlyEmojis, MESSAGE_TYPE, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, MessagesSearch, OGMetadata, PollMessage, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, blockUsers, createOrGetDirectChannel, handleGetMessage, handleSendMessage, switchChannelActiveChannel, unBlockUsers };
|
|
58041
|
+
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, ForwardMessagePopup, FrequentlyEmojis, MESSAGE_TYPE, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, MessagesSearch, OGMetadata, PollMessage, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, blockUsers, createOrGetDirectChannel, extractUrlMatches, handleGetMessage, handleSendMessage, switchChannelActiveChannel, unBlockUsers };
|
|
57982
58042
|
//# sourceMappingURL=index.modern.js.map
|
package/messageUtils/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ declare const MessageStatusIcon: ({ messageStatus, messageStatusDisplayingType,
|
|
|
8
8
|
readIconColor?: string | undefined;
|
|
9
9
|
accentColor?: string | undefined;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
|
+
declare function extractUrlMatches(text: string): Array<{
|
|
12
|
+
text: string;
|
|
13
|
+
url: string;
|
|
14
|
+
}> | null;
|
|
11
15
|
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary, onMentionNameClick, shouldOpenUserProfileForMention, unsupportedMessage, target, isInviteLink, onInviteLinkClick }: {
|
|
12
16
|
text: string;
|
|
13
17
|
message: any;
|
|
@@ -24,4 +28,4 @@ declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts,
|
|
|
24
28
|
isInviteLink?: boolean | undefined;
|
|
25
29
|
onInviteLinkClick?: ((key: string) => void) | undefined;
|
|
26
30
|
}) => any;
|
|
27
|
-
export { MessageStatusIcon, MessageTextFormat };
|
|
31
|
+
export { MessageStatusIcon, MessageTextFormat, extractUrlMatches };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|