sceyt-chat-react-uikit 1.6.9-beta.17 → 1.6.9-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/components/ChannelList/index.d.ts +1 -0
- package/index.js +164 -73
- package/index.modern.js +164 -73
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ interface IChannelListProps {
|
|
|
29
29
|
searchInputTextColor?: string;
|
|
30
30
|
searchChannelsPosition?: 'inline' | 'bottom';
|
|
31
31
|
searchInputBorderRadius?: string;
|
|
32
|
+
searchChannelsPadding?: string;
|
|
32
33
|
getSelectedChannel?: (channel: IChannel) => void;
|
|
33
34
|
filter?: {
|
|
34
35
|
channelType?: string;
|
package/index.js
CHANGED
|
@@ -10075,18 +10075,29 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
10075
10075
|
}
|
|
10076
10076
|
}
|
|
10077
10077
|
}
|
|
10078
|
+
var updatedMessageData = null;
|
|
10078
10079
|
if (messagesMap[channelId]) {
|
|
10079
|
-
messagesMap[channelId]
|
|
10080
|
+
messagesMap[channelId].map(function (mes) {
|
|
10080
10081
|
if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
|
|
10081
10082
|
if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
|
|
10082
|
-
|
|
10083
|
+
updatedMessageData = _extends({}, updatedMessage.params);
|
|
10084
|
+
return updatedMessageData;
|
|
10083
10085
|
} else {
|
|
10084
|
-
|
|
10086
|
+
var _updatedMessage$param;
|
|
10087
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params, {
|
|
10088
|
+
attachments: [].concat(mes.attachments, ((_updatedMessage$param = updatedMessage.params) === null || _updatedMessage$param === void 0 ? void 0 : _updatedMessage$param.attachments) || []).filter(function (att, index, self) {
|
|
10089
|
+
return index === self.findIndex(function (t) {
|
|
10090
|
+
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10091
|
+
});
|
|
10092
|
+
})
|
|
10093
|
+
});
|
|
10094
|
+
return updatedMessage;
|
|
10085
10095
|
}
|
|
10086
10096
|
}
|
|
10087
10097
|
return mes;
|
|
10088
10098
|
});
|
|
10089
10099
|
}
|
|
10100
|
+
return updatedMessageData;
|
|
10090
10101
|
}
|
|
10091
10102
|
function addReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
10092
10103
|
if (messagesMap[channelId]) {
|
|
@@ -10330,7 +10341,6 @@ var messageSlice = createSlice({
|
|
|
10330
10341
|
reducers: {
|
|
10331
10342
|
addMessage: function addMessage(state, action) {
|
|
10332
10343
|
var message = action.payload.message;
|
|
10333
|
-
log.info('addMessage ... ', message);
|
|
10334
10344
|
state.activeChannelMessages.push(message);
|
|
10335
10345
|
},
|
|
10336
10346
|
deleteMessageFromList: function deleteMessageFromList(state, action) {
|
|
@@ -10448,11 +10458,48 @@ var messageSlice = createSlice({
|
|
|
10448
10458
|
state.activeChannelMessages.push(params);
|
|
10449
10459
|
}
|
|
10450
10460
|
},
|
|
10451
|
-
|
|
10461
|
+
updateMessageAttachment: function updateMessageAttachment(state, action) {
|
|
10452
10462
|
var _action$payload4 = action.payload,
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10463
|
+
url = _action$payload4.url,
|
|
10464
|
+
messageId = _action$payload4.messageId,
|
|
10465
|
+
params = _action$payload4.params;
|
|
10466
|
+
state.activeChannelMessages = state.activeChannelMessages.map(function (message) {
|
|
10467
|
+
if (message.id === messageId) {
|
|
10468
|
+
for (var index = 0; index < message.attachments.length; index++) {
|
|
10469
|
+
var attachment = message.attachments[index];
|
|
10470
|
+
if (attachment.url === url) {
|
|
10471
|
+
message.attachments[index] = _extends({}, attachment, params);
|
|
10472
|
+
}
|
|
10473
|
+
}
|
|
10474
|
+
}
|
|
10475
|
+
if (message.attachments.length) {
|
|
10476
|
+
var detachedAttachments = message.attachments.map(function (att) {
|
|
10477
|
+
var _att$user, _att$user2;
|
|
10478
|
+
return _extends({}, att, {
|
|
10479
|
+
user: _extends({}, att.user, {
|
|
10480
|
+
metadata: _extends({}, ((_att$user = att.user) === null || _att$user === void 0 ? void 0 : _att$user.metadata) || {}),
|
|
10481
|
+
presence: _extends({}, ((_att$user2 = att.user) === null || _att$user2 === void 0 ? void 0 : _att$user2.presence) || {})
|
|
10482
|
+
})
|
|
10483
|
+
});
|
|
10484
|
+
});
|
|
10485
|
+
updateMessageOnAllMessages(messageId, {
|
|
10486
|
+
attachments: detachedAttachments
|
|
10487
|
+
});
|
|
10488
|
+
updateMessageOnMap(message.channelId, {
|
|
10489
|
+
messageId: messageId,
|
|
10490
|
+
params: {
|
|
10491
|
+
attachments: detachedAttachments
|
|
10492
|
+
}
|
|
10493
|
+
});
|
|
10494
|
+
}
|
|
10495
|
+
return message;
|
|
10496
|
+
});
|
|
10497
|
+
},
|
|
10498
|
+
addReactionToMessage: function addReactionToMessage(state, action) {
|
|
10499
|
+
var _action$payload5 = action.payload,
|
|
10500
|
+
message = _action$payload5.message,
|
|
10501
|
+
reaction = _action$payload5.reaction,
|
|
10502
|
+
isSelf = _action$payload5.isSelf;
|
|
10456
10503
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
10457
10504
|
if (msg.id === message.id) {
|
|
10458
10505
|
var slfReactions = [].concat(msg.userReactions);
|
|
@@ -10472,10 +10519,10 @@ var messageSlice = createSlice({
|
|
|
10472
10519
|
});
|
|
10473
10520
|
},
|
|
10474
10521
|
deleteReactionFromMessage: function deleteReactionFromMessage(state, action) {
|
|
10475
|
-
var _action$
|
|
10476
|
-
reaction = _action$
|
|
10477
|
-
message = _action$
|
|
10478
|
-
isSelf = _action$
|
|
10522
|
+
var _action$payload6 = action.payload,
|
|
10523
|
+
reaction = _action$payload6.reaction,
|
|
10524
|
+
message = _action$payload6.message,
|
|
10525
|
+
isSelf = _action$payload6.isSelf;
|
|
10479
10526
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
10480
10527
|
if (msg.id === message.id) {
|
|
10481
10528
|
var userReactions = msg.userReactions;
|
|
@@ -10524,9 +10571,9 @@ var messageSlice = createSlice({
|
|
|
10524
10571
|
(_state$activeTabAttac = state.activeTabAttachments).push.apply(_state$activeTabAttac, action.payload.attachments);
|
|
10525
10572
|
},
|
|
10526
10573
|
addAttachmentsForPopup: function addAttachmentsForPopup(state, action) {
|
|
10527
|
-
var _action$
|
|
10528
|
-
attachments = _action$
|
|
10529
|
-
direction = _action$
|
|
10574
|
+
var _action$payload7 = action.payload,
|
|
10575
|
+
attachments = _action$payload7.attachments,
|
|
10576
|
+
direction = _action$payload7.direction;
|
|
10530
10577
|
if (direction === 'prev') {
|
|
10531
10578
|
var _state$attachmentsFor;
|
|
10532
10579
|
(_state$attachmentsFor = state.attachmentsForPopup).push.apply(_state$attachmentsFor, attachments);
|
|
@@ -10542,11 +10589,11 @@ var messageSlice = createSlice({
|
|
|
10542
10589
|
state.attachmentForPopupHasNext = action.payload.hasPrev;
|
|
10543
10590
|
},
|
|
10544
10591
|
updateUploadProgress: function updateUploadProgress(state, action) {
|
|
10545
|
-
var _action$
|
|
10546
|
-
uploaded = _action$
|
|
10547
|
-
total = _action$
|
|
10548
|
-
attachmentId = _action$
|
|
10549
|
-
progress = _action$
|
|
10592
|
+
var _action$payload8 = action.payload,
|
|
10593
|
+
uploaded = _action$payload8.uploaded,
|
|
10594
|
+
total = _action$payload8.total,
|
|
10595
|
+
attachmentId = _action$payload8.attachmentId,
|
|
10596
|
+
progress = _action$payload8.progress;
|
|
10550
10597
|
var updateData = {
|
|
10551
10598
|
uploaded: uploaded,
|
|
10552
10599
|
total: total,
|
|
@@ -10570,23 +10617,23 @@ var messageSlice = createSlice({
|
|
|
10570
10617
|
state.messageForReply = action.payload.message;
|
|
10571
10618
|
},
|
|
10572
10619
|
uploadAttachmentCompilation: function uploadAttachmentCompilation(state, action) {
|
|
10573
|
-
var _action$
|
|
10574
|
-
attachmentUploadingState = _action$
|
|
10575
|
-
attachmentId = _action$
|
|
10620
|
+
var _action$payload9 = action.payload,
|
|
10621
|
+
attachmentUploadingState = _action$payload9.attachmentUploadingState,
|
|
10622
|
+
attachmentId = _action$payload9.attachmentId;
|
|
10576
10623
|
state.attachmentsUploadingState[attachmentId] = attachmentUploadingState;
|
|
10577
10624
|
},
|
|
10578
10625
|
setReactionsList: function setReactionsList(state, action) {
|
|
10579
|
-
var _action$
|
|
10580
|
-
reactions = _action$
|
|
10581
|
-
hasNext = _action$
|
|
10626
|
+
var _action$payload0 = action.payload,
|
|
10627
|
+
reactions = _action$payload0.reactions,
|
|
10628
|
+
hasNext = _action$payload0.hasNext;
|
|
10582
10629
|
state.reactionsHasNext = hasNext;
|
|
10583
10630
|
state.reactionsList = [].concat(reactions);
|
|
10584
10631
|
},
|
|
10585
10632
|
addReactionsToList: function addReactionsToList(state, action) {
|
|
10586
10633
|
var _state$reactionsList;
|
|
10587
|
-
var _action$
|
|
10588
|
-
reactions = _action$
|
|
10589
|
-
hasNext = _action$
|
|
10634
|
+
var _action$payload1 = action.payload,
|
|
10635
|
+
reactions = _action$payload1.reactions,
|
|
10636
|
+
hasNext = _action$payload1.hasNext;
|
|
10590
10637
|
state.reactionsHasNext = hasNext;
|
|
10591
10638
|
(_state$reactionsList = state.reactionsList).push.apply(_state$reactionsList, reactions);
|
|
10592
10639
|
},
|
|
@@ -10647,6 +10694,7 @@ var _messageSlice$actions = messageSlice.actions,
|
|
|
10647
10694
|
addMessages = _messageSlice$actions.addMessages,
|
|
10648
10695
|
updateMessagesStatus = _messageSlice$actions.updateMessagesStatus,
|
|
10649
10696
|
updateMessage = _messageSlice$actions.updateMessage,
|
|
10697
|
+
updateMessageAttachment = _messageSlice$actions.updateMessageAttachment,
|
|
10650
10698
|
addReactionToMessage = _messageSlice$actions.addReactionToMessage,
|
|
10651
10699
|
deleteReactionFromMessage = _messageSlice$actions.deleteReactionFromMessage,
|
|
10652
10700
|
setHasPrevMessages = _messageSlice$actions.setHasPrevMessages,
|
|
@@ -11738,6 +11786,13 @@ function setMessagesHasNextAC(hasNext) {
|
|
|
11738
11786
|
hasNext: hasNext
|
|
11739
11787
|
});
|
|
11740
11788
|
}
|
|
11789
|
+
function setUpdateMessageAttachmentAC(url, messageId, params) {
|
|
11790
|
+
return updateMessageAttachment({
|
|
11791
|
+
url: url,
|
|
11792
|
+
messageId: messageId,
|
|
11793
|
+
params: params
|
|
11794
|
+
});
|
|
11795
|
+
}
|
|
11741
11796
|
function updateMessageAC(messageId, params, addIfNotExists) {
|
|
11742
11797
|
return updateMessage({
|
|
11743
11798
|
messageId: messageId,
|
|
@@ -17153,12 +17208,6 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
17153
17208
|
addMessageToMap(channel.id, messageToAdd);
|
|
17154
17209
|
addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
17155
17210
|
setPendingMessages(channel.id, [messageToAdd]);
|
|
17156
|
-
var hasNextMessages = store.getState().MessageReducer.messagesHasNext;
|
|
17157
|
-
var activeChannelMessages = store.getState().MessageReducer.activeChannelMessages;
|
|
17158
|
-
var isLatestMessageInChannelMessages = activeChannelMessages[activeChannelMessages.length - 1].id === channel.lastMessage.id;
|
|
17159
|
-
if (hasNextMessages || !isLatestMessageInChannelMessages) {
|
|
17160
|
-
store.dispatch(getMessagesAC(channel, true, channel.lastMessage.id, undefined, undefined, false));
|
|
17161
|
-
}
|
|
17162
17211
|
store.dispatch(scrollToNewMessageAC(true));
|
|
17163
17212
|
store.dispatch(addMessageAC(messageToAdd));
|
|
17164
17213
|
return Promise.resolve();
|
|
@@ -18332,7 +18381,7 @@ function editMessage(action) {
|
|
|
18332
18381
|
}, _marked6$1, null, [[0, 5]]);
|
|
18333
18382
|
}
|
|
18334
18383
|
function getMessagesQuery(action) {
|
|
18335
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, pendingMessages, _messagesMap, filteredPendingMessages, index, mes, _t9;
|
|
18384
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, pendingMessages, _messagesMap, filteredPendingMessages, index, mes, _t9;
|
|
18336
18385
|
return _regenerator().w(function (_context9) {
|
|
18337
18386
|
while (1) switch (_context9.p = _context9.n) {
|
|
18338
18387
|
case 0:
|
|
@@ -18342,7 +18391,7 @@ function getMessagesQuery(action) {
|
|
|
18342
18391
|
case 1:
|
|
18343
18392
|
_action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight;
|
|
18344
18393
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
18345
|
-
_context9.n =
|
|
18394
|
+
_context9.n = 48;
|
|
18346
18395
|
break;
|
|
18347
18396
|
}
|
|
18348
18397
|
SceytChatClient = getClient();
|
|
@@ -18428,7 +18477,7 @@ function getMessagesQuery(action) {
|
|
|
18428
18477
|
_context9.n = 12;
|
|
18429
18478
|
return effects.put(setScrollToMessagesAC(messageId, highlight));
|
|
18430
18479
|
case 12:
|
|
18431
|
-
_context9.n =
|
|
18480
|
+
_context9.n = 45;
|
|
18432
18481
|
break;
|
|
18433
18482
|
case 13:
|
|
18434
18483
|
if (!messageId) {
|
|
@@ -18494,7 +18543,7 @@ function getMessagesQuery(action) {
|
|
|
18494
18543
|
_context9.n = 24;
|
|
18495
18544
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18496
18545
|
case 24:
|
|
18497
|
-
_context9.n =
|
|
18546
|
+
_context9.n = 45;
|
|
18498
18547
|
break;
|
|
18499
18548
|
case 25:
|
|
18500
18549
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
@@ -18566,7 +18615,7 @@ function getMessagesQuery(action) {
|
|
|
18566
18615
|
_context9.n = 37;
|
|
18567
18616
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
18568
18617
|
case 37:
|
|
18569
|
-
_context9.n =
|
|
18618
|
+
_context9.n = 45;
|
|
18570
18619
|
break;
|
|
18571
18620
|
case 38:
|
|
18572
18621
|
setAllMessages([]);
|
|
@@ -18595,22 +18644,29 @@ function getMessagesQuery(action) {
|
|
|
18595
18644
|
result.messages = [].concat(_secondResult4.messages, result.messages);
|
|
18596
18645
|
result.hasNext = _secondResult4.hasNext;
|
|
18597
18646
|
case 42:
|
|
18647
|
+
updatedMessages = [];
|
|
18598
18648
|
result.messages.forEach(function (msg) {
|
|
18599
|
-
updateMessageOnMap(channel.id, {
|
|
18649
|
+
var updatedMessage = updateMessageOnMap(channel.id, {
|
|
18600
18650
|
messageId: msg.id,
|
|
18601
18651
|
params: msg
|
|
18602
18652
|
});
|
|
18603
|
-
updateMessageOnAllMessages(msg.id, msg);
|
|
18653
|
+
updateMessageOnAllMessages(msg.id, updatedMessage || msg);
|
|
18654
|
+
updatedMessages.push(updatedMessage || msg);
|
|
18604
18655
|
});
|
|
18656
|
+
setMessagesToMap(channel.id, updatedMessages);
|
|
18657
|
+
setAllMessages([].concat(updatedMessages));
|
|
18605
18658
|
_context9.n = 43;
|
|
18606
|
-
return effects.put(
|
|
18659
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
18607
18660
|
case 43:
|
|
18608
18661
|
_context9.n = 44;
|
|
18609
|
-
return effects.put(
|
|
18662
|
+
return effects.put(setMessagesHasPrevAC(result.hasNext));
|
|
18610
18663
|
case 44:
|
|
18664
|
+
_context9.n = 45;
|
|
18665
|
+
return effects.put(setMessagesHasNextAC(false));
|
|
18666
|
+
case 45:
|
|
18611
18667
|
pendingMessages = getPendingMessages(channel.id);
|
|
18612
18668
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
18613
|
-
_context9.n =
|
|
18669
|
+
_context9.n = 47;
|
|
18614
18670
|
break;
|
|
18615
18671
|
}
|
|
18616
18672
|
_messagesMap = {};
|
|
@@ -18620,40 +18676,40 @@ function getMessagesQuery(action) {
|
|
|
18620
18676
|
filteredPendingMessages = pendingMessages.filter(function (msg) {
|
|
18621
18677
|
return !_messagesMap[msg.tid || ''];
|
|
18622
18678
|
});
|
|
18623
|
-
_context9.n =
|
|
18679
|
+
_context9.n = 46;
|
|
18624
18680
|
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
18625
|
-
case
|
|
18681
|
+
case 46:
|
|
18626
18682
|
for (index = 0; index < filteredPendingMessages.length; index++) {
|
|
18627
18683
|
mes = filteredPendingMessages[index];
|
|
18628
18684
|
removePendingMessageFromMap(channel === null || channel === void 0 ? void 0 : channel.id, mes.tid || mes.id);
|
|
18629
18685
|
}
|
|
18630
|
-
case 46:
|
|
18631
|
-
_context9.n = 48;
|
|
18632
|
-
break;
|
|
18633
18686
|
case 47:
|
|
18687
|
+
_context9.n = 49;
|
|
18688
|
+
break;
|
|
18689
|
+
case 48:
|
|
18634
18690
|
if (!channel.isMockChannel) {
|
|
18635
|
-
_context9.n =
|
|
18691
|
+
_context9.n = 49;
|
|
18636
18692
|
break;
|
|
18637
18693
|
}
|
|
18638
|
-
_context9.n =
|
|
18694
|
+
_context9.n = 49;
|
|
18639
18695
|
return effects.put(setMessagesAC([]));
|
|
18640
|
-
case 48:
|
|
18641
|
-
_context9.n = 50;
|
|
18642
|
-
break;
|
|
18643
18696
|
case 49:
|
|
18644
|
-
_context9.
|
|
18645
|
-
|
|
18646
|
-
log.error('error in message query', _t9);
|
|
18697
|
+
_context9.n = 51;
|
|
18698
|
+
break;
|
|
18647
18699
|
case 50:
|
|
18648
18700
|
_context9.p = 50;
|
|
18649
|
-
|
|
18650
|
-
|
|
18701
|
+
_t9 = _context9.v;
|
|
18702
|
+
log.error('error in message query', _t9);
|
|
18651
18703
|
case 51:
|
|
18652
|
-
|
|
18704
|
+
_context9.p = 51;
|
|
18705
|
+
_context9.n = 52;
|
|
18706
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18653
18707
|
case 52:
|
|
18708
|
+
return _context9.f(51);
|
|
18709
|
+
case 53:
|
|
18654
18710
|
return _context9.a(2);
|
|
18655
18711
|
}
|
|
18656
|
-
}, _marked7$1, null, [[0,
|
|
18712
|
+
}, _marked7$1, null, [[0, 50, 51, 53]]);
|
|
18657
18713
|
}
|
|
18658
18714
|
function loadMoreMessages(action) {
|
|
18659
18715
|
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t0;
|
|
@@ -23129,7 +23185,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23129
23185
|
channelAvatarSize = _ref.channelAvatarSize,
|
|
23130
23186
|
channelAvatarTextSize = _ref.channelAvatarTextSize,
|
|
23131
23187
|
searchChannelInputFontSize = _ref.searchChannelInputFontSize,
|
|
23132
|
-
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize
|
|
23188
|
+
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize,
|
|
23189
|
+
searchChannelsPadding = _ref.searchChannelsPadding;
|
|
23133
23190
|
var _useColor = useColors(),
|
|
23134
23191
|
background = _useColor[THEME_COLORS.BACKGROUND],
|
|
23135
23192
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -23366,7 +23423,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23366
23423
|
}, /*#__PURE__*/React__default.createElement(ChannelListHeader, {
|
|
23367
23424
|
withCustomList: !!List,
|
|
23368
23425
|
maxWidth: channelListRef.current && ((_channelListRef$curre2 = channelListRef.current) === null || _channelListRef$curre2 === void 0 ? void 0 : _channelListRef$curre2.clientWidth) || 0,
|
|
23369
|
-
borderColor: borderColor
|
|
23426
|
+
borderColor: borderColor,
|
|
23427
|
+
padding: searchChannelsPadding
|
|
23370
23428
|
}, Profile, showSearch && searchChannelsPosition === 'inline' ? (/*#__PURE__*/React__default.createElement(ChannelSearch, {
|
|
23371
23429
|
inline: true,
|
|
23372
23430
|
borderRadius: searchInputBorderRadius,
|
|
@@ -23689,8 +23747,10 @@ var NoData = styled__default.div(_templateObject8$4 || (_templateObject8$4 = _ta
|
|
|
23689
23747
|
return props.color;
|
|
23690
23748
|
});
|
|
23691
23749
|
var LoadingWrapper = styled__default.div(_templateObject9$4 || (_templateObject9$4 = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: calc(50% - 20px);\n top: calc(50% - 20px);\n"])));
|
|
23692
|
-
var ChannelListHeader = styled__default.div(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n max-width: ", ";\n padding:
|
|
23750
|
+
var ChannelListHeader = styled__default.div(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n max-width: ", ";\n padding: ", ";\n padding-left: 22px;\n box-sizing: border-box;\n padding-left: ", ";\n border-right: ", ";\n"])), function (props) {
|
|
23693
23751
|
return props.maxWidth ? props.maxWidth + "px" : 'inherit';
|
|
23752
|
+
}, function (props) {
|
|
23753
|
+
return props.padding || '12px';
|
|
23694
23754
|
}, function (props) {
|
|
23695
23755
|
return props.withoutProfile && '52px';
|
|
23696
23756
|
}, function (props) {
|
|
@@ -29227,7 +29287,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
29227
29287
|
if (downloadIsCancelled) {
|
|
29228
29288
|
setDownloadIsCancelled(false);
|
|
29229
29289
|
if (customDownloader) {
|
|
29230
|
-
customDownloader(attachment.url, false, function () {
|
|
29290
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29291
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29292
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29293
|
+
setSizeProgress({
|
|
29294
|
+
loaded: progress.loaded || 0,
|
|
29295
|
+
total: progress.total || 0
|
|
29296
|
+
});
|
|
29297
|
+
setProgress(uploadPercent);
|
|
29298
|
+
}, messageType).then(function (url) {
|
|
29231
29299
|
downloadImage(url);
|
|
29232
29300
|
});
|
|
29233
29301
|
} else {
|
|
@@ -29355,23 +29423,35 @@ var Attachment = function Attachment(_ref) {
|
|
|
29355
29423
|
}
|
|
29356
29424
|
}, [attachmentUrl]);
|
|
29357
29425
|
React.useEffect(function () {
|
|
29358
|
-
if (connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
29426
|
+
if (!attachment.attachmentUrl && connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
29359
29427
|
getAttachmentUrlFromCache(attachment.url).then(function (cachedUrl) {
|
|
29360
29428
|
try {
|
|
29361
29429
|
if (attachment.type === 'image' && !isPreview) {
|
|
29362
29430
|
if (cachedUrl) {
|
|
29363
29431
|
setAttachmentUrl(cachedUrl);
|
|
29432
|
+
dispatch(setUpdateMessageAttachmentAC(attachment.url, attachment.messageId, {
|
|
29433
|
+
attachmentUrl: cachedUrl
|
|
29434
|
+
}));
|
|
29364
29435
|
setIsCached(true);
|
|
29365
29436
|
} else {
|
|
29366
29437
|
setIsCached(false);
|
|
29367
29438
|
setDownloadingFile(true);
|
|
29368
29439
|
if (customDownloader) {
|
|
29369
|
-
customDownloader(attachment.url, false, function () {
|
|
29440
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29441
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29442
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29443
|
+
setSizeProgress({
|
|
29444
|
+
loaded: progress.loaded || 0,
|
|
29445
|
+
total: progress.total || 0
|
|
29446
|
+
});
|
|
29447
|
+
setProgress(uploadPercent);
|
|
29448
|
+
}, messageType).then(function (url) {
|
|
29370
29449
|
try {
|
|
29371
29450
|
downloadImage(url);
|
|
29372
29451
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
29373
29452
|
setAttachmentToCache(attachment.url, response);
|
|
29374
29453
|
setIsCached(true);
|
|
29454
|
+
setDownloadingFile(false);
|
|
29375
29455
|
});
|
|
29376
29456
|
} catch (e) {
|
|
29377
29457
|
return Promise.reject(e);
|
|
@@ -29410,7 +29490,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
29410
29490
|
log.info('error on get attachment url from cache. .. ', e);
|
|
29411
29491
|
if (customDownloader) {
|
|
29412
29492
|
setDownloadingFile(true);
|
|
29413
|
-
customDownloader(attachment.url,
|
|
29493
|
+
customDownloader(attachment.url, true, function (progress) {
|
|
29494
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29495
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29496
|
+
setSizeProgress({
|
|
29497
|
+
loaded: progress.loaded || 0,
|
|
29498
|
+
total: progress.total || 0
|
|
29499
|
+
});
|
|
29500
|
+
setProgress(uploadPercent);
|
|
29501
|
+
}, messageType).then(function (url) {
|
|
29414
29502
|
try {
|
|
29415
29503
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
29416
29504
|
setAttachmentToCache(attachment.url, response);
|
|
@@ -29515,7 +29603,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29515
29603
|
imageMinWidth: imageMinWidth,
|
|
29516
29604
|
withPrefix: withPrefix,
|
|
29517
29605
|
borderColor: borderColor
|
|
29518
|
-
}, /*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
29606
|
+
}, !isPreview && (isInUploadingState || downloadingFile) && sizeProgress && sizeProgress.loaded < sizeProgress.total && (/*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
29519
29607
|
isRepliedMessage: isRepliedMessage,
|
|
29520
29608
|
isDetailsView: isDetailsView,
|
|
29521
29609
|
backgroundColor: overlayBackground2
|
|
@@ -29545,7 +29633,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29545
29633
|
}
|
|
29546
29634
|
})), sizeProgress && (/*#__PURE__*/React__default.createElement(SizeProgress, {
|
|
29547
29635
|
color: textOnPrimary
|
|
29548
|
-
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1)))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
29636
|
+
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1))))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
29549
29637
|
backgroundColor: background,
|
|
29550
29638
|
color: iconInactive,
|
|
29551
29639
|
onClick: function onClick() {
|
|
@@ -32939,7 +33027,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32939
33027
|
clearVisibleMessagesMap();
|
|
32940
33028
|
}
|
|
32941
33029
|
if (channel) {
|
|
32942
|
-
dispatch(getMessagesAC(channel,
|
|
33030
|
+
dispatch(getMessagesAC(channel, undefined, undefined, undefined, true));
|
|
32943
33031
|
}
|
|
32944
33032
|
if (channel.id) {
|
|
32945
33033
|
if (channel.newMessageCount && channel.newMessageCount > 0) {
|
|
@@ -40642,7 +40730,10 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
40642
40730
|
var showScrollToNewMessageButton = reactRedux.useSelector(showScrollToNewMessageButtonSelector);
|
|
40643
40731
|
var messages = reactRedux.useSelector(activeChannelMessagesSelector) || [];
|
|
40644
40732
|
var handleScrollToBottom = function handleScrollToBottom() {
|
|
40645
|
-
|
|
40733
|
+
var user = getClient().user;
|
|
40734
|
+
if (channel.lastMessage.user.id !== user.id) {
|
|
40735
|
+
dispatch(markMessagesAsReadAC(channel.id, [channel.lastMessage.id]));
|
|
40736
|
+
}
|
|
40646
40737
|
handleScrollToLastMessage(channel.lastMessage.id);
|
|
40647
40738
|
};
|
|
40648
40739
|
var handleScrollToLastMessage = function handleScrollToLastMessage(messageId) {
|
package/index.modern.js
CHANGED
|
@@ -10054,18 +10054,29 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
10054
10054
|
}
|
|
10055
10055
|
}
|
|
10056
10056
|
}
|
|
10057
|
+
var updatedMessageData = null;
|
|
10057
10058
|
if (messagesMap[channelId]) {
|
|
10058
|
-
messagesMap[channelId]
|
|
10059
|
+
messagesMap[channelId].map(function (mes) {
|
|
10059
10060
|
if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
|
|
10060
10061
|
if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
|
|
10061
|
-
|
|
10062
|
+
updatedMessageData = _extends({}, updatedMessage.params);
|
|
10063
|
+
return updatedMessageData;
|
|
10062
10064
|
} else {
|
|
10063
|
-
|
|
10065
|
+
var _updatedMessage$param;
|
|
10066
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params, {
|
|
10067
|
+
attachments: [].concat(mes.attachments, ((_updatedMessage$param = updatedMessage.params) === null || _updatedMessage$param === void 0 ? void 0 : _updatedMessage$param.attachments) || []).filter(function (att, index, self) {
|
|
10068
|
+
return index === self.findIndex(function (t) {
|
|
10069
|
+
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10070
|
+
});
|
|
10071
|
+
})
|
|
10072
|
+
});
|
|
10073
|
+
return updatedMessage;
|
|
10064
10074
|
}
|
|
10065
10075
|
}
|
|
10066
10076
|
return mes;
|
|
10067
10077
|
});
|
|
10068
10078
|
}
|
|
10079
|
+
return updatedMessageData;
|
|
10069
10080
|
}
|
|
10070
10081
|
function addReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
10071
10082
|
if (messagesMap[channelId]) {
|
|
@@ -10309,7 +10320,6 @@ var messageSlice = createSlice({
|
|
|
10309
10320
|
reducers: {
|
|
10310
10321
|
addMessage: function addMessage(state, action) {
|
|
10311
10322
|
var message = action.payload.message;
|
|
10312
|
-
log.info('addMessage ... ', message);
|
|
10313
10323
|
state.activeChannelMessages.push(message);
|
|
10314
10324
|
},
|
|
10315
10325
|
deleteMessageFromList: function deleteMessageFromList(state, action) {
|
|
@@ -10427,11 +10437,48 @@ var messageSlice = createSlice({
|
|
|
10427
10437
|
state.activeChannelMessages.push(params);
|
|
10428
10438
|
}
|
|
10429
10439
|
},
|
|
10430
|
-
|
|
10440
|
+
updateMessageAttachment: function updateMessageAttachment(state, action) {
|
|
10431
10441
|
var _action$payload4 = action.payload,
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10442
|
+
url = _action$payload4.url,
|
|
10443
|
+
messageId = _action$payload4.messageId,
|
|
10444
|
+
params = _action$payload4.params;
|
|
10445
|
+
state.activeChannelMessages = state.activeChannelMessages.map(function (message) {
|
|
10446
|
+
if (message.id === messageId) {
|
|
10447
|
+
for (var index = 0; index < message.attachments.length; index++) {
|
|
10448
|
+
var attachment = message.attachments[index];
|
|
10449
|
+
if (attachment.url === url) {
|
|
10450
|
+
message.attachments[index] = _extends({}, attachment, params);
|
|
10451
|
+
}
|
|
10452
|
+
}
|
|
10453
|
+
}
|
|
10454
|
+
if (message.attachments.length) {
|
|
10455
|
+
var detachedAttachments = message.attachments.map(function (att) {
|
|
10456
|
+
var _att$user, _att$user2;
|
|
10457
|
+
return _extends({}, att, {
|
|
10458
|
+
user: _extends({}, att.user, {
|
|
10459
|
+
metadata: _extends({}, ((_att$user = att.user) === null || _att$user === void 0 ? void 0 : _att$user.metadata) || {}),
|
|
10460
|
+
presence: _extends({}, ((_att$user2 = att.user) === null || _att$user2 === void 0 ? void 0 : _att$user2.presence) || {})
|
|
10461
|
+
})
|
|
10462
|
+
});
|
|
10463
|
+
});
|
|
10464
|
+
updateMessageOnAllMessages(messageId, {
|
|
10465
|
+
attachments: detachedAttachments
|
|
10466
|
+
});
|
|
10467
|
+
updateMessageOnMap(message.channelId, {
|
|
10468
|
+
messageId: messageId,
|
|
10469
|
+
params: {
|
|
10470
|
+
attachments: detachedAttachments
|
|
10471
|
+
}
|
|
10472
|
+
});
|
|
10473
|
+
}
|
|
10474
|
+
return message;
|
|
10475
|
+
});
|
|
10476
|
+
},
|
|
10477
|
+
addReactionToMessage: function addReactionToMessage(state, action) {
|
|
10478
|
+
var _action$payload5 = action.payload,
|
|
10479
|
+
message = _action$payload5.message,
|
|
10480
|
+
reaction = _action$payload5.reaction,
|
|
10481
|
+
isSelf = _action$payload5.isSelf;
|
|
10435
10482
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
10436
10483
|
if (msg.id === message.id) {
|
|
10437
10484
|
var slfReactions = [].concat(msg.userReactions);
|
|
@@ -10451,10 +10498,10 @@ var messageSlice = createSlice({
|
|
|
10451
10498
|
});
|
|
10452
10499
|
},
|
|
10453
10500
|
deleteReactionFromMessage: function deleteReactionFromMessage(state, action) {
|
|
10454
|
-
var _action$
|
|
10455
|
-
reaction = _action$
|
|
10456
|
-
message = _action$
|
|
10457
|
-
isSelf = _action$
|
|
10501
|
+
var _action$payload6 = action.payload,
|
|
10502
|
+
reaction = _action$payload6.reaction,
|
|
10503
|
+
message = _action$payload6.message,
|
|
10504
|
+
isSelf = _action$payload6.isSelf;
|
|
10458
10505
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
10459
10506
|
if (msg.id === message.id) {
|
|
10460
10507
|
var userReactions = msg.userReactions;
|
|
@@ -10503,9 +10550,9 @@ var messageSlice = createSlice({
|
|
|
10503
10550
|
(_state$activeTabAttac = state.activeTabAttachments).push.apply(_state$activeTabAttac, action.payload.attachments);
|
|
10504
10551
|
},
|
|
10505
10552
|
addAttachmentsForPopup: function addAttachmentsForPopup(state, action) {
|
|
10506
|
-
var _action$
|
|
10507
|
-
attachments = _action$
|
|
10508
|
-
direction = _action$
|
|
10553
|
+
var _action$payload7 = action.payload,
|
|
10554
|
+
attachments = _action$payload7.attachments,
|
|
10555
|
+
direction = _action$payload7.direction;
|
|
10509
10556
|
if (direction === 'prev') {
|
|
10510
10557
|
var _state$attachmentsFor;
|
|
10511
10558
|
(_state$attachmentsFor = state.attachmentsForPopup).push.apply(_state$attachmentsFor, attachments);
|
|
@@ -10521,11 +10568,11 @@ var messageSlice = createSlice({
|
|
|
10521
10568
|
state.attachmentForPopupHasNext = action.payload.hasPrev;
|
|
10522
10569
|
},
|
|
10523
10570
|
updateUploadProgress: function updateUploadProgress(state, action) {
|
|
10524
|
-
var _action$
|
|
10525
|
-
uploaded = _action$
|
|
10526
|
-
total = _action$
|
|
10527
|
-
attachmentId = _action$
|
|
10528
|
-
progress = _action$
|
|
10571
|
+
var _action$payload8 = action.payload,
|
|
10572
|
+
uploaded = _action$payload8.uploaded,
|
|
10573
|
+
total = _action$payload8.total,
|
|
10574
|
+
attachmentId = _action$payload8.attachmentId,
|
|
10575
|
+
progress = _action$payload8.progress;
|
|
10529
10576
|
var updateData = {
|
|
10530
10577
|
uploaded: uploaded,
|
|
10531
10578
|
total: total,
|
|
@@ -10549,23 +10596,23 @@ var messageSlice = createSlice({
|
|
|
10549
10596
|
state.messageForReply = action.payload.message;
|
|
10550
10597
|
},
|
|
10551
10598
|
uploadAttachmentCompilation: function uploadAttachmentCompilation(state, action) {
|
|
10552
|
-
var _action$
|
|
10553
|
-
attachmentUploadingState = _action$
|
|
10554
|
-
attachmentId = _action$
|
|
10599
|
+
var _action$payload9 = action.payload,
|
|
10600
|
+
attachmentUploadingState = _action$payload9.attachmentUploadingState,
|
|
10601
|
+
attachmentId = _action$payload9.attachmentId;
|
|
10555
10602
|
state.attachmentsUploadingState[attachmentId] = attachmentUploadingState;
|
|
10556
10603
|
},
|
|
10557
10604
|
setReactionsList: function setReactionsList(state, action) {
|
|
10558
|
-
var _action$
|
|
10559
|
-
reactions = _action$
|
|
10560
|
-
hasNext = _action$
|
|
10605
|
+
var _action$payload0 = action.payload,
|
|
10606
|
+
reactions = _action$payload0.reactions,
|
|
10607
|
+
hasNext = _action$payload0.hasNext;
|
|
10561
10608
|
state.reactionsHasNext = hasNext;
|
|
10562
10609
|
state.reactionsList = [].concat(reactions);
|
|
10563
10610
|
},
|
|
10564
10611
|
addReactionsToList: function addReactionsToList(state, action) {
|
|
10565
10612
|
var _state$reactionsList;
|
|
10566
|
-
var _action$
|
|
10567
|
-
reactions = _action$
|
|
10568
|
-
hasNext = _action$
|
|
10613
|
+
var _action$payload1 = action.payload,
|
|
10614
|
+
reactions = _action$payload1.reactions,
|
|
10615
|
+
hasNext = _action$payload1.hasNext;
|
|
10569
10616
|
state.reactionsHasNext = hasNext;
|
|
10570
10617
|
(_state$reactionsList = state.reactionsList).push.apply(_state$reactionsList, reactions);
|
|
10571
10618
|
},
|
|
@@ -10626,6 +10673,7 @@ var _messageSlice$actions = messageSlice.actions,
|
|
|
10626
10673
|
addMessages = _messageSlice$actions.addMessages,
|
|
10627
10674
|
updateMessagesStatus = _messageSlice$actions.updateMessagesStatus,
|
|
10628
10675
|
updateMessage = _messageSlice$actions.updateMessage,
|
|
10676
|
+
updateMessageAttachment = _messageSlice$actions.updateMessageAttachment,
|
|
10629
10677
|
addReactionToMessage = _messageSlice$actions.addReactionToMessage,
|
|
10630
10678
|
deleteReactionFromMessage = _messageSlice$actions.deleteReactionFromMessage,
|
|
10631
10679
|
setHasPrevMessages = _messageSlice$actions.setHasPrevMessages,
|
|
@@ -11717,6 +11765,13 @@ function setMessagesHasNextAC(hasNext) {
|
|
|
11717
11765
|
hasNext: hasNext
|
|
11718
11766
|
});
|
|
11719
11767
|
}
|
|
11768
|
+
function setUpdateMessageAttachmentAC(url, messageId, params) {
|
|
11769
|
+
return updateMessageAttachment({
|
|
11770
|
+
url: url,
|
|
11771
|
+
messageId: messageId,
|
|
11772
|
+
params: params
|
|
11773
|
+
});
|
|
11774
|
+
}
|
|
11720
11775
|
function updateMessageAC(messageId, params, addIfNotExists) {
|
|
11721
11776
|
return updateMessage({
|
|
11722
11777
|
messageId: messageId,
|
|
@@ -17132,12 +17187,6 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
17132
17187
|
addMessageToMap(channel.id, messageToAdd);
|
|
17133
17188
|
addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
17134
17189
|
setPendingMessages(channel.id, [messageToAdd]);
|
|
17135
|
-
var hasNextMessages = store.getState().MessageReducer.messagesHasNext;
|
|
17136
|
-
var activeChannelMessages = store.getState().MessageReducer.activeChannelMessages;
|
|
17137
|
-
var isLatestMessageInChannelMessages = activeChannelMessages[activeChannelMessages.length - 1].id === channel.lastMessage.id;
|
|
17138
|
-
if (hasNextMessages || !isLatestMessageInChannelMessages) {
|
|
17139
|
-
store.dispatch(getMessagesAC(channel, true, channel.lastMessage.id, undefined, undefined, false));
|
|
17140
|
-
}
|
|
17141
17190
|
store.dispatch(scrollToNewMessageAC(true));
|
|
17142
17191
|
store.dispatch(addMessageAC(messageToAdd));
|
|
17143
17192
|
return Promise.resolve();
|
|
@@ -18311,7 +18360,7 @@ function editMessage(action) {
|
|
|
18311
18360
|
}, _marked6$1, null, [[0, 5]]);
|
|
18312
18361
|
}
|
|
18313
18362
|
function getMessagesQuery(action) {
|
|
18314
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, pendingMessages, _messagesMap, filteredPendingMessages, index, mes, _t9;
|
|
18363
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, pendingMessages, _messagesMap, filteredPendingMessages, index, mes, _t9;
|
|
18315
18364
|
return _regenerator().w(function (_context9) {
|
|
18316
18365
|
while (1) switch (_context9.p = _context9.n) {
|
|
18317
18366
|
case 0:
|
|
@@ -18321,7 +18370,7 @@ function getMessagesQuery(action) {
|
|
|
18321
18370
|
case 1:
|
|
18322
18371
|
_action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight;
|
|
18323
18372
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
18324
|
-
_context9.n =
|
|
18373
|
+
_context9.n = 48;
|
|
18325
18374
|
break;
|
|
18326
18375
|
}
|
|
18327
18376
|
SceytChatClient = getClient();
|
|
@@ -18407,7 +18456,7 @@ function getMessagesQuery(action) {
|
|
|
18407
18456
|
_context9.n = 12;
|
|
18408
18457
|
return put(setScrollToMessagesAC(messageId, highlight));
|
|
18409
18458
|
case 12:
|
|
18410
|
-
_context9.n =
|
|
18459
|
+
_context9.n = 45;
|
|
18411
18460
|
break;
|
|
18412
18461
|
case 13:
|
|
18413
18462
|
if (!messageId) {
|
|
@@ -18473,7 +18522,7 @@ function getMessagesQuery(action) {
|
|
|
18473
18522
|
_context9.n = 24;
|
|
18474
18523
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18475
18524
|
case 24:
|
|
18476
|
-
_context9.n =
|
|
18525
|
+
_context9.n = 45;
|
|
18477
18526
|
break;
|
|
18478
18527
|
case 25:
|
|
18479
18528
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
@@ -18545,7 +18594,7 @@ function getMessagesQuery(action) {
|
|
|
18545
18594
|
_context9.n = 37;
|
|
18546
18595
|
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
18547
18596
|
case 37:
|
|
18548
|
-
_context9.n =
|
|
18597
|
+
_context9.n = 45;
|
|
18549
18598
|
break;
|
|
18550
18599
|
case 38:
|
|
18551
18600
|
setAllMessages([]);
|
|
@@ -18574,22 +18623,29 @@ function getMessagesQuery(action) {
|
|
|
18574
18623
|
result.messages = [].concat(_secondResult4.messages, result.messages);
|
|
18575
18624
|
result.hasNext = _secondResult4.hasNext;
|
|
18576
18625
|
case 42:
|
|
18626
|
+
updatedMessages = [];
|
|
18577
18627
|
result.messages.forEach(function (msg) {
|
|
18578
|
-
updateMessageOnMap(channel.id, {
|
|
18628
|
+
var updatedMessage = updateMessageOnMap(channel.id, {
|
|
18579
18629
|
messageId: msg.id,
|
|
18580
18630
|
params: msg
|
|
18581
18631
|
});
|
|
18582
|
-
updateMessageOnAllMessages(msg.id, msg);
|
|
18632
|
+
updateMessageOnAllMessages(msg.id, updatedMessage || msg);
|
|
18633
|
+
updatedMessages.push(updatedMessage || msg);
|
|
18583
18634
|
});
|
|
18635
|
+
setMessagesToMap(channel.id, updatedMessages);
|
|
18636
|
+
setAllMessages([].concat(updatedMessages));
|
|
18584
18637
|
_context9.n = 43;
|
|
18585
|
-
return put(
|
|
18638
|
+
return put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
18586
18639
|
case 43:
|
|
18587
18640
|
_context9.n = 44;
|
|
18588
|
-
return put(
|
|
18641
|
+
return put(setMessagesHasPrevAC(result.hasNext));
|
|
18589
18642
|
case 44:
|
|
18643
|
+
_context9.n = 45;
|
|
18644
|
+
return put(setMessagesHasNextAC(false));
|
|
18645
|
+
case 45:
|
|
18590
18646
|
pendingMessages = getPendingMessages(channel.id);
|
|
18591
18647
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
18592
|
-
_context9.n =
|
|
18648
|
+
_context9.n = 47;
|
|
18593
18649
|
break;
|
|
18594
18650
|
}
|
|
18595
18651
|
_messagesMap = {};
|
|
@@ -18599,40 +18655,40 @@ function getMessagesQuery(action) {
|
|
|
18599
18655
|
filteredPendingMessages = pendingMessages.filter(function (msg) {
|
|
18600
18656
|
return !_messagesMap[msg.tid || ''];
|
|
18601
18657
|
});
|
|
18602
|
-
_context9.n =
|
|
18658
|
+
_context9.n = 46;
|
|
18603
18659
|
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
18604
|
-
case
|
|
18660
|
+
case 46:
|
|
18605
18661
|
for (index = 0; index < filteredPendingMessages.length; index++) {
|
|
18606
18662
|
mes = filteredPendingMessages[index];
|
|
18607
18663
|
removePendingMessageFromMap(channel === null || channel === void 0 ? void 0 : channel.id, mes.tid || mes.id);
|
|
18608
18664
|
}
|
|
18609
|
-
case 46:
|
|
18610
|
-
_context9.n = 48;
|
|
18611
|
-
break;
|
|
18612
18665
|
case 47:
|
|
18666
|
+
_context9.n = 49;
|
|
18667
|
+
break;
|
|
18668
|
+
case 48:
|
|
18613
18669
|
if (!channel.isMockChannel) {
|
|
18614
|
-
_context9.n =
|
|
18670
|
+
_context9.n = 49;
|
|
18615
18671
|
break;
|
|
18616
18672
|
}
|
|
18617
|
-
_context9.n =
|
|
18673
|
+
_context9.n = 49;
|
|
18618
18674
|
return put(setMessagesAC([]));
|
|
18619
|
-
case 48:
|
|
18620
|
-
_context9.n = 50;
|
|
18621
|
-
break;
|
|
18622
18675
|
case 49:
|
|
18623
|
-
_context9.
|
|
18624
|
-
|
|
18625
|
-
log.error('error in message query', _t9);
|
|
18676
|
+
_context9.n = 51;
|
|
18677
|
+
break;
|
|
18626
18678
|
case 50:
|
|
18627
18679
|
_context9.p = 50;
|
|
18628
|
-
|
|
18629
|
-
|
|
18680
|
+
_t9 = _context9.v;
|
|
18681
|
+
log.error('error in message query', _t9);
|
|
18630
18682
|
case 51:
|
|
18631
|
-
|
|
18683
|
+
_context9.p = 51;
|
|
18684
|
+
_context9.n = 52;
|
|
18685
|
+
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18632
18686
|
case 52:
|
|
18687
|
+
return _context9.f(51);
|
|
18688
|
+
case 53:
|
|
18633
18689
|
return _context9.a(2);
|
|
18634
18690
|
}
|
|
18635
|
-
}, _marked7$1, null, [[0,
|
|
18691
|
+
}, _marked7$1, null, [[0, 50, 51, 53]]);
|
|
18636
18692
|
}
|
|
18637
18693
|
function loadMoreMessages(action) {
|
|
18638
18694
|
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t0;
|
|
@@ -23108,7 +23164,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23108
23164
|
channelAvatarSize = _ref.channelAvatarSize,
|
|
23109
23165
|
channelAvatarTextSize = _ref.channelAvatarTextSize,
|
|
23110
23166
|
searchChannelInputFontSize = _ref.searchChannelInputFontSize,
|
|
23111
|
-
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize
|
|
23167
|
+
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize,
|
|
23168
|
+
searchChannelsPadding = _ref.searchChannelsPadding;
|
|
23112
23169
|
var _useColor = useColors(),
|
|
23113
23170
|
background = _useColor[THEME_COLORS.BACKGROUND],
|
|
23114
23171
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -23345,7 +23402,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23345
23402
|
}, /*#__PURE__*/React__default.createElement(ChannelListHeader, {
|
|
23346
23403
|
withCustomList: !!List,
|
|
23347
23404
|
maxWidth: channelListRef.current && ((_channelListRef$curre2 = channelListRef.current) === null || _channelListRef$curre2 === void 0 ? void 0 : _channelListRef$curre2.clientWidth) || 0,
|
|
23348
|
-
borderColor: borderColor
|
|
23405
|
+
borderColor: borderColor,
|
|
23406
|
+
padding: searchChannelsPadding
|
|
23349
23407
|
}, Profile, showSearch && searchChannelsPosition === 'inline' ? (/*#__PURE__*/React__default.createElement(ChannelSearch, {
|
|
23350
23408
|
inline: true,
|
|
23351
23409
|
borderRadius: searchInputBorderRadius,
|
|
@@ -23668,8 +23726,10 @@ var NoData = styled.div(_templateObject8$4 || (_templateObject8$4 = _taggedTempl
|
|
|
23668
23726
|
return props.color;
|
|
23669
23727
|
});
|
|
23670
23728
|
var LoadingWrapper = styled.div(_templateObject9$4 || (_templateObject9$4 = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: calc(50% - 20px);\n top: calc(50% - 20px);\n"])));
|
|
23671
|
-
var ChannelListHeader = styled.div(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n max-width: ", ";\n padding:
|
|
23729
|
+
var ChannelListHeader = styled.div(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n max-width: ", ";\n padding: ", ";\n padding-left: 22px;\n box-sizing: border-box;\n padding-left: ", ";\n border-right: ", ";\n"])), function (props) {
|
|
23672
23730
|
return props.maxWidth ? props.maxWidth + "px" : 'inherit';
|
|
23731
|
+
}, function (props) {
|
|
23732
|
+
return props.padding || '12px';
|
|
23673
23733
|
}, function (props) {
|
|
23674
23734
|
return props.withoutProfile && '52px';
|
|
23675
23735
|
}, function (props) {
|
|
@@ -29206,7 +29266,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
29206
29266
|
if (downloadIsCancelled) {
|
|
29207
29267
|
setDownloadIsCancelled(false);
|
|
29208
29268
|
if (customDownloader) {
|
|
29209
|
-
customDownloader(attachment.url, false, function () {
|
|
29269
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29270
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29271
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29272
|
+
setSizeProgress({
|
|
29273
|
+
loaded: progress.loaded || 0,
|
|
29274
|
+
total: progress.total || 0
|
|
29275
|
+
});
|
|
29276
|
+
setProgress(uploadPercent);
|
|
29277
|
+
}, messageType).then(function (url) {
|
|
29210
29278
|
downloadImage(url);
|
|
29211
29279
|
});
|
|
29212
29280
|
} else {
|
|
@@ -29334,23 +29402,35 @@ var Attachment = function Attachment(_ref) {
|
|
|
29334
29402
|
}
|
|
29335
29403
|
}, [attachmentUrl]);
|
|
29336
29404
|
useEffect(function () {
|
|
29337
|
-
if (connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
29405
|
+
if (!attachment.attachmentUrl && connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
29338
29406
|
getAttachmentUrlFromCache(attachment.url).then(function (cachedUrl) {
|
|
29339
29407
|
try {
|
|
29340
29408
|
if (attachment.type === 'image' && !isPreview) {
|
|
29341
29409
|
if (cachedUrl) {
|
|
29342
29410
|
setAttachmentUrl(cachedUrl);
|
|
29411
|
+
dispatch(setUpdateMessageAttachmentAC(attachment.url, attachment.messageId, {
|
|
29412
|
+
attachmentUrl: cachedUrl
|
|
29413
|
+
}));
|
|
29343
29414
|
setIsCached(true);
|
|
29344
29415
|
} else {
|
|
29345
29416
|
setIsCached(false);
|
|
29346
29417
|
setDownloadingFile(true);
|
|
29347
29418
|
if (customDownloader) {
|
|
29348
|
-
customDownloader(attachment.url, false, function () {
|
|
29419
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29420
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29421
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29422
|
+
setSizeProgress({
|
|
29423
|
+
loaded: progress.loaded || 0,
|
|
29424
|
+
total: progress.total || 0
|
|
29425
|
+
});
|
|
29426
|
+
setProgress(uploadPercent);
|
|
29427
|
+
}, messageType).then(function (url) {
|
|
29349
29428
|
try {
|
|
29350
29429
|
downloadImage(url);
|
|
29351
29430
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
29352
29431
|
setAttachmentToCache(attachment.url, response);
|
|
29353
29432
|
setIsCached(true);
|
|
29433
|
+
setDownloadingFile(false);
|
|
29354
29434
|
});
|
|
29355
29435
|
} catch (e) {
|
|
29356
29436
|
return Promise.reject(e);
|
|
@@ -29389,7 +29469,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
29389
29469
|
log.info('error on get attachment url from cache. .. ', e);
|
|
29390
29470
|
if (customDownloader) {
|
|
29391
29471
|
setDownloadingFile(true);
|
|
29392
|
-
customDownloader(attachment.url,
|
|
29472
|
+
customDownloader(attachment.url, true, function (progress) {
|
|
29473
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29474
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29475
|
+
setSizeProgress({
|
|
29476
|
+
loaded: progress.loaded || 0,
|
|
29477
|
+
total: progress.total || 0
|
|
29478
|
+
});
|
|
29479
|
+
setProgress(uploadPercent);
|
|
29480
|
+
}, messageType).then(function (url) {
|
|
29393
29481
|
try {
|
|
29394
29482
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
29395
29483
|
setAttachmentToCache(attachment.url, response);
|
|
@@ -29494,7 +29582,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29494
29582
|
imageMinWidth: imageMinWidth,
|
|
29495
29583
|
withPrefix: withPrefix,
|
|
29496
29584
|
borderColor: borderColor
|
|
29497
|
-
}, /*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
29585
|
+
}, !isPreview && (isInUploadingState || downloadingFile) && sizeProgress && sizeProgress.loaded < sizeProgress.total && (/*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
29498
29586
|
isRepliedMessage: isRepliedMessage,
|
|
29499
29587
|
isDetailsView: isDetailsView,
|
|
29500
29588
|
backgroundColor: overlayBackground2
|
|
@@ -29524,7 +29612,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29524
29612
|
}
|
|
29525
29613
|
})), sizeProgress && (/*#__PURE__*/React__default.createElement(SizeProgress, {
|
|
29526
29614
|
color: textOnPrimary
|
|
29527
|
-
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1)))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
29615
|
+
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1))))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
29528
29616
|
backgroundColor: background,
|
|
29529
29617
|
color: iconInactive,
|
|
29530
29618
|
onClick: function onClick() {
|
|
@@ -32918,7 +33006,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32918
33006
|
clearVisibleMessagesMap();
|
|
32919
33007
|
}
|
|
32920
33008
|
if (channel) {
|
|
32921
|
-
dispatch(getMessagesAC(channel,
|
|
33009
|
+
dispatch(getMessagesAC(channel, undefined, undefined, undefined, true));
|
|
32922
33010
|
}
|
|
32923
33011
|
if (channel.id) {
|
|
32924
33012
|
if (channel.newMessageCount && channel.newMessageCount > 0) {
|
|
@@ -40621,7 +40709,10 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
40621
40709
|
var showScrollToNewMessageButton = useSelector(showScrollToNewMessageButtonSelector);
|
|
40622
40710
|
var messages = useSelector(activeChannelMessagesSelector) || [];
|
|
40623
40711
|
var handleScrollToBottom = function handleScrollToBottom() {
|
|
40624
|
-
|
|
40712
|
+
var user = getClient().user;
|
|
40713
|
+
if (channel.lastMessage.user.id !== user.id) {
|
|
40714
|
+
dispatch(markMessagesAsReadAC(channel.id, [channel.lastMessage.id]));
|
|
40715
|
+
}
|
|
40625
40716
|
handleScrollToLastMessage(channel.lastMessage.id);
|
|
40626
40717
|
};
|
|
40627
40718
|
var handleScrollToLastMessage = function handleScrollToLastMessage(messageId) {
|