sceyt-chat-react-uikit 1.7.7-beta.10 → 1.7.7-beta.12
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 +752 -695
- package/index.modern.js +753 -696
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18841,25 +18841,17 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
18841
18841
|
mentionedUsers: message.mentionedUsers,
|
|
18842
18842
|
parentMessage: message.parentMessage
|
|
18843
18843
|
});
|
|
18844
|
-
addMessageToMap(channel.id, messageToAdd);
|
|
18845
|
-
var activeChannelId = getActiveChannelId();
|
|
18846
|
-
if (activeChannelId === channel.id) {
|
|
18847
|
-
addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18848
|
-
}
|
|
18849
18844
|
setPendingMessage(channel.id, messageToAdd);
|
|
18850
18845
|
if (!(messageToAdd !== null && messageToAdd !== void 0 && messageToAdd.forwardingDetails)) {
|
|
18851
18846
|
store.dispatch(scrollToNewMessageAC(true));
|
|
18852
18847
|
}
|
|
18853
|
-
if (activeChannelId === channel.id) {
|
|
18854
|
-
store.dispatch(addMessageAC(messageToAdd));
|
|
18855
|
-
}
|
|
18856
18848
|
return Promise.resolve();
|
|
18857
18849
|
} catch (e) {
|
|
18858
18850
|
return Promise.reject(e);
|
|
18859
18851
|
}
|
|
18860
18852
|
};
|
|
18861
18853
|
function sendMessage(action) {
|
|
18862
|
-
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap, pendingMessages, channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop, i, messageBuilder, messageToSend,
|
|
18854
|
+
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap, pendingMessages, channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop, i, messageBuilder, messageToSend, _loop2, _i, _t2;
|
|
18863
18855
|
return _regenerator().w(function (_context3) {
|
|
18864
18856
|
while (1) switch (_context3.p = _context3.n) {
|
|
18865
18857
|
case 0:
|
|
@@ -18987,7 +18979,8 @@ function sendMessage(action) {
|
|
|
18987
18979
|
channelId: channel.id
|
|
18988
18980
|
}));
|
|
18989
18981
|
messageForSend = _extends({}, _messageToSend, {
|
|
18990
|
-
attachments: [messageAttachment]
|
|
18982
|
+
attachments: [messageAttachment],
|
|
18983
|
+
createdAt: new Date(Date.now())
|
|
18991
18984
|
});
|
|
18992
18985
|
messagesToSend.push(messageForSend);
|
|
18993
18986
|
pendingMessages.push(_extends({}, messageForSend, {
|
|
@@ -19029,8 +19022,7 @@ function sendMessage(action) {
|
|
|
19029
19022
|
messageBuilder.setReplyInThread();
|
|
19030
19023
|
}
|
|
19031
19024
|
messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
|
|
19032
|
-
|
|
19033
|
-
pendingMessages.push(_extends({}, messageCopy, {
|
|
19025
|
+
pendingMessages.push(_extends({}, messageToSend, {
|
|
19034
19026
|
attachments: message.attachments
|
|
19035
19027
|
}));
|
|
19036
19028
|
messageToSend = _extends({}, messageToSend, {
|
|
@@ -19040,15 +19032,31 @@ function sendMessage(action) {
|
|
|
19040
19032
|
}
|
|
19041
19033
|
case 11:
|
|
19042
19034
|
_loop2 = /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
19043
|
-
var messageAttachment, messageToSend,
|
|
19035
|
+
var messageAttachment, messageToSend, messageCopy, activeChannelId, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, _t;
|
|
19044
19036
|
return _regenerator().w(function (_context2) {
|
|
19045
19037
|
while (1) switch (_context2.p = _context2.n) {
|
|
19046
19038
|
case 0:
|
|
19047
19039
|
messageAttachment = messagesToSend[_i].attachments;
|
|
19048
19040
|
messageToSend = messagesToSend[_i];
|
|
19049
19041
|
_context2.p = 1;
|
|
19050
|
-
|
|
19051
|
-
|
|
19042
|
+
messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i]));
|
|
19043
|
+
activeChannelId = getActiveChannelId();
|
|
19044
|
+
if (action.type !== RESEND_MESSAGE) {
|
|
19045
|
+
addMessageToMap(channel.id, _extends({}, messageToSend, {
|
|
19046
|
+
createdAt: new Date(Date.now())
|
|
19047
|
+
}));
|
|
19048
|
+
if (activeChannelId === channel.id) {
|
|
19049
|
+
addAllMessages([_extends({}, messageToSend, {
|
|
19050
|
+
createdAt: new Date(Date.now())
|
|
19051
|
+
})], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
19052
|
+
}
|
|
19053
|
+
if (activeChannelId === channel.id) {
|
|
19054
|
+
store.dispatch(addMessageAC(_extends({}, messageToSend, {
|
|
19055
|
+
createdAt: new Date(Date.now())
|
|
19056
|
+
})));
|
|
19057
|
+
}
|
|
19058
|
+
store.dispatch(scrollToNewMessageAC(true));
|
|
19059
|
+
}
|
|
19052
19060
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19053
19061
|
_context2.n = 12;
|
|
19054
19062
|
break;
|
|
@@ -19059,7 +19067,7 @@ function sendMessage(action) {
|
|
|
19059
19067
|
break;
|
|
19060
19068
|
}
|
|
19061
19069
|
_context2.n = 2;
|
|
19062
|
-
return effects.call(handleUploadAttachments, messageAttachment || [],
|
|
19070
|
+
return effects.call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
|
|
19063
19071
|
case 2:
|
|
19064
19072
|
_attachmentsToSend = _context2.v;
|
|
19065
19073
|
case 3:
|
|
@@ -19069,9 +19077,13 @@ function sendMessage(action) {
|
|
|
19069
19077
|
linkAttachmentToSend = linkAttachmentBuilder.setName(linkAttachment.name).setUpload(linkAttachment.upload).create();
|
|
19070
19078
|
}
|
|
19071
19079
|
if (linkAttachmentToSend) {
|
|
19072
|
-
messageToSend
|
|
19080
|
+
messageToSend = _extends({}, messageToSend, {
|
|
19081
|
+
attachments: [].concat(_attachmentsToSend, [linkAttachmentToSend])
|
|
19082
|
+
});
|
|
19073
19083
|
} else {
|
|
19074
|
-
messageToSend
|
|
19084
|
+
messageToSend = _extends({}, messageToSend, {
|
|
19085
|
+
attachments: [].concat(_attachmentsToSend)
|
|
19086
|
+
});
|
|
19075
19087
|
}
|
|
19076
19088
|
_context2.n = 4;
|
|
19077
19089
|
return effects.call(channel.sendMessage, messageToSend);
|
|
@@ -19107,7 +19119,9 @@ function sendMessage(action) {
|
|
|
19107
19119
|
_context2.n = 5;
|
|
19108
19120
|
break;
|
|
19109
19121
|
case 8:
|
|
19110
|
-
|
|
19122
|
+
if (action.type === RESEND_MESSAGE) {
|
|
19123
|
+
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19124
|
+
}
|
|
19111
19125
|
attachmentsToUpdate = [];
|
|
19112
19126
|
if (messageResponse.attachments && messageResponse.attachments.length > 0) {
|
|
19113
19127
|
currentAttachmentsMap = {};
|
|
@@ -19239,7 +19253,7 @@ function sendMessage(action) {
|
|
|
19239
19253
|
}, _marked$3, null, [[1, 15]]);
|
|
19240
19254
|
}
|
|
19241
19255
|
function sendTextMessage(action) {
|
|
19242
|
-
var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
|
|
19256
|
+
var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _activeChannelId, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
|
|
19243
19257
|
return _regenerator().w(function (_context4) {
|
|
19244
19258
|
while (1) switch (_context4.p = _context4.n) {
|
|
19245
19259
|
case 0:
|
|
@@ -19302,18 +19316,30 @@ function sendTextMessage(action) {
|
|
|
19302
19316
|
if (message.repliedInThread) {
|
|
19303
19317
|
messageBuilder.setReplyInThread();
|
|
19304
19318
|
}
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
attachments: message === null || message === void 0 ? void 0 : message.attachments
|
|
19319
|
+
createdMessage = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
|
|
19320
|
+
messageToSend = _extends({}, createdMessage, action.type === RESEND_MESSAGE ? {
|
|
19321
|
+
attachments: message === null || message === void 0 ? void 0 : message.attachments
|
|
19322
|
+
} : {});
|
|
19323
|
+
pendingMessage = _extends({}, messageToSend, {
|
|
19308
19324
|
createdAt: new Date(Date.now()),
|
|
19309
19325
|
mentionedUsers: message.mentionedUsers,
|
|
19310
19326
|
parentMessage: message.parentMessage
|
|
19311
|
-
})
|
|
19327
|
+
});
|
|
19312
19328
|
sendMessageTid = messageToSend.tid;
|
|
19313
19329
|
if (pendingMessage && pendingMessage.metadata) {
|
|
19314
19330
|
pendingMessage.metadata = JSON.parse(pendingMessage.metadata);
|
|
19315
19331
|
}
|
|
19316
|
-
|
|
19332
|
+
if (action.type !== RESEND_MESSAGE && pendingMessage) {
|
|
19333
|
+
_activeChannelId = getActiveChannelId();
|
|
19334
|
+
addMessageToMap(channel.id, pendingMessage);
|
|
19335
|
+
if (_activeChannelId === channel.id) {
|
|
19336
|
+
addAllMessages([pendingMessage], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
19337
|
+
}
|
|
19338
|
+
if (_activeChannelId === channel.id) {
|
|
19339
|
+
store.dispatch(addMessageAC(pendingMessage));
|
|
19340
|
+
}
|
|
19341
|
+
store.dispatch(scrollToNewMessageAC(true));
|
|
19342
|
+
}
|
|
19317
19343
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19318
19344
|
_context4.n = 15;
|
|
19319
19345
|
break;
|
|
@@ -19383,11 +19409,8 @@ function sendTextMessage(action) {
|
|
|
19383
19409
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19384
19410
|
case 14:
|
|
19385
19411
|
channel.lastMessage = messageToUpdate;
|
|
19386
|
-
if (
|
|
19387
|
-
message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
|
|
19388
|
-
message.id && store.dispatch(removePendingMessageAC(channel.id, message.id));
|
|
19412
|
+
if (action.type === RESEND_MESSAGE) {
|
|
19389
19413
|
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19390
|
-
messageToSend.id && store.dispatch(removePendingMessageAC(channel.id, messageToSend.id));
|
|
19391
19414
|
}
|
|
19392
19415
|
_context4.n = 16;
|
|
19393
19416
|
break;
|
|
@@ -19547,6 +19570,15 @@ function forwardMessage(action) {
|
|
|
19547
19570
|
_context5.n = 8;
|
|
19548
19571
|
return effects.put(getMessagesAC(channel));
|
|
19549
19572
|
case 8:
|
|
19573
|
+
if (action.type !== RESEND_MESSAGE) {
|
|
19574
|
+
addMessageToMap(channel.id, pendingMessage);
|
|
19575
|
+
if (activeChannelId === channel.id) {
|
|
19576
|
+
addAllMessages([pendingMessage], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
19577
|
+
}
|
|
19578
|
+
if (activeChannelId === channel.id) {
|
|
19579
|
+
store.dispatch(addMessageAC(pendingMessage));
|
|
19580
|
+
}
|
|
19581
|
+
}
|
|
19550
19582
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19551
19583
|
_context5.n = 14;
|
|
19552
19584
|
break;
|
|
@@ -19578,7 +19610,9 @@ function forwardMessage(action) {
|
|
|
19578
19610
|
case 10:
|
|
19579
19611
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19580
19612
|
case 11:
|
|
19581
|
-
|
|
19613
|
+
if (action.type === RESEND_MESSAGE) {
|
|
19614
|
+
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19615
|
+
}
|
|
19582
19616
|
updateMessageOnMap(channel.id, {
|
|
19583
19617
|
messageId: !isAddToPendingMessagesMap ? message.tid : messageToSend.tid,
|
|
19584
19618
|
params: messageUpdateData
|
|
@@ -19798,19 +19832,118 @@ function editMessage(action) {
|
|
|
19798
19832
|
}
|
|
19799
19833
|
}, _marked6$1, null, [[0, 5]]);
|
|
19800
19834
|
}
|
|
19801
|
-
function
|
|
19802
|
-
var
|
|
19835
|
+
var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connectionState) {
|
|
19836
|
+
var pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9;
|
|
19803
19837
|
return _regenerator().w(function (_context9) {
|
|
19804
19838
|
while (1) switch (_context9.p = _context9.n) {
|
|
19805
19839
|
case 0:
|
|
19806
|
-
|
|
19840
|
+
pendingMessagesMap = _extends({}, getPendingMessagesMap());
|
|
19841
|
+
_t7 = _regeneratorKeys(pendingMessagesMap);
|
|
19842
|
+
case 1:
|
|
19843
|
+
if ((_t8 = _t7()).done) {
|
|
19844
|
+
_context9.n = 12;
|
|
19845
|
+
break;
|
|
19846
|
+
}
|
|
19847
|
+
channelId = _t8.value;
|
|
19848
|
+
_iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
19849
|
+
case 2:
|
|
19850
|
+
if ((_step = _iterator()).done) {
|
|
19851
|
+
_context9.n = 11;
|
|
19852
|
+
break;
|
|
19853
|
+
}
|
|
19854
|
+
msg = _step.value;
|
|
19855
|
+
attachments = msg === null || msg === void 0 ? void 0 : (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
19856
|
+
return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
|
|
19857
|
+
});
|
|
19858
|
+
_context9.p = 3;
|
|
19859
|
+
if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
|
|
19860
|
+
_context9.n = 5;
|
|
19861
|
+
break;
|
|
19862
|
+
}
|
|
19863
|
+
_context9.n = 4;
|
|
19864
|
+
return effects.call(forwardMessage, {
|
|
19865
|
+
type: RESEND_MESSAGE,
|
|
19866
|
+
payload: {
|
|
19867
|
+
message: msg,
|
|
19868
|
+
connectionState: connectionState,
|
|
19869
|
+
channelId: channelId,
|
|
19870
|
+
isForward: true,
|
|
19871
|
+
isAddToPendingMessagesMap: false
|
|
19872
|
+
}
|
|
19873
|
+
});
|
|
19874
|
+
case 4:
|
|
19875
|
+
_context9.n = 8;
|
|
19876
|
+
break;
|
|
19877
|
+
case 5:
|
|
19878
|
+
if (!(attachments && attachments.length > 0)) {
|
|
19879
|
+
_context9.n = 7;
|
|
19880
|
+
break;
|
|
19881
|
+
}
|
|
19882
|
+
_context9.n = 6;
|
|
19883
|
+
return effects.call(sendMessage, {
|
|
19884
|
+
type: RESEND_MESSAGE,
|
|
19885
|
+
payload: {
|
|
19886
|
+
message: msg,
|
|
19887
|
+
connectionState: connectionState,
|
|
19888
|
+
channelId: channelId,
|
|
19889
|
+
sendAttachmentsAsSeparateMessage: false,
|
|
19890
|
+
isResend: true,
|
|
19891
|
+
isAddToPendingMessagesMap: false
|
|
19892
|
+
}
|
|
19893
|
+
});
|
|
19894
|
+
case 6:
|
|
19895
|
+
_context9.n = 8;
|
|
19896
|
+
break;
|
|
19897
|
+
case 7:
|
|
19898
|
+
_context9.n = 8;
|
|
19899
|
+
return effects.call(sendTextMessage, {
|
|
19900
|
+
type: RESEND_MESSAGE,
|
|
19901
|
+
payload: {
|
|
19902
|
+
message: msg,
|
|
19903
|
+
connectionState: connectionState,
|
|
19904
|
+
channelId: channelId,
|
|
19905
|
+
isAddToPendingMessagesMap: false
|
|
19906
|
+
}
|
|
19907
|
+
});
|
|
19908
|
+
case 8:
|
|
19909
|
+
_context9.n = 10;
|
|
19910
|
+
break;
|
|
19911
|
+
case 9:
|
|
19912
|
+
_context9.p = 9;
|
|
19913
|
+
_t9 = _context9.v;
|
|
19914
|
+
log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t9);
|
|
19915
|
+
case 10:
|
|
19916
|
+
_context9.n = 2;
|
|
19917
|
+
break;
|
|
19918
|
+
case 11:
|
|
19807
19919
|
_context9.n = 1;
|
|
19920
|
+
break;
|
|
19921
|
+
case 12:
|
|
19922
|
+
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
19923
|
+
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
19924
|
+
_context9.n = 13;
|
|
19925
|
+
break;
|
|
19926
|
+
}
|
|
19927
|
+
_context9.n = 13;
|
|
19928
|
+
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
19929
|
+
case 13:
|
|
19930
|
+
return _context9.a(2);
|
|
19931
|
+
}
|
|
19932
|
+
}, _callee3, null, [[3, 9]]);
|
|
19933
|
+
});
|
|
19934
|
+
function getMessagesQuery(action) {
|
|
19935
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
|
|
19936
|
+
return _regenerator().w(function (_context0) {
|
|
19937
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
19938
|
+
case 0:
|
|
19939
|
+
_context0.p = 0;
|
|
19940
|
+
_context0.n = 1;
|
|
19808
19941
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19809
19942
|
case 1:
|
|
19810
19943
|
_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, behavior = _action$payload.behavior;
|
|
19811
19944
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
19812
19945
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
19813
|
-
|
|
19946
|
+
_context0.n = 76;
|
|
19814
19947
|
break;
|
|
19815
19948
|
}
|
|
19816
19949
|
SceytChatClient = getClient();
|
|
@@ -19818,19 +19951,19 @@ function getMessagesQuery(action) {
|
|
|
19818
19951
|
messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
|
|
19819
19952
|
messageQueryBuilder.reverse(true);
|
|
19820
19953
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19821
|
-
|
|
19954
|
+
_context0.n = 3;
|
|
19822
19955
|
break;
|
|
19823
19956
|
}
|
|
19824
|
-
|
|
19957
|
+
_context0.n = 2;
|
|
19825
19958
|
return effects.call(messageQueryBuilder.build);
|
|
19826
19959
|
case 2:
|
|
19827
|
-
|
|
19828
|
-
|
|
19960
|
+
_t0 = _context0.v;
|
|
19961
|
+
_context0.n = 4;
|
|
19829
19962
|
break;
|
|
19830
19963
|
case 3:
|
|
19831
|
-
|
|
19964
|
+
_t0 = null;
|
|
19832
19965
|
case 4:
|
|
19833
|
-
messageQuery =
|
|
19966
|
+
messageQuery = _t0;
|
|
19834
19967
|
query.messageQuery = messageQuery;
|
|
19835
19968
|
cachedMessages = Object.values(getMessagesFromMap(channel.id) || {}).sort(function (a, b) {
|
|
19836
19969
|
return Number(a.id) - Number(b.id);
|
|
@@ -19840,57 +19973,57 @@ function getMessagesQuery(action) {
|
|
|
19840
19973
|
hasNext: false
|
|
19841
19974
|
};
|
|
19842
19975
|
if (!loadWithLastMessage) {
|
|
19843
|
-
|
|
19976
|
+
_context0.n = 19;
|
|
19844
19977
|
break;
|
|
19845
19978
|
}
|
|
19846
19979
|
allMessages = getAllMessages();
|
|
19847
19980
|
havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
|
|
19848
19981
|
if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
|
|
19849
|
-
|
|
19982
|
+
_context0.n = 14;
|
|
19850
19983
|
break;
|
|
19851
19984
|
}
|
|
19852
19985
|
setHasPrevCached(false);
|
|
19853
19986
|
setMessagesToMap(channel.id, []);
|
|
19854
19987
|
setAllMessages([]);
|
|
19855
19988
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19856
|
-
|
|
19989
|
+
_context0.n = 6;
|
|
19857
19990
|
break;
|
|
19858
19991
|
}
|
|
19859
|
-
|
|
19992
|
+
_context0.n = 5;
|
|
19860
19993
|
return effects.call(messageQuery.loadPreviousMessageId, '0');
|
|
19861
19994
|
case 5:
|
|
19862
|
-
|
|
19863
|
-
|
|
19995
|
+
_t1 = _context0.v;
|
|
19996
|
+
_context0.n = 7;
|
|
19864
19997
|
break;
|
|
19865
19998
|
case 6:
|
|
19866
|
-
|
|
19999
|
+
_t1 = {
|
|
19867
20000
|
messages: [],
|
|
19868
20001
|
hasNext: false
|
|
19869
20002
|
};
|
|
19870
20003
|
case 7:
|
|
19871
|
-
result =
|
|
20004
|
+
result = _t1;
|
|
19872
20005
|
if (!(result.messages.length === 50)) {
|
|
19873
|
-
|
|
20006
|
+
_context0.n = 11;
|
|
19874
20007
|
break;
|
|
19875
20008
|
}
|
|
19876
20009
|
messageQuery.limit = 30;
|
|
19877
20010
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19878
|
-
|
|
20011
|
+
_context0.n = 9;
|
|
19879
20012
|
break;
|
|
19880
20013
|
}
|
|
19881
|
-
|
|
20014
|
+
_context0.n = 8;
|
|
19882
20015
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
19883
20016
|
case 8:
|
|
19884
|
-
|
|
19885
|
-
|
|
20017
|
+
_t10 = _context0.v;
|
|
20018
|
+
_context0.n = 10;
|
|
19886
20019
|
break;
|
|
19887
20020
|
case 9:
|
|
19888
|
-
|
|
20021
|
+
_t10 = {
|
|
19889
20022
|
messages: [],
|
|
19890
20023
|
hasNext: false
|
|
19891
20024
|
};
|
|
19892
20025
|
case 10:
|
|
19893
|
-
secondResult =
|
|
20026
|
+
secondResult = _t10;
|
|
19894
20027
|
result.messages = [].concat(secondResult.messages, result.messages);
|
|
19895
20028
|
result.hasNext = secondResult.hasNext;
|
|
19896
20029
|
case 11:
|
|
@@ -19906,40 +20039,40 @@ function getMessagesQuery(action) {
|
|
|
19906
20039
|
return !messagesMap[msg.tid || ''];
|
|
19907
20040
|
});
|
|
19908
20041
|
result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
|
|
19909
|
-
|
|
20042
|
+
_context0.n = 12;
|
|
19910
20043
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19911
20044
|
case 12:
|
|
19912
20045
|
setMessagesToMap(channel.id, result.messages);
|
|
19913
20046
|
setAllMessages(result.messages);
|
|
19914
|
-
|
|
20047
|
+
_context0.n = 13;
|
|
19915
20048
|
return effects.put(setMessagesHasPrevAC(true));
|
|
19916
20049
|
case 13:
|
|
19917
|
-
|
|
20050
|
+
_context0.n = 16;
|
|
19918
20051
|
break;
|
|
19919
20052
|
case 14:
|
|
19920
20053
|
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
19921
|
-
|
|
20054
|
+
_context0.n = 15;
|
|
19922
20055
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19923
20056
|
case 15:
|
|
19924
|
-
|
|
20057
|
+
_context0.n = 16;
|
|
19925
20058
|
return effects.put(setMessagesHasPrevAC(true));
|
|
19926
20059
|
case 16:
|
|
19927
|
-
|
|
20060
|
+
_context0.n = 17;
|
|
19928
20061
|
return effects.put(setMessagesHasNextAC(false));
|
|
19929
20062
|
case 17:
|
|
19930
20063
|
setHasNextCached(false);
|
|
19931
20064
|
if (!messageId) {
|
|
19932
|
-
|
|
20065
|
+
_context0.n = 18;
|
|
19933
20066
|
break;
|
|
19934
20067
|
}
|
|
19935
|
-
|
|
20068
|
+
_context0.n = 18;
|
|
19936
20069
|
return effects.put(setScrollToMessagesAC(messageId, highlight, behavior));
|
|
19937
20070
|
case 18:
|
|
19938
|
-
|
|
20071
|
+
_context0.n = 72;
|
|
19939
20072
|
break;
|
|
19940
20073
|
case 19:
|
|
19941
20074
|
if (!messageId) {
|
|
19942
|
-
|
|
20075
|
+
_context0.n = 38;
|
|
19943
20076
|
break;
|
|
19944
20077
|
}
|
|
19945
20078
|
_allMessages = getAllMessages();
|
|
@@ -19948,87 +20081,87 @@ function getMessagesQuery(action) {
|
|
|
19948
20081
|
});
|
|
19949
20082
|
maxLengthPart = MESSAGES_MAX_LENGTH / 2;
|
|
19950
20083
|
if (!(messageIndex >= maxLengthPart)) {
|
|
19951
|
-
|
|
20084
|
+
_context0.n = 22;
|
|
19952
20085
|
break;
|
|
19953
20086
|
}
|
|
19954
20087
|
result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
|
|
19955
|
-
|
|
20088
|
+
_context0.n = 20;
|
|
19956
20089
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19957
20090
|
case 20:
|
|
19958
20091
|
setHasPrevCached(messageIndex > maxLengthPart);
|
|
19959
20092
|
setHasNextCached(_allMessages.length > maxLengthPart);
|
|
19960
|
-
|
|
20093
|
+
_context0.n = 21;
|
|
19961
20094
|
return effects.put(setMessagesHasPrevAC(true));
|
|
19962
20095
|
case 21:
|
|
19963
|
-
|
|
20096
|
+
_context0.n = 34;
|
|
19964
20097
|
break;
|
|
19965
20098
|
case 22:
|
|
19966
20099
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
19967
20100
|
log.info('load by message id from server ...............', messageId);
|
|
19968
20101
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19969
|
-
|
|
20102
|
+
_context0.n = 24;
|
|
19970
20103
|
break;
|
|
19971
20104
|
}
|
|
19972
|
-
|
|
20105
|
+
_context0.n = 23;
|
|
19973
20106
|
return effects.call(messageQuery.loadNearMessageId, messageId);
|
|
19974
20107
|
case 23:
|
|
19975
|
-
|
|
19976
|
-
|
|
20108
|
+
_t11 = _context0.v;
|
|
20109
|
+
_context0.n = 25;
|
|
19977
20110
|
break;
|
|
19978
20111
|
case 24:
|
|
19979
|
-
|
|
20112
|
+
_t11 = {
|
|
19980
20113
|
messages: [],
|
|
19981
20114
|
hasNext: false
|
|
19982
20115
|
};
|
|
19983
20116
|
case 25:
|
|
19984
|
-
result =
|
|
20117
|
+
result = _t11;
|
|
19985
20118
|
if (!(result.messages.length === 50)) {
|
|
19986
|
-
|
|
20119
|
+
_context0.n = 32;
|
|
19987
20120
|
break;
|
|
19988
20121
|
}
|
|
19989
20122
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
19990
20123
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19991
|
-
|
|
20124
|
+
_context0.n = 27;
|
|
19992
20125
|
break;
|
|
19993
20126
|
}
|
|
19994
|
-
|
|
20127
|
+
_context0.n = 26;
|
|
19995
20128
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
19996
20129
|
case 26:
|
|
19997
|
-
|
|
19998
|
-
|
|
20130
|
+
_t12 = _context0.v;
|
|
20131
|
+
_context0.n = 28;
|
|
19999
20132
|
break;
|
|
20000
20133
|
case 27:
|
|
20001
|
-
|
|
20134
|
+
_t12 = {
|
|
20002
20135
|
messages: [],
|
|
20003
20136
|
hasNext: false
|
|
20004
20137
|
};
|
|
20005
20138
|
case 28:
|
|
20006
|
-
_secondResult =
|
|
20139
|
+
_secondResult = _t12;
|
|
20007
20140
|
messageQuery.reverse = false;
|
|
20008
20141
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20009
|
-
|
|
20142
|
+
_context0.n = 30;
|
|
20010
20143
|
break;
|
|
20011
20144
|
}
|
|
20012
|
-
|
|
20145
|
+
_context0.n = 29;
|
|
20013
20146
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
20014
20147
|
case 29:
|
|
20015
|
-
|
|
20016
|
-
|
|
20148
|
+
_t13 = _context0.v;
|
|
20149
|
+
_context0.n = 31;
|
|
20017
20150
|
break;
|
|
20018
20151
|
case 30:
|
|
20019
|
-
|
|
20152
|
+
_t13 = {
|
|
20020
20153
|
messages: [],
|
|
20021
20154
|
hasNext: false
|
|
20022
20155
|
};
|
|
20023
20156
|
case 31:
|
|
20024
|
-
thirdResult =
|
|
20157
|
+
thirdResult = _t13;
|
|
20025
20158
|
result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
|
|
20026
20159
|
result.hasNext = _secondResult.hasNext;
|
|
20027
20160
|
messageQuery.reverse = true;
|
|
20028
|
-
|
|
20161
|
+
_context0.n = 32;
|
|
20029
20162
|
return effects.put(setMessagesHasPrevAC(_secondResult.hasNext));
|
|
20030
20163
|
case 32:
|
|
20031
|
-
|
|
20164
|
+
_context0.n = 33;
|
|
20032
20165
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20033
20166
|
case 33:
|
|
20034
20167
|
setMessagesToMap(channel.id, result.messages);
|
|
@@ -20036,208 +20169,208 @@ function getMessagesQuery(action) {
|
|
|
20036
20169
|
setHasPrevCached(false);
|
|
20037
20170
|
setHasNextCached(false);
|
|
20038
20171
|
case 34:
|
|
20039
|
-
|
|
20172
|
+
_context0.n = 35;
|
|
20040
20173
|
return effects.put(setMessagesHasNextAC(true));
|
|
20041
20174
|
case 35:
|
|
20042
|
-
|
|
20175
|
+
_context0.n = 36;
|
|
20043
20176
|
return effects.put(setScrollToMessagesAC(messageId, true, behavior));
|
|
20044
20177
|
case 36:
|
|
20045
|
-
|
|
20178
|
+
_context0.n = 37;
|
|
20046
20179
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20047
20180
|
case 37:
|
|
20048
|
-
|
|
20181
|
+
_context0.n = 72;
|
|
20049
20182
|
break;
|
|
20050
20183
|
case 38:
|
|
20051
20184
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
20052
|
-
|
|
20185
|
+
_context0.n = 61;
|
|
20053
20186
|
break;
|
|
20054
20187
|
}
|
|
20055
20188
|
setMessagesToMap(channel.id, []);
|
|
20056
20189
|
setAllMessages([]);
|
|
20057
20190
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
20058
20191
|
if (!Number(channel.lastDisplayedMessageId)) {
|
|
20059
|
-
|
|
20192
|
+
_context0.n = 50;
|
|
20060
20193
|
break;
|
|
20061
20194
|
}
|
|
20062
20195
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20063
|
-
|
|
20196
|
+
_context0.n = 40;
|
|
20064
20197
|
break;
|
|
20065
20198
|
}
|
|
20066
|
-
|
|
20199
|
+
_context0.n = 39;
|
|
20067
20200
|
return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
|
|
20068
20201
|
case 39:
|
|
20069
|
-
|
|
20070
|
-
|
|
20202
|
+
_t14 = _context0.v;
|
|
20203
|
+
_context0.n = 41;
|
|
20071
20204
|
break;
|
|
20072
20205
|
case 40:
|
|
20073
|
-
|
|
20206
|
+
_t14 = {
|
|
20074
20207
|
messages: [],
|
|
20075
20208
|
hasNext: false
|
|
20076
20209
|
};
|
|
20077
20210
|
case 41:
|
|
20078
|
-
result =
|
|
20211
|
+
result = _t14;
|
|
20079
20212
|
if (!(result.messages.length === 50)) {
|
|
20080
|
-
|
|
20213
|
+
_context0.n = 49;
|
|
20081
20214
|
break;
|
|
20082
20215
|
}
|
|
20083
20216
|
messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
|
|
20084
20217
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20085
|
-
|
|
20218
|
+
_context0.n = 43;
|
|
20086
20219
|
break;
|
|
20087
20220
|
}
|
|
20088
|
-
|
|
20221
|
+
_context0.n = 42;
|
|
20089
20222
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20090
20223
|
case 42:
|
|
20091
|
-
|
|
20092
|
-
|
|
20224
|
+
_t15 = _context0.v;
|
|
20225
|
+
_context0.n = 44;
|
|
20093
20226
|
break;
|
|
20094
20227
|
case 43:
|
|
20095
|
-
|
|
20228
|
+
_t15 = {
|
|
20096
20229
|
messages: [],
|
|
20097
20230
|
hasNext: false
|
|
20098
20231
|
};
|
|
20099
20232
|
case 44:
|
|
20100
|
-
_secondResult2 =
|
|
20233
|
+
_secondResult2 = _t15;
|
|
20101
20234
|
if (!(channel.newMessageCount > 25)) {
|
|
20102
|
-
|
|
20235
|
+
_context0.n = 48;
|
|
20103
20236
|
break;
|
|
20104
20237
|
}
|
|
20105
20238
|
messageQuery.reverse = false;
|
|
20106
20239
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20107
|
-
|
|
20240
|
+
_context0.n = 46;
|
|
20108
20241
|
break;
|
|
20109
20242
|
}
|
|
20110
|
-
|
|
20243
|
+
_context0.n = 45;
|
|
20111
20244
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
20112
20245
|
case 45:
|
|
20113
|
-
|
|
20114
|
-
|
|
20246
|
+
_t16 = _context0.v;
|
|
20247
|
+
_context0.n = 47;
|
|
20115
20248
|
break;
|
|
20116
20249
|
case 46:
|
|
20117
|
-
|
|
20250
|
+
_t16 = {
|
|
20118
20251
|
messages: [],
|
|
20119
20252
|
hasNext: false
|
|
20120
20253
|
};
|
|
20121
20254
|
case 47:
|
|
20122
|
-
_thirdResult =
|
|
20255
|
+
_thirdResult = _t16;
|
|
20123
20256
|
result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
|
|
20124
20257
|
messageQuery.reverse = true;
|
|
20125
|
-
|
|
20258
|
+
_context0.n = 49;
|
|
20126
20259
|
break;
|
|
20127
20260
|
case 48:
|
|
20128
20261
|
result.messages = [].concat(_secondResult2.messages, result.messages);
|
|
20129
20262
|
case 49:
|
|
20130
|
-
|
|
20263
|
+
_context0.n = 57;
|
|
20131
20264
|
break;
|
|
20132
20265
|
case 50:
|
|
20133
20266
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20134
|
-
|
|
20267
|
+
_context0.n = 52;
|
|
20135
20268
|
break;
|
|
20136
20269
|
}
|
|
20137
|
-
|
|
20270
|
+
_context0.n = 51;
|
|
20138
20271
|
return effects.call(messageQuery.loadPrevious);
|
|
20139
20272
|
case 51:
|
|
20140
|
-
|
|
20141
|
-
|
|
20273
|
+
_t17 = _context0.v;
|
|
20274
|
+
_context0.n = 53;
|
|
20142
20275
|
break;
|
|
20143
20276
|
case 52:
|
|
20144
|
-
|
|
20277
|
+
_t17 = {
|
|
20145
20278
|
messages: [],
|
|
20146
20279
|
hasNext: false
|
|
20147
20280
|
};
|
|
20148
20281
|
case 53:
|
|
20149
|
-
result =
|
|
20282
|
+
result = _t17;
|
|
20150
20283
|
if (!(result.messages.length === 50)) {
|
|
20151
|
-
|
|
20284
|
+
_context0.n = 57;
|
|
20152
20285
|
break;
|
|
20153
20286
|
}
|
|
20154
20287
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20155
20288
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20156
|
-
|
|
20289
|
+
_context0.n = 55;
|
|
20157
20290
|
break;
|
|
20158
20291
|
}
|
|
20159
|
-
|
|
20292
|
+
_context0.n = 54;
|
|
20160
20293
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20161
20294
|
case 54:
|
|
20162
|
-
|
|
20163
|
-
|
|
20295
|
+
_t18 = _context0.v;
|
|
20296
|
+
_context0.n = 56;
|
|
20164
20297
|
break;
|
|
20165
20298
|
case 55:
|
|
20166
|
-
|
|
20299
|
+
_t18 = {
|
|
20167
20300
|
messages: [],
|
|
20168
20301
|
hasNext: false
|
|
20169
20302
|
};
|
|
20170
20303
|
case 56:
|
|
20171
|
-
_secondResult3 =
|
|
20304
|
+
_secondResult3 = _t18;
|
|
20172
20305
|
result.messages = [].concat(_secondResult3.messages, result.messages);
|
|
20173
20306
|
result.hasNext = _secondResult3.hasNext;
|
|
20174
20307
|
case 57:
|
|
20175
|
-
|
|
20308
|
+
_context0.n = 58;
|
|
20176
20309
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20177
20310
|
case 58:
|
|
20178
|
-
|
|
20311
|
+
_context0.n = 59;
|
|
20179
20312
|
return effects.put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
|
|
20180
20313
|
case 59:
|
|
20181
20314
|
setMessagesToMap(channel.id, result.messages);
|
|
20182
20315
|
setAllMessages([].concat(result.messages));
|
|
20183
|
-
|
|
20316
|
+
_context0.n = 60;
|
|
20184
20317
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20185
20318
|
case 60:
|
|
20186
|
-
|
|
20319
|
+
_context0.n = 72;
|
|
20187
20320
|
break;
|
|
20188
20321
|
case 61:
|
|
20189
20322
|
previousAllMessages = getAllMessages();
|
|
20190
20323
|
setMessagesToMap(channel.id, []);
|
|
20191
20324
|
setAllMessages([]);
|
|
20192
20325
|
if (!(cachedMessages && cachedMessages.length)) {
|
|
20193
|
-
|
|
20326
|
+
_context0.n = 62;
|
|
20194
20327
|
break;
|
|
20195
20328
|
}
|
|
20196
20329
|
setMessagesToMap(channel.id, []);
|
|
20197
20330
|
setAllMessages([].concat(cachedMessages));
|
|
20198
|
-
|
|
20331
|
+
_context0.n = 62;
|
|
20199
20332
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
|
|
20200
20333
|
case 62:
|
|
20201
20334
|
log.info('load message from server');
|
|
20202
20335
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20203
|
-
|
|
20336
|
+
_context0.n = 64;
|
|
20204
20337
|
break;
|
|
20205
20338
|
}
|
|
20206
|
-
|
|
20339
|
+
_context0.n = 63;
|
|
20207
20340
|
return effects.call(messageQuery.loadPrevious);
|
|
20208
20341
|
case 63:
|
|
20209
|
-
|
|
20210
|
-
|
|
20342
|
+
_t19 = _context0.v;
|
|
20343
|
+
_context0.n = 65;
|
|
20211
20344
|
break;
|
|
20212
20345
|
case 64:
|
|
20213
|
-
|
|
20346
|
+
_t19 = {
|
|
20214
20347
|
messages: [],
|
|
20215
20348
|
hasNext: false
|
|
20216
20349
|
};
|
|
20217
20350
|
case 65:
|
|
20218
|
-
result =
|
|
20351
|
+
result = _t19;
|
|
20219
20352
|
if (!(result.messages.length === 50)) {
|
|
20220
|
-
|
|
20353
|
+
_context0.n = 69;
|
|
20221
20354
|
break;
|
|
20222
20355
|
}
|
|
20223
20356
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20224
20357
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20225
|
-
|
|
20358
|
+
_context0.n = 67;
|
|
20226
20359
|
break;
|
|
20227
20360
|
}
|
|
20228
|
-
|
|
20361
|
+
_context0.n = 66;
|
|
20229
20362
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20230
20363
|
case 66:
|
|
20231
|
-
|
|
20232
|
-
|
|
20364
|
+
_t20 = _context0.v;
|
|
20365
|
+
_context0.n = 68;
|
|
20233
20366
|
break;
|
|
20234
20367
|
case 67:
|
|
20235
|
-
|
|
20368
|
+
_t20 = {
|
|
20236
20369
|
messages: [],
|
|
20237
20370
|
hasNext: false
|
|
20238
20371
|
};
|
|
20239
20372
|
case 68:
|
|
20240
|
-
_secondResult4 =
|
|
20373
|
+
_secondResult4 = _t20;
|
|
20241
20374
|
result.messages = [].concat(_secondResult4.messages, result.messages);
|
|
20242
20375
|
result.hasNext = _secondResult4.hasNext;
|
|
20243
20376
|
case 69:
|
|
@@ -20269,18 +20402,18 @@ function getMessagesQuery(action) {
|
|
|
20269
20402
|
updatedMessages = [].concat(updatedMessages, allMessagesAfterLastMessage || []);
|
|
20270
20403
|
setMessagesToMap(channel.id, updatedMessages);
|
|
20271
20404
|
setAllMessages(updatedMessages);
|
|
20272
|
-
|
|
20405
|
+
_context0.n = 70;
|
|
20273
20406
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
20274
20407
|
case 70:
|
|
20275
|
-
|
|
20408
|
+
_context0.n = 71;
|
|
20276
20409
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20277
20410
|
case 71:
|
|
20278
|
-
|
|
20411
|
+
_context0.n = 72;
|
|
20279
20412
|
return effects.put(setMessagesHasNextAC(false));
|
|
20280
20413
|
case 72:
|
|
20281
20414
|
pendingMessages = getPendingMessages(channel.id);
|
|
20282
20415
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
20283
|
-
|
|
20416
|
+
_context0.n = 73;
|
|
20284
20417
|
break;
|
|
20285
20418
|
}
|
|
20286
20419
|
_messagesMap = {};
|
|
@@ -20290,152 +20423,76 @@ function getMessagesQuery(action) {
|
|
|
20290
20423
|
filteredPendingMessages = pendingMessages.filter(function (msg) {
|
|
20291
20424
|
return !_messagesMap[msg.tid || ''];
|
|
20292
20425
|
});
|
|
20293
|
-
|
|
20426
|
+
_context0.n = 73;
|
|
20294
20427
|
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
20295
20428
|
case 73:
|
|
20296
20429
|
waitToSendPendingMessages = store.getState().UserReducer.waitToSendPendingMessages;
|
|
20297
20430
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED && waitToSendPendingMessages)) {
|
|
20298
|
-
|
|
20431
|
+
_context0.n = 75;
|
|
20299
20432
|
break;
|
|
20300
20433
|
}
|
|
20301
|
-
|
|
20434
|
+
_context0.n = 74;
|
|
20302
20435
|
return effects.put(setWaitToSendPendingMessagesAC(false));
|
|
20303
20436
|
case 74:
|
|
20304
|
-
|
|
20305
|
-
|
|
20437
|
+
_context0.n = 75;
|
|
20438
|
+
return effects.spawn(sendPendingMessages, connectionState);
|
|
20306
20439
|
case 75:
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
break;
|
|
20310
|
-
}
|
|
20311
|
-
channelId = _t19.value;
|
|
20312
|
-
_iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
20440
|
+
_context0.n = 77;
|
|
20441
|
+
break;
|
|
20313
20442
|
case 76:
|
|
20314
|
-
if (
|
|
20315
|
-
|
|
20316
|
-
break;
|
|
20317
|
-
}
|
|
20318
|
-
msg = _step.value;
|
|
20319
|
-
attachments = (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
20320
|
-
return att.type !== attachmentTypes.link;
|
|
20321
|
-
});
|
|
20322
|
-
if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
|
|
20323
|
-
_context9.n = 78;
|
|
20443
|
+
if (!channel.isMockChannel) {
|
|
20444
|
+
_context0.n = 77;
|
|
20324
20445
|
break;
|
|
20325
20446
|
}
|
|
20326
|
-
|
|
20327
|
-
return effects.
|
|
20328
|
-
type: RESEND_MESSAGE,
|
|
20329
|
-
payload: {
|
|
20330
|
-
message: msg,
|
|
20331
|
-
connectionState: connectionState,
|
|
20332
|
-
channelId: channelId
|
|
20333
|
-
}
|
|
20334
|
-
});
|
|
20447
|
+
_context0.n = 77;
|
|
20448
|
+
return effects.put(setMessagesAC([]));
|
|
20335
20449
|
case 77:
|
|
20336
|
-
|
|
20450
|
+
_context0.n = 79;
|
|
20337
20451
|
break;
|
|
20338
20452
|
case 78:
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
}
|
|
20343
|
-
_context9.n = 79;
|
|
20344
|
-
return effects.call(sendMessage, {
|
|
20345
|
-
type: RESEND_MESSAGE,
|
|
20346
|
-
payload: {
|
|
20347
|
-
message: msg,
|
|
20348
|
-
connectionState: connectionState,
|
|
20349
|
-
channelId: channelId
|
|
20350
|
-
}
|
|
20351
|
-
});
|
|
20453
|
+
_context0.p = 78;
|
|
20454
|
+
_t21 = _context0.v;
|
|
20455
|
+
log.error('error in message query', _t21);
|
|
20352
20456
|
case 79:
|
|
20353
|
-
|
|
20354
|
-
|
|
20457
|
+
_context0.p = 79;
|
|
20458
|
+
_context0.n = 80;
|
|
20459
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20355
20460
|
case 80:
|
|
20356
|
-
|
|
20357
|
-
return effects.call(sendTextMessage, {
|
|
20358
|
-
type: RESEND_MESSAGE,
|
|
20359
|
-
payload: {
|
|
20360
|
-
message: msg,
|
|
20361
|
-
connectionState: connectionState,
|
|
20362
|
-
channelId: channelId
|
|
20363
|
-
}
|
|
20364
|
-
});
|
|
20461
|
+
return _context0.f(79);
|
|
20365
20462
|
case 81:
|
|
20366
|
-
|
|
20367
|
-
break;
|
|
20368
|
-
case 82:
|
|
20369
|
-
_context9.n = 75;
|
|
20370
|
-
break;
|
|
20371
|
-
case 83:
|
|
20372
|
-
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
20373
|
-
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
20374
|
-
_context9.n = 84;
|
|
20375
|
-
break;
|
|
20376
|
-
}
|
|
20377
|
-
_context9.n = 84;
|
|
20378
|
-
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
20379
|
-
case 84:
|
|
20380
|
-
_context9.n = 85;
|
|
20381
|
-
return effects.put(setWaitToSendPendingMessagesAC(false));
|
|
20382
|
-
case 85:
|
|
20383
|
-
_context9.n = 87;
|
|
20384
|
-
break;
|
|
20385
|
-
case 86:
|
|
20386
|
-
if (!channel.isMockChannel) {
|
|
20387
|
-
_context9.n = 87;
|
|
20388
|
-
break;
|
|
20389
|
-
}
|
|
20390
|
-
_context9.n = 87;
|
|
20391
|
-
return effects.put(setMessagesAC([]));
|
|
20392
|
-
case 87:
|
|
20393
|
-
_context9.n = 89;
|
|
20394
|
-
break;
|
|
20395
|
-
case 88:
|
|
20396
|
-
_context9.p = 88;
|
|
20397
|
-
_t20 = _context9.v;
|
|
20398
|
-
log.error('error in message query', _t20);
|
|
20399
|
-
case 89:
|
|
20400
|
-
_context9.p = 89;
|
|
20401
|
-
_context9.n = 90;
|
|
20402
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20403
|
-
case 90:
|
|
20404
|
-
return _context9.f(89);
|
|
20405
|
-
case 91:
|
|
20406
|
-
return _context9.a(2);
|
|
20463
|
+
return _context0.a(2);
|
|
20407
20464
|
}
|
|
20408
|
-
}, _marked7$1, null, [[0,
|
|
20465
|
+
}, _marked7$1, null, [[0, 78, 79, 81]]);
|
|
20409
20466
|
}
|
|
20410
20467
|
function getMessageQuery(action) {
|
|
20411
|
-
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage,
|
|
20412
|
-
return _regenerator().w(function (
|
|
20413
|
-
while (1) switch (
|
|
20468
|
+
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t22;
|
|
20469
|
+
return _regenerator().w(function (_context1) {
|
|
20470
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
20414
20471
|
case 0:
|
|
20415
|
-
|
|
20472
|
+
_context1.p = 0;
|
|
20416
20473
|
payload = action.payload;
|
|
20417
20474
|
channelId = payload.channelId, messageId = payload.messageId;
|
|
20418
|
-
|
|
20475
|
+
_context1.n = 1;
|
|
20419
20476
|
return effects.call(getChannelFromAllChannels, channelId);
|
|
20420
20477
|
case 1:
|
|
20421
|
-
channel =
|
|
20478
|
+
channel = _context1.v;
|
|
20422
20479
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
20423
20480
|
if (!(!channel || connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
20424
|
-
|
|
20481
|
+
_context1.n = 2;
|
|
20425
20482
|
break;
|
|
20426
20483
|
}
|
|
20427
|
-
return
|
|
20484
|
+
return _context1.a(2);
|
|
20428
20485
|
case 2:
|
|
20429
|
-
|
|
20486
|
+
_context1.n = 3;
|
|
20430
20487
|
return effects.call(channel.getMessagesById, [messageId]);
|
|
20431
20488
|
case 3:
|
|
20432
|
-
messages =
|
|
20489
|
+
messages = _context1.v;
|
|
20433
20490
|
fetchedMessage = messages && messages[0] ? JSON.parse(JSON.stringify(messages[0])) : null;
|
|
20434
20491
|
if (!fetchedMessage) {
|
|
20435
|
-
|
|
20492
|
+
_context1.n = 6;
|
|
20436
20493
|
break;
|
|
20437
20494
|
}
|
|
20438
|
-
|
|
20495
|
+
_context1.n = 4;
|
|
20439
20496
|
return effects.put(updateMessageAC(messageId, fetchedMessage));
|
|
20440
20497
|
case 4:
|
|
20441
20498
|
updateMessageOnMap(channel.id, {
|
|
@@ -20443,45 +20500,45 @@ function getMessageQuery(action) {
|
|
|
20443
20500
|
params: fetchedMessage
|
|
20444
20501
|
});
|
|
20445
20502
|
updateMessageOnAllMessages(messageId, fetchedMessage);
|
|
20446
|
-
|
|
20503
|
+
_context1.n = 5;
|
|
20447
20504
|
return effects.put(setScrollToMessagesAC(messageId, false));
|
|
20448
20505
|
case 5:
|
|
20449
20506
|
if (!(channel.lastMessage && channel.lastMessage.id === messageId)) {
|
|
20450
|
-
|
|
20507
|
+
_context1.n = 6;
|
|
20451
20508
|
break;
|
|
20452
20509
|
}
|
|
20453
20510
|
updateChannelLastMessageOnAllChannels(channel.id, fetchedMessage);
|
|
20454
|
-
|
|
20511
|
+
_context1.n = 6;
|
|
20455
20512
|
return effects.put(updateChannelLastMessageAC(fetchedMessage, channel));
|
|
20456
20513
|
case 6:
|
|
20457
|
-
|
|
20514
|
+
_context1.n = 8;
|
|
20458
20515
|
break;
|
|
20459
20516
|
case 7:
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
log.error('error in message query',
|
|
20517
|
+
_context1.p = 7;
|
|
20518
|
+
_t22 = _context1.v;
|
|
20519
|
+
log.error('error in message query', _t22);
|
|
20463
20520
|
case 8:
|
|
20464
|
-
return
|
|
20521
|
+
return _context1.a(2);
|
|
20465
20522
|
}
|
|
20466
20523
|
}, _marked8$1, null, [[0, 7]]);
|
|
20467
20524
|
}
|
|
20468
20525
|
function loadMoreMessages(action) {
|
|
20469
|
-
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result,
|
|
20470
|
-
return _regenerator().w(function (
|
|
20471
|
-
while (1) switch (
|
|
20526
|
+
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t23;
|
|
20527
|
+
return _regenerator().w(function (_context10) {
|
|
20528
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
20472
20529
|
case 0:
|
|
20473
|
-
|
|
20530
|
+
_context10.p = 0;
|
|
20474
20531
|
payload = action.payload;
|
|
20475
20532
|
limit = payload.limit, direction = payload.direction, channelId = payload.channelId, messageId = payload.messageId, hasNext = payload.hasNext;
|
|
20476
20533
|
SceytChatClient = getClient();
|
|
20477
20534
|
messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channelId);
|
|
20478
20535
|
messageQueryBuilder.reverse(true);
|
|
20479
|
-
|
|
20536
|
+
_context10.n = 1;
|
|
20480
20537
|
return effects.call(messageQueryBuilder.build);
|
|
20481
20538
|
case 1:
|
|
20482
|
-
messageQuery =
|
|
20539
|
+
messageQuery = _context10.v;
|
|
20483
20540
|
messageQuery.limit = limit || 5;
|
|
20484
|
-
|
|
20541
|
+
_context10.n = 2;
|
|
20485
20542
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
20486
20543
|
case 2:
|
|
20487
20544
|
result = {
|
|
@@ -20489,130 +20546,130 @@ function loadMoreMessages(action) {
|
|
|
20489
20546
|
hasNext: false
|
|
20490
20547
|
};
|
|
20491
20548
|
if (!(direction === MESSAGE_LOAD_DIRECTION.PREV)) {
|
|
20492
|
-
|
|
20549
|
+
_context10.n = 6;
|
|
20493
20550
|
break;
|
|
20494
20551
|
}
|
|
20495
20552
|
if (!getHasPrevCached()) {
|
|
20496
|
-
|
|
20553
|
+
_context10.n = 3;
|
|
20497
20554
|
break;
|
|
20498
20555
|
}
|
|
20499
20556
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
|
|
20500
|
-
|
|
20557
|
+
_context10.n = 5;
|
|
20501
20558
|
break;
|
|
20502
20559
|
case 3:
|
|
20503
20560
|
if (!hasNext) {
|
|
20504
|
-
|
|
20561
|
+
_context10.n = 5;
|
|
20505
20562
|
break;
|
|
20506
20563
|
}
|
|
20507
|
-
|
|
20564
|
+
_context10.n = 4;
|
|
20508
20565
|
return effects.call(messageQuery.loadPreviousMessageId, messageId);
|
|
20509
20566
|
case 4:
|
|
20510
|
-
result =
|
|
20567
|
+
result = _context10.v;
|
|
20511
20568
|
if (result.messages.length) {
|
|
20512
20569
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
|
|
20513
20570
|
setMessagesToMap(channelId, result.messages);
|
|
20514
20571
|
}
|
|
20515
|
-
|
|
20572
|
+
_context10.n = 5;
|
|
20516
20573
|
return effects.put(setMessagesHasPrevAC(result.hasNext));
|
|
20517
20574
|
case 5:
|
|
20518
|
-
|
|
20575
|
+
_context10.n = 10;
|
|
20519
20576
|
break;
|
|
20520
20577
|
case 6:
|
|
20521
20578
|
if (!getHasNextCached()) {
|
|
20522
|
-
|
|
20579
|
+
_context10.n = 7;
|
|
20523
20580
|
break;
|
|
20524
20581
|
}
|
|
20525
20582
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
20526
|
-
|
|
20583
|
+
_context10.n = 9;
|
|
20527
20584
|
break;
|
|
20528
20585
|
case 7:
|
|
20529
20586
|
if (!hasNext) {
|
|
20530
|
-
|
|
20587
|
+
_context10.n = 9;
|
|
20531
20588
|
break;
|
|
20532
20589
|
}
|
|
20533
20590
|
log.info('saga load next from server ... ', messageId);
|
|
20534
20591
|
messageQuery.reverse = false;
|
|
20535
|
-
|
|
20592
|
+
_context10.n = 8;
|
|
20536
20593
|
return effects.call(messageQuery.loadNextMessageId, messageId);
|
|
20537
20594
|
case 8:
|
|
20538
|
-
result =
|
|
20595
|
+
result = _context10.v;
|
|
20539
20596
|
if (result.messages.length) {
|
|
20540
20597
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
20541
20598
|
setMessagesToMap(channelId, result.messages);
|
|
20542
20599
|
}
|
|
20543
|
-
|
|
20600
|
+
_context10.n = 9;
|
|
20544
20601
|
return effects.put(setMessagesHasNextAC(result.hasNext));
|
|
20545
20602
|
case 9:
|
|
20546
|
-
|
|
20603
|
+
_context10.n = 10;
|
|
20547
20604
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20548
20605
|
case 10:
|
|
20549
20606
|
if (!(result.messages && result.messages.length && result.messages.length > 0)) {
|
|
20550
|
-
|
|
20607
|
+
_context10.n = 12;
|
|
20551
20608
|
break;
|
|
20552
20609
|
}
|
|
20553
|
-
|
|
20610
|
+
_context10.n = 11;
|
|
20554
20611
|
return effects.put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
|
|
20555
20612
|
case 11:
|
|
20556
|
-
|
|
20613
|
+
_context10.n = 16;
|
|
20557
20614
|
break;
|
|
20558
20615
|
case 12:
|
|
20559
|
-
|
|
20616
|
+
_context10.n = 13;
|
|
20560
20617
|
return effects.put(addMessagesAC([], direction));
|
|
20561
20618
|
case 13:
|
|
20562
20619
|
if (!(direction === MESSAGE_LOAD_DIRECTION.NEXT)) {
|
|
20563
|
-
|
|
20620
|
+
_context10.n = 15;
|
|
20564
20621
|
break;
|
|
20565
20622
|
}
|
|
20566
|
-
|
|
20623
|
+
_context10.n = 14;
|
|
20567
20624
|
return effects.put(setMessagesHasNextAC(false));
|
|
20568
20625
|
case 14:
|
|
20569
|
-
|
|
20626
|
+
_context10.n = 16;
|
|
20570
20627
|
break;
|
|
20571
20628
|
case 15:
|
|
20572
|
-
|
|
20629
|
+
_context10.n = 16;
|
|
20573
20630
|
return effects.put(setMessagesHasPrevAC(false));
|
|
20574
20631
|
case 16:
|
|
20575
|
-
|
|
20632
|
+
_context10.n = 17;
|
|
20576
20633
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20577
20634
|
case 17:
|
|
20578
|
-
|
|
20635
|
+
_context10.n = 19;
|
|
20579
20636
|
break;
|
|
20580
20637
|
case 18:
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
log.error('error in load more messages',
|
|
20638
|
+
_context10.p = 18;
|
|
20639
|
+
_t23 = _context10.v;
|
|
20640
|
+
log.error('error in load more messages', _t23);
|
|
20584
20641
|
case 19:
|
|
20585
|
-
return
|
|
20642
|
+
return _context10.a(2);
|
|
20586
20643
|
}
|
|
20587
20644
|
}, _marked9$1, null, [[0, 18]]);
|
|
20588
20645
|
}
|
|
20589
20646
|
function addReaction(action) {
|
|
20590
|
-
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam,
|
|
20591
|
-
return _regenerator().w(function (
|
|
20592
|
-
while (1) switch (
|
|
20647
|
+
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t24;
|
|
20648
|
+
return _regenerator().w(function (_context11) {
|
|
20649
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
20593
20650
|
case 0:
|
|
20594
|
-
|
|
20651
|
+
_context11.p = 0;
|
|
20595
20652
|
payload = action.payload;
|
|
20596
20653
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, score = payload.score, reason = payload.reason, enforceUnique = payload.enforceUnique;
|
|
20597
20654
|
user = getClient().user;
|
|
20598
|
-
|
|
20655
|
+
_context11.n = 1;
|
|
20599
20656
|
return effects.call(getChannelFromMap, channelId);
|
|
20600
20657
|
case 1:
|
|
20601
|
-
channel =
|
|
20658
|
+
channel = _context11.v;
|
|
20602
20659
|
if (!channel) {
|
|
20603
20660
|
channel = getChannelFromAllChannels(channelId);
|
|
20604
20661
|
if (channel) {
|
|
20605
20662
|
setChannelInMap(channel);
|
|
20606
20663
|
}
|
|
20607
20664
|
}
|
|
20608
|
-
|
|
20665
|
+
_context11.n = 2;
|
|
20609
20666
|
return effects.call(channel.addReaction, messageId, key, score, reason, enforceUnique);
|
|
20610
20667
|
case 2:
|
|
20611
|
-
_yield$call =
|
|
20668
|
+
_yield$call = _context11.v;
|
|
20612
20669
|
message = _yield$call.message;
|
|
20613
20670
|
reaction = _yield$call.reaction;
|
|
20614
20671
|
if (!(user.id === message.user.id)) {
|
|
20615
|
-
|
|
20672
|
+
_context11.n = 4;
|
|
20616
20673
|
break;
|
|
20617
20674
|
}
|
|
20618
20675
|
channelUpdateParam = {
|
|
@@ -20620,99 +20677,99 @@ function addReaction(action) {
|
|
|
20620
20677
|
lastReactedMessage: message,
|
|
20621
20678
|
newReactions: [reaction]
|
|
20622
20679
|
};
|
|
20623
|
-
|
|
20680
|
+
_context11.n = 3;
|
|
20624
20681
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
20625
20682
|
case 3:
|
|
20626
20683
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
20627
20684
|
case 4:
|
|
20628
|
-
|
|
20685
|
+
_context11.n = 5;
|
|
20629
20686
|
return effects.put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
20630
20687
|
case 5:
|
|
20631
|
-
|
|
20688
|
+
_context11.n = 6;
|
|
20632
20689
|
return effects.put(addReactionToListAC(reaction));
|
|
20633
20690
|
case 6:
|
|
20634
|
-
|
|
20691
|
+
_context11.n = 7;
|
|
20635
20692
|
return effects.put(addReactionToMessageAC(message, reaction, true));
|
|
20636
20693
|
case 7:
|
|
20637
20694
|
addReactionToMessageOnMap(channelId, message, reaction, true);
|
|
20638
20695
|
addReactionOnAllMessages(message, reaction, true);
|
|
20639
|
-
|
|
20696
|
+
_context11.n = 9;
|
|
20640
20697
|
break;
|
|
20641
20698
|
case 8:
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
log.error('ERROR in add reaction',
|
|
20699
|
+
_context11.p = 8;
|
|
20700
|
+
_t24 = _context11.v;
|
|
20701
|
+
log.error('ERROR in add reaction', _t24.message);
|
|
20645
20702
|
case 9:
|
|
20646
|
-
return
|
|
20703
|
+
return _context11.a(2);
|
|
20647
20704
|
}
|
|
20648
20705
|
}, _marked0$1, null, [[0, 8]]);
|
|
20649
20706
|
}
|
|
20650
20707
|
function deleteReaction(action) {
|
|
20651
|
-
var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam,
|
|
20652
|
-
return _regenerator().w(function (
|
|
20653
|
-
while (1) switch (
|
|
20708
|
+
var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t25;
|
|
20709
|
+
return _regenerator().w(function (_context12) {
|
|
20710
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
20654
20711
|
case 0:
|
|
20655
|
-
|
|
20712
|
+
_context12.p = 0;
|
|
20656
20713
|
payload = action.payload;
|
|
20657
20714
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, isLastReaction = payload.isLastReaction;
|
|
20658
|
-
|
|
20715
|
+
_context12.n = 1;
|
|
20659
20716
|
return effects.call(getChannelFromMap, channelId);
|
|
20660
20717
|
case 1:
|
|
20661
|
-
channel =
|
|
20718
|
+
channel = _context12.v;
|
|
20662
20719
|
if (!channel) {
|
|
20663
20720
|
channel = getChannelFromAllChannels(channelId);
|
|
20664
20721
|
if (channel) {
|
|
20665
20722
|
setChannelInMap(channel);
|
|
20666
20723
|
}
|
|
20667
20724
|
}
|
|
20668
|
-
|
|
20725
|
+
_context12.n = 2;
|
|
20669
20726
|
return effects.call(channel.deleteReaction, messageId, key);
|
|
20670
20727
|
case 2:
|
|
20671
|
-
_yield$call2 =
|
|
20728
|
+
_yield$call2 = _context12.v;
|
|
20672
20729
|
message = _yield$call2.message;
|
|
20673
20730
|
reaction = _yield$call2.reaction;
|
|
20674
20731
|
if (!isLastReaction) {
|
|
20675
|
-
|
|
20732
|
+
_context12.n = 4;
|
|
20676
20733
|
break;
|
|
20677
20734
|
}
|
|
20678
20735
|
channelUpdateParam = {
|
|
20679
20736
|
userMessageReactions: [],
|
|
20680
20737
|
lastReactedMessage: null
|
|
20681
20738
|
};
|
|
20682
|
-
|
|
20739
|
+
_context12.n = 3;
|
|
20683
20740
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
20684
20741
|
case 3:
|
|
20685
20742
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
20686
20743
|
case 4:
|
|
20687
|
-
|
|
20744
|
+
_context12.n = 5;
|
|
20688
20745
|
return effects.put(deleteReactionFromListAC(reaction));
|
|
20689
20746
|
case 5:
|
|
20690
|
-
|
|
20747
|
+
_context12.n = 6;
|
|
20691
20748
|
return effects.put(deleteReactionFromMessageAC(message, reaction, true));
|
|
20692
20749
|
case 6:
|
|
20693
20750
|
removeReactionToMessageOnMap(channelId, message, reaction, true);
|
|
20694
20751
|
removeReactionOnAllMessages(message, reaction, true);
|
|
20695
|
-
|
|
20752
|
+
_context12.n = 8;
|
|
20696
20753
|
break;
|
|
20697
20754
|
case 7:
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
log.error('ERROR in delete reaction',
|
|
20755
|
+
_context12.p = 7;
|
|
20756
|
+
_t25 = _context12.v;
|
|
20757
|
+
log.error('ERROR in delete reaction', _t25.message);
|
|
20701
20758
|
case 8:
|
|
20702
|
-
return
|
|
20759
|
+
return _context12.a(2);
|
|
20703
20760
|
}
|
|
20704
20761
|
}, _marked1$1, null, [[0, 7]]);
|
|
20705
20762
|
}
|
|
20706
20763
|
function getReactions(action) {
|
|
20707
|
-
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result,
|
|
20708
|
-
return _regenerator().w(function (
|
|
20709
|
-
while (1) switch (
|
|
20764
|
+
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t26;
|
|
20765
|
+
return _regenerator().w(function (_context13) {
|
|
20766
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
20710
20767
|
case 0:
|
|
20711
|
-
|
|
20768
|
+
_context13.p = 0;
|
|
20712
20769
|
payload = action.payload;
|
|
20713
20770
|
messageId = payload.messageId, key = payload.key, limit = payload.limit;
|
|
20714
20771
|
SceytChatClient = getClient();
|
|
20715
|
-
|
|
20772
|
+
_context13.n = 1;
|
|
20716
20773
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
20717
20774
|
case 1:
|
|
20718
20775
|
reactionQueryBuilder = new SceytChatClient.ReactionListQueryBuilder(messageId);
|
|
@@ -20720,74 +20777,74 @@ function getReactions(action) {
|
|
|
20720
20777
|
if (key) {
|
|
20721
20778
|
reactionQueryBuilder.setKey(key);
|
|
20722
20779
|
}
|
|
20723
|
-
|
|
20780
|
+
_context13.n = 2;
|
|
20724
20781
|
return effects.call(reactionQueryBuilder.build);
|
|
20725
20782
|
case 2:
|
|
20726
|
-
reactionQuery =
|
|
20727
|
-
|
|
20783
|
+
reactionQuery = _context13.v;
|
|
20784
|
+
_context13.n = 3;
|
|
20728
20785
|
return effects.call(reactionQuery.loadNext);
|
|
20729
20786
|
case 3:
|
|
20730
|
-
result =
|
|
20787
|
+
result = _context13.v;
|
|
20731
20788
|
query.ReactionsQuery = reactionQuery;
|
|
20732
|
-
|
|
20789
|
+
_context13.n = 4;
|
|
20733
20790
|
return effects.put(setReactionsListAC(result.reactions, result.hasNext));
|
|
20734
20791
|
case 4:
|
|
20735
|
-
|
|
20792
|
+
_context13.n = 5;
|
|
20736
20793
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
20737
20794
|
case 5:
|
|
20738
|
-
|
|
20795
|
+
_context13.n = 7;
|
|
20739
20796
|
break;
|
|
20740
20797
|
case 6:
|
|
20741
|
-
|
|
20742
|
-
|
|
20743
|
-
log.error('ERROR in get reactions',
|
|
20798
|
+
_context13.p = 6;
|
|
20799
|
+
_t26 = _context13.v;
|
|
20800
|
+
log.error('ERROR in get reactions', _t26.message);
|
|
20744
20801
|
case 7:
|
|
20745
|
-
return
|
|
20802
|
+
return _context13.a(2);
|
|
20746
20803
|
}
|
|
20747
20804
|
}, _marked10$1, null, [[0, 6]]);
|
|
20748
20805
|
}
|
|
20749
20806
|
function loadMoreReactions(action) {
|
|
20750
|
-
var payload, limit, ReactionQuery, result,
|
|
20751
|
-
return _regenerator().w(function (
|
|
20752
|
-
while (1) switch (
|
|
20807
|
+
var payload, limit, ReactionQuery, result, _t27;
|
|
20808
|
+
return _regenerator().w(function (_context14) {
|
|
20809
|
+
while (1) switch (_context14.p = _context14.n) {
|
|
20753
20810
|
case 0:
|
|
20754
|
-
|
|
20811
|
+
_context14.p = 0;
|
|
20755
20812
|
payload = action.payload;
|
|
20756
20813
|
limit = payload.limit;
|
|
20757
|
-
|
|
20814
|
+
_context14.n = 1;
|
|
20758
20815
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
20759
20816
|
case 1:
|
|
20760
20817
|
ReactionQuery = query.ReactionsQuery;
|
|
20761
20818
|
if (limit) {
|
|
20762
20819
|
ReactionQuery.limit = limit;
|
|
20763
20820
|
}
|
|
20764
|
-
|
|
20821
|
+
_context14.n = 2;
|
|
20765
20822
|
return effects.call(ReactionQuery.loadNext);
|
|
20766
20823
|
case 2:
|
|
20767
|
-
result =
|
|
20768
|
-
|
|
20824
|
+
result = _context14.v;
|
|
20825
|
+
_context14.n = 3;
|
|
20769
20826
|
return effects.put(addReactionsToListAC(result.reactions, result.hasNext));
|
|
20770
20827
|
case 3:
|
|
20771
|
-
|
|
20828
|
+
_context14.n = 4;
|
|
20772
20829
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
20773
20830
|
case 4:
|
|
20774
|
-
|
|
20831
|
+
_context14.n = 6;
|
|
20775
20832
|
break;
|
|
20776
20833
|
case 5:
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
log.error('ERROR in load more reactions',
|
|
20834
|
+
_context14.p = 5;
|
|
20835
|
+
_t27 = _context14.v;
|
|
20836
|
+
log.error('ERROR in load more reactions', _t27.message);
|
|
20780
20837
|
case 6:
|
|
20781
|
-
return
|
|
20838
|
+
return _context14.a(2);
|
|
20782
20839
|
}
|
|
20783
20840
|
}, _marked11$1, null, [[0, 5]]);
|
|
20784
20841
|
}
|
|
20785
20842
|
function getMessageAttachments(action) {
|
|
20786
|
-
var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result,
|
|
20787
|
-
return _regenerator().w(function (
|
|
20788
|
-
while (1) switch (
|
|
20843
|
+
var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t28;
|
|
20844
|
+
return _regenerator().w(function (_context15) {
|
|
20845
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
20789
20846
|
case 0:
|
|
20790
|
-
|
|
20847
|
+
_context15.p = 0;
|
|
20791
20848
|
_action$payload2 = action.payload, channelId = _action$payload2.channelId, attachmentType = _action$payload2.attachmentType, limit = _action$payload2.limit, direction = _action$payload2.direction, attachmentId = _action$payload2.attachmentId, forPopup = _action$payload2.forPopup;
|
|
20792
20849
|
SceytChatClient = getClient();
|
|
20793
20850
|
typeList = [attachmentTypes.video, attachmentTypes.image, attachmentTypes.file, attachmentTypes.link, attachmentTypes.voice];
|
|
@@ -20802,244 +20859,244 @@ function getMessageAttachments(action) {
|
|
|
20802
20859
|
}
|
|
20803
20860
|
AttachmentByTypeQueryBuilder = new SceytChatClient.AttachmentListQueryBuilder(channelId, typeList);
|
|
20804
20861
|
AttachmentByTypeQueryBuilder.limit(limit || 34);
|
|
20805
|
-
|
|
20862
|
+
_context15.n = 1;
|
|
20806
20863
|
return effects.call(AttachmentByTypeQueryBuilder.build);
|
|
20807
20864
|
case 1:
|
|
20808
|
-
AttachmentByTypeQuery =
|
|
20865
|
+
AttachmentByTypeQuery = _context15.v;
|
|
20809
20866
|
if (forPopup) {
|
|
20810
20867
|
AttachmentByTypeQuery.reverse = true;
|
|
20811
20868
|
}
|
|
20812
20869
|
if (!(direction === queryDirection.NEXT)) {
|
|
20813
|
-
|
|
20870
|
+
_context15.n = 3;
|
|
20814
20871
|
break;
|
|
20815
20872
|
}
|
|
20816
|
-
|
|
20873
|
+
_context15.n = 2;
|
|
20817
20874
|
return effects.call(AttachmentByTypeQuery.loadPrevious);
|
|
20818
20875
|
case 2:
|
|
20819
|
-
result =
|
|
20820
|
-
|
|
20876
|
+
result = _context15.v;
|
|
20877
|
+
_context15.n = 7;
|
|
20821
20878
|
break;
|
|
20822
20879
|
case 3:
|
|
20823
20880
|
if (!(direction === queryDirection.NEAR)) {
|
|
20824
|
-
|
|
20881
|
+
_context15.n = 5;
|
|
20825
20882
|
break;
|
|
20826
20883
|
}
|
|
20827
|
-
|
|
20884
|
+
_context15.n = 4;
|
|
20828
20885
|
return effects.call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
|
|
20829
20886
|
case 4:
|
|
20830
|
-
result =
|
|
20831
|
-
|
|
20887
|
+
result = _context15.v;
|
|
20888
|
+
_context15.n = 7;
|
|
20832
20889
|
break;
|
|
20833
20890
|
case 5:
|
|
20834
|
-
|
|
20891
|
+
_context15.n = 6;
|
|
20835
20892
|
return effects.call(AttachmentByTypeQuery.loadPrevious);
|
|
20836
20893
|
case 6:
|
|
20837
|
-
result =
|
|
20894
|
+
result = _context15.v;
|
|
20838
20895
|
case 7:
|
|
20839
20896
|
if (!forPopup) {
|
|
20840
|
-
|
|
20897
|
+
_context15.n = 10;
|
|
20841
20898
|
break;
|
|
20842
20899
|
}
|
|
20843
20900
|
query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
|
|
20844
|
-
|
|
20901
|
+
_context15.n = 8;
|
|
20845
20902
|
return effects.put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
20846
20903
|
case 8:
|
|
20847
|
-
|
|
20904
|
+
_context15.n = 9;
|
|
20848
20905
|
return effects.put(setAttachmentsCompleteForPopupAC(result.hasNext));
|
|
20849
20906
|
case 9:
|
|
20850
|
-
|
|
20907
|
+
_context15.n = 12;
|
|
20851
20908
|
break;
|
|
20852
20909
|
case 10:
|
|
20853
20910
|
query.AttachmentByTypeQuery = AttachmentByTypeQuery;
|
|
20854
|
-
|
|
20911
|
+
_context15.n = 11;
|
|
20855
20912
|
return effects.put(setAttachmentsCompleteAC(result.hasNext));
|
|
20856
20913
|
case 11:
|
|
20857
|
-
|
|
20914
|
+
_context15.n = 12;
|
|
20858
20915
|
return effects.put(setAttachmentsAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
20859
20916
|
case 12:
|
|
20860
|
-
|
|
20917
|
+
_context15.n = 14;
|
|
20861
20918
|
break;
|
|
20862
20919
|
case 13:
|
|
20863
|
-
|
|
20864
|
-
|
|
20865
|
-
log.error('error in message attachment query',
|
|
20920
|
+
_context15.p = 13;
|
|
20921
|
+
_t28 = _context15.v;
|
|
20922
|
+
log.error('error in message attachment query', _t28);
|
|
20866
20923
|
case 14:
|
|
20867
|
-
return
|
|
20924
|
+
return _context15.a(2);
|
|
20868
20925
|
}
|
|
20869
20926
|
}, _marked12$1, null, [[0, 13]]);
|
|
20870
20927
|
}
|
|
20871
20928
|
function loadMoreMessageAttachments(action) {
|
|
20872
|
-
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext,
|
|
20873
|
-
return _regenerator().w(function (
|
|
20874
|
-
while (1) switch (
|
|
20929
|
+
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t29;
|
|
20930
|
+
return _regenerator().w(function (_context16) {
|
|
20931
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
20875
20932
|
case 0:
|
|
20876
|
-
|
|
20933
|
+
_context16.p = 0;
|
|
20877
20934
|
_action$payload3 = action.payload, limit = _action$payload3.limit, direction = _action$payload3.direction, forPopup = _action$payload3.forPopup;
|
|
20878
20935
|
if (forPopup) {
|
|
20879
20936
|
AttachmentQuery = query.AttachmentByTypeQueryForPopup;
|
|
20880
20937
|
} else {
|
|
20881
20938
|
AttachmentQuery = query.AttachmentByTypeQuery;
|
|
20882
20939
|
}
|
|
20883
|
-
|
|
20940
|
+
_context16.n = 1;
|
|
20884
20941
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
20885
20942
|
case 1:
|
|
20886
20943
|
AttachmentQuery.limit = limit;
|
|
20887
|
-
|
|
20944
|
+
_context16.n = 2;
|
|
20888
20945
|
return effects.call(AttachmentQuery.loadPrevious);
|
|
20889
20946
|
case 2:
|
|
20890
|
-
_yield$call3 =
|
|
20947
|
+
_yield$call3 = _context16.v;
|
|
20891
20948
|
attachments = _yield$call3.attachments;
|
|
20892
20949
|
hasNext = _yield$call3.hasNext;
|
|
20893
20950
|
if (!forPopup) {
|
|
20894
|
-
|
|
20951
|
+
_context16.n = 4;
|
|
20895
20952
|
break;
|
|
20896
20953
|
}
|
|
20897
|
-
|
|
20954
|
+
_context16.n = 3;
|
|
20898
20955
|
return effects.put(addAttachmentsForPopupAC(attachments, direction));
|
|
20899
20956
|
case 3:
|
|
20900
|
-
|
|
20957
|
+
_context16.n = 7;
|
|
20901
20958
|
break;
|
|
20902
20959
|
case 4:
|
|
20903
|
-
|
|
20960
|
+
_context16.n = 5;
|
|
20904
20961
|
return effects.put(setAttachmentsCompleteAC(hasNext));
|
|
20905
20962
|
case 5:
|
|
20906
|
-
|
|
20963
|
+
_context16.n = 6;
|
|
20907
20964
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20908
20965
|
case 6:
|
|
20909
|
-
|
|
20966
|
+
_context16.n = 7;
|
|
20910
20967
|
return effects.put(addAttachmentsAC(attachments));
|
|
20911
20968
|
case 7:
|
|
20912
|
-
|
|
20969
|
+
_context16.n = 9;
|
|
20913
20970
|
break;
|
|
20914
20971
|
case 8:
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
log.error('error in message attachment query',
|
|
20972
|
+
_context16.p = 8;
|
|
20973
|
+
_t29 = _context16.v;
|
|
20974
|
+
log.error('error in message attachment query', _t29);
|
|
20918
20975
|
case 9:
|
|
20919
|
-
return
|
|
20976
|
+
return _context16.a(2);
|
|
20920
20977
|
}
|
|
20921
20978
|
}, _marked13$1, null, [[0, 8]]);
|
|
20922
20979
|
}
|
|
20923
20980
|
function pauseAttachmentUploading(action) {
|
|
20924
|
-
var attachmentId, isPaused,
|
|
20925
|
-
return _regenerator().w(function (
|
|
20926
|
-
while (1) switch (
|
|
20981
|
+
var attachmentId, isPaused, _t30;
|
|
20982
|
+
return _regenerator().w(function (_context17) {
|
|
20983
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
20927
20984
|
case 0:
|
|
20928
|
-
|
|
20985
|
+
_context17.p = 0;
|
|
20929
20986
|
attachmentId = action.payload.attachmentId;
|
|
20930
20987
|
if (!getCustomUploader()) {
|
|
20931
|
-
|
|
20988
|
+
_context17.n = 1;
|
|
20932
20989
|
break;
|
|
20933
20990
|
}
|
|
20934
20991
|
isPaused = pauseUpload(attachmentId);
|
|
20935
20992
|
if (!isPaused) {
|
|
20936
|
-
|
|
20993
|
+
_context17.n = 1;
|
|
20937
20994
|
break;
|
|
20938
20995
|
}
|
|
20939
|
-
|
|
20996
|
+
_context17.n = 1;
|
|
20940
20997
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.PAUSED, attachmentId));
|
|
20941
20998
|
case 1:
|
|
20942
|
-
|
|
20999
|
+
_context17.n = 3;
|
|
20943
21000
|
break;
|
|
20944
21001
|
case 2:
|
|
20945
|
-
|
|
20946
|
-
|
|
20947
|
-
log.error('error in pause attachment uploading',
|
|
21002
|
+
_context17.p = 2;
|
|
21003
|
+
_t30 = _context17.v;
|
|
21004
|
+
log.error('error in pause attachment uploading', _t30);
|
|
20948
21005
|
case 3:
|
|
20949
|
-
return
|
|
21006
|
+
return _context17.a(2);
|
|
20950
21007
|
}
|
|
20951
21008
|
}, _marked14$1, null, [[0, 2]]);
|
|
20952
21009
|
}
|
|
20953
21010
|
function resumeAttachmentUploading(action) {
|
|
20954
|
-
var attachmentId, isResumed,
|
|
20955
|
-
return _regenerator().w(function (
|
|
20956
|
-
while (1) switch (
|
|
21011
|
+
var attachmentId, isResumed, _t31;
|
|
21012
|
+
return _regenerator().w(function (_context18) {
|
|
21013
|
+
while (1) switch (_context18.p = _context18.n) {
|
|
20957
21014
|
case 0:
|
|
20958
|
-
|
|
21015
|
+
_context18.p = 0;
|
|
20959
21016
|
attachmentId = action.payload.attachmentId;
|
|
20960
21017
|
log.info('resume for attachment ... ', attachmentId);
|
|
20961
21018
|
if (!getCustomUploader()) {
|
|
20962
|
-
|
|
21019
|
+
_context18.n = 1;
|
|
20963
21020
|
break;
|
|
20964
21021
|
}
|
|
20965
21022
|
isResumed = resumeUpload(attachmentId);
|
|
20966
21023
|
if (!isResumed) {
|
|
20967
|
-
|
|
21024
|
+
_context18.n = 1;
|
|
20968
21025
|
break;
|
|
20969
21026
|
}
|
|
20970
|
-
|
|
21027
|
+
_context18.n = 1;
|
|
20971
21028
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
|
|
20972
21029
|
case 1:
|
|
20973
|
-
|
|
21030
|
+
_context18.n = 3;
|
|
20974
21031
|
break;
|
|
20975
21032
|
case 2:
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
log.error('error in resume attachment uploading',
|
|
21033
|
+
_context18.p = 2;
|
|
21034
|
+
_t31 = _context18.v;
|
|
21035
|
+
log.error('error in resume attachment uploading', _t31);
|
|
20979
21036
|
case 3:
|
|
20980
|
-
return
|
|
21037
|
+
return _context18.a(2);
|
|
20981
21038
|
}
|
|
20982
21039
|
}, _marked15$1, null, [[0, 2]]);
|
|
20983
21040
|
}
|
|
20984
21041
|
function getMessageMarkers(action) {
|
|
20985
|
-
var _action$payload4, messageId, channelId, deliveryStatus, sceytChatClient, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkers,
|
|
20986
|
-
return _regenerator().w(function (
|
|
20987
|
-
while (1) switch (
|
|
21042
|
+
var _action$payload4, messageId, channelId, deliveryStatus, sceytChatClient, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkers, _t32;
|
|
21043
|
+
return _regenerator().w(function (_context19) {
|
|
21044
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
20988
21045
|
case 0:
|
|
20989
|
-
|
|
20990
|
-
|
|
21046
|
+
_context19.p = 0;
|
|
21047
|
+
_context19.n = 1;
|
|
20991
21048
|
return effects.put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADING));
|
|
20992
21049
|
case 1:
|
|
20993
21050
|
_action$payload4 = action.payload, messageId = _action$payload4.messageId, channelId = _action$payload4.channelId, deliveryStatus = _action$payload4.deliveryStatus;
|
|
20994
21051
|
sceytChatClient = getClient();
|
|
20995
21052
|
if (!sceytChatClient) {
|
|
20996
|
-
|
|
21053
|
+
_context19.n = 4;
|
|
20997
21054
|
break;
|
|
20998
21055
|
}
|
|
20999
21056
|
messageMarkerListQueryBuilder = new sceytChatClient.MessageMarkerListQueryBuilder(channelId, String(messageId), deliveryStatus);
|
|
21000
|
-
|
|
21057
|
+
_context19.n = 2;
|
|
21001
21058
|
return effects.call(messageMarkerListQueryBuilder.build);
|
|
21002
21059
|
case 2:
|
|
21003
|
-
messageMarkerListQuery =
|
|
21004
|
-
|
|
21060
|
+
messageMarkerListQuery = _context19.v;
|
|
21061
|
+
_context19.n = 3;
|
|
21005
21062
|
return effects.call(messageMarkerListQuery.loadNext);
|
|
21006
21063
|
case 3:
|
|
21007
|
-
messageMarkers =
|
|
21008
|
-
|
|
21064
|
+
messageMarkers = _context19.v;
|
|
21065
|
+
_context19.n = 4;
|
|
21009
21066
|
return effects.put(setMessageMarkersAC(channelId, messageId, messageMarkers.markers, deliveryStatus));
|
|
21010
21067
|
case 4:
|
|
21011
|
-
|
|
21068
|
+
_context19.n = 6;
|
|
21012
21069
|
break;
|
|
21013
21070
|
case 5:
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
log.error('error in get message markers',
|
|
21071
|
+
_context19.p = 5;
|
|
21072
|
+
_t32 = _context19.v;
|
|
21073
|
+
log.error('error in get message markers', _t32);
|
|
21017
21074
|
case 6:
|
|
21018
|
-
|
|
21019
|
-
|
|
21075
|
+
_context19.p = 6;
|
|
21076
|
+
_context19.n = 7;
|
|
21020
21077
|
return effects.put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADED));
|
|
21021
21078
|
case 7:
|
|
21022
|
-
return
|
|
21079
|
+
return _context19.f(6);
|
|
21023
21080
|
case 8:
|
|
21024
|
-
return
|
|
21081
|
+
return _context19.a(2);
|
|
21025
21082
|
}
|
|
21026
21083
|
}, _marked16$1, null, [[0, 5, 6, 8]]);
|
|
21027
21084
|
}
|
|
21028
21085
|
function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
21029
21086
|
var _user$presence, _message$pollDetails, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4;
|
|
21030
21087
|
var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7, _iterator2, _step2, obj;
|
|
21031
|
-
return _regenerator().w(function (
|
|
21032
|
-
while (1) switch (
|
|
21088
|
+
return _regenerator().w(function (_context20) {
|
|
21089
|
+
while (1) switch (_context20.n) {
|
|
21033
21090
|
case 0:
|
|
21034
|
-
|
|
21091
|
+
_context20.n = 1;
|
|
21035
21092
|
return effects.call(getChannelFromMap, channelId);
|
|
21036
21093
|
case 1:
|
|
21037
|
-
channel =
|
|
21094
|
+
channel = _context20.v;
|
|
21038
21095
|
if (message.pollDetails) {
|
|
21039
|
-
|
|
21096
|
+
_context20.n = 2;
|
|
21040
21097
|
break;
|
|
21041
21098
|
}
|
|
21042
|
-
return
|
|
21099
|
+
return _context20.a(2);
|
|
21043
21100
|
case 2:
|
|
21044
21101
|
user = getClient().user;
|
|
21045
21102
|
vote = {
|
|
@@ -21077,13 +21134,13 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21077
21134
|
incrementVotesPerOptionCount: 1
|
|
21078
21135
|
});
|
|
21079
21136
|
if (isResend) {
|
|
21080
|
-
|
|
21137
|
+
_context20.n = 5;
|
|
21081
21138
|
break;
|
|
21082
21139
|
}
|
|
21083
21140
|
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21084
21141
|
case 3:
|
|
21085
21142
|
if ((_step2 = _iterator2()).done) {
|
|
21086
|
-
|
|
21143
|
+
_context20.n = 5;
|
|
21087
21144
|
break;
|
|
21088
21145
|
}
|
|
21089
21146
|
obj = _step2.value;
|
|
@@ -21092,46 +21149,46 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21092
21149
|
params: {}
|
|
21093
21150
|
}, obj);
|
|
21094
21151
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21095
|
-
|
|
21152
|
+
_context20.n = 4;
|
|
21096
21153
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21097
21154
|
case 4:
|
|
21098
|
-
|
|
21155
|
+
_context20.n = 3;
|
|
21099
21156
|
break;
|
|
21100
21157
|
case 5:
|
|
21101
21158
|
if (!channel) {
|
|
21102
|
-
|
|
21159
|
+
_context20.n = 7;
|
|
21103
21160
|
break;
|
|
21104
21161
|
}
|
|
21105
|
-
|
|
21162
|
+
_context20.n = 6;
|
|
21106
21163
|
return effects.call(channel.addVote, message.id, pollId, [optionId]);
|
|
21107
21164
|
case 6:
|
|
21108
|
-
|
|
21165
|
+
_context20.n = 7;
|
|
21109
21166
|
return effects.put(removePendingPollActionAC(message.id, 'ADD_POLL_VOTE', optionId));
|
|
21110
21167
|
case 7:
|
|
21111
|
-
return
|
|
21168
|
+
return _context20.a(2);
|
|
21112
21169
|
}
|
|
21113
21170
|
}, _marked17$1);
|
|
21114
21171
|
}
|
|
21115
21172
|
function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
21116
21173
|
var channel, obj;
|
|
21117
|
-
return _regenerator().w(function (
|
|
21118
|
-
while (1) switch (
|
|
21174
|
+
return _regenerator().w(function (_context21) {
|
|
21175
|
+
while (1) switch (_context21.n) {
|
|
21119
21176
|
case 0:
|
|
21120
|
-
|
|
21177
|
+
_context21.n = 1;
|
|
21121
21178
|
return effects.call(getChannelFromMap, channelId);
|
|
21122
21179
|
case 1:
|
|
21123
|
-
channel =
|
|
21180
|
+
channel = _context21.v;
|
|
21124
21181
|
if (channel) {
|
|
21125
|
-
|
|
21182
|
+
_context21.n = 2;
|
|
21126
21183
|
break;
|
|
21127
21184
|
}
|
|
21128
|
-
return
|
|
21185
|
+
return _context21.a(2);
|
|
21129
21186
|
case 2:
|
|
21130
21187
|
if (message.pollDetails) {
|
|
21131
|
-
|
|
21188
|
+
_context21.n = 3;
|
|
21132
21189
|
break;
|
|
21133
21190
|
}
|
|
21134
|
-
return
|
|
21191
|
+
return _context21.a(2);
|
|
21135
21192
|
case 3:
|
|
21136
21193
|
obj = {
|
|
21137
21194
|
type: 'addOwn',
|
|
@@ -21143,24 +21200,24 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
|
21143
21200
|
params: {}
|
|
21144
21201
|
}, obj);
|
|
21145
21202
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21146
|
-
|
|
21203
|
+
_context21.n = 4;
|
|
21147
21204
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21148
21205
|
case 4:
|
|
21149
|
-
return
|
|
21206
|
+
return _context21.a(2);
|
|
21150
21207
|
}
|
|
21151
21208
|
}, _marked18$1);
|
|
21152
21209
|
}
|
|
21153
21210
|
function addPollVote(action) {
|
|
21154
|
-
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, connectionState, user, vote, pendingAction, conflictCheck, channel, _Object$values2, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj,
|
|
21155
|
-
return _regenerator().w(function (
|
|
21156
|
-
while (1) switch (
|
|
21211
|
+
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, connectionState, user, vote, pendingAction, conflictCheck, channel, _Object$values2, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t33;
|
|
21212
|
+
return _regenerator().w(function (_context22) {
|
|
21213
|
+
while (1) switch (_context22.p = _context22.n) {
|
|
21157
21214
|
case 0:
|
|
21158
|
-
|
|
21215
|
+
_context22.p = 0;
|
|
21159
21216
|
payload = action.payload;
|
|
21160
21217
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21161
21218
|
sceytChatClient = getClient();
|
|
21162
21219
|
if (!sceytChatClient) {
|
|
21163
|
-
|
|
21220
|
+
_context22.n = 7;
|
|
21164
21221
|
break;
|
|
21165
21222
|
}
|
|
21166
21223
|
connectionState = sceytChatClient.connectionState;
|
|
@@ -21187,7 +21244,7 @@ function addPollVote(action) {
|
|
|
21187
21244
|
}
|
|
21188
21245
|
};
|
|
21189
21246
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21190
|
-
|
|
21247
|
+
_context22.n = 6;
|
|
21191
21248
|
break;
|
|
21192
21249
|
}
|
|
21193
21250
|
pendingAction = {
|
|
@@ -21199,22 +21256,22 @@ function addPollVote(action) {
|
|
|
21199
21256
|
};
|
|
21200
21257
|
conflictCheck = checkPendingPollActionConflict(pendingAction);
|
|
21201
21258
|
if (!(conflictCheck.hasConflict && !conflictCheck.shouldSkip)) {
|
|
21202
|
-
|
|
21259
|
+
_context22.n = 4;
|
|
21203
21260
|
break;
|
|
21204
21261
|
}
|
|
21205
|
-
|
|
21262
|
+
_context22.n = 1;
|
|
21206
21263
|
return effects.call(getChannelFromMap, channelId);
|
|
21207
21264
|
case 1:
|
|
21208
|
-
channel =
|
|
21265
|
+
channel = _context22.v;
|
|
21209
21266
|
if (!channel) {
|
|
21210
|
-
|
|
21267
|
+
_context22.n = 3;
|
|
21211
21268
|
break;
|
|
21212
21269
|
}
|
|
21213
21270
|
currentMessage = ((_Object$values2 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.find(function (msg) {
|
|
21214
21271
|
return msg.id === message.id || msg.tid === message.id;
|
|
21215
21272
|
})) || message;
|
|
21216
21273
|
hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[pollId]) || false;
|
|
21217
|
-
|
|
21274
|
+
_context22.n = 2;
|
|
21218
21275
|
return effects.put(addPollVotesToListAC(pollId, optionId, [(_currentMessage$pollD = currentMessage.pollDetails) === null || _currentMessage$pollD === void 0 ? void 0 : (_currentMessage$pollD2 = _currentMessage$pollD.voteDetails) === null || _currentMessage$pollD2 === void 0 ? void 0 : (_currentMessage$pollD3 = _currentMessage$pollD2.ownVotes) === null || _currentMessage$pollD3 === void 0 ? void 0 : _currentMessage$pollD3[0]], hasNext, message.id));
|
|
21219
21276
|
case 2:
|
|
21220
21277
|
obj = {
|
|
@@ -21227,60 +21284,60 @@ function addPollVote(action) {
|
|
|
21227
21284
|
params: {}
|
|
21228
21285
|
}, obj);
|
|
21229
21286
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21230
|
-
|
|
21287
|
+
_context22.n = 3;
|
|
21231
21288
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21232
21289
|
case 3:
|
|
21233
|
-
|
|
21290
|
+
_context22.n = 5;
|
|
21234
21291
|
break;
|
|
21235
21292
|
case 4:
|
|
21236
21293
|
if (conflictCheck.shouldSkip) {
|
|
21237
|
-
|
|
21294
|
+
_context22.n = 5;
|
|
21238
21295
|
break;
|
|
21239
21296
|
}
|
|
21240
|
-
return
|
|
21297
|
+
return _context22.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
|
|
21241
21298
|
case 5:
|
|
21242
21299
|
if (!conflictCheck.shouldSkip) {
|
|
21243
21300
|
setPendingPollAction(pendingAction);
|
|
21244
21301
|
}
|
|
21245
|
-
return
|
|
21302
|
+
return _context22.a(2);
|
|
21246
21303
|
case 6:
|
|
21247
|
-
return
|
|
21304
|
+
return _context22.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message, isResend)), 7);
|
|
21248
21305
|
case 7:
|
|
21249
|
-
|
|
21306
|
+
_context22.n = 9;
|
|
21250
21307
|
break;
|
|
21251
21308
|
case 8:
|
|
21252
|
-
|
|
21253
|
-
|
|
21254
|
-
log.error('error in add poll vote',
|
|
21309
|
+
_context22.p = 8;
|
|
21310
|
+
_t33 = _context22.v;
|
|
21311
|
+
log.error('error in add poll vote', _t33);
|
|
21255
21312
|
case 9:
|
|
21256
|
-
return
|
|
21313
|
+
return _context22.a(2);
|
|
21257
21314
|
}
|
|
21258
21315
|
}, _marked19$1, null, [[0, 8]]);
|
|
21259
21316
|
}
|
|
21260
21317
|
function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
21261
21318
|
var _message$pollDetails8, _message$pollDetails9, _message$pollDetails0;
|
|
21262
21319
|
var channel, vote, obj;
|
|
21263
|
-
return _regenerator().w(function (
|
|
21264
|
-
while (1) switch (
|
|
21320
|
+
return _regenerator().w(function (_context23) {
|
|
21321
|
+
while (1) switch (_context23.n) {
|
|
21265
21322
|
case 0:
|
|
21266
|
-
|
|
21323
|
+
_context23.n = 1;
|
|
21267
21324
|
return effects.call(getChannelFromMap, channelId);
|
|
21268
21325
|
case 1:
|
|
21269
|
-
channel =
|
|
21326
|
+
channel = _context23.v;
|
|
21270
21327
|
if (message.pollDetails) {
|
|
21271
|
-
|
|
21328
|
+
_context23.n = 2;
|
|
21272
21329
|
break;
|
|
21273
21330
|
}
|
|
21274
|
-
return
|
|
21331
|
+
return _context23.a(2);
|
|
21275
21332
|
case 2:
|
|
21276
21333
|
vote = (_message$pollDetails8 = message.pollDetails) === null || _message$pollDetails8 === void 0 ? void 0 : (_message$pollDetails9 = _message$pollDetails8.voteDetails) === null || _message$pollDetails9 === void 0 ? void 0 : (_message$pollDetails0 = _message$pollDetails9.ownVotes) === null || _message$pollDetails0 === void 0 ? void 0 : _message$pollDetails0.find(function (vote) {
|
|
21277
21334
|
return vote.optionId === optionId;
|
|
21278
21335
|
});
|
|
21279
21336
|
if (vote) {
|
|
21280
|
-
|
|
21337
|
+
_context23.n = 3;
|
|
21281
21338
|
break;
|
|
21282
21339
|
}
|
|
21283
|
-
return
|
|
21340
|
+
return _context23.a(2);
|
|
21284
21341
|
case 3:
|
|
21285
21342
|
obj = {
|
|
21286
21343
|
type: 'deleteOwn',
|
|
@@ -21288,7 +21345,7 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21288
21345
|
incrementVotesPerOptionCount: -1
|
|
21289
21346
|
};
|
|
21290
21347
|
if (isResend) {
|
|
21291
|
-
|
|
21348
|
+
_context23.n = 4;
|
|
21292
21349
|
break;
|
|
21293
21350
|
}
|
|
21294
21351
|
updateMessageOnMap(channel.id, {
|
|
@@ -21296,43 +21353,43 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21296
21353
|
params: {}
|
|
21297
21354
|
}, obj);
|
|
21298
21355
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21299
|
-
|
|
21356
|
+
_context23.n = 4;
|
|
21300
21357
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21301
21358
|
case 4:
|
|
21302
21359
|
if (!channel) {
|
|
21303
|
-
|
|
21360
|
+
_context23.n = 6;
|
|
21304
21361
|
break;
|
|
21305
21362
|
}
|
|
21306
|
-
|
|
21363
|
+
_context23.n = 5;
|
|
21307
21364
|
return effects.call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
21308
21365
|
case 5:
|
|
21309
|
-
|
|
21366
|
+
_context23.n = 6;
|
|
21310
21367
|
return effects.put(removePendingPollActionAC(message.id, 'DELETE_POLL_VOTE', optionId));
|
|
21311
21368
|
case 6:
|
|
21312
|
-
return
|
|
21369
|
+
return _context23.a(2);
|
|
21313
21370
|
}
|
|
21314
21371
|
}, _marked20$1);
|
|
21315
21372
|
}
|
|
21316
21373
|
function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote) {
|
|
21317
21374
|
var channel, obj;
|
|
21318
|
-
return _regenerator().w(function (
|
|
21319
|
-
while (1) switch (
|
|
21375
|
+
return _regenerator().w(function (_context24) {
|
|
21376
|
+
while (1) switch (_context24.n) {
|
|
21320
21377
|
case 0:
|
|
21321
|
-
|
|
21378
|
+
_context24.n = 1;
|
|
21322
21379
|
return effects.call(getChannelFromMap, channelId);
|
|
21323
21380
|
case 1:
|
|
21324
|
-
channel =
|
|
21381
|
+
channel = _context24.v;
|
|
21325
21382
|
if (channel) {
|
|
21326
|
-
|
|
21383
|
+
_context24.n = 2;
|
|
21327
21384
|
break;
|
|
21328
21385
|
}
|
|
21329
|
-
return
|
|
21386
|
+
return _context24.a(2);
|
|
21330
21387
|
case 2:
|
|
21331
21388
|
if (message.pollDetails) {
|
|
21332
|
-
|
|
21389
|
+
_context24.n = 3;
|
|
21333
21390
|
break;
|
|
21334
21391
|
}
|
|
21335
|
-
return
|
|
21392
|
+
return _context24.a(2);
|
|
21336
21393
|
case 3:
|
|
21337
21394
|
obj = {
|
|
21338
21395
|
type: 'deleteOwn',
|
|
@@ -21344,24 +21401,24 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
|
|
|
21344
21401
|
params: {}
|
|
21345
21402
|
}, obj);
|
|
21346
21403
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21347
|
-
|
|
21404
|
+
_context24.n = 4;
|
|
21348
21405
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21349
21406
|
case 4:
|
|
21350
|
-
return
|
|
21407
|
+
return _context24.a(2);
|
|
21351
21408
|
}
|
|
21352
21409
|
}, _marked21$1);
|
|
21353
21410
|
}
|
|
21354
21411
|
function deletePollVote(action) {
|
|
21355
|
-
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, connectionState, vote, pendingAction, conflictCheck, channel, _Object$values3, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj,
|
|
21356
|
-
return _regenerator().w(function (
|
|
21357
|
-
while (1) switch (
|
|
21412
|
+
var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, connectionState, vote, pendingAction, conflictCheck, channel, _Object$values3, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t34;
|
|
21413
|
+
return _regenerator().w(function (_context25) {
|
|
21414
|
+
while (1) switch (_context25.p = _context25.n) {
|
|
21358
21415
|
case 0:
|
|
21359
|
-
|
|
21416
|
+
_context25.p = 0;
|
|
21360
21417
|
payload = action.payload;
|
|
21361
21418
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21362
21419
|
sceytChatClient = getClient();
|
|
21363
21420
|
if (!sceytChatClient) {
|
|
21364
|
-
|
|
21421
|
+
_context25.n = 8;
|
|
21365
21422
|
break;
|
|
21366
21423
|
}
|
|
21367
21424
|
connectionState = sceytChatClient.connectionState;
|
|
@@ -21369,13 +21426,13 @@ function deletePollVote(action) {
|
|
|
21369
21426
|
return vote.optionId === optionId;
|
|
21370
21427
|
});
|
|
21371
21428
|
if (vote) {
|
|
21372
|
-
|
|
21429
|
+
_context25.n = 1;
|
|
21373
21430
|
break;
|
|
21374
21431
|
}
|
|
21375
|
-
return
|
|
21432
|
+
return _context25.a(2);
|
|
21376
21433
|
case 1:
|
|
21377
21434
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21378
|
-
|
|
21435
|
+
_context25.n = 7;
|
|
21379
21436
|
break;
|
|
21380
21437
|
}
|
|
21381
21438
|
pendingAction = {
|
|
@@ -21387,21 +21444,21 @@ function deletePollVote(action) {
|
|
|
21387
21444
|
};
|
|
21388
21445
|
conflictCheck = checkPendingPollActionConflict(pendingAction);
|
|
21389
21446
|
if (!(conflictCheck.hasConflict && conflictCheck.shouldSkip)) {
|
|
21390
|
-
|
|
21447
|
+
_context25.n = 5;
|
|
21391
21448
|
break;
|
|
21392
21449
|
}
|
|
21393
|
-
|
|
21450
|
+
_context25.n = 2;
|
|
21394
21451
|
return effects.call(getChannelFromMap, channelId);
|
|
21395
21452
|
case 2:
|
|
21396
|
-
channel =
|
|
21453
|
+
channel = _context25.v;
|
|
21397
21454
|
if (!channel) {
|
|
21398
|
-
|
|
21455
|
+
_context25.n = 4;
|
|
21399
21456
|
break;
|
|
21400
21457
|
}
|
|
21401
21458
|
currentMessage = ((_Object$values3 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.find(function (msg) {
|
|
21402
21459
|
return msg.id === message.id || msg.tid === message.id;
|
|
21403
21460
|
})) || message;
|
|
21404
|
-
|
|
21461
|
+
_context25.n = 3;
|
|
21405
21462
|
return effects.put(deletePollVotesFromListAC(pollId, optionId, [(_currentMessage$pollD4 = currentMessage.pollDetails) === null || _currentMessage$pollD4 === void 0 ? void 0 : (_currentMessage$pollD5 = _currentMessage$pollD4.voteDetails) === null || _currentMessage$pollD5 === void 0 ? void 0 : (_currentMessage$pollD6 = _currentMessage$pollD5.ownVotes) === null || _currentMessage$pollD6 === void 0 ? void 0 : _currentMessage$pollD6[0]], message.id));
|
|
21406
21463
|
case 3:
|
|
21407
21464
|
obj = {
|
|
@@ -21414,45 +21471,45 @@ function deletePollVote(action) {
|
|
|
21414
21471
|
params: {}
|
|
21415
21472
|
}, obj);
|
|
21416
21473
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21417
|
-
|
|
21474
|
+
_context25.n = 4;
|
|
21418
21475
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21419
21476
|
case 4:
|
|
21420
|
-
|
|
21477
|
+
_context25.n = 6;
|
|
21421
21478
|
break;
|
|
21422
21479
|
case 5:
|
|
21423
21480
|
if (conflictCheck.shouldSkip) {
|
|
21424
|
-
|
|
21481
|
+
_context25.n = 6;
|
|
21425
21482
|
break;
|
|
21426
21483
|
}
|
|
21427
|
-
return
|
|
21484
|
+
return _context25.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
|
|
21428
21485
|
case 6:
|
|
21429
21486
|
if (!conflictCheck.shouldSkip) {
|
|
21430
21487
|
setPendingPollAction(pendingAction);
|
|
21431
21488
|
}
|
|
21432
|
-
return
|
|
21489
|
+
return _context25.a(2);
|
|
21433
21490
|
case 7:
|
|
21434
|
-
return
|
|
21491
|
+
return _context25.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message, isResend)), 8);
|
|
21435
21492
|
case 8:
|
|
21436
|
-
|
|
21493
|
+
_context25.n = 10;
|
|
21437
21494
|
break;
|
|
21438
21495
|
case 9:
|
|
21439
|
-
|
|
21440
|
-
|
|
21441
|
-
log.error('error in delete poll vote',
|
|
21496
|
+
_context25.p = 9;
|
|
21497
|
+
_t34 = _context25.v;
|
|
21498
|
+
log.error('error in delete poll vote', _t34);
|
|
21442
21499
|
case 10:
|
|
21443
|
-
return
|
|
21500
|
+
return _context25.a(2);
|
|
21444
21501
|
}
|
|
21445
21502
|
}, _marked22$1, null, [[0, 9]]);
|
|
21446
21503
|
}
|
|
21447
21504
|
function executeClosePoll(channelId, pollId, message) {
|
|
21448
21505
|
var channel, obj;
|
|
21449
|
-
return _regenerator().w(function (
|
|
21450
|
-
while (1) switch (
|
|
21506
|
+
return _regenerator().w(function (_context26) {
|
|
21507
|
+
while (1) switch (_context26.n) {
|
|
21451
21508
|
case 0:
|
|
21452
|
-
|
|
21509
|
+
_context26.n = 1;
|
|
21453
21510
|
return effects.call(getChannelFromMap, channelId);
|
|
21454
21511
|
case 1:
|
|
21455
|
-
channel =
|
|
21512
|
+
channel = _context26.v;
|
|
21456
21513
|
obj = {
|
|
21457
21514
|
type: 'close',
|
|
21458
21515
|
incrementVotesPerOptionCount: 0
|
|
@@ -21462,37 +21519,37 @@ function executeClosePoll(channelId, pollId, message) {
|
|
|
21462
21519
|
params: {}
|
|
21463
21520
|
}, obj);
|
|
21464
21521
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21465
|
-
|
|
21522
|
+
_context26.n = 2;
|
|
21466
21523
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21467
21524
|
case 2:
|
|
21468
21525
|
if (!channel) {
|
|
21469
|
-
|
|
21526
|
+
_context26.n = 4;
|
|
21470
21527
|
break;
|
|
21471
21528
|
}
|
|
21472
|
-
|
|
21529
|
+
_context26.n = 3;
|
|
21473
21530
|
return effects.call(channel.closePoll, message.id, pollId);
|
|
21474
21531
|
case 3:
|
|
21475
|
-
|
|
21532
|
+
_context26.n = 4;
|
|
21476
21533
|
return effects.put(removePendingPollActionAC(message.id, 'CLOSE_POLL'));
|
|
21477
21534
|
case 4:
|
|
21478
|
-
return
|
|
21535
|
+
return _context26.a(2);
|
|
21479
21536
|
}
|
|
21480
21537
|
}, _marked23$1);
|
|
21481
21538
|
}
|
|
21482
21539
|
function updateMessageOptimisticallyForClosePoll(channelId, message) {
|
|
21483
21540
|
var channel, pollDetails;
|
|
21484
|
-
return _regenerator().w(function (
|
|
21485
|
-
while (1) switch (
|
|
21541
|
+
return _regenerator().w(function (_context27) {
|
|
21542
|
+
while (1) switch (_context27.n) {
|
|
21486
21543
|
case 0:
|
|
21487
|
-
|
|
21544
|
+
_context27.n = 1;
|
|
21488
21545
|
return effects.call(getChannelFromMap, channelId);
|
|
21489
21546
|
case 1:
|
|
21490
|
-
channel =
|
|
21547
|
+
channel = _context27.v;
|
|
21491
21548
|
if (channel) {
|
|
21492
|
-
|
|
21549
|
+
_context27.n = 2;
|
|
21493
21550
|
break;
|
|
21494
21551
|
}
|
|
21495
|
-
return
|
|
21552
|
+
return _context27.a(2);
|
|
21496
21553
|
case 2:
|
|
21497
21554
|
pollDetails = JSON.parse(JSON.stringify(message.pollDetails));
|
|
21498
21555
|
pollDetails.closed = true;
|
|
@@ -21506,34 +21563,34 @@ function updateMessageOptimisticallyForClosePoll(channelId, message) {
|
|
|
21506
21563
|
updateMessageOnAllMessages(message.id, {
|
|
21507
21564
|
pollDetails: pollDetails
|
|
21508
21565
|
});
|
|
21509
|
-
|
|
21566
|
+
_context27.n = 3;
|
|
21510
21567
|
return effects.put(updateMessageAC(message.id, {
|
|
21511
21568
|
pollDetails: pollDetails
|
|
21512
21569
|
}));
|
|
21513
21570
|
case 3:
|
|
21514
|
-
return
|
|
21571
|
+
return _context27.a(2);
|
|
21515
21572
|
}
|
|
21516
21573
|
}, _marked24$1);
|
|
21517
21574
|
}
|
|
21518
21575
|
function closePoll(action) {
|
|
21519
|
-
var payload, channelId, pollId, message, sceytChatClient, connectionState,
|
|
21520
|
-
return _regenerator().w(function (
|
|
21521
|
-
while (1) switch (
|
|
21576
|
+
var payload, channelId, pollId, message, sceytChatClient, connectionState, _t35;
|
|
21577
|
+
return _regenerator().w(function (_context28) {
|
|
21578
|
+
while (1) switch (_context28.p = _context28.n) {
|
|
21522
21579
|
case 0:
|
|
21523
|
-
|
|
21580
|
+
_context28.p = 0;
|
|
21524
21581
|
payload = action.payload;
|
|
21525
21582
|
channelId = payload.channelId, pollId = payload.pollId, message = payload.message;
|
|
21526
21583
|
sceytChatClient = getClient();
|
|
21527
21584
|
if (!sceytChatClient) {
|
|
21528
|
-
|
|
21585
|
+
_context28.n = 3;
|
|
21529
21586
|
break;
|
|
21530
21587
|
}
|
|
21531
21588
|
connectionState = sceytChatClient.connectionState;
|
|
21532
21589
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21533
|
-
|
|
21590
|
+
_context28.n = 2;
|
|
21534
21591
|
break;
|
|
21535
21592
|
}
|
|
21536
|
-
return
|
|
21593
|
+
return _context28.d(_regeneratorValues(updateMessageOptimisticallyForClosePoll(channelId, message)), 1);
|
|
21537
21594
|
case 1:
|
|
21538
21595
|
setPendingPollAction({
|
|
21539
21596
|
type: 'CLOSE_POLL',
|
|
@@ -21541,38 +21598,38 @@ function closePoll(action) {
|
|
|
21541
21598
|
pollId: pollId,
|
|
21542
21599
|
message: message
|
|
21543
21600
|
});
|
|
21544
|
-
return
|
|
21601
|
+
return _context28.a(2);
|
|
21545
21602
|
case 2:
|
|
21546
|
-
return
|
|
21603
|
+
return _context28.d(_regeneratorValues(executeClosePoll(channelId, pollId, message)), 3);
|
|
21547
21604
|
case 3:
|
|
21548
|
-
|
|
21605
|
+
_context28.n = 5;
|
|
21549
21606
|
break;
|
|
21550
21607
|
case 4:
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
log.error('error in close poll',
|
|
21608
|
+
_context28.p = 4;
|
|
21609
|
+
_t35 = _context28.v;
|
|
21610
|
+
log.error('error in close poll', _t35);
|
|
21554
21611
|
case 5:
|
|
21555
|
-
return
|
|
21612
|
+
return _context28.a(2);
|
|
21556
21613
|
}
|
|
21557
21614
|
}, _marked25$1, null, [[0, 4]]);
|
|
21558
21615
|
}
|
|
21559
21616
|
function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
21560
21617
|
var channel, _iterator3, _step3, obj;
|
|
21561
|
-
return _regenerator().w(function (
|
|
21562
|
-
while (1) switch (
|
|
21618
|
+
return _regenerator().w(function (_context29) {
|
|
21619
|
+
while (1) switch (_context29.n) {
|
|
21563
21620
|
case 0:
|
|
21564
|
-
|
|
21621
|
+
_context29.n = 1;
|
|
21565
21622
|
return effects.call(getChannelFromMap, channelId);
|
|
21566
21623
|
case 1:
|
|
21567
|
-
channel =
|
|
21624
|
+
channel = _context29.v;
|
|
21568
21625
|
if (isResend) {
|
|
21569
|
-
|
|
21626
|
+
_context29.n = 4;
|
|
21570
21627
|
break;
|
|
21571
21628
|
}
|
|
21572
21629
|
_iterator3 = _createForOfIteratorHelperLoose(objs);
|
|
21573
21630
|
case 2:
|
|
21574
21631
|
if ((_step3 = _iterator3()).done) {
|
|
21575
|
-
|
|
21632
|
+
_context29.n = 4;
|
|
21576
21633
|
break;
|
|
21577
21634
|
}
|
|
21578
21635
|
obj = _step3.value;
|
|
@@ -21581,45 +21638,45 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
21581
21638
|
params: {}
|
|
21582
21639
|
}, obj);
|
|
21583
21640
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21584
|
-
|
|
21641
|
+
_context29.n = 3;
|
|
21585
21642
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21586
21643
|
case 3:
|
|
21587
|
-
|
|
21644
|
+
_context29.n = 2;
|
|
21588
21645
|
break;
|
|
21589
21646
|
case 4:
|
|
21590
21647
|
if (!channel) {
|
|
21591
|
-
|
|
21648
|
+
_context29.n = 6;
|
|
21592
21649
|
break;
|
|
21593
21650
|
}
|
|
21594
|
-
|
|
21651
|
+
_context29.n = 5;
|
|
21595
21652
|
return effects.call(channel.retractVote, message.id, pollId);
|
|
21596
21653
|
case 5:
|
|
21597
|
-
|
|
21654
|
+
_context29.n = 6;
|
|
21598
21655
|
return effects.put(removePendingPollActionAC(message.id || '', 'RETRACT_POLL_VOTE'));
|
|
21599
21656
|
case 6:
|
|
21600
|
-
return
|
|
21657
|
+
return _context29.a(2);
|
|
21601
21658
|
}
|
|
21602
21659
|
}, _marked26$1);
|
|
21603
21660
|
}
|
|
21604
21661
|
function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
|
|
21605
21662
|
var channel, _iterator4, _step4, obj;
|
|
21606
|
-
return _regenerator().w(function (
|
|
21607
|
-
while (1) switch (
|
|
21663
|
+
return _regenerator().w(function (_context30) {
|
|
21664
|
+
while (1) switch (_context30.n) {
|
|
21608
21665
|
case 0:
|
|
21609
|
-
|
|
21666
|
+
_context30.n = 1;
|
|
21610
21667
|
return effects.call(getChannelFromMap, channelId);
|
|
21611
21668
|
case 1:
|
|
21612
|
-
channel =
|
|
21669
|
+
channel = _context30.v;
|
|
21613
21670
|
if (channel) {
|
|
21614
|
-
|
|
21671
|
+
_context30.n = 2;
|
|
21615
21672
|
break;
|
|
21616
21673
|
}
|
|
21617
|
-
return
|
|
21674
|
+
return _context30.a(2);
|
|
21618
21675
|
case 2:
|
|
21619
21676
|
_iterator4 = _createForOfIteratorHelperLoose(objs);
|
|
21620
21677
|
case 3:
|
|
21621
21678
|
if ((_step4 = _iterator4()).done) {
|
|
21622
|
-
|
|
21679
|
+
_context30.n = 5;
|
|
21623
21680
|
break;
|
|
21624
21681
|
}
|
|
21625
21682
|
obj = _step4.value;
|
|
@@ -21628,27 +21685,27 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
21628
21685
|
params: {}
|
|
21629
21686
|
});
|
|
21630
21687
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21631
|
-
|
|
21688
|
+
_context30.n = 4;
|
|
21632
21689
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21633
21690
|
case 4:
|
|
21634
|
-
|
|
21691
|
+
_context30.n = 3;
|
|
21635
21692
|
break;
|
|
21636
21693
|
case 5:
|
|
21637
|
-
return
|
|
21694
|
+
return _context30.a(2);
|
|
21638
21695
|
}
|
|
21639
21696
|
}, _marked27$1);
|
|
21640
21697
|
}
|
|
21641
21698
|
function retractPollVote(action) {
|
|
21642
|
-
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator5, _step5, _message$pollDetails12, _message$pollDetails13, vote,
|
|
21643
|
-
return _regenerator().w(function (
|
|
21644
|
-
while (1) switch (
|
|
21699
|
+
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator5, _step5, _message$pollDetails12, _message$pollDetails13, vote, _t36;
|
|
21700
|
+
return _regenerator().w(function (_context31) {
|
|
21701
|
+
while (1) switch (_context31.p = _context31.n) {
|
|
21645
21702
|
case 0:
|
|
21646
|
-
|
|
21703
|
+
_context31.p = 0;
|
|
21647
21704
|
payload = action.payload;
|
|
21648
21705
|
channelId = payload.channelId, pollId = payload.pollId, message = payload.message, isResend = payload.isResend;
|
|
21649
21706
|
sceytChatClient = getClient();
|
|
21650
21707
|
if (!sceytChatClient) {
|
|
21651
|
-
|
|
21708
|
+
_context31.n = 3;
|
|
21652
21709
|
break;
|
|
21653
21710
|
}
|
|
21654
21711
|
connectionState = sceytChatClient.connectionState;
|
|
@@ -21662,10 +21719,10 @@ function retractPollVote(action) {
|
|
|
21662
21719
|
});
|
|
21663
21720
|
}
|
|
21664
21721
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21665
|
-
|
|
21722
|
+
_context31.n = 2;
|
|
21666
21723
|
break;
|
|
21667
21724
|
}
|
|
21668
|
-
return
|
|
21725
|
+
return _context31.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)), 1);
|
|
21669
21726
|
case 1:
|
|
21670
21727
|
setPendingPollAction({
|
|
21671
21728
|
type: 'RETRACT_POLL_VOTE',
|
|
@@ -21673,39 +21730,39 @@ function retractPollVote(action) {
|
|
|
21673
21730
|
pollId: pollId,
|
|
21674
21731
|
message: message
|
|
21675
21732
|
});
|
|
21676
|
-
return
|
|
21733
|
+
return _context31.a(2);
|
|
21677
21734
|
case 2:
|
|
21678
|
-
return
|
|
21735
|
+
return _context31.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, message, objs, isResend)), 3);
|
|
21679
21736
|
case 3:
|
|
21680
|
-
|
|
21737
|
+
_context31.n = 5;
|
|
21681
21738
|
break;
|
|
21682
21739
|
case 4:
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
log.error('error in retract poll vote',
|
|
21740
|
+
_context31.p = 4;
|
|
21741
|
+
_t36 = _context31.v;
|
|
21742
|
+
log.error('error in retract poll vote', _t36);
|
|
21686
21743
|
case 5:
|
|
21687
|
-
return
|
|
21744
|
+
return _context31.a(2);
|
|
21688
21745
|
}
|
|
21689
21746
|
}, _marked28$1, null, [[0, 4]]);
|
|
21690
21747
|
}
|
|
21691
21748
|
function resendPendingPollActions(action) {
|
|
21692
|
-
var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy,
|
|
21693
|
-
return _regenerator().w(function (
|
|
21694
|
-
while (1) switch (
|
|
21749
|
+
var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t37;
|
|
21750
|
+
return _regenerator().w(function (_context32) {
|
|
21751
|
+
while (1) switch (_context32.p = _context32.n) {
|
|
21695
21752
|
case 0:
|
|
21696
|
-
|
|
21753
|
+
_context32.p = 0;
|
|
21697
21754
|
payload = action.payload;
|
|
21698
21755
|
connectionState = payload.connectionState;
|
|
21699
21756
|
sceytChatClient = getClient();
|
|
21700
21757
|
if (!(!sceytChatClient || connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21701
|
-
|
|
21758
|
+
_context32.n = 1;
|
|
21702
21759
|
break;
|
|
21703
21760
|
}
|
|
21704
|
-
return
|
|
21761
|
+
return _context32.a(2);
|
|
21705
21762
|
case 1:
|
|
21706
21763
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
21707
21764
|
pendingPollActionsMapCopy = JSON.parse(JSON.stringify(pendingPollActionsMap));
|
|
21708
|
-
|
|
21765
|
+
_context32.n = 2;
|
|
21709
21766
|
return effects.call(function () {
|
|
21710
21767
|
return new Promise(function (resolve) {
|
|
21711
21768
|
return setTimeout(resolve, 1000);
|
|
@@ -21741,32 +21798,32 @@ function resendPendingPollActions(action) {
|
|
|
21741
21798
|
}
|
|
21742
21799
|
});
|
|
21743
21800
|
});
|
|
21744
|
-
|
|
21801
|
+
_context32.n = 4;
|
|
21745
21802
|
break;
|
|
21746
21803
|
case 3:
|
|
21747
|
-
|
|
21748
|
-
|
|
21749
|
-
log.error('error in resend pending poll actions',
|
|
21804
|
+
_context32.p = 3;
|
|
21805
|
+
_t37 = _context32.v;
|
|
21806
|
+
log.error('error in resend pending poll actions', _t37);
|
|
21750
21807
|
case 4:
|
|
21751
|
-
return
|
|
21808
|
+
return _context32.a(2);
|
|
21752
21809
|
}
|
|
21753
21810
|
}, _marked29$1, null, [[0, 3]]);
|
|
21754
21811
|
}
|
|
21755
21812
|
function getPollVotes(action) {
|
|
21756
|
-
var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes,
|
|
21757
|
-
return _regenerator().w(function (
|
|
21758
|
-
while (1) switch (
|
|
21813
|
+
var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes, _t38;
|
|
21814
|
+
return _regenerator().w(function (_context33) {
|
|
21815
|
+
while (1) switch (_context33.p = _context33.n) {
|
|
21759
21816
|
case 0:
|
|
21760
|
-
|
|
21817
|
+
_context33.p = 0;
|
|
21761
21818
|
payload = action.payload;
|
|
21762
21819
|
messageId = payload.messageId, pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
|
|
21763
21820
|
key = pollId + "_" + optionId;
|
|
21764
|
-
|
|
21821
|
+
_context33.n = 1;
|
|
21765
21822
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
|
|
21766
21823
|
case 1:
|
|
21767
21824
|
SceytChatClient = getClient();
|
|
21768
21825
|
if (!(!SceytChatClient || !SceytChatClient.PollVotesQueryBuilder)) {
|
|
21769
|
-
|
|
21826
|
+
_context33.n = 2;
|
|
21770
21827
|
break;
|
|
21771
21828
|
}
|
|
21772
21829
|
throw new Error('SceytChatClient or PollVotesQueryBuilder not available');
|
|
@@ -21774,14 +21831,14 @@ function getPollVotes(action) {
|
|
|
21774
21831
|
queryBuilder = new SceytChatClient.PollVotesQueryBuilder(messageId, pollId);
|
|
21775
21832
|
queryBuilder.setOptionId(optionId);
|
|
21776
21833
|
queryBuilder.limit(limit || 20);
|
|
21777
|
-
|
|
21834
|
+
_context33.n = 3;
|
|
21778
21835
|
return effects.call(queryBuilder.build);
|
|
21779
21836
|
case 3:
|
|
21780
|
-
pollVotesQuery =
|
|
21781
|
-
|
|
21837
|
+
pollVotesQuery = _context33.v;
|
|
21838
|
+
_context33.n = 4;
|
|
21782
21839
|
return effects.call(pollVotesQuery.loadNext);
|
|
21783
21840
|
case 4:
|
|
21784
|
-
result =
|
|
21841
|
+
result = _context33.v;
|
|
21785
21842
|
if (!query.PollVotesQueries) {
|
|
21786
21843
|
query.PollVotesQueries = {};
|
|
21787
21844
|
}
|
|
@@ -21809,39 +21866,39 @@ function getPollVotes(action) {
|
|
|
21809
21866
|
}
|
|
21810
21867
|
};
|
|
21811
21868
|
});
|
|
21812
|
-
|
|
21869
|
+
_context33.n = 5;
|
|
21813
21870
|
return effects.put(setPollVotesListAC(pollId, optionId, formattedVotes, result.hasNext || false));
|
|
21814
21871
|
case 5:
|
|
21815
|
-
|
|
21872
|
+
_context33.n = 6;
|
|
21816
21873
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
|
|
21817
21874
|
case 6:
|
|
21818
|
-
|
|
21875
|
+
_context33.n = 8;
|
|
21819
21876
|
break;
|
|
21820
21877
|
case 7:
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
log.error('ERROR in get poll votes',
|
|
21824
|
-
|
|
21878
|
+
_context33.p = 7;
|
|
21879
|
+
_t38 = _context33.v;
|
|
21880
|
+
log.error('ERROR in get poll votes', _t38);
|
|
21881
|
+
_context33.n = 8;
|
|
21825
21882
|
return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
|
|
21826
21883
|
case 8:
|
|
21827
|
-
return
|
|
21884
|
+
return _context33.a(2);
|
|
21828
21885
|
}
|
|
21829
21886
|
}, _marked30$1, null, [[0, 7]]);
|
|
21830
21887
|
}
|
|
21831
21888
|
function loadMorePollVotes(action) {
|
|
21832
|
-
var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes,
|
|
21833
|
-
return _regenerator().w(function (
|
|
21834
|
-
while (1) switch (
|
|
21889
|
+
var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes, _t39;
|
|
21890
|
+
return _regenerator().w(function (_context34) {
|
|
21891
|
+
while (1) switch (_context34.p = _context34.n) {
|
|
21835
21892
|
case 0:
|
|
21836
|
-
|
|
21893
|
+
_context34.p = 0;
|
|
21837
21894
|
payload = action.payload;
|
|
21838
21895
|
pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
|
|
21839
21896
|
key = pollId + "_" + optionId;
|
|
21840
|
-
|
|
21897
|
+
_context34.n = 1;
|
|
21841
21898
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
|
|
21842
21899
|
case 1:
|
|
21843
21900
|
if (!(!query.PollVotesQueries || !query.PollVotesQueries[key])) {
|
|
21844
|
-
|
|
21901
|
+
_context34.n = 2;
|
|
21845
21902
|
break;
|
|
21846
21903
|
}
|
|
21847
21904
|
throw new Error('Poll votes query not found');
|
|
@@ -21850,10 +21907,10 @@ function loadMorePollVotes(action) {
|
|
|
21850
21907
|
if (limit && pollVotesQuery.limit < limit) {
|
|
21851
21908
|
pollVotesQuery.limit = limit;
|
|
21852
21909
|
}
|
|
21853
|
-
|
|
21910
|
+
_context34.n = 3;
|
|
21854
21911
|
return effects.call(pollVotesQuery.loadNext);
|
|
21855
21912
|
case 3:
|
|
21856
|
-
result =
|
|
21913
|
+
result = _context34.v;
|
|
21857
21914
|
formattedVotes = (result.votes || []).map(function (vote) {
|
|
21858
21915
|
return {
|
|
21859
21916
|
optionId: vote.optionId || optionId,
|
|
@@ -21877,105 +21934,105 @@ function loadMorePollVotes(action) {
|
|
|
21877
21934
|
}
|
|
21878
21935
|
};
|
|
21879
21936
|
});
|
|
21880
|
-
|
|
21937
|
+
_context34.n = 4;
|
|
21881
21938
|
return effects.put(addPollVotesToListAC(pollId, optionId, formattedVotes, result.hasNext || false));
|
|
21882
21939
|
case 4:
|
|
21883
|
-
|
|
21940
|
+
_context34.n = 5;
|
|
21884
21941
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
|
|
21885
21942
|
case 5:
|
|
21886
|
-
|
|
21943
|
+
_context34.n = 7;
|
|
21887
21944
|
break;
|
|
21888
21945
|
case 6:
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
log.error('ERROR in load more poll votes',
|
|
21892
|
-
|
|
21946
|
+
_context34.p = 6;
|
|
21947
|
+
_t39 = _context34.v;
|
|
21948
|
+
log.error('ERROR in load more poll votes', _t39);
|
|
21949
|
+
_context34.n = 7;
|
|
21893
21950
|
return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
|
|
21894
21951
|
case 7:
|
|
21895
|
-
return
|
|
21952
|
+
return _context34.a(2);
|
|
21896
21953
|
}
|
|
21897
21954
|
}, _marked31$1, null, [[0, 6]]);
|
|
21898
21955
|
}
|
|
21899
21956
|
function MessageSaga() {
|
|
21900
|
-
return _regenerator().w(function (
|
|
21901
|
-
while (1) switch (
|
|
21957
|
+
return _regenerator().w(function (_context35) {
|
|
21958
|
+
while (1) switch (_context35.n) {
|
|
21902
21959
|
case 0:
|
|
21903
|
-
|
|
21960
|
+
_context35.n = 1;
|
|
21904
21961
|
return effects.takeEvery(SEND_MESSAGE, sendMessage);
|
|
21905
21962
|
case 1:
|
|
21906
|
-
|
|
21963
|
+
_context35.n = 2;
|
|
21907
21964
|
return effects.takeEvery(SEND_TEXT_MESSAGE, sendTextMessage);
|
|
21908
21965
|
case 2:
|
|
21909
|
-
|
|
21966
|
+
_context35.n = 3;
|
|
21910
21967
|
return effects.takeEvery(FORWARD_MESSAGE, forwardMessage);
|
|
21911
21968
|
case 3:
|
|
21912
|
-
|
|
21969
|
+
_context35.n = 4;
|
|
21913
21970
|
return effects.takeEvery(RESEND_MESSAGE, resendMessage);
|
|
21914
21971
|
case 4:
|
|
21915
|
-
|
|
21972
|
+
_context35.n = 5;
|
|
21916
21973
|
return effects.takeLatest(EDIT_MESSAGE, editMessage);
|
|
21917
21974
|
case 5:
|
|
21918
|
-
|
|
21975
|
+
_context35.n = 6;
|
|
21919
21976
|
return effects.takeEvery(DELETE_MESSAGE, deleteMessage);
|
|
21920
21977
|
case 6:
|
|
21921
|
-
|
|
21978
|
+
_context35.n = 7;
|
|
21922
21979
|
return effects.takeLatest(GET_MESSAGES, getMessagesQuery);
|
|
21923
21980
|
case 7:
|
|
21924
|
-
|
|
21981
|
+
_context35.n = 8;
|
|
21925
21982
|
return effects.takeEvery(GET_MESSAGE, getMessageQuery);
|
|
21926
21983
|
case 8:
|
|
21927
|
-
|
|
21984
|
+
_context35.n = 9;
|
|
21928
21985
|
return effects.takeLatest(GET_MESSAGE_MARKERS, getMessageMarkers);
|
|
21929
21986
|
case 9:
|
|
21930
|
-
|
|
21987
|
+
_context35.n = 10;
|
|
21931
21988
|
return effects.takeLatest(GET_MESSAGES_ATTACHMENTS, getMessageAttachments);
|
|
21932
21989
|
case 10:
|
|
21933
|
-
|
|
21990
|
+
_context35.n = 11;
|
|
21934
21991
|
return effects.takeLatest(LOAD_MORE_MESSAGES_ATTACHMENTS, loadMoreMessageAttachments);
|
|
21935
21992
|
case 11:
|
|
21936
|
-
|
|
21993
|
+
_context35.n = 12;
|
|
21937
21994
|
return effects.takeLatest(ADD_REACTION, addReaction);
|
|
21938
21995
|
case 12:
|
|
21939
|
-
|
|
21996
|
+
_context35.n = 13;
|
|
21940
21997
|
return effects.takeLatest(DELETE_REACTION, deleteReaction);
|
|
21941
21998
|
case 13:
|
|
21942
|
-
|
|
21999
|
+
_context35.n = 14;
|
|
21943
22000
|
return effects.takeEvery(LOAD_MORE_MESSAGES, loadMoreMessages);
|
|
21944
22001
|
case 14:
|
|
21945
|
-
|
|
22002
|
+
_context35.n = 15;
|
|
21946
22003
|
return effects.takeEvery(GET_REACTIONS, getReactions);
|
|
21947
22004
|
case 15:
|
|
21948
|
-
|
|
22005
|
+
_context35.n = 16;
|
|
21949
22006
|
return effects.takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
|
|
21950
22007
|
case 16:
|
|
21951
|
-
|
|
22008
|
+
_context35.n = 17;
|
|
21952
22009
|
return effects.takeEvery(PAUSE_ATTACHMENT_UPLOADING, pauseAttachmentUploading);
|
|
21953
22010
|
case 17:
|
|
21954
|
-
|
|
22011
|
+
_context35.n = 18;
|
|
21955
22012
|
return effects.takeEvery(RESUME_ATTACHMENT_UPLOADING, resumeAttachmentUploading);
|
|
21956
22013
|
case 18:
|
|
21957
|
-
|
|
22014
|
+
_context35.n = 19;
|
|
21958
22015
|
return effects.takeEvery(ADD_POLL_VOTE, addPollVote);
|
|
21959
22016
|
case 19:
|
|
21960
|
-
|
|
22017
|
+
_context35.n = 20;
|
|
21961
22018
|
return effects.takeEvery(DELETE_POLL_VOTE, deletePollVote);
|
|
21962
22019
|
case 20:
|
|
21963
|
-
|
|
22020
|
+
_context35.n = 21;
|
|
21964
22021
|
return effects.takeEvery(CLOSE_POLL, closePoll);
|
|
21965
22022
|
case 21:
|
|
21966
|
-
|
|
22023
|
+
_context35.n = 22;
|
|
21967
22024
|
return effects.takeEvery(RETRACT_POLL_VOTE, retractPollVote);
|
|
21968
22025
|
case 22:
|
|
21969
|
-
|
|
22026
|
+
_context35.n = 23;
|
|
21970
22027
|
return effects.takeEvery(GET_POLL_VOTES, getPollVotes);
|
|
21971
22028
|
case 23:
|
|
21972
|
-
|
|
22029
|
+
_context35.n = 24;
|
|
21973
22030
|
return effects.takeEvery(LOAD_MORE_POLL_VOTES, loadMorePollVotes);
|
|
21974
22031
|
case 24:
|
|
21975
|
-
|
|
22032
|
+
_context35.n = 25;
|
|
21976
22033
|
return effects.takeEvery(RESEND_PENDING_POLL_ACTIONS, resendPendingPollActions);
|
|
21977
22034
|
case 25:
|
|
21978
|
-
return
|
|
22035
|
+
return _context35.a(2);
|
|
21979
22036
|
}
|
|
21980
22037
|
}, _marked32$1);
|
|
21981
22038
|
}
|