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