sceyt-chat-react-uikit 1.7.8-beta.5 → 1.7.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 +132 -149
- package/index.modern.js +132 -149
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10740,6 +10740,12 @@ function setPendingPollActionsMapAC(messageId, event) {
|
|
|
10740
10740
|
event: event
|
|
10741
10741
|
});
|
|
10742
10742
|
}
|
|
10743
|
+
function updatePendingPollActionAC(messageId, message) {
|
|
10744
|
+
return updatePendingPollAction({
|
|
10745
|
+
messageId: messageId,
|
|
10746
|
+
message: message
|
|
10747
|
+
});
|
|
10748
|
+
}
|
|
10743
10749
|
function setPendingMessageAC(channelId, message) {
|
|
10744
10750
|
return setPendingMessage$1({
|
|
10745
10751
|
channelId: channelId,
|
|
@@ -11841,10 +11847,24 @@ var messageSlice = createSlice({
|
|
|
11841
11847
|
}
|
|
11842
11848
|
state.pendingPollActions[messageId] = [].concat(state.pendingPollActions[messageId], [event]);
|
|
11843
11849
|
},
|
|
11844
|
-
|
|
11850
|
+
updatePendingPollAction: function updatePendingPollAction(state, action) {
|
|
11845
11851
|
var _action$payload20 = action.payload,
|
|
11846
|
-
|
|
11852
|
+
messageId = _action$payload20.messageId,
|
|
11847
11853
|
message = _action$payload20.message;
|
|
11854
|
+
if (!state.pendingPollActions[messageId]) {
|
|
11855
|
+
return;
|
|
11856
|
+
}
|
|
11857
|
+
state.pendingPollActions[messageId] = state.pendingPollActions[messageId].map(function (action) {
|
|
11858
|
+
var _action$message, _action$message2;
|
|
11859
|
+
return ((_action$message = action.message) === null || _action$message === void 0 ? void 0 : _action$message.id) === messageId || ((_action$message2 = action.message) === null || _action$message2 === void 0 ? void 0 : _action$message2.tid) === messageId ? _extends({}, action, {
|
|
11860
|
+
message: message
|
|
11861
|
+
}) : action;
|
|
11862
|
+
});
|
|
11863
|
+
},
|
|
11864
|
+
setPendingMessage: function setPendingMessage(state, action) {
|
|
11865
|
+
var _action$payload21 = action.payload,
|
|
11866
|
+
channelId = _action$payload21.channelId,
|
|
11867
|
+
message = _action$payload21.message;
|
|
11848
11868
|
if (!state.pendingMessagesMap[channelId]) {
|
|
11849
11869
|
state.pendingMessagesMap[channelId] = [];
|
|
11850
11870
|
}
|
|
@@ -11856,9 +11876,9 @@ var messageSlice = createSlice({
|
|
|
11856
11876
|
}
|
|
11857
11877
|
},
|
|
11858
11878
|
removePendingMessage: function removePendingMessage(state, action) {
|
|
11859
|
-
var _action$
|
|
11860
|
-
channelId = _action$
|
|
11861
|
-
messageId = _action$
|
|
11879
|
+
var _action$payload22 = action.payload,
|
|
11880
|
+
channelId = _action$payload22.channelId,
|
|
11881
|
+
messageId = _action$payload22.messageId;
|
|
11862
11882
|
if (state.pendingMessagesMap[channelId]) {
|
|
11863
11883
|
state.pendingMessagesMap[channelId] = state.pendingMessagesMap[channelId].filter(function (msg) {
|
|
11864
11884
|
return !(msg.id === messageId || msg.tid === messageId);
|
|
@@ -11869,10 +11889,10 @@ var messageSlice = createSlice({
|
|
|
11869
11889
|
}
|
|
11870
11890
|
},
|
|
11871
11891
|
updatePendingMessage: function updatePendingMessage(state, action) {
|
|
11872
|
-
var _action$
|
|
11873
|
-
channelId = _action$
|
|
11874
|
-
messageId = _action$
|
|
11875
|
-
updatedMessage = _action$
|
|
11892
|
+
var _action$payload23 = action.payload,
|
|
11893
|
+
channelId = _action$payload23.channelId,
|
|
11894
|
+
messageId = _action$payload23.messageId,
|
|
11895
|
+
updatedMessage = _action$payload23.updatedMessage;
|
|
11876
11896
|
if (state.pendingMessagesMap[channelId]) {
|
|
11877
11897
|
state.pendingMessagesMap[channelId] = state.pendingMessagesMap[channelId].map(function (msg) {
|
|
11878
11898
|
if (msg.id === messageId || msg.tid === messageId) {
|
|
@@ -11947,7 +11967,8 @@ var _messageSlice$actions = messageSlice.actions,
|
|
|
11947
11967
|
setPendingPollActionsMap = _messageSlice$actions.setPendingPollActionsMap,
|
|
11948
11968
|
setPendingMessage$1 = _messageSlice$actions.setPendingMessage,
|
|
11949
11969
|
removePendingMessage = _messageSlice$actions.removePendingMessage,
|
|
11950
|
-
updatePendingMessage = _messageSlice$actions.updatePendingMessage
|
|
11970
|
+
updatePendingMessage = _messageSlice$actions.updatePendingMessage,
|
|
11971
|
+
updatePendingPollAction = _messageSlice$actions.updatePendingPollAction;
|
|
11951
11972
|
var MessageReducer = messageSlice.reducer;
|
|
11952
11973
|
|
|
11953
11974
|
var initialState$2 = {
|
|
@@ -15425,6 +15446,7 @@ function watchForEvents() {
|
|
|
15425
15446
|
}
|
|
15426
15447
|
return _context.a(3, 183);
|
|
15427
15448
|
case 99:
|
|
15449
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_ADDED ... ');
|
|
15428
15450
|
_channel10 = args.channel, pollDetails = args.pollDetails, _messageId = args.messageId;
|
|
15429
15451
|
pollDetailsData = pollDetails;
|
|
15430
15452
|
_context.n = 100;
|
|
@@ -15509,6 +15531,7 @@ function watchForEvents() {
|
|
|
15509
15531
|
case 108:
|
|
15510
15532
|
return _context.a(3, 183);
|
|
15511
15533
|
case 109:
|
|
15534
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_DELETED ... ');
|
|
15512
15535
|
_channel11 = args.channel, _pollDetails = args.pollDetails, _messageId2 = args.messageId;
|
|
15513
15536
|
_pollDetailsData = _pollDetails;
|
|
15514
15537
|
_context.n = 110;
|
|
@@ -15568,6 +15591,7 @@ function watchForEvents() {
|
|
|
15568
15591
|
case 116:
|
|
15569
15592
|
return _context.a(3, 183);
|
|
15570
15593
|
case 117:
|
|
15594
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_RETRACTED ... ');
|
|
15571
15595
|
_channel12 = args.channel, _pollDetails2 = args.pollDetails, _messageId3 = args.messageId;
|
|
15572
15596
|
_context.n = 118;
|
|
15573
15597
|
return effects.call(getActiveChannelId);
|
|
@@ -15626,6 +15650,7 @@ function watchForEvents() {
|
|
|
15626
15650
|
case 124:
|
|
15627
15651
|
return _context.a(3, 183);
|
|
15628
15652
|
case 125:
|
|
15653
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_CLOSED ... ');
|
|
15629
15654
|
_channel13 = args.channel, _messageId4 = args.messageId;
|
|
15630
15655
|
_context.n = 126;
|
|
15631
15656
|
return effects.call(getActiveChannelId);
|
|
@@ -19143,6 +19168,10 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
19143
19168
|
_context.n = 7;
|
|
19144
19169
|
break;
|
|
19145
19170
|
case 6:
|
|
19171
|
+
if (!(channel !== null && channel !== void 0 && channel.id)) {
|
|
19172
|
+
_context.n = 7;
|
|
19173
|
+
break;
|
|
19174
|
+
}
|
|
19146
19175
|
_context.n = 7;
|
|
19147
19176
|
return effects.put(getMessagesAC(channel, false, channel === null || channel === void 0 ? void 0 : (_channel$lastMessage3 = channel.lastMessage) === null || _channel$lastMessage3 === void 0 ? void 0 : _channel$lastMessage3.id, undefined, false, 'smooth', true));
|
|
19148
19177
|
case 7:
|
|
@@ -19358,7 +19387,7 @@ function sendMessage(action) {
|
|
|
19358
19387
|
messagesToSend.push(messageToSend);
|
|
19359
19388
|
case 12:
|
|
19360
19389
|
_loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
19361
|
-
var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData,
|
|
19390
|
+
var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, stringifiedMessageUpdateData, activeChannelId, channelUpdateParam, isErrorResendable, _t;
|
|
19362
19391
|
return _regenerator().w(function (_context3) {
|
|
19363
19392
|
while (1) switch (_context3.p = _context3.n) {
|
|
19364
19393
|
case 0:
|
|
@@ -19460,23 +19489,23 @@ function sendMessage(action) {
|
|
|
19460
19489
|
createdAt: messageResponse.createdAt,
|
|
19461
19490
|
channelId: channel.id
|
|
19462
19491
|
};
|
|
19492
|
+
stringifiedMessageUpdateData = JSON.parse(JSON.stringify(messageUpdateData));
|
|
19463
19493
|
activeChannelId = getActiveChannelId();
|
|
19464
19494
|
if (!(activeChannelId === channel.id)) {
|
|
19465
19495
|
_context3.n = 9;
|
|
19466
19496
|
break;
|
|
19467
19497
|
}
|
|
19468
19498
|
_context3.n = 9;
|
|
19469
|
-
return effects.put(updateMessageAC(messageToSend.tid,
|
|
19499
|
+
return effects.put(updateMessageAC(messageToSend.tid, stringifiedMessageUpdateData, true));
|
|
19470
19500
|
case 9:
|
|
19471
19501
|
_context3.n = 10;
|
|
19472
19502
|
return effects.put(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19473
19503
|
case 10:
|
|
19474
|
-
addMessageToMap(channel.id,
|
|
19504
|
+
addMessageToMap(channel.id, stringifiedMessageUpdateData);
|
|
19475
19505
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19476
|
-
|
|
19477
|
-
updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
|
|
19506
|
+
updateChannelLastMessageOnAllChannels(channel.id, stringifiedMessageUpdateData);
|
|
19478
19507
|
channelUpdateParam = {
|
|
19479
|
-
lastMessage:
|
|
19508
|
+
lastMessage: stringifiedMessageUpdateData,
|
|
19480
19509
|
lastReactedMessage: null
|
|
19481
19510
|
};
|
|
19482
19511
|
if (!channel.unread) {
|
|
@@ -19567,7 +19596,7 @@ function sendMessage(action) {
|
|
|
19567
19596
|
}, _marked$3, null, [[1, 16, 17, 19]]);
|
|
19568
19597
|
}
|
|
19569
19598
|
function sendTextMessage(action) {
|
|
19570
|
-
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, activeChannelId, messageToUpdate, channelUpdateParam, isErrorResendable, _activeChannelId, _t3;
|
|
19599
|
+
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, activeChannelId, stringifiedMessageUpdateData, messageToUpdate, channelUpdateParam, isErrorResendable, _activeChannelId, _t3;
|
|
19571
19600
|
return _regenerator().w(function (_context5) {
|
|
19572
19601
|
while (1) switch (_context5.p = _context5.n) {
|
|
19573
19602
|
case 0:
|
|
@@ -19655,7 +19684,7 @@ function sendTextMessage(action) {
|
|
|
19655
19684
|
return effects.call(updateMessage$1, action.type, pendingMessage, channel.id, true, message);
|
|
19656
19685
|
case 8:
|
|
19657
19686
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19658
|
-
_context5.n =
|
|
19687
|
+
_context5.n = 18;
|
|
19659
19688
|
break;
|
|
19660
19689
|
}
|
|
19661
19690
|
if (!sendMessageHandler) {
|
|
@@ -19699,10 +19728,14 @@ function sendTextMessage(action) {
|
|
|
19699
19728
|
_context5.n = 13;
|
|
19700
19729
|
return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
|
|
19701
19730
|
case 13:
|
|
19731
|
+
stringifiedMessageUpdateData = JSON.parse(JSON.stringify(messageUpdateData));
|
|
19702
19732
|
_context5.n = 14;
|
|
19703
|
-
return effects.put(
|
|
19733
|
+
return effects.put(updatePendingPollActionAC(messageToSend.tid, stringifiedMessageUpdateData));
|
|
19704
19734
|
case 14:
|
|
19705
|
-
|
|
19735
|
+
_context5.n = 15;
|
|
19736
|
+
return effects.put(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19737
|
+
case 15:
|
|
19738
|
+
addMessageToMap(channel.id, stringifiedMessageUpdateData);
|
|
19706
19739
|
if (activeChannelId === channel.id) {
|
|
19707
19740
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19708
19741
|
}
|
|
@@ -19712,42 +19745,42 @@ function sendTextMessage(action) {
|
|
|
19712
19745
|
lastMessage: messageToUpdate,
|
|
19713
19746
|
lastReactedMessage: null
|
|
19714
19747
|
};
|
|
19715
|
-
_context5.n =
|
|
19748
|
+
_context5.n = 16;
|
|
19716
19749
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19717
|
-
case
|
|
19750
|
+
case 16:
|
|
19718
19751
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19719
19752
|
if (!channel.unread) {
|
|
19720
|
-
_context5.n =
|
|
19753
|
+
_context5.n = 17;
|
|
19721
19754
|
break;
|
|
19722
19755
|
}
|
|
19723
|
-
_context5.n =
|
|
19756
|
+
_context5.n = 17;
|
|
19724
19757
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19725
|
-
case
|
|
19758
|
+
case 17:
|
|
19726
19759
|
channel.lastMessage = messageToUpdate;
|
|
19727
|
-
_context5.n =
|
|
19760
|
+
_context5.n = 19;
|
|
19728
19761
|
break;
|
|
19729
|
-
case 17:
|
|
19730
|
-
throw new Error('Connection required to send message');
|
|
19731
19762
|
case 18:
|
|
19732
|
-
|
|
19733
|
-
break;
|
|
19763
|
+
throw new Error('Connection required to send message');
|
|
19734
19764
|
case 19:
|
|
19735
|
-
_context5.
|
|
19765
|
+
_context5.n = 23;
|
|
19766
|
+
break;
|
|
19767
|
+
case 20:
|
|
19768
|
+
_context5.p = 20;
|
|
19736
19769
|
_t3 = _context5.v;
|
|
19737
19770
|
log.error('error on send text message ... ', _t3 === null || _t3 === void 0 ? void 0 : _t3.type);
|
|
19738
19771
|
isErrorResendable = isResendableError(_t3 === null || _t3 === void 0 ? void 0 : _t3.type);
|
|
19739
19772
|
if (!(!isErrorResendable && channel.id && sendMessageTid)) {
|
|
19740
|
-
_context5.n =
|
|
19773
|
+
_context5.n = 22;
|
|
19741
19774
|
break;
|
|
19742
19775
|
}
|
|
19743
|
-
_context5.n =
|
|
19776
|
+
_context5.n = 21;
|
|
19744
19777
|
return effects.put(removePendingMessageAC(channel.id, sendMessageTid));
|
|
19745
|
-
case 20:
|
|
19746
|
-
_context5.n = 22;
|
|
19747
|
-
break;
|
|
19748
19778
|
case 21:
|
|
19779
|
+
_context5.n = 23;
|
|
19780
|
+
break;
|
|
19781
|
+
case 22:
|
|
19749
19782
|
if (!(channel.id && sendMessageTid)) {
|
|
19750
|
-
_context5.n =
|
|
19783
|
+
_context5.n = 23;
|
|
19751
19784
|
break;
|
|
19752
19785
|
}
|
|
19753
19786
|
updateMessageOnMap(channel.id, {
|
|
@@ -19758,26 +19791,26 @@ function sendTextMessage(action) {
|
|
|
19758
19791
|
});
|
|
19759
19792
|
_activeChannelId = getActiveChannelId();
|
|
19760
19793
|
if (!(_activeChannelId === channel.id)) {
|
|
19761
|
-
_context5.n =
|
|
19794
|
+
_context5.n = 23;
|
|
19762
19795
|
break;
|
|
19763
19796
|
}
|
|
19764
19797
|
updateMessageOnAllMessages(sendMessageTid, {
|
|
19765
19798
|
state: MESSAGE_STATUS.FAILED
|
|
19766
19799
|
});
|
|
19767
|
-
_context5.n =
|
|
19800
|
+
_context5.n = 23;
|
|
19768
19801
|
return effects.put(updateMessageAC(sendMessageTid, {
|
|
19769
19802
|
state: MESSAGE_STATUS.FAILED
|
|
19770
19803
|
}));
|
|
19771
|
-
case 22:
|
|
19772
|
-
_context5.p = 22;
|
|
19773
|
-
_context5.n = 23;
|
|
19774
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19775
19804
|
case 23:
|
|
19776
|
-
|
|
19805
|
+
_context5.p = 23;
|
|
19806
|
+
_context5.n = 24;
|
|
19807
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19777
19808
|
case 24:
|
|
19809
|
+
return _context5.f(23);
|
|
19810
|
+
case 25:
|
|
19778
19811
|
return _context5.a(2);
|
|
19779
19812
|
}
|
|
19780
|
-
}, _marked2$2, null, [[3,
|
|
19813
|
+
}, _marked2$2, null, [[3, 20, 23, 25]]);
|
|
19781
19814
|
}
|
|
19782
19815
|
function forwardMessage(action) {
|
|
19783
19816
|
var payload, message, channelId, connectionState, isForward, pendingMessage, channel, activeChannelId, messageTid, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, isErrorResendable, _activeChannelId2, _t4;
|
|
@@ -21447,9 +21480,9 @@ function getMessageMarkers(action) {
|
|
|
21447
21480
|
}
|
|
21448
21481
|
}, _marked16$1, null, [[0, 5, 6, 8]]);
|
|
21449
21482
|
}
|
|
21450
|
-
function executeAddPollVote(channelId, pollId, optionId, message
|
|
21483
|
+
function executeAddPollVote(channelId, pollId, optionId, message) {
|
|
21451
21484
|
var _user$presence, _message$pollDetails, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4;
|
|
21452
|
-
var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7
|
|
21485
|
+
var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7;
|
|
21453
21486
|
return _regenerator().w(function (_context22) {
|
|
21454
21487
|
while (1) switch (_context22.n) {
|
|
21455
21488
|
case 0:
|
|
@@ -21498,38 +21531,16 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21498
21531
|
vote: vote,
|
|
21499
21532
|
incrementVotesPerOptionCount: 1
|
|
21500
21533
|
});
|
|
21501
|
-
if (
|
|
21502
|
-
_context22.n =
|
|
21503
|
-
break;
|
|
21504
|
-
}
|
|
21505
|
-
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21506
|
-
case 3:
|
|
21507
|
-
if ((_step2 = _iterator2()).done) {
|
|
21508
|
-
_context22.n = 5;
|
|
21534
|
+
if (!(channel && message.id)) {
|
|
21535
|
+
_context22.n = 4;
|
|
21509
21536
|
break;
|
|
21510
21537
|
}
|
|
21511
|
-
obj = _step2.value;
|
|
21512
|
-
updateMessageOnMap(channel.id, {
|
|
21513
|
-
messageId: message.id,
|
|
21514
|
-
params: {}
|
|
21515
|
-
}, obj);
|
|
21516
|
-
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21517
|
-
_context22.n = 4;
|
|
21518
|
-
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21519
|
-
case 4:
|
|
21520
21538
|
_context22.n = 3;
|
|
21521
|
-
break;
|
|
21522
|
-
case 5:
|
|
21523
|
-
if (!channel) {
|
|
21524
|
-
_context22.n = 7;
|
|
21525
|
-
break;
|
|
21526
|
-
}
|
|
21527
|
-
_context22.n = 6;
|
|
21528
21539
|
return effects.call(channel.addVote, message.id, pollId, [optionId]);
|
|
21529
|
-
case
|
|
21530
|
-
_context22.n =
|
|
21540
|
+
case 3:
|
|
21541
|
+
_context22.n = 4;
|
|
21531
21542
|
return effects.put(removePendingPollActionAC(message.id, 'ADD_POLL_VOTE', optionId));
|
|
21532
|
-
case
|
|
21543
|
+
case 4:
|
|
21533
21544
|
return _context22.a(2);
|
|
21534
21545
|
}
|
|
21535
21546
|
}, _marked17$1);
|
|
@@ -21573,7 +21584,7 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
|
21573
21584
|
}, _marked18$1);
|
|
21574
21585
|
}
|
|
21575
21586
|
function addPollVote(action) {
|
|
21576
|
-
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2,
|
|
21587
|
+
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, user, vote, pendingAction, conflictCheck, channel, _Object$values, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t32;
|
|
21577
21588
|
return _regenerator().w(function (_context24) {
|
|
21578
21589
|
while (1) switch (_context24.p = _context24.n) {
|
|
21579
21590
|
case 0:
|
|
@@ -21582,10 +21593,9 @@ function addPollVote(action) {
|
|
|
21582
21593
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21583
21594
|
sceytChatClient = getClient();
|
|
21584
21595
|
if (!sceytChatClient) {
|
|
21585
|
-
_context24.n =
|
|
21596
|
+
_context24.n = 6;
|
|
21586
21597
|
break;
|
|
21587
21598
|
}
|
|
21588
|
-
connectionState = sceytChatClient.connectionState;
|
|
21589
21599
|
user = sceytChatClient.user;
|
|
21590
21600
|
vote = {
|
|
21591
21601
|
optionId: optionId,
|
|
@@ -21608,10 +21618,6 @@ function addPollVote(action) {
|
|
|
21608
21618
|
createdAt: new Date().getTime()
|
|
21609
21619
|
}
|
|
21610
21620
|
};
|
|
21611
|
-
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21612
|
-
_context24.n = 6;
|
|
21613
|
-
break;
|
|
21614
|
-
}
|
|
21615
21621
|
pendingAction = {
|
|
21616
21622
|
type: 'ADD_POLL_VOTE',
|
|
21617
21623
|
channelId: channelId,
|
|
@@ -21661,27 +21667,25 @@ function addPollVote(action) {
|
|
|
21661
21667
|
}
|
|
21662
21668
|
return _context24.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
|
|
21663
21669
|
case 5:
|
|
21664
|
-
if (!conflictCheck.shouldSkip) {
|
|
21670
|
+
if (!conflictCheck.shouldSkip && !isResend) {
|
|
21665
21671
|
setPendingPollAction(pendingAction);
|
|
21666
21672
|
}
|
|
21667
|
-
return _context24.
|
|
21673
|
+
return _context24.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message)), 6);
|
|
21668
21674
|
case 6:
|
|
21669
|
-
|
|
21670
|
-
case 7:
|
|
21671
|
-
_context24.n = 9;
|
|
21675
|
+
_context24.n = 8;
|
|
21672
21676
|
break;
|
|
21673
|
-
case
|
|
21674
|
-
_context24.p =
|
|
21677
|
+
case 7:
|
|
21678
|
+
_context24.p = 7;
|
|
21675
21679
|
_t32 = _context24.v;
|
|
21676
21680
|
log.error('error in add poll vote', _t32);
|
|
21677
|
-
case
|
|
21681
|
+
case 8:
|
|
21678
21682
|
return _context24.a(2);
|
|
21679
21683
|
}
|
|
21680
|
-
}, _marked19$1, null, [[0,
|
|
21684
|
+
}, _marked19$1, null, [[0, 7]]);
|
|
21681
21685
|
}
|
|
21682
|
-
function executeDeletePollVote(channelId, pollId, optionId, message
|
|
21686
|
+
function executeDeletePollVote(channelId, pollId, optionId, message) {
|
|
21683
21687
|
var _message$pollDetails8, _message$pollDetails9, _message$pollDetails0;
|
|
21684
|
-
var channel, vote
|
|
21688
|
+
var channel, vote;
|
|
21685
21689
|
return _regenerator().w(function (_context25) {
|
|
21686
21690
|
while (1) switch (_context25.n) {
|
|
21687
21691
|
case 0:
|
|
@@ -21704,33 +21708,16 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21704
21708
|
}
|
|
21705
21709
|
return _context25.a(2);
|
|
21706
21710
|
case 3:
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
vote: vote,
|
|
21710
|
-
incrementVotesPerOptionCount: -1
|
|
21711
|
-
};
|
|
21712
|
-
if (isResend) {
|
|
21713
|
-
_context25.n = 4;
|
|
21711
|
+
if (!(channel && message.id)) {
|
|
21712
|
+
_context25.n = 5;
|
|
21714
21713
|
break;
|
|
21715
21714
|
}
|
|
21716
|
-
updateMessageOnMap(channel.id, {
|
|
21717
|
-
messageId: message.id,
|
|
21718
|
-
params: {}
|
|
21719
|
-
}, obj);
|
|
21720
|
-
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21721
21715
|
_context25.n = 4;
|
|
21722
|
-
return effects.
|
|
21716
|
+
return effects.call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
21723
21717
|
case 4:
|
|
21724
|
-
if (!channel) {
|
|
21725
|
-
_context25.n = 6;
|
|
21726
|
-
break;
|
|
21727
|
-
}
|
|
21728
21718
|
_context25.n = 5;
|
|
21729
|
-
return effects.call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
21730
|
-
case 5:
|
|
21731
|
-
_context25.n = 6;
|
|
21732
21719
|
return effects.put(removePendingPollActionAC(message.id, 'DELETE_POLL_VOTE', optionId));
|
|
21733
|
-
case
|
|
21720
|
+
case 5:
|
|
21734
21721
|
return _context25.a(2);
|
|
21735
21722
|
}
|
|
21736
21723
|
}, _marked20$1);
|
|
@@ -21774,7 +21761,7 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
|
|
|
21774
21761
|
}, _marked21$1);
|
|
21775
21762
|
}
|
|
21776
21763
|
function deletePollVote(action) {
|
|
21777
|
-
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11,
|
|
21764
|
+
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, vote, pendingAction, conflictCheck, channel, _Object$values2, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t33;
|
|
21778
21765
|
return _regenerator().w(function (_context27) {
|
|
21779
21766
|
while (1) switch (_context27.p = _context27.n) {
|
|
21780
21767
|
case 0:
|
|
@@ -21783,10 +21770,9 @@ function deletePollVote(action) {
|
|
|
21783
21770
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21784
21771
|
sceytChatClient = getClient();
|
|
21785
21772
|
if (!sceytChatClient) {
|
|
21786
|
-
_context27.n =
|
|
21773
|
+
_context27.n = 7;
|
|
21787
21774
|
break;
|
|
21788
21775
|
}
|
|
21789
|
-
connectionState = sceytChatClient.connectionState;
|
|
21790
21776
|
vote = (_message$pollDetails1 = message.pollDetails) === null || _message$pollDetails1 === void 0 ? void 0 : (_message$pollDetails10 = _message$pollDetails1.voteDetails) === null || _message$pollDetails10 === void 0 ? void 0 : (_message$pollDetails11 = _message$pollDetails10.ownVotes) === null || _message$pollDetails11 === void 0 ? void 0 : _message$pollDetails11.find(function (vote) {
|
|
21791
21777
|
return vote.optionId === optionId;
|
|
21792
21778
|
});
|
|
@@ -21796,10 +21782,6 @@ function deletePollVote(action) {
|
|
|
21796
21782
|
}
|
|
21797
21783
|
return _context27.a(2);
|
|
21798
21784
|
case 1:
|
|
21799
|
-
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21800
|
-
_context27.n = 7;
|
|
21801
|
-
break;
|
|
21802
|
-
}
|
|
21803
21785
|
pendingAction = {
|
|
21804
21786
|
type: 'DELETE_POLL_VOTE',
|
|
21805
21787
|
channelId: channelId,
|
|
@@ -21848,23 +21830,21 @@ function deletePollVote(action) {
|
|
|
21848
21830
|
}
|
|
21849
21831
|
return _context27.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
|
|
21850
21832
|
case 6:
|
|
21851
|
-
if (!conflictCheck.shouldSkip) {
|
|
21833
|
+
if (!conflictCheck.shouldSkip && !isResend) {
|
|
21852
21834
|
setPendingPollAction(pendingAction);
|
|
21853
21835
|
}
|
|
21854
|
-
return _context27.
|
|
21836
|
+
return _context27.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message)), 7);
|
|
21855
21837
|
case 7:
|
|
21856
|
-
|
|
21857
|
-
case 8:
|
|
21858
|
-
_context27.n = 10;
|
|
21838
|
+
_context27.n = 9;
|
|
21859
21839
|
break;
|
|
21860
|
-
case
|
|
21861
|
-
_context27.p =
|
|
21840
|
+
case 8:
|
|
21841
|
+
_context27.p = 8;
|
|
21862
21842
|
_t33 = _context27.v;
|
|
21863
21843
|
log.error('error in delete poll vote', _t33);
|
|
21864
|
-
case
|
|
21844
|
+
case 9:
|
|
21865
21845
|
return _context27.a(2);
|
|
21866
21846
|
}
|
|
21867
|
-
}, _marked22$1, null, [[0,
|
|
21847
|
+
}, _marked22$1, null, [[0, 8]]);
|
|
21868
21848
|
}
|
|
21869
21849
|
function executeClosePoll(channelId, pollId, message) {
|
|
21870
21850
|
var channel, obj;
|
|
@@ -21887,7 +21867,7 @@ function executeClosePoll(channelId, pollId, message) {
|
|
|
21887
21867
|
_context28.n = 2;
|
|
21888
21868
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21889
21869
|
case 2:
|
|
21890
|
-
if (!channel) {
|
|
21870
|
+
if (!(channel && message.id)) {
|
|
21891
21871
|
_context28.n = 4;
|
|
21892
21872
|
break;
|
|
21893
21873
|
}
|
|
@@ -21979,7 +21959,7 @@ function closePoll(action) {
|
|
|
21979
21959
|
}, _marked25$1, null, [[0, 4]]);
|
|
21980
21960
|
}
|
|
21981
21961
|
function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
21982
|
-
var channel,
|
|
21962
|
+
var channel, _iterator2, _step2, obj;
|
|
21983
21963
|
return _regenerator().w(function (_context31) {
|
|
21984
21964
|
while (1) switch (_context31.n) {
|
|
21985
21965
|
case 0:
|
|
@@ -21991,13 +21971,13 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
21991
21971
|
_context31.n = 4;
|
|
21992
21972
|
break;
|
|
21993
21973
|
}
|
|
21994
|
-
|
|
21974
|
+
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21995
21975
|
case 2:
|
|
21996
|
-
if ((
|
|
21976
|
+
if ((_step2 = _iterator2()).done) {
|
|
21997
21977
|
_context31.n = 4;
|
|
21998
21978
|
break;
|
|
21999
21979
|
}
|
|
22000
|
-
obj =
|
|
21980
|
+
obj = _step2.value;
|
|
22001
21981
|
updateMessageOnMap(channelId, {
|
|
22002
21982
|
messageId: message.id,
|
|
22003
21983
|
params: {}
|
|
@@ -22009,7 +21989,7 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
22009
21989
|
_context31.n = 2;
|
|
22010
21990
|
break;
|
|
22011
21991
|
case 4:
|
|
22012
|
-
if (!channel) {
|
|
21992
|
+
if (!(channel && message.id)) {
|
|
22013
21993
|
_context31.n = 6;
|
|
22014
21994
|
break;
|
|
22015
21995
|
}
|
|
@@ -22024,7 +22004,7 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
22024
22004
|
}, _marked26$1);
|
|
22025
22005
|
}
|
|
22026
22006
|
function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
|
|
22027
|
-
var channel,
|
|
22007
|
+
var channel, _iterator3, _step3, obj;
|
|
22028
22008
|
return _regenerator().w(function (_context32) {
|
|
22029
22009
|
while (1) switch (_context32.n) {
|
|
22030
22010
|
case 0:
|
|
@@ -22038,13 +22018,13 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
22038
22018
|
}
|
|
22039
22019
|
return _context32.a(2);
|
|
22040
22020
|
case 2:
|
|
22041
|
-
|
|
22021
|
+
_iterator3 = _createForOfIteratorHelperLoose(objs);
|
|
22042
22022
|
case 3:
|
|
22043
|
-
if ((
|
|
22023
|
+
if ((_step3 = _iterator3()).done) {
|
|
22044
22024
|
_context32.n = 5;
|
|
22045
22025
|
break;
|
|
22046
22026
|
}
|
|
22047
|
-
obj =
|
|
22027
|
+
obj = _step3.value;
|
|
22048
22028
|
updateMessageOnMap(channelId, {
|
|
22049
22029
|
messageId: message.id,
|
|
22050
22030
|
params: {}
|
|
@@ -22061,7 +22041,7 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
22061
22041
|
}, _marked27$1);
|
|
22062
22042
|
}
|
|
22063
22043
|
function retractPollVote(action) {
|
|
22064
|
-
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs,
|
|
22044
|
+
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator4, _step4, _message$pollDetails12, _message$pollDetails13, vote, _t35;
|
|
22065
22045
|
return _regenerator().w(function (_context33) {
|
|
22066
22046
|
while (1) switch (_context33.p = _context33.n) {
|
|
22067
22047
|
case 0:
|
|
@@ -22075,8 +22055,8 @@ function retractPollVote(action) {
|
|
|
22075
22055
|
}
|
|
22076
22056
|
connectionState = sceytChatClient.connectionState;
|
|
22077
22057
|
objs = [];
|
|
22078
|
-
for (
|
|
22079
|
-
vote =
|
|
22058
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(((_message$pollDetails12 = message.pollDetails) === null || _message$pollDetails12 === void 0 ? void 0 : (_message$pollDetails13 = _message$pollDetails12.voteDetails) === null || _message$pollDetails13 === void 0 ? void 0 : _message$pollDetails13.ownVotes) || []); !(_step4 = _iterator4()).done;) {
|
|
22059
|
+
vote = _step4.value;
|
|
22080
22060
|
objs.push({
|
|
22081
22061
|
type: 'deleteOwn',
|
|
22082
22062
|
vote: vote,
|
|
@@ -38528,7 +38508,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38528
38508
|
if (unreadScrollTo) {
|
|
38529
38509
|
return Promise.resolve();
|
|
38530
38510
|
}
|
|
38531
|
-
if (target.scrollTop === 0 && scrollToNewMessage.scrollToBottom && scrollToNewMessage.updateMessageList && messagesLoading !== LOADING_STATE.LOADING) {
|
|
38511
|
+
if (target.scrollTop === 0 && scrollToNewMessage.scrollToBottom && scrollToNewMessage.updateMessageList && messagesLoading !== LOADING_STATE.LOADING && channel !== null && channel !== void 0 && channel.id) {
|
|
38532
38512
|
dispatch(getMessagesAC(channel, true));
|
|
38533
38513
|
}
|
|
38534
38514
|
if (target.scrollTop <= -50) {
|
|
@@ -38617,7 +38597,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38617
38597
|
nextDisableRef.current = false;
|
|
38618
38598
|
}, 1000 + positiveValue * 0.1);
|
|
38619
38599
|
}
|
|
38620
|
-
} else {
|
|
38600
|
+
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
38621
38601
|
dispatch(getMessagesAC(channel, undefined, messageId, undefined, true, 'smooth', true));
|
|
38622
38602
|
}
|
|
38623
38603
|
return Promise.resolve();
|
|
@@ -38801,7 +38781,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38801
38781
|
prevDisableRef.current = false;
|
|
38802
38782
|
shouldLoadMessagesRef.current = '';
|
|
38803
38783
|
loadingRef.current = false;
|
|
38804
|
-
if (channel.backToLinkedChannel) {
|
|
38784
|
+
if (channel.backToLinkedChannel && channel !== null && channel !== void 0 && channel.id) {
|
|
38805
38785
|
var visibleMessages = getVisibleMessagesMap();
|
|
38806
38786
|
var visibleMessagesIds = Object.keys(visibleMessages);
|
|
38807
38787
|
var messageId = visibleMessagesIds[visibleMessagesIds.length - 1];
|
|
@@ -38811,7 +38791,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38811
38791
|
if (!channel.isLinkedChannel) {
|
|
38812
38792
|
clearVisibleMessagesMap();
|
|
38813
38793
|
}
|
|
38814
|
-
if (channel) {
|
|
38794
|
+
if (channel && channel !== null && channel !== void 0 && channel.id) {
|
|
38815
38795
|
dispatch(getMessagesAC(channel, undefined, undefined, undefined, true));
|
|
38816
38796
|
}
|
|
38817
38797
|
if (channel.id) {
|
|
@@ -38980,7 +38960,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38980
38960
|
setScrollIntoView(true);
|
|
38981
38961
|
var lastReadMessageNode = document.getElementById(channel.lastDisplayedMessageId) || null;
|
|
38982
38962
|
var newLastDisplayedMessageId = channel.lastDisplayedMessageId;
|
|
38983
|
-
if (!lastReadMessageNode) {
|
|
38963
|
+
if (!lastReadMessageNode && channel.lastDisplayedMessageId && channel.lastDisplayedMessageId !== '0') {
|
|
38984
38964
|
for (var index = 0; index < messages.length; index++) {
|
|
38985
38965
|
var message = messages[index];
|
|
38986
38966
|
if (channel.lastDisplayedMessageId >= message.id && (messages.length < index + 2 || channel.lastDisplayedMessageId <= messages[index + 1].id)) {
|
|
@@ -38989,6 +38969,9 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38989
38969
|
break;
|
|
38990
38970
|
}
|
|
38991
38971
|
}
|
|
38972
|
+
} else if (!lastReadMessageNode && (!channel.lastDisplayedMessageId || channel.lastDisplayedMessageId === '0') && messages !== null && messages !== void 0 && messages.length) {
|
|
38973
|
+
newLastDisplayedMessageId = messages[0].id;
|
|
38974
|
+
lastReadMessageNode = document.getElementById(newLastDisplayedMessageId);
|
|
38992
38975
|
}
|
|
38993
38976
|
if (lastReadMessageNode && scrollElement) {
|
|
38994
38977
|
dispatch(scrollToNewMessageAC(false));
|
|
@@ -48301,7 +48284,7 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
48301
48284
|
});
|
|
48302
48285
|
}
|
|
48303
48286
|
}
|
|
48304
|
-
} else {
|
|
48287
|
+
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
48305
48288
|
dispatch(getMessagesAC(channel, true, messageId, undefined, false, 'smooth', true));
|
|
48306
48289
|
}
|
|
48307
48290
|
return Promise.resolve();
|
|
@@ -48490,7 +48473,7 @@ var MessagesScrollToUnreadMentionsButton = function MessagesScrollToUnreadMentio
|
|
|
48490
48473
|
repliedMessage.classList.remove('highlight');
|
|
48491
48474
|
}, 1500);
|
|
48492
48475
|
}
|
|
48493
|
-
} else {
|
|
48476
|
+
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
48494
48477
|
dispatch(getMessagesAC(channel, undefined, messageId));
|
|
48495
48478
|
}
|
|
48496
48479
|
return Promise.resolve();
|
package/index.modern.js
CHANGED
|
@@ -10739,6 +10739,12 @@ function setPendingPollActionsMapAC(messageId, event) {
|
|
|
10739
10739
|
event: event
|
|
10740
10740
|
});
|
|
10741
10741
|
}
|
|
10742
|
+
function updatePendingPollActionAC(messageId, message) {
|
|
10743
|
+
return updatePendingPollAction({
|
|
10744
|
+
messageId: messageId,
|
|
10745
|
+
message: message
|
|
10746
|
+
});
|
|
10747
|
+
}
|
|
10742
10748
|
function setPendingMessageAC(channelId, message) {
|
|
10743
10749
|
return setPendingMessage$1({
|
|
10744
10750
|
channelId: channelId,
|
|
@@ -11840,10 +11846,24 @@ var messageSlice = createSlice({
|
|
|
11840
11846
|
}
|
|
11841
11847
|
state.pendingPollActions[messageId] = [].concat(state.pendingPollActions[messageId], [event]);
|
|
11842
11848
|
},
|
|
11843
|
-
|
|
11849
|
+
updatePendingPollAction: function updatePendingPollAction(state, action) {
|
|
11844
11850
|
var _action$payload20 = action.payload,
|
|
11845
|
-
|
|
11851
|
+
messageId = _action$payload20.messageId,
|
|
11846
11852
|
message = _action$payload20.message;
|
|
11853
|
+
if (!state.pendingPollActions[messageId]) {
|
|
11854
|
+
return;
|
|
11855
|
+
}
|
|
11856
|
+
state.pendingPollActions[messageId] = state.pendingPollActions[messageId].map(function (action) {
|
|
11857
|
+
var _action$message, _action$message2;
|
|
11858
|
+
return ((_action$message = action.message) === null || _action$message === void 0 ? void 0 : _action$message.id) === messageId || ((_action$message2 = action.message) === null || _action$message2 === void 0 ? void 0 : _action$message2.tid) === messageId ? _extends({}, action, {
|
|
11859
|
+
message: message
|
|
11860
|
+
}) : action;
|
|
11861
|
+
});
|
|
11862
|
+
},
|
|
11863
|
+
setPendingMessage: function setPendingMessage(state, action) {
|
|
11864
|
+
var _action$payload21 = action.payload,
|
|
11865
|
+
channelId = _action$payload21.channelId,
|
|
11866
|
+
message = _action$payload21.message;
|
|
11847
11867
|
if (!state.pendingMessagesMap[channelId]) {
|
|
11848
11868
|
state.pendingMessagesMap[channelId] = [];
|
|
11849
11869
|
}
|
|
@@ -11855,9 +11875,9 @@ var messageSlice = createSlice({
|
|
|
11855
11875
|
}
|
|
11856
11876
|
},
|
|
11857
11877
|
removePendingMessage: function removePendingMessage(state, action) {
|
|
11858
|
-
var _action$
|
|
11859
|
-
channelId = _action$
|
|
11860
|
-
messageId = _action$
|
|
11878
|
+
var _action$payload22 = action.payload,
|
|
11879
|
+
channelId = _action$payload22.channelId,
|
|
11880
|
+
messageId = _action$payload22.messageId;
|
|
11861
11881
|
if (state.pendingMessagesMap[channelId]) {
|
|
11862
11882
|
state.pendingMessagesMap[channelId] = state.pendingMessagesMap[channelId].filter(function (msg) {
|
|
11863
11883
|
return !(msg.id === messageId || msg.tid === messageId);
|
|
@@ -11868,10 +11888,10 @@ var messageSlice = createSlice({
|
|
|
11868
11888
|
}
|
|
11869
11889
|
},
|
|
11870
11890
|
updatePendingMessage: function updatePendingMessage(state, action) {
|
|
11871
|
-
var _action$
|
|
11872
|
-
channelId = _action$
|
|
11873
|
-
messageId = _action$
|
|
11874
|
-
updatedMessage = _action$
|
|
11891
|
+
var _action$payload23 = action.payload,
|
|
11892
|
+
channelId = _action$payload23.channelId,
|
|
11893
|
+
messageId = _action$payload23.messageId,
|
|
11894
|
+
updatedMessage = _action$payload23.updatedMessage;
|
|
11875
11895
|
if (state.pendingMessagesMap[channelId]) {
|
|
11876
11896
|
state.pendingMessagesMap[channelId] = state.pendingMessagesMap[channelId].map(function (msg) {
|
|
11877
11897
|
if (msg.id === messageId || msg.tid === messageId) {
|
|
@@ -11946,7 +11966,8 @@ var _messageSlice$actions = messageSlice.actions,
|
|
|
11946
11966
|
setPendingPollActionsMap = _messageSlice$actions.setPendingPollActionsMap,
|
|
11947
11967
|
setPendingMessage$1 = _messageSlice$actions.setPendingMessage,
|
|
11948
11968
|
removePendingMessage = _messageSlice$actions.removePendingMessage,
|
|
11949
|
-
updatePendingMessage = _messageSlice$actions.updatePendingMessage
|
|
11969
|
+
updatePendingMessage = _messageSlice$actions.updatePendingMessage,
|
|
11970
|
+
updatePendingPollAction = _messageSlice$actions.updatePendingPollAction;
|
|
11950
11971
|
var MessageReducer = messageSlice.reducer;
|
|
11951
11972
|
|
|
11952
11973
|
var initialState$2 = {
|
|
@@ -15424,6 +15445,7 @@ function watchForEvents() {
|
|
|
15424
15445
|
}
|
|
15425
15446
|
return _context.a(3, 183);
|
|
15426
15447
|
case 99:
|
|
15448
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_ADDED ... ');
|
|
15427
15449
|
_channel10 = args.channel, pollDetails = args.pollDetails, _messageId = args.messageId;
|
|
15428
15450
|
pollDetailsData = pollDetails;
|
|
15429
15451
|
_context.n = 100;
|
|
@@ -15508,6 +15530,7 @@ function watchForEvents() {
|
|
|
15508
15530
|
case 108:
|
|
15509
15531
|
return _context.a(3, 183);
|
|
15510
15532
|
case 109:
|
|
15533
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_DELETED ... ');
|
|
15511
15534
|
_channel11 = args.channel, _pollDetails = args.pollDetails, _messageId2 = args.messageId;
|
|
15512
15535
|
_pollDetailsData = _pollDetails;
|
|
15513
15536
|
_context.n = 110;
|
|
@@ -15567,6 +15590,7 @@ function watchForEvents() {
|
|
|
15567
15590
|
case 116:
|
|
15568
15591
|
return _context.a(3, 183);
|
|
15569
15592
|
case 117:
|
|
15593
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_RETRACTED ... ');
|
|
15570
15594
|
_channel12 = args.channel, _pollDetails2 = args.pollDetails, _messageId3 = args.messageId;
|
|
15571
15595
|
_context.n = 118;
|
|
15572
15596
|
return call(getActiveChannelId);
|
|
@@ -15625,6 +15649,7 @@ function watchForEvents() {
|
|
|
15625
15649
|
case 124:
|
|
15626
15650
|
return _context.a(3, 183);
|
|
15627
15651
|
case 125:
|
|
15652
|
+
console.log('CHANNEL_EVENT_TYPES.POLL_CLOSED ... ');
|
|
15628
15653
|
_channel13 = args.channel, _messageId4 = args.messageId;
|
|
15629
15654
|
_context.n = 126;
|
|
15630
15655
|
return call(getActiveChannelId);
|
|
@@ -19142,6 +19167,10 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
19142
19167
|
_context.n = 7;
|
|
19143
19168
|
break;
|
|
19144
19169
|
case 6:
|
|
19170
|
+
if (!(channel !== null && channel !== void 0 && channel.id)) {
|
|
19171
|
+
_context.n = 7;
|
|
19172
|
+
break;
|
|
19173
|
+
}
|
|
19145
19174
|
_context.n = 7;
|
|
19146
19175
|
return put(getMessagesAC(channel, false, channel === null || channel === void 0 ? void 0 : (_channel$lastMessage3 = channel.lastMessage) === null || _channel$lastMessage3 === void 0 ? void 0 : _channel$lastMessage3.id, undefined, false, 'smooth', true));
|
|
19147
19176
|
case 7:
|
|
@@ -19357,7 +19386,7 @@ function sendMessage(action) {
|
|
|
19357
19386
|
messagesToSend.push(messageToSend);
|
|
19358
19387
|
case 12:
|
|
19359
19388
|
_loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
19360
|
-
var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData,
|
|
19389
|
+
var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, stringifiedMessageUpdateData, activeChannelId, channelUpdateParam, isErrorResendable, _t;
|
|
19361
19390
|
return _regenerator().w(function (_context3) {
|
|
19362
19391
|
while (1) switch (_context3.p = _context3.n) {
|
|
19363
19392
|
case 0:
|
|
@@ -19459,23 +19488,23 @@ function sendMessage(action) {
|
|
|
19459
19488
|
createdAt: messageResponse.createdAt,
|
|
19460
19489
|
channelId: channel.id
|
|
19461
19490
|
};
|
|
19491
|
+
stringifiedMessageUpdateData = JSON.parse(JSON.stringify(messageUpdateData));
|
|
19462
19492
|
activeChannelId = getActiveChannelId();
|
|
19463
19493
|
if (!(activeChannelId === channel.id)) {
|
|
19464
19494
|
_context3.n = 9;
|
|
19465
19495
|
break;
|
|
19466
19496
|
}
|
|
19467
19497
|
_context3.n = 9;
|
|
19468
|
-
return put(updateMessageAC(messageToSend.tid,
|
|
19498
|
+
return put(updateMessageAC(messageToSend.tid, stringifiedMessageUpdateData, true));
|
|
19469
19499
|
case 9:
|
|
19470
19500
|
_context3.n = 10;
|
|
19471
19501
|
return put(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19472
19502
|
case 10:
|
|
19473
|
-
addMessageToMap(channel.id,
|
|
19503
|
+
addMessageToMap(channel.id, stringifiedMessageUpdateData);
|
|
19474
19504
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19475
|
-
|
|
19476
|
-
updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
|
|
19505
|
+
updateChannelLastMessageOnAllChannels(channel.id, stringifiedMessageUpdateData);
|
|
19477
19506
|
channelUpdateParam = {
|
|
19478
|
-
lastMessage:
|
|
19507
|
+
lastMessage: stringifiedMessageUpdateData,
|
|
19479
19508
|
lastReactedMessage: null
|
|
19480
19509
|
};
|
|
19481
19510
|
if (!channel.unread) {
|
|
@@ -19566,7 +19595,7 @@ function sendMessage(action) {
|
|
|
19566
19595
|
}, _marked$3, null, [[1, 16, 17, 19]]);
|
|
19567
19596
|
}
|
|
19568
19597
|
function sendTextMessage(action) {
|
|
19569
|
-
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, activeChannelId, messageToUpdate, channelUpdateParam, isErrorResendable, _activeChannelId, _t3;
|
|
19598
|
+
var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, activeChannelId, stringifiedMessageUpdateData, messageToUpdate, channelUpdateParam, isErrorResendable, _activeChannelId, _t3;
|
|
19570
19599
|
return _regenerator().w(function (_context5) {
|
|
19571
19600
|
while (1) switch (_context5.p = _context5.n) {
|
|
19572
19601
|
case 0:
|
|
@@ -19654,7 +19683,7 @@ function sendTextMessage(action) {
|
|
|
19654
19683
|
return call(updateMessage$1, action.type, pendingMessage, channel.id, true, message);
|
|
19655
19684
|
case 8:
|
|
19656
19685
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19657
|
-
_context5.n =
|
|
19686
|
+
_context5.n = 18;
|
|
19658
19687
|
break;
|
|
19659
19688
|
}
|
|
19660
19689
|
if (!sendMessageHandler) {
|
|
@@ -19698,10 +19727,14 @@ function sendTextMessage(action) {
|
|
|
19698
19727
|
_context5.n = 13;
|
|
19699
19728
|
return put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
|
|
19700
19729
|
case 13:
|
|
19730
|
+
stringifiedMessageUpdateData = JSON.parse(JSON.stringify(messageUpdateData));
|
|
19701
19731
|
_context5.n = 14;
|
|
19702
|
-
return put(
|
|
19732
|
+
return put(updatePendingPollActionAC(messageToSend.tid, stringifiedMessageUpdateData));
|
|
19703
19733
|
case 14:
|
|
19704
|
-
|
|
19734
|
+
_context5.n = 15;
|
|
19735
|
+
return put(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19736
|
+
case 15:
|
|
19737
|
+
addMessageToMap(channel.id, stringifiedMessageUpdateData);
|
|
19705
19738
|
if (activeChannelId === channel.id) {
|
|
19706
19739
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19707
19740
|
}
|
|
@@ -19711,42 +19744,42 @@ function sendTextMessage(action) {
|
|
|
19711
19744
|
lastMessage: messageToUpdate,
|
|
19712
19745
|
lastReactedMessage: null
|
|
19713
19746
|
};
|
|
19714
|
-
_context5.n =
|
|
19747
|
+
_context5.n = 16;
|
|
19715
19748
|
return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19716
|
-
case
|
|
19749
|
+
case 16:
|
|
19717
19750
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19718
19751
|
if (!channel.unread) {
|
|
19719
|
-
_context5.n =
|
|
19752
|
+
_context5.n = 17;
|
|
19720
19753
|
break;
|
|
19721
19754
|
}
|
|
19722
|
-
_context5.n =
|
|
19755
|
+
_context5.n = 17;
|
|
19723
19756
|
return put(markChannelAsReadAC(channel.id));
|
|
19724
|
-
case
|
|
19757
|
+
case 17:
|
|
19725
19758
|
channel.lastMessage = messageToUpdate;
|
|
19726
|
-
_context5.n =
|
|
19759
|
+
_context5.n = 19;
|
|
19727
19760
|
break;
|
|
19728
|
-
case 17:
|
|
19729
|
-
throw new Error('Connection required to send message');
|
|
19730
19761
|
case 18:
|
|
19731
|
-
|
|
19732
|
-
break;
|
|
19762
|
+
throw new Error('Connection required to send message');
|
|
19733
19763
|
case 19:
|
|
19734
|
-
_context5.
|
|
19764
|
+
_context5.n = 23;
|
|
19765
|
+
break;
|
|
19766
|
+
case 20:
|
|
19767
|
+
_context5.p = 20;
|
|
19735
19768
|
_t3 = _context5.v;
|
|
19736
19769
|
log.error('error on send text message ... ', _t3 === null || _t3 === void 0 ? void 0 : _t3.type);
|
|
19737
19770
|
isErrorResendable = isResendableError(_t3 === null || _t3 === void 0 ? void 0 : _t3.type);
|
|
19738
19771
|
if (!(!isErrorResendable && channel.id && sendMessageTid)) {
|
|
19739
|
-
_context5.n =
|
|
19772
|
+
_context5.n = 22;
|
|
19740
19773
|
break;
|
|
19741
19774
|
}
|
|
19742
|
-
_context5.n =
|
|
19775
|
+
_context5.n = 21;
|
|
19743
19776
|
return put(removePendingMessageAC(channel.id, sendMessageTid));
|
|
19744
|
-
case 20:
|
|
19745
|
-
_context5.n = 22;
|
|
19746
|
-
break;
|
|
19747
19777
|
case 21:
|
|
19778
|
+
_context5.n = 23;
|
|
19779
|
+
break;
|
|
19780
|
+
case 22:
|
|
19748
19781
|
if (!(channel.id && sendMessageTid)) {
|
|
19749
|
-
_context5.n =
|
|
19782
|
+
_context5.n = 23;
|
|
19750
19783
|
break;
|
|
19751
19784
|
}
|
|
19752
19785
|
updateMessageOnMap(channel.id, {
|
|
@@ -19757,26 +19790,26 @@ function sendTextMessage(action) {
|
|
|
19757
19790
|
});
|
|
19758
19791
|
_activeChannelId = getActiveChannelId();
|
|
19759
19792
|
if (!(_activeChannelId === channel.id)) {
|
|
19760
|
-
_context5.n =
|
|
19793
|
+
_context5.n = 23;
|
|
19761
19794
|
break;
|
|
19762
19795
|
}
|
|
19763
19796
|
updateMessageOnAllMessages(sendMessageTid, {
|
|
19764
19797
|
state: MESSAGE_STATUS.FAILED
|
|
19765
19798
|
});
|
|
19766
|
-
_context5.n =
|
|
19799
|
+
_context5.n = 23;
|
|
19767
19800
|
return put(updateMessageAC(sendMessageTid, {
|
|
19768
19801
|
state: MESSAGE_STATUS.FAILED
|
|
19769
19802
|
}));
|
|
19770
|
-
case 22:
|
|
19771
|
-
_context5.p = 22;
|
|
19772
|
-
_context5.n = 23;
|
|
19773
|
-
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19774
19803
|
case 23:
|
|
19775
|
-
|
|
19804
|
+
_context5.p = 23;
|
|
19805
|
+
_context5.n = 24;
|
|
19806
|
+
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19776
19807
|
case 24:
|
|
19808
|
+
return _context5.f(23);
|
|
19809
|
+
case 25:
|
|
19777
19810
|
return _context5.a(2);
|
|
19778
19811
|
}
|
|
19779
|
-
}, _marked2$2, null, [[3,
|
|
19812
|
+
}, _marked2$2, null, [[3, 20, 23, 25]]);
|
|
19780
19813
|
}
|
|
19781
19814
|
function forwardMessage(action) {
|
|
19782
19815
|
var payload, message, channelId, connectionState, isForward, pendingMessage, channel, activeChannelId, messageTid, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, isErrorResendable, _activeChannelId2, _t4;
|
|
@@ -21446,9 +21479,9 @@ function getMessageMarkers(action) {
|
|
|
21446
21479
|
}
|
|
21447
21480
|
}, _marked16$1, null, [[0, 5, 6, 8]]);
|
|
21448
21481
|
}
|
|
21449
|
-
function executeAddPollVote(channelId, pollId, optionId, message
|
|
21482
|
+
function executeAddPollVote(channelId, pollId, optionId, message) {
|
|
21450
21483
|
var _user$presence, _message$pollDetails, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4;
|
|
21451
|
-
var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7
|
|
21484
|
+
var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7;
|
|
21452
21485
|
return _regenerator().w(function (_context22) {
|
|
21453
21486
|
while (1) switch (_context22.n) {
|
|
21454
21487
|
case 0:
|
|
@@ -21497,38 +21530,16 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21497
21530
|
vote: vote,
|
|
21498
21531
|
incrementVotesPerOptionCount: 1
|
|
21499
21532
|
});
|
|
21500
|
-
if (
|
|
21501
|
-
_context22.n =
|
|
21502
|
-
break;
|
|
21503
|
-
}
|
|
21504
|
-
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21505
|
-
case 3:
|
|
21506
|
-
if ((_step2 = _iterator2()).done) {
|
|
21507
|
-
_context22.n = 5;
|
|
21533
|
+
if (!(channel && message.id)) {
|
|
21534
|
+
_context22.n = 4;
|
|
21508
21535
|
break;
|
|
21509
21536
|
}
|
|
21510
|
-
obj = _step2.value;
|
|
21511
|
-
updateMessageOnMap(channel.id, {
|
|
21512
|
-
messageId: message.id,
|
|
21513
|
-
params: {}
|
|
21514
|
-
}, obj);
|
|
21515
|
-
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21516
|
-
_context22.n = 4;
|
|
21517
|
-
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21518
|
-
case 4:
|
|
21519
21537
|
_context22.n = 3;
|
|
21520
|
-
break;
|
|
21521
|
-
case 5:
|
|
21522
|
-
if (!channel) {
|
|
21523
|
-
_context22.n = 7;
|
|
21524
|
-
break;
|
|
21525
|
-
}
|
|
21526
|
-
_context22.n = 6;
|
|
21527
21538
|
return call(channel.addVote, message.id, pollId, [optionId]);
|
|
21528
|
-
case
|
|
21529
|
-
_context22.n =
|
|
21539
|
+
case 3:
|
|
21540
|
+
_context22.n = 4;
|
|
21530
21541
|
return put(removePendingPollActionAC(message.id, 'ADD_POLL_VOTE', optionId));
|
|
21531
|
-
case
|
|
21542
|
+
case 4:
|
|
21532
21543
|
return _context22.a(2);
|
|
21533
21544
|
}
|
|
21534
21545
|
}, _marked17$1);
|
|
@@ -21572,7 +21583,7 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
|
21572
21583
|
}, _marked18$1);
|
|
21573
21584
|
}
|
|
21574
21585
|
function addPollVote(action) {
|
|
21575
|
-
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2,
|
|
21586
|
+
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, user, vote, pendingAction, conflictCheck, channel, _Object$values, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t32;
|
|
21576
21587
|
return _regenerator().w(function (_context24) {
|
|
21577
21588
|
while (1) switch (_context24.p = _context24.n) {
|
|
21578
21589
|
case 0:
|
|
@@ -21581,10 +21592,9 @@ function addPollVote(action) {
|
|
|
21581
21592
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21582
21593
|
sceytChatClient = getClient();
|
|
21583
21594
|
if (!sceytChatClient) {
|
|
21584
|
-
_context24.n =
|
|
21595
|
+
_context24.n = 6;
|
|
21585
21596
|
break;
|
|
21586
21597
|
}
|
|
21587
|
-
connectionState = sceytChatClient.connectionState;
|
|
21588
21598
|
user = sceytChatClient.user;
|
|
21589
21599
|
vote = {
|
|
21590
21600
|
optionId: optionId,
|
|
@@ -21607,10 +21617,6 @@ function addPollVote(action) {
|
|
|
21607
21617
|
createdAt: new Date().getTime()
|
|
21608
21618
|
}
|
|
21609
21619
|
};
|
|
21610
|
-
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21611
|
-
_context24.n = 6;
|
|
21612
|
-
break;
|
|
21613
|
-
}
|
|
21614
21620
|
pendingAction = {
|
|
21615
21621
|
type: 'ADD_POLL_VOTE',
|
|
21616
21622
|
channelId: channelId,
|
|
@@ -21660,27 +21666,25 @@ function addPollVote(action) {
|
|
|
21660
21666
|
}
|
|
21661
21667
|
return _context24.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
|
|
21662
21668
|
case 5:
|
|
21663
|
-
if (!conflictCheck.shouldSkip) {
|
|
21669
|
+
if (!conflictCheck.shouldSkip && !isResend) {
|
|
21664
21670
|
setPendingPollAction(pendingAction);
|
|
21665
21671
|
}
|
|
21666
|
-
return _context24.
|
|
21672
|
+
return _context24.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message)), 6);
|
|
21667
21673
|
case 6:
|
|
21668
|
-
|
|
21669
|
-
case 7:
|
|
21670
|
-
_context24.n = 9;
|
|
21674
|
+
_context24.n = 8;
|
|
21671
21675
|
break;
|
|
21672
|
-
case
|
|
21673
|
-
_context24.p =
|
|
21676
|
+
case 7:
|
|
21677
|
+
_context24.p = 7;
|
|
21674
21678
|
_t32 = _context24.v;
|
|
21675
21679
|
log.error('error in add poll vote', _t32);
|
|
21676
|
-
case
|
|
21680
|
+
case 8:
|
|
21677
21681
|
return _context24.a(2);
|
|
21678
21682
|
}
|
|
21679
|
-
}, _marked19$1, null, [[0,
|
|
21683
|
+
}, _marked19$1, null, [[0, 7]]);
|
|
21680
21684
|
}
|
|
21681
|
-
function executeDeletePollVote(channelId, pollId, optionId, message
|
|
21685
|
+
function executeDeletePollVote(channelId, pollId, optionId, message) {
|
|
21682
21686
|
var _message$pollDetails8, _message$pollDetails9, _message$pollDetails0;
|
|
21683
|
-
var channel, vote
|
|
21687
|
+
var channel, vote;
|
|
21684
21688
|
return _regenerator().w(function (_context25) {
|
|
21685
21689
|
while (1) switch (_context25.n) {
|
|
21686
21690
|
case 0:
|
|
@@ -21703,33 +21707,16 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21703
21707
|
}
|
|
21704
21708
|
return _context25.a(2);
|
|
21705
21709
|
case 3:
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
vote: vote,
|
|
21709
|
-
incrementVotesPerOptionCount: -1
|
|
21710
|
-
};
|
|
21711
|
-
if (isResend) {
|
|
21712
|
-
_context25.n = 4;
|
|
21710
|
+
if (!(channel && message.id)) {
|
|
21711
|
+
_context25.n = 5;
|
|
21713
21712
|
break;
|
|
21714
21713
|
}
|
|
21715
|
-
updateMessageOnMap(channel.id, {
|
|
21716
|
-
messageId: message.id,
|
|
21717
|
-
params: {}
|
|
21718
|
-
}, obj);
|
|
21719
|
-
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21720
21714
|
_context25.n = 4;
|
|
21721
|
-
return
|
|
21715
|
+
return call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
21722
21716
|
case 4:
|
|
21723
|
-
if (!channel) {
|
|
21724
|
-
_context25.n = 6;
|
|
21725
|
-
break;
|
|
21726
|
-
}
|
|
21727
21717
|
_context25.n = 5;
|
|
21728
|
-
return call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
21729
|
-
case 5:
|
|
21730
|
-
_context25.n = 6;
|
|
21731
21718
|
return put(removePendingPollActionAC(message.id, 'DELETE_POLL_VOTE', optionId));
|
|
21732
|
-
case
|
|
21719
|
+
case 5:
|
|
21733
21720
|
return _context25.a(2);
|
|
21734
21721
|
}
|
|
21735
21722
|
}, _marked20$1);
|
|
@@ -21773,7 +21760,7 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
|
|
|
21773
21760
|
}, _marked21$1);
|
|
21774
21761
|
}
|
|
21775
21762
|
function deletePollVote(action) {
|
|
21776
|
-
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11,
|
|
21763
|
+
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, vote, pendingAction, conflictCheck, channel, _Object$values2, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t33;
|
|
21777
21764
|
return _regenerator().w(function (_context27) {
|
|
21778
21765
|
while (1) switch (_context27.p = _context27.n) {
|
|
21779
21766
|
case 0:
|
|
@@ -21782,10 +21769,9 @@ function deletePollVote(action) {
|
|
|
21782
21769
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21783
21770
|
sceytChatClient = getClient();
|
|
21784
21771
|
if (!sceytChatClient) {
|
|
21785
|
-
_context27.n =
|
|
21772
|
+
_context27.n = 7;
|
|
21786
21773
|
break;
|
|
21787
21774
|
}
|
|
21788
|
-
connectionState = sceytChatClient.connectionState;
|
|
21789
21775
|
vote = (_message$pollDetails1 = message.pollDetails) === null || _message$pollDetails1 === void 0 ? void 0 : (_message$pollDetails10 = _message$pollDetails1.voteDetails) === null || _message$pollDetails10 === void 0 ? void 0 : (_message$pollDetails11 = _message$pollDetails10.ownVotes) === null || _message$pollDetails11 === void 0 ? void 0 : _message$pollDetails11.find(function (vote) {
|
|
21790
21776
|
return vote.optionId === optionId;
|
|
21791
21777
|
});
|
|
@@ -21795,10 +21781,6 @@ function deletePollVote(action) {
|
|
|
21795
21781
|
}
|
|
21796
21782
|
return _context27.a(2);
|
|
21797
21783
|
case 1:
|
|
21798
|
-
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21799
|
-
_context27.n = 7;
|
|
21800
|
-
break;
|
|
21801
|
-
}
|
|
21802
21784
|
pendingAction = {
|
|
21803
21785
|
type: 'DELETE_POLL_VOTE',
|
|
21804
21786
|
channelId: channelId,
|
|
@@ -21847,23 +21829,21 @@ function deletePollVote(action) {
|
|
|
21847
21829
|
}
|
|
21848
21830
|
return _context27.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
|
|
21849
21831
|
case 6:
|
|
21850
|
-
if (!conflictCheck.shouldSkip) {
|
|
21832
|
+
if (!conflictCheck.shouldSkip && !isResend) {
|
|
21851
21833
|
setPendingPollAction(pendingAction);
|
|
21852
21834
|
}
|
|
21853
|
-
return _context27.
|
|
21835
|
+
return _context27.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message)), 7);
|
|
21854
21836
|
case 7:
|
|
21855
|
-
|
|
21856
|
-
case 8:
|
|
21857
|
-
_context27.n = 10;
|
|
21837
|
+
_context27.n = 9;
|
|
21858
21838
|
break;
|
|
21859
|
-
case
|
|
21860
|
-
_context27.p =
|
|
21839
|
+
case 8:
|
|
21840
|
+
_context27.p = 8;
|
|
21861
21841
|
_t33 = _context27.v;
|
|
21862
21842
|
log.error('error in delete poll vote', _t33);
|
|
21863
|
-
case
|
|
21843
|
+
case 9:
|
|
21864
21844
|
return _context27.a(2);
|
|
21865
21845
|
}
|
|
21866
|
-
}, _marked22$1, null, [[0,
|
|
21846
|
+
}, _marked22$1, null, [[0, 8]]);
|
|
21867
21847
|
}
|
|
21868
21848
|
function executeClosePoll(channelId, pollId, message) {
|
|
21869
21849
|
var channel, obj;
|
|
@@ -21886,7 +21866,7 @@ function executeClosePoll(channelId, pollId, message) {
|
|
|
21886
21866
|
_context28.n = 2;
|
|
21887
21867
|
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21888
21868
|
case 2:
|
|
21889
|
-
if (!channel) {
|
|
21869
|
+
if (!(channel && message.id)) {
|
|
21890
21870
|
_context28.n = 4;
|
|
21891
21871
|
break;
|
|
21892
21872
|
}
|
|
@@ -21978,7 +21958,7 @@ function closePoll(action) {
|
|
|
21978
21958
|
}, _marked25$1, null, [[0, 4]]);
|
|
21979
21959
|
}
|
|
21980
21960
|
function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
21981
|
-
var channel,
|
|
21961
|
+
var channel, _iterator2, _step2, obj;
|
|
21982
21962
|
return _regenerator().w(function (_context31) {
|
|
21983
21963
|
while (1) switch (_context31.n) {
|
|
21984
21964
|
case 0:
|
|
@@ -21990,13 +21970,13 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
21990
21970
|
_context31.n = 4;
|
|
21991
21971
|
break;
|
|
21992
21972
|
}
|
|
21993
|
-
|
|
21973
|
+
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21994
21974
|
case 2:
|
|
21995
|
-
if ((
|
|
21975
|
+
if ((_step2 = _iterator2()).done) {
|
|
21996
21976
|
_context31.n = 4;
|
|
21997
21977
|
break;
|
|
21998
21978
|
}
|
|
21999
|
-
obj =
|
|
21979
|
+
obj = _step2.value;
|
|
22000
21980
|
updateMessageOnMap(channelId, {
|
|
22001
21981
|
messageId: message.id,
|
|
22002
21982
|
params: {}
|
|
@@ -22008,7 +21988,7 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
22008
21988
|
_context31.n = 2;
|
|
22009
21989
|
break;
|
|
22010
21990
|
case 4:
|
|
22011
|
-
if (!channel) {
|
|
21991
|
+
if (!(channel && message.id)) {
|
|
22012
21992
|
_context31.n = 6;
|
|
22013
21993
|
break;
|
|
22014
21994
|
}
|
|
@@ -22023,7 +22003,7 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
22023
22003
|
}, _marked26$1);
|
|
22024
22004
|
}
|
|
22025
22005
|
function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
|
|
22026
|
-
var channel,
|
|
22006
|
+
var channel, _iterator3, _step3, obj;
|
|
22027
22007
|
return _regenerator().w(function (_context32) {
|
|
22028
22008
|
while (1) switch (_context32.n) {
|
|
22029
22009
|
case 0:
|
|
@@ -22037,13 +22017,13 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
22037
22017
|
}
|
|
22038
22018
|
return _context32.a(2);
|
|
22039
22019
|
case 2:
|
|
22040
|
-
|
|
22020
|
+
_iterator3 = _createForOfIteratorHelperLoose(objs);
|
|
22041
22021
|
case 3:
|
|
22042
|
-
if ((
|
|
22022
|
+
if ((_step3 = _iterator3()).done) {
|
|
22043
22023
|
_context32.n = 5;
|
|
22044
22024
|
break;
|
|
22045
22025
|
}
|
|
22046
|
-
obj =
|
|
22026
|
+
obj = _step3.value;
|
|
22047
22027
|
updateMessageOnMap(channelId, {
|
|
22048
22028
|
messageId: message.id,
|
|
22049
22029
|
params: {}
|
|
@@ -22060,7 +22040,7 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
22060
22040
|
}, _marked27$1);
|
|
22061
22041
|
}
|
|
22062
22042
|
function retractPollVote(action) {
|
|
22063
|
-
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs,
|
|
22043
|
+
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator4, _step4, _message$pollDetails12, _message$pollDetails13, vote, _t35;
|
|
22064
22044
|
return _regenerator().w(function (_context33) {
|
|
22065
22045
|
while (1) switch (_context33.p = _context33.n) {
|
|
22066
22046
|
case 0:
|
|
@@ -22074,8 +22054,8 @@ function retractPollVote(action) {
|
|
|
22074
22054
|
}
|
|
22075
22055
|
connectionState = sceytChatClient.connectionState;
|
|
22076
22056
|
objs = [];
|
|
22077
|
-
for (
|
|
22078
|
-
vote =
|
|
22057
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(((_message$pollDetails12 = message.pollDetails) === null || _message$pollDetails12 === void 0 ? void 0 : (_message$pollDetails13 = _message$pollDetails12.voteDetails) === null || _message$pollDetails13 === void 0 ? void 0 : _message$pollDetails13.ownVotes) || []); !(_step4 = _iterator4()).done;) {
|
|
22058
|
+
vote = _step4.value;
|
|
22079
22059
|
objs.push({
|
|
22080
22060
|
type: 'deleteOwn',
|
|
22081
22061
|
vote: vote,
|
|
@@ -38527,7 +38507,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38527
38507
|
if (unreadScrollTo) {
|
|
38528
38508
|
return Promise.resolve();
|
|
38529
38509
|
}
|
|
38530
|
-
if (target.scrollTop === 0 && scrollToNewMessage.scrollToBottom && scrollToNewMessage.updateMessageList && messagesLoading !== LOADING_STATE.LOADING) {
|
|
38510
|
+
if (target.scrollTop === 0 && scrollToNewMessage.scrollToBottom && scrollToNewMessage.updateMessageList && messagesLoading !== LOADING_STATE.LOADING && channel !== null && channel !== void 0 && channel.id) {
|
|
38531
38511
|
dispatch(getMessagesAC(channel, true));
|
|
38532
38512
|
}
|
|
38533
38513
|
if (target.scrollTop <= -50) {
|
|
@@ -38616,7 +38596,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38616
38596
|
nextDisableRef.current = false;
|
|
38617
38597
|
}, 1000 + positiveValue * 0.1);
|
|
38618
38598
|
}
|
|
38619
|
-
} else {
|
|
38599
|
+
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
38620
38600
|
dispatch(getMessagesAC(channel, undefined, messageId, undefined, true, 'smooth', true));
|
|
38621
38601
|
}
|
|
38622
38602
|
return Promise.resolve();
|
|
@@ -38800,7 +38780,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38800
38780
|
prevDisableRef.current = false;
|
|
38801
38781
|
shouldLoadMessagesRef.current = '';
|
|
38802
38782
|
loadingRef.current = false;
|
|
38803
|
-
if (channel.backToLinkedChannel) {
|
|
38783
|
+
if (channel.backToLinkedChannel && channel !== null && channel !== void 0 && channel.id) {
|
|
38804
38784
|
var visibleMessages = getVisibleMessagesMap();
|
|
38805
38785
|
var visibleMessagesIds = Object.keys(visibleMessages);
|
|
38806
38786
|
var messageId = visibleMessagesIds[visibleMessagesIds.length - 1];
|
|
@@ -38810,7 +38790,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38810
38790
|
if (!channel.isLinkedChannel) {
|
|
38811
38791
|
clearVisibleMessagesMap();
|
|
38812
38792
|
}
|
|
38813
|
-
if (channel) {
|
|
38793
|
+
if (channel && channel !== null && channel !== void 0 && channel.id) {
|
|
38814
38794
|
dispatch(getMessagesAC(channel, undefined, undefined, undefined, true));
|
|
38815
38795
|
}
|
|
38816
38796
|
if (channel.id) {
|
|
@@ -38979,7 +38959,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38979
38959
|
setScrollIntoView(true);
|
|
38980
38960
|
var lastReadMessageNode = document.getElementById(channel.lastDisplayedMessageId) || null;
|
|
38981
38961
|
var newLastDisplayedMessageId = channel.lastDisplayedMessageId;
|
|
38982
|
-
if (!lastReadMessageNode) {
|
|
38962
|
+
if (!lastReadMessageNode && channel.lastDisplayedMessageId && channel.lastDisplayedMessageId !== '0') {
|
|
38983
38963
|
for (var index = 0; index < messages.length; index++) {
|
|
38984
38964
|
var message = messages[index];
|
|
38985
38965
|
if (channel.lastDisplayedMessageId >= message.id && (messages.length < index + 2 || channel.lastDisplayedMessageId <= messages[index + 1].id)) {
|
|
@@ -38988,6 +38968,9 @@ var MessageList = function MessageList(_ref2) {
|
|
|
38988
38968
|
break;
|
|
38989
38969
|
}
|
|
38990
38970
|
}
|
|
38971
|
+
} else if (!lastReadMessageNode && (!channel.lastDisplayedMessageId || channel.lastDisplayedMessageId === '0') && messages !== null && messages !== void 0 && messages.length) {
|
|
38972
|
+
newLastDisplayedMessageId = messages[0].id;
|
|
38973
|
+
lastReadMessageNode = document.getElementById(newLastDisplayedMessageId);
|
|
38991
38974
|
}
|
|
38992
38975
|
if (lastReadMessageNode && scrollElement) {
|
|
38993
38976
|
dispatch(scrollToNewMessageAC(false));
|
|
@@ -48300,7 +48283,7 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
48300
48283
|
});
|
|
48301
48284
|
}
|
|
48302
48285
|
}
|
|
48303
|
-
} else {
|
|
48286
|
+
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
48304
48287
|
dispatch(getMessagesAC(channel, true, messageId, undefined, false, 'smooth', true));
|
|
48305
48288
|
}
|
|
48306
48289
|
return Promise.resolve();
|
|
@@ -48489,7 +48472,7 @@ var MessagesScrollToUnreadMentionsButton = function MessagesScrollToUnreadMentio
|
|
|
48489
48472
|
repliedMessage.classList.remove('highlight');
|
|
48490
48473
|
}, 1500);
|
|
48491
48474
|
}
|
|
48492
|
-
} else {
|
|
48475
|
+
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
48493
48476
|
dispatch(getMessagesAC(channel, undefined, messageId));
|
|
48494
48477
|
}
|
|
48495
48478
|
return Promise.resolve();
|