sceyt-chat-react-uikit 1.7.7-beta.16 → 1.7.7-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +906 -871
- package/index.modern.js +906 -871
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18973,9 +18973,6 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
18973
18973
|
parentMessage: message.parentMessage
|
|
18974
18974
|
});
|
|
18975
18975
|
setPendingMessage(channel.id, messageToAdd);
|
|
18976
|
-
if (!(messageToAdd !== null && messageToAdd !== void 0 && messageToAdd.forwardingDetails)) {
|
|
18977
|
-
store.dispatch(scrollToNewMessageAC(true));
|
|
18978
|
-
}
|
|
18979
18976
|
return Promise.resolve();
|
|
18980
18977
|
} catch (e) {
|
|
18981
18978
|
return Promise.reject(e);
|
|
@@ -18985,41 +18982,55 @@ var updateMessage$1 = function updateMessage(actionType, pending, channel, scrol
|
|
|
18985
18982
|
if (scrollToNewMessage === void 0) {
|
|
18986
18983
|
scrollToNewMessage = true;
|
|
18987
18984
|
}
|
|
18988
|
-
|
|
18989
|
-
var activeChannelId
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
18985
|
+
return /*#__PURE__*/_regenerator().m(function _callee() {
|
|
18986
|
+
var activeChannelId;
|
|
18987
|
+
return _regenerator().w(function (_context) {
|
|
18988
|
+
while (1) switch (_context.n) {
|
|
18989
|
+
case 0:
|
|
18990
|
+
activeChannelId = getActiveChannelId();
|
|
18991
|
+
if (!(actionType !== RESEND_MESSAGE)) {
|
|
18992
|
+
_context.n = 2;
|
|
18993
|
+
break;
|
|
18994
|
+
}
|
|
18995
|
+
addMessageToMap(channel.id, pending);
|
|
18996
|
+
if (activeChannelId === channel.id) {
|
|
18997
|
+
addAllMessages([pending], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18998
|
+
}
|
|
18999
|
+
if (!(activeChannelId === channel.id)) {
|
|
19000
|
+
_context.n = 1;
|
|
19001
|
+
break;
|
|
19002
|
+
}
|
|
19003
|
+
_context.n = 1;
|
|
19004
|
+
return effects.put(addMessageAC(pending));
|
|
19005
|
+
case 1:
|
|
19006
|
+
if (!scrollToNewMessage) {
|
|
19007
|
+
_context.n = 2;
|
|
19008
|
+
break;
|
|
19009
|
+
}
|
|
19010
|
+
_context.n = 2;
|
|
19011
|
+
return effects.put(scrollToNewMessageAC(true, true));
|
|
19012
|
+
case 2:
|
|
19013
|
+
return _context.a(2);
|
|
19000
19014
|
}
|
|
19001
|
-
}
|
|
19002
|
-
|
|
19003
|
-
} catch (e) {
|
|
19004
|
-
return Promise.reject(e);
|
|
19005
|
-
}
|
|
19015
|
+
}, _callee);
|
|
19016
|
+
})();
|
|
19006
19017
|
};
|
|
19007
19018
|
function sendMessage(action) {
|
|
19008
19019
|
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap, pendingMessages, channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop, i, messageBuilder, messageToSend, pending, _loop2, _i, _t2;
|
|
19009
|
-
return _regenerator().w(function (
|
|
19010
|
-
while (1) switch (
|
|
19020
|
+
return _regenerator().w(function (_context4) {
|
|
19021
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
19011
19022
|
case 0:
|
|
19012
19023
|
payload = action.payload;
|
|
19013
19024
|
message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId, sendAttachmentsAsSeparateMessage = payload.sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
|
|
19014
19025
|
pendingMessages = [];
|
|
19015
|
-
|
|
19016
|
-
|
|
19026
|
+
_context4.p = 1;
|
|
19027
|
+
_context4.n = 2;
|
|
19017
19028
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19018
19029
|
case 2:
|
|
19019
|
-
|
|
19030
|
+
_context4.n = 3;
|
|
19020
19031
|
return effects.call(getChannelFromMap, channelId);
|
|
19021
19032
|
case 3:
|
|
19022
|
-
channel =
|
|
19033
|
+
channel = _context4.v;
|
|
19023
19034
|
if (!channel) {
|
|
19024
19035
|
channel = getChannelFromAllChannels(channelId);
|
|
19025
19036
|
if (channel) {
|
|
@@ -19027,7 +19038,7 @@ function sendMessage(action) {
|
|
|
19027
19038
|
}
|
|
19028
19039
|
}
|
|
19029
19040
|
if (!channel.isMockChannel) {
|
|
19030
|
-
|
|
19041
|
+
_context4.n = 6;
|
|
19031
19042
|
break;
|
|
19032
19043
|
}
|
|
19033
19044
|
SceytChatClient = getClient();
|
|
@@ -19037,17 +19048,17 @@ function sendMessage(action) {
|
|
|
19037
19048
|
members: channel.members,
|
|
19038
19049
|
metadata: ''
|
|
19039
19050
|
};
|
|
19040
|
-
|
|
19051
|
+
_context4.n = 4;
|
|
19041
19052
|
return effects.call(SceytChatClient.Channel.create, createChannelData);
|
|
19042
19053
|
case 4:
|
|
19043
|
-
channel =
|
|
19044
|
-
|
|
19054
|
+
channel = _context4.v;
|
|
19055
|
+
_context4.n = 5;
|
|
19045
19056
|
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(channel))));
|
|
19046
19057
|
case 5:
|
|
19047
19058
|
addChannelToAllChannels(channel);
|
|
19048
19059
|
setChannelInMap(channel);
|
|
19049
19060
|
case 6:
|
|
19050
|
-
|
|
19061
|
+
_context4.n = 7;
|
|
19051
19062
|
return effects.put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
19052
19063
|
case 7:
|
|
19053
19064
|
mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
|
|
@@ -19055,7 +19066,7 @@ function sendMessage(action) {
|
|
|
19055
19066
|
}) : [];
|
|
19056
19067
|
customUploader = getCustomUploader();
|
|
19057
19068
|
if (!(message.attachments && message.attachments.length)) {
|
|
19058
|
-
|
|
19069
|
+
_context4.n = 15;
|
|
19059
19070
|
break;
|
|
19060
19071
|
}
|
|
19061
19072
|
linkAttachment = null;
|
|
@@ -19068,13 +19079,13 @@ function sendMessage(action) {
|
|
|
19068
19079
|
return att.type !== attachmentTypes.link;
|
|
19069
19080
|
});
|
|
19070
19081
|
if (!(mediaAttachments && mediaAttachments.length)) {
|
|
19071
|
-
|
|
19082
|
+
_context4.n = 12;
|
|
19072
19083
|
break;
|
|
19073
19084
|
}
|
|
19074
|
-
_loop = /*#__PURE__*/_regenerator().m(function
|
|
19085
|
+
_loop = /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
19075
19086
|
var attachment, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, messageForSend, _pending;
|
|
19076
|
-
return _regenerator().w(function (
|
|
19077
|
-
while (1) switch (
|
|
19087
|
+
return _regenerator().w(function (_context2) {
|
|
19088
|
+
while (1) switch (_context2.n) {
|
|
19078
19089
|
case 0:
|
|
19079
19090
|
attachment = mediaAttachments[i];
|
|
19080
19091
|
if (attachment.cachedUrl) {
|
|
@@ -19118,101 +19129,112 @@ function sendMessage(action) {
|
|
|
19118
19129
|
if (customUploader) {
|
|
19119
19130
|
messageAttachment.url = attachment.data;
|
|
19120
19131
|
}
|
|
19121
|
-
if (sendAttachmentsAsSeparateMessage) {
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
messageTid: _messageToSend.tid,
|
|
19133
|
-
channelId: channel.id
|
|
19134
|
-
}));
|
|
19135
|
-
messageForSend = _extends({}, _messageToSend, {
|
|
19136
|
-
attachments: [messageAttachment],
|
|
19137
|
-
createdAt: new Date(Date.now())
|
|
19138
|
-
});
|
|
19139
|
-
messagesToSend.push(messageForSend);
|
|
19140
|
-
_pending = _extends({}, messageForSend, {
|
|
19141
|
-
attachments: [attachment],
|
|
19142
|
-
createdAt: new Date(Date.now())
|
|
19143
|
-
});
|
|
19144
|
-
pendingMessages.push(_pending);
|
|
19145
|
-
updateMessage$1(action.type, _pending, channel);
|
|
19146
|
-
} else {
|
|
19147
|
-
attachmentsToSend.push(messageAttachment);
|
|
19132
|
+
if (!sendAttachmentsAsSeparateMessage) {
|
|
19133
|
+
_context2.n = 2;
|
|
19134
|
+
break;
|
|
19135
|
+
}
|
|
19136
|
+
_messageBuilder = channel.createMessageBuilder();
|
|
19137
|
+
_messageBuilder.setBody(i === 0 ? message.body : '').setAttachments([]).setBodyAttributes(i === 0 ? message.bodyAttributes : {}).setMentionUserIds(i === 0 ? mentionedUserIds : []).setType(message.type).setDisplayCount(message.type === exports.MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === exports.MESSAGE_TYPE.SYSTEM).setMetadata(i === 0 ? JSON.stringify(message.metadata) : '');
|
|
19138
|
+
if (message.parentMessage) {
|
|
19139
|
+
_messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
|
|
19140
|
+
}
|
|
19141
|
+
if (message.repliedInThread) {
|
|
19142
|
+
_messageBuilder.setReplyInThread();
|
|
19148
19143
|
}
|
|
19144
|
+
_messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : _messageBuilder.create();
|
|
19145
|
+
setPendingAttachment(messageAttachment.tid, _extends({}, messageAttachment.data, {
|
|
19146
|
+
messageTid: _messageToSend.tid,
|
|
19147
|
+
channelId: channel.id
|
|
19148
|
+
}));
|
|
19149
|
+
messageForSend = _extends({}, _messageToSend, {
|
|
19150
|
+
attachments: [messageAttachment],
|
|
19151
|
+
createdAt: new Date(Date.now())
|
|
19152
|
+
});
|
|
19153
|
+
messagesToSend.push(messageForSend);
|
|
19154
|
+
_pending = _extends({}, messageForSend, {
|
|
19155
|
+
attachments: [attachment],
|
|
19156
|
+
createdAt: new Date(Date.now())
|
|
19157
|
+
});
|
|
19158
|
+
pendingMessages.push(_pending);
|
|
19159
|
+
_context2.n = 1;
|
|
19160
|
+
return effects.call(updateMessage$1, action.type, _pending, channel);
|
|
19161
|
+
case 1:
|
|
19162
|
+
_context2.n = 3;
|
|
19163
|
+
break;
|
|
19164
|
+
case 2:
|
|
19165
|
+
attachmentsToSend.push(messageAttachment);
|
|
19166
|
+
case 3:
|
|
19149
19167
|
if (!(!messageAttachment.cachedUrl && customUploader)) {
|
|
19150
|
-
|
|
19168
|
+
_context2.n = 4;
|
|
19151
19169
|
break;
|
|
19152
19170
|
}
|
|
19153
|
-
|
|
19171
|
+
_context2.n = 4;
|
|
19154
19172
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, messageAttachment.tid));
|
|
19155
|
-
case
|
|
19156
|
-
return
|
|
19173
|
+
case 4:
|
|
19174
|
+
return _context2.a(2);
|
|
19157
19175
|
}
|
|
19158
|
-
},
|
|
19176
|
+
}, _callee2);
|
|
19159
19177
|
});
|
|
19160
19178
|
i = 0;
|
|
19161
19179
|
case 8:
|
|
19162
19180
|
if (!(i < mediaAttachments.length)) {
|
|
19163
|
-
|
|
19181
|
+
_context4.n = 10;
|
|
19164
19182
|
break;
|
|
19165
19183
|
}
|
|
19166
|
-
return
|
|
19184
|
+
return _context4.d(_regeneratorValues(_loop()), 9);
|
|
19167
19185
|
case 9:
|
|
19168
19186
|
i++;
|
|
19169
|
-
|
|
19187
|
+
_context4.n = 8;
|
|
19170
19188
|
break;
|
|
19171
19189
|
case 10:
|
|
19172
|
-
if (
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
attachments: message.attachments,
|
|
19184
|
-
createdAt: new Date(Date.now())
|
|
19185
|
-
});
|
|
19186
|
-
pendingMessages.push(pending);
|
|
19187
|
-
updateMessage$1(action.type, pending, channel);
|
|
19188
|
-
messageToSend = _extends({}, messageToSend, {
|
|
19189
|
-
attachments: attachmentsToSend
|
|
19190
|
-
});
|
|
19191
|
-
messagesToSend.push(messageToSend);
|
|
19190
|
+
if (sendAttachmentsAsSeparateMessage) {
|
|
19191
|
+
_context4.n = 12;
|
|
19192
|
+
break;
|
|
19193
|
+
}
|
|
19194
|
+
messageBuilder = channel.createMessageBuilder();
|
|
19195
|
+
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(message.attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === exports.MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === exports.MESSAGE_TYPE.SYSTEM).setMetadata(JSON.stringify(message.metadata));
|
|
19196
|
+
if (message.parentMessage) {
|
|
19197
|
+
messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
|
|
19198
|
+
}
|
|
19199
|
+
if (message.repliedInThread) {
|
|
19200
|
+
messageBuilder.setReplyInThread();
|
|
19192
19201
|
}
|
|
19202
|
+
messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
|
|
19203
|
+
pending = _extends({}, messageToSend, {
|
|
19204
|
+
attachments: message.attachments,
|
|
19205
|
+
createdAt: new Date(Date.now())
|
|
19206
|
+
});
|
|
19207
|
+
pendingMessages.push(pending);
|
|
19208
|
+
_context4.n = 11;
|
|
19209
|
+
return effects.call(updateMessage$1, action.type, pending, channel);
|
|
19193
19210
|
case 11:
|
|
19194
|
-
|
|
19211
|
+
messageToSend = _extends({}, messageToSend, {
|
|
19212
|
+
attachments: attachmentsToSend
|
|
19213
|
+
});
|
|
19214
|
+
messagesToSend.push(messageToSend);
|
|
19215
|
+
case 12:
|
|
19216
|
+
_loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
19195
19217
|
var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, connectionIsDisconnected, _t;
|
|
19196
|
-
return _regenerator().w(function (
|
|
19197
|
-
while (1) switch (
|
|
19218
|
+
return _regenerator().w(function (_context3) {
|
|
19219
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
19198
19220
|
case 0:
|
|
19199
19221
|
messageAttachment = messagesToSend[_i].attachments;
|
|
19200
19222
|
messageToSend = messagesToSend[_i];
|
|
19201
|
-
|
|
19223
|
+
_context3.p = 1;
|
|
19202
19224
|
messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i]));
|
|
19203
19225
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19204
|
-
|
|
19226
|
+
_context3.n = 12;
|
|
19205
19227
|
break;
|
|
19206
19228
|
}
|
|
19207
19229
|
_attachmentsToSend = messageAttachment;
|
|
19208
19230
|
if (!customUploader) {
|
|
19209
|
-
|
|
19231
|
+
_context3.n = 3;
|
|
19210
19232
|
break;
|
|
19211
19233
|
}
|
|
19212
|
-
|
|
19234
|
+
_context3.n = 2;
|
|
19213
19235
|
return effects.call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
|
|
19214
19236
|
case 2:
|
|
19215
|
-
_attachmentsToSend =
|
|
19237
|
+
_attachmentsToSend = _context3.v;
|
|
19216
19238
|
case 3:
|
|
19217
19239
|
linkAttachmentToSend = null;
|
|
19218
19240
|
if (_i === 0 && linkAttachment) {
|
|
@@ -19228,18 +19250,18 @@ function sendMessage(action) {
|
|
|
19228
19250
|
attachments: [].concat(_attachmentsToSend)
|
|
19229
19251
|
});
|
|
19230
19252
|
}
|
|
19231
|
-
|
|
19253
|
+
_context3.n = 4;
|
|
19232
19254
|
return effects.call(channel.sendMessage, messageToSend);
|
|
19233
19255
|
case 4:
|
|
19234
|
-
messageResponse =
|
|
19256
|
+
messageResponse = _context3.v;
|
|
19235
19257
|
if (!customUploader) {
|
|
19236
|
-
|
|
19258
|
+
_context3.n = 8;
|
|
19237
19259
|
break;
|
|
19238
19260
|
}
|
|
19239
19261
|
k = 0;
|
|
19240
19262
|
case 5:
|
|
19241
19263
|
if (!(k < messageAttachment.length)) {
|
|
19242
|
-
|
|
19264
|
+
_context3.n = 8;
|
|
19243
19265
|
break;
|
|
19244
19266
|
}
|
|
19245
19267
|
messageResponse.attachments[k] = _extends({}, messageResponse.attachments[k], {
|
|
@@ -19253,13 +19275,13 @@ function sendMessage(action) {
|
|
|
19253
19275
|
checksum: pendingAttachment.checksum || (pendingAttachment === null || pendingAttachment === void 0 ? void 0 : pendingAttachment.file)
|
|
19254
19276
|
})], 'checksum');
|
|
19255
19277
|
}
|
|
19256
|
-
|
|
19278
|
+
_context3.n = 6;
|
|
19257
19279
|
return effects.put(removeAttachmentProgressAC(messageAttachment[k].tid));
|
|
19258
19280
|
case 6:
|
|
19259
19281
|
deletePendingAttachment(messageAttachment[k].tid);
|
|
19260
19282
|
case 7:
|
|
19261
19283
|
k++;
|
|
19262
|
-
|
|
19284
|
+
_context3.n = 5;
|
|
19263
19285
|
break;
|
|
19264
19286
|
case 8:
|
|
19265
19287
|
if (action.type === RESEND_MESSAGE) {
|
|
@@ -19297,7 +19319,7 @@ function sendMessage(action) {
|
|
|
19297
19319
|
createdAt: messageResponse.createdAt,
|
|
19298
19320
|
channelId: channel.id
|
|
19299
19321
|
};
|
|
19300
|
-
|
|
19322
|
+
_context3.n = 9;
|
|
19301
19323
|
return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData))));
|
|
19302
19324
|
case 9:
|
|
19303
19325
|
updateMessageOnMap(channel.id, {
|
|
@@ -19312,53 +19334,53 @@ function sendMessage(action) {
|
|
|
19312
19334
|
lastReactedMessage: null
|
|
19313
19335
|
};
|
|
19314
19336
|
if (!channel.unread) {
|
|
19315
|
-
|
|
19337
|
+
_context3.n = 10;
|
|
19316
19338
|
break;
|
|
19317
19339
|
}
|
|
19318
|
-
|
|
19340
|
+
_context3.n = 10;
|
|
19319
19341
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19320
19342
|
case 10:
|
|
19321
|
-
|
|
19343
|
+
_context3.n = 11;
|
|
19322
19344
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19323
19345
|
case 11:
|
|
19324
19346
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19325
|
-
|
|
19347
|
+
_context3.n = 13;
|
|
19326
19348
|
break;
|
|
19327
19349
|
case 12:
|
|
19328
19350
|
throw new Error('Connection required to send message');
|
|
19329
19351
|
case 13:
|
|
19330
|
-
|
|
19352
|
+
_context3.n = 19;
|
|
19331
19353
|
break;
|
|
19332
19354
|
case 14:
|
|
19333
|
-
|
|
19334
|
-
_t =
|
|
19355
|
+
_context3.p = 14;
|
|
19356
|
+
_t = _context3.v;
|
|
19335
19357
|
pendingMessage = pendingMessages === null || pendingMessages === void 0 ? void 0 : pendingMessages.find(function (pendingMessage) {
|
|
19336
19358
|
return pendingMessage.tid === messageToSend.tid;
|
|
19337
19359
|
});
|
|
19338
19360
|
if (!(channel && pendingMessage && action.type !== RESEND_MESSAGE)) {
|
|
19339
|
-
|
|
19361
|
+
_context3.n = 17;
|
|
19340
19362
|
break;
|
|
19341
19363
|
}
|
|
19342
19364
|
connectionIsDisconnected = store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED;
|
|
19343
19365
|
if (!(isAddToPendingMessagesMap && connectionIsDisconnected)) {
|
|
19344
|
-
|
|
19366
|
+
_context3.n = 16;
|
|
19345
19367
|
break;
|
|
19346
19368
|
}
|
|
19347
|
-
|
|
19369
|
+
_context3.n = 15;
|
|
19348
19370
|
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19349
19371
|
case 15:
|
|
19350
|
-
|
|
19372
|
+
_context3.n = 17;
|
|
19351
19373
|
break;
|
|
19352
19374
|
case 16:
|
|
19353
|
-
|
|
19375
|
+
_context3.n = 17;
|
|
19354
19376
|
return effects.put(removePendingMessageAC(channel.id, pendingMessage.tid));
|
|
19355
19377
|
case 17:
|
|
19356
19378
|
log.error('Error on uploading attachment', messageToSend.tid, _t);
|
|
19357
19379
|
if (!(messageToSend.attachments && messageToSend.attachments.length)) {
|
|
19358
|
-
|
|
19380
|
+
_context3.n = 18;
|
|
19359
19381
|
break;
|
|
19360
19382
|
}
|
|
19361
|
-
|
|
19383
|
+
_context3.n = 18;
|
|
19362
19384
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, messageToSend.attachments[0].tid));
|
|
19363
19385
|
case 18:
|
|
19364
19386
|
updateMessageOnMap(channel.id, {
|
|
@@ -19370,58 +19392,58 @@ function sendMessage(action) {
|
|
|
19370
19392
|
updateMessageOnAllMessages(messageToSend.tid, {
|
|
19371
19393
|
state: MESSAGE_STATUS.FAILED
|
|
19372
19394
|
});
|
|
19373
|
-
|
|
19395
|
+
_context3.n = 19;
|
|
19374
19396
|
return effects.put(updateMessageAC(messageToSend.tid, {
|
|
19375
19397
|
state: MESSAGE_STATUS.FAILED
|
|
19376
19398
|
}));
|
|
19377
19399
|
case 19:
|
|
19378
|
-
return
|
|
19400
|
+
return _context3.a(2);
|
|
19379
19401
|
}
|
|
19380
|
-
},
|
|
19402
|
+
}, _callee3, null, [[1, 14]]);
|
|
19381
19403
|
});
|
|
19382
19404
|
_i = 0;
|
|
19383
|
-
case
|
|
19405
|
+
case 13:
|
|
19384
19406
|
if (!(_i < messagesToSend.length)) {
|
|
19385
|
-
|
|
19407
|
+
_context4.n = 15;
|
|
19386
19408
|
break;
|
|
19387
19409
|
}
|
|
19388
|
-
return
|
|
19389
|
-
case 13:
|
|
19390
|
-
_i++;
|
|
19391
|
-
_context3.n = 12;
|
|
19392
|
-
break;
|
|
19410
|
+
return _context4.d(_regeneratorValues(_loop2()), 14);
|
|
19393
19411
|
case 14:
|
|
19394
|
-
|
|
19412
|
+
_i++;
|
|
19413
|
+
_context4.n = 13;
|
|
19395
19414
|
break;
|
|
19396
19415
|
case 15:
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
log.error('error on send message ... ', _t2);
|
|
19416
|
+
_context4.n = 17;
|
|
19417
|
+
break;
|
|
19400
19418
|
case 16:
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19419
|
+
_context4.p = 16;
|
|
19420
|
+
_t2 = _context4.v;
|
|
19421
|
+
log.error('error on send message ... ', _t2);
|
|
19404
19422
|
case 17:
|
|
19405
|
-
|
|
19423
|
+
_context4.p = 17;
|
|
19424
|
+
_context4.n = 18;
|
|
19425
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19406
19426
|
case 18:
|
|
19407
|
-
return
|
|
19427
|
+
return _context4.f(17);
|
|
19428
|
+
case 19:
|
|
19429
|
+
return _context4.a(2);
|
|
19408
19430
|
}
|
|
19409
|
-
}, _marked$3, null, [[1,
|
|
19431
|
+
}, _marked$3, null, [[1, 16, 17, 19]]);
|
|
19410
19432
|
}
|
|
19411
19433
|
function sendTextMessage(action) {
|
|
19412
19434
|
var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, connectionIsDisconnected, _t3;
|
|
19413
|
-
return _regenerator().w(function (
|
|
19414
|
-
while (1) switch (
|
|
19435
|
+
return _regenerator().w(function (_context5) {
|
|
19436
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
19415
19437
|
case 0:
|
|
19416
19438
|
payload = action.payload;
|
|
19417
19439
|
message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
|
|
19418
|
-
|
|
19440
|
+
_context5.n = 1;
|
|
19419
19441
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19420
19442
|
case 1:
|
|
19421
|
-
|
|
19443
|
+
_context5.n = 2;
|
|
19422
19444
|
return effects.call(getChannelFromMap, channelId);
|
|
19423
19445
|
case 2:
|
|
19424
|
-
channel =
|
|
19446
|
+
channel = _context5.v;
|
|
19425
19447
|
if (!channel) {
|
|
19426
19448
|
channel = getChannelFromAllChannels(channelId);
|
|
19427
19449
|
if (channel) {
|
|
@@ -19430,9 +19452,9 @@ function sendTextMessage(action) {
|
|
|
19430
19452
|
}
|
|
19431
19453
|
pendingMessage = null;
|
|
19432
19454
|
activeChannelId = getActiveChannelId();
|
|
19433
|
-
|
|
19455
|
+
_context5.p = 3;
|
|
19434
19456
|
if (!channel.isMockChannel) {
|
|
19435
|
-
|
|
19457
|
+
_context5.n = 6;
|
|
19436
19458
|
break;
|
|
19437
19459
|
}
|
|
19438
19460
|
SceytChatClient = getClient();
|
|
@@ -19442,17 +19464,17 @@ function sendTextMessage(action) {
|
|
|
19442
19464
|
members: channel.members,
|
|
19443
19465
|
metadata: ''
|
|
19444
19466
|
};
|
|
19445
|
-
|
|
19467
|
+
_context5.n = 4;
|
|
19446
19468
|
return effects.call(SceytChatClient.Channel.create, createChannelData);
|
|
19447
19469
|
case 4:
|
|
19448
|
-
channel =
|
|
19449
|
-
|
|
19470
|
+
channel = _context5.v;
|
|
19471
|
+
_context5.n = 5;
|
|
19450
19472
|
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(channel))));
|
|
19451
19473
|
case 5:
|
|
19452
19474
|
addChannelToAllChannels(channel);
|
|
19453
19475
|
setChannelInMap(channel);
|
|
19454
19476
|
case 6:
|
|
19455
|
-
|
|
19477
|
+
_context5.n = 7;
|
|
19456
19478
|
return effects.put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
19457
19479
|
case 7:
|
|
19458
19480
|
mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
|
|
@@ -19485,29 +19507,33 @@ function sendTextMessage(action) {
|
|
|
19485
19507
|
if (pendingMessage && pendingMessage.metadata) {
|
|
19486
19508
|
pendingMessage.metadata = JSON.parse(pendingMessage.metadata);
|
|
19487
19509
|
}
|
|
19488
|
-
if (pendingMessage) {
|
|
19489
|
-
|
|
19510
|
+
if (!pendingMessage) {
|
|
19511
|
+
_context5.n = 8;
|
|
19512
|
+
break;
|
|
19490
19513
|
}
|
|
19514
|
+
_context5.n = 8;
|
|
19515
|
+
return effects.call(updateMessage$1, action.type, pendingMessage, channel);
|
|
19516
|
+
case 8:
|
|
19491
19517
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19492
|
-
|
|
19518
|
+
_context5.n = 16;
|
|
19493
19519
|
break;
|
|
19494
19520
|
}
|
|
19495
19521
|
if (!sendMessageHandler) {
|
|
19496
|
-
|
|
19522
|
+
_context5.n = 10;
|
|
19497
19523
|
break;
|
|
19498
19524
|
}
|
|
19499
|
-
|
|
19525
|
+
_context5.n = 9;
|
|
19500
19526
|
return effects.call(sendMessageHandler, messageToSend, channel.id);
|
|
19501
|
-
case 8:
|
|
19502
|
-
messageResponse = _context4.v;
|
|
19503
|
-
_context4.n = 11;
|
|
19504
|
-
break;
|
|
19505
19527
|
case 9:
|
|
19506
|
-
|
|
19507
|
-
|
|
19528
|
+
messageResponse = _context5.v;
|
|
19529
|
+
_context5.n = 12;
|
|
19530
|
+
break;
|
|
19508
19531
|
case 10:
|
|
19509
|
-
|
|
19532
|
+
_context5.n = 11;
|
|
19533
|
+
return effects.call(channel.sendMessage, messageToSend);
|
|
19510
19534
|
case 11:
|
|
19535
|
+
messageResponse = _context5.v;
|
|
19536
|
+
case 12:
|
|
19511
19537
|
messageUpdateData = {
|
|
19512
19538
|
id: messageResponse.id,
|
|
19513
19539
|
body: messageResponse.body,
|
|
@@ -19526,12 +19552,12 @@ function sendTextMessage(action) {
|
|
|
19526
19552
|
channelId: channel.id
|
|
19527
19553
|
};
|
|
19528
19554
|
if (!(activeChannelId === channel.id)) {
|
|
19529
|
-
|
|
19555
|
+
_context5.n = 13;
|
|
19530
19556
|
break;
|
|
19531
19557
|
}
|
|
19532
|
-
|
|
19558
|
+
_context5.n = 13;
|
|
19533
19559
|
return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData));
|
|
19534
|
-
case
|
|
19560
|
+
case 13:
|
|
19535
19561
|
updateMessageOnMap(channel.id, {
|
|
19536
19562
|
messageId: !isAddToPendingMessagesMap ? message.tid : messageToSend.tid,
|
|
19537
19563
|
params: messageUpdateData
|
|
@@ -19545,49 +19571,49 @@ function sendTextMessage(action) {
|
|
|
19545
19571
|
lastMessage: messageToUpdate,
|
|
19546
19572
|
lastReactedMessage: null
|
|
19547
19573
|
};
|
|
19548
|
-
|
|
19574
|
+
_context5.n = 14;
|
|
19549
19575
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19550
|
-
case
|
|
19576
|
+
case 14:
|
|
19551
19577
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19552
19578
|
if (!channel.unread) {
|
|
19553
|
-
|
|
19579
|
+
_context5.n = 15;
|
|
19554
19580
|
break;
|
|
19555
19581
|
}
|
|
19556
|
-
|
|
19582
|
+
_context5.n = 15;
|
|
19557
19583
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19558
|
-
case
|
|
19584
|
+
case 15:
|
|
19559
19585
|
channel.lastMessage = messageToUpdate;
|
|
19560
19586
|
if (action.type === RESEND_MESSAGE) {
|
|
19561
19587
|
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19562
19588
|
}
|
|
19563
|
-
|
|
19589
|
+
_context5.n = 17;
|
|
19564
19590
|
break;
|
|
19565
|
-
case 15:
|
|
19566
|
-
throw new Error('Connection required to send message');
|
|
19567
19591
|
case 16:
|
|
19568
|
-
|
|
19569
|
-
break;
|
|
19592
|
+
throw new Error('Connection required to send message');
|
|
19570
19593
|
case 17:
|
|
19571
|
-
|
|
19572
|
-
|
|
19594
|
+
_context5.n = 22;
|
|
19595
|
+
break;
|
|
19596
|
+
case 18:
|
|
19597
|
+
_context5.p = 18;
|
|
19598
|
+
_t3 = _context5.v;
|
|
19573
19599
|
if (!(activeChannelId === channel.id && pendingMessage && action.type !== RESEND_MESSAGE)) {
|
|
19574
|
-
|
|
19600
|
+
_context5.n = 21;
|
|
19575
19601
|
break;
|
|
19576
19602
|
}
|
|
19577
19603
|
connectionIsDisconnected = store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED;
|
|
19578
19604
|
if (!(isAddToPendingMessagesMap && connectionIsDisconnected)) {
|
|
19579
|
-
|
|
19605
|
+
_context5.n = 20;
|
|
19580
19606
|
break;
|
|
19581
19607
|
}
|
|
19582
|
-
|
|
19608
|
+
_context5.n = 19;
|
|
19583
19609
|
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19584
|
-
case 18:
|
|
19585
|
-
_context4.n = 20;
|
|
19586
|
-
break;
|
|
19587
19610
|
case 19:
|
|
19588
|
-
|
|
19589
|
-
|
|
19611
|
+
_context5.n = 21;
|
|
19612
|
+
break;
|
|
19590
19613
|
case 20:
|
|
19614
|
+
_context5.n = 21;
|
|
19615
|
+
return effects.put(removePendingMessageAC(channel.id, pendingMessage.tid));
|
|
19616
|
+
case 21:
|
|
19591
19617
|
log.error('error on send text message ... ', _t3);
|
|
19592
19618
|
updateMessageOnMap(channel.id, {
|
|
19593
19619
|
messageId: sendMessageTid,
|
|
@@ -19596,31 +19622,31 @@ function sendTextMessage(action) {
|
|
|
19596
19622
|
}
|
|
19597
19623
|
});
|
|
19598
19624
|
if (!(activeChannelId === channel.id)) {
|
|
19599
|
-
|
|
19625
|
+
_context5.n = 22;
|
|
19600
19626
|
break;
|
|
19601
19627
|
}
|
|
19602
19628
|
updateMessageOnAllMessages(sendMessageTid, {
|
|
19603
19629
|
state: MESSAGE_STATUS.FAILED
|
|
19604
19630
|
});
|
|
19605
|
-
|
|
19631
|
+
_context5.n = 22;
|
|
19606
19632
|
return effects.put(updateMessageAC(sendMessageTid, {
|
|
19607
19633
|
state: MESSAGE_STATUS.FAILED
|
|
19608
19634
|
}));
|
|
19609
|
-
case 21:
|
|
19610
|
-
_context4.p = 21;
|
|
19611
|
-
_context4.n = 22;
|
|
19612
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19613
19635
|
case 22:
|
|
19614
|
-
|
|
19636
|
+
_context5.p = 22;
|
|
19637
|
+
_context5.n = 23;
|
|
19638
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19615
19639
|
case 23:
|
|
19616
|
-
return
|
|
19640
|
+
return _context5.f(22);
|
|
19641
|
+
case 24:
|
|
19642
|
+
return _context5.a(2);
|
|
19617
19643
|
}
|
|
19618
|
-
}, _marked2$2, null, [[3,
|
|
19644
|
+
}, _marked2$2, null, [[3, 18, 22, 24]]);
|
|
19619
19645
|
}
|
|
19620
19646
|
function forwardMessage(action) {
|
|
19621
19647
|
var payload, message, channelId, connectionState, isForward, isAddToPendingMessagesMap, pendingMessage, channel, activeChannelId, messageTid, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, connectionIsDisconnected, _t4;
|
|
19622
|
-
return _regenerator().w(function (
|
|
19623
|
-
while (1) switch (
|
|
19648
|
+
return _regenerator().w(function (_context6) {
|
|
19649
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
19624
19650
|
case 0:
|
|
19625
19651
|
payload = action.payload;
|
|
19626
19652
|
message = payload.message, channelId = payload.channelId, connectionState = payload.connectionState, isForward = payload.isForward, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
|
|
@@ -19628,35 +19654,35 @@ function forwardMessage(action) {
|
|
|
19628
19654
|
channel = null;
|
|
19629
19655
|
activeChannelId = getActiveChannelId();
|
|
19630
19656
|
messageTid = null;
|
|
19631
|
-
|
|
19632
|
-
|
|
19657
|
+
_context6.p = 1;
|
|
19658
|
+
_context6.n = 2;
|
|
19633
19659
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19634
19660
|
case 2:
|
|
19635
|
-
|
|
19661
|
+
_context6.n = 3;
|
|
19636
19662
|
return effects.call(getChannelFromMap, channelId);
|
|
19637
19663
|
case 3:
|
|
19638
|
-
channel =
|
|
19664
|
+
channel = _context6.v;
|
|
19639
19665
|
if (channel) {
|
|
19640
|
-
|
|
19666
|
+
_context6.n = 6;
|
|
19641
19667
|
break;
|
|
19642
19668
|
}
|
|
19643
19669
|
channel = getChannelFromAllChannels(channelId) || null;
|
|
19644
19670
|
if (channel) {
|
|
19645
|
-
|
|
19671
|
+
_context6.n = 5;
|
|
19646
19672
|
break;
|
|
19647
19673
|
}
|
|
19648
19674
|
SceytChatClient = getClient();
|
|
19649
|
-
|
|
19675
|
+
_context6.n = 4;
|
|
19650
19676
|
return effects.call(SceytChatClient.getChannel, channelId);
|
|
19651
19677
|
case 4:
|
|
19652
|
-
channel =
|
|
19678
|
+
channel = _context6.v;
|
|
19653
19679
|
case 5:
|
|
19654
19680
|
if (channel) {
|
|
19655
19681
|
setChannelInMap(channel);
|
|
19656
19682
|
}
|
|
19657
19683
|
case 6:
|
|
19658
19684
|
if (channel) {
|
|
19659
|
-
|
|
19685
|
+
_context6.n = 7;
|
|
19660
19686
|
break;
|
|
19661
19687
|
}
|
|
19662
19688
|
throw new Error('Channel not found');
|
|
@@ -19666,7 +19692,7 @@ function forwardMessage(action) {
|
|
|
19666
19692
|
}) : [];
|
|
19667
19693
|
attachments = message.attachments;
|
|
19668
19694
|
if ((channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC) && !(channel.userRole === 'admin' || channel.userRole === 'owner')) {
|
|
19669
|
-
|
|
19695
|
+
_context6.n = 16;
|
|
19670
19696
|
break;
|
|
19671
19697
|
}
|
|
19672
19698
|
if (message.attachments && message.attachments.length) {
|
|
@@ -19710,32 +19736,36 @@ function forwardMessage(action) {
|
|
|
19710
19736
|
pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
|
|
19711
19737
|
}
|
|
19712
19738
|
if (!(channelId === activeChannelId)) {
|
|
19713
|
-
|
|
19739
|
+
_context6.n = 8;
|
|
19714
19740
|
break;
|
|
19715
19741
|
}
|
|
19716
19742
|
hasNextMessages = store.getState().MessageReducer.messagesHasNext;
|
|
19717
19743
|
if (getHasNextCached()) {
|
|
19718
|
-
|
|
19744
|
+
_context6.n = 8;
|
|
19719
19745
|
break;
|
|
19720
19746
|
}
|
|
19721
19747
|
if (!hasNextMessages) {
|
|
19722
|
-
|
|
19748
|
+
_context6.n = 8;
|
|
19723
19749
|
break;
|
|
19724
19750
|
}
|
|
19725
|
-
|
|
19751
|
+
_context6.n = 8;
|
|
19726
19752
|
return effects.put(getMessagesAC(channel));
|
|
19727
19753
|
case 8:
|
|
19728
|
-
if (pendingMessage) {
|
|
19729
|
-
|
|
19754
|
+
if (!pendingMessage) {
|
|
19755
|
+
_context6.n = 9;
|
|
19756
|
+
break;
|
|
19730
19757
|
}
|
|
19758
|
+
_context6.n = 9;
|
|
19759
|
+
return effects.call(updateMessage$1, action.type, pendingMessage, channel, false);
|
|
19760
|
+
case 9:
|
|
19731
19761
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19732
|
-
|
|
19762
|
+
_context6.n = 15;
|
|
19733
19763
|
break;
|
|
19734
19764
|
}
|
|
19735
|
-
|
|
19765
|
+
_context6.n = 10;
|
|
19736
19766
|
return effects.call(channel.sendMessage, messageToSend);
|
|
19737
|
-
case
|
|
19738
|
-
messageResponse =
|
|
19767
|
+
case 10:
|
|
19768
|
+
messageResponse = _context6.v;
|
|
19739
19769
|
messageUpdateData = {
|
|
19740
19770
|
id: messageResponse.id,
|
|
19741
19771
|
type: messageResponse.type,
|
|
@@ -19751,14 +19781,14 @@ function forwardMessage(action) {
|
|
|
19751
19781
|
channelId: channel.id
|
|
19752
19782
|
};
|
|
19753
19783
|
if (!(channelId === activeChannelId)) {
|
|
19754
|
-
|
|
19784
|
+
_context6.n = 12;
|
|
19755
19785
|
break;
|
|
19756
19786
|
}
|
|
19757
|
-
|
|
19787
|
+
_context6.n = 11;
|
|
19758
19788
|
return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData))));
|
|
19759
|
-
case 10:
|
|
19760
|
-
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19761
19789
|
case 11:
|
|
19790
|
+
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19791
|
+
case 12:
|
|
19762
19792
|
if (action.type === RESEND_MESSAGE) {
|
|
19763
19793
|
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19764
19794
|
}
|
|
@@ -19772,47 +19802,47 @@ function forwardMessage(action) {
|
|
|
19772
19802
|
lastMessage: messageToUpdate,
|
|
19773
19803
|
lastReactedMessage: null
|
|
19774
19804
|
};
|
|
19775
|
-
|
|
19805
|
+
_context6.n = 13;
|
|
19776
19806
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19777
|
-
case
|
|
19807
|
+
case 13:
|
|
19778
19808
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19779
19809
|
if (!channel.unread) {
|
|
19780
|
-
|
|
19810
|
+
_context6.n = 14;
|
|
19781
19811
|
break;
|
|
19782
19812
|
}
|
|
19783
|
-
|
|
19813
|
+
_context6.n = 14;
|
|
19784
19814
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19785
|
-
case 13:
|
|
19786
|
-
_context5.n = 15;
|
|
19787
|
-
break;
|
|
19788
19815
|
case 14:
|
|
19789
|
-
|
|
19790
|
-
case 15:
|
|
19791
|
-
_context5.n = 21;
|
|
19816
|
+
_context6.n = 16;
|
|
19792
19817
|
break;
|
|
19818
|
+
case 15:
|
|
19819
|
+
throw new Error('Connection required to forward message');
|
|
19793
19820
|
case 16:
|
|
19794
|
-
|
|
19795
|
-
|
|
19821
|
+
_context6.n = 22;
|
|
19822
|
+
break;
|
|
19823
|
+
case 17:
|
|
19824
|
+
_context6.p = 17;
|
|
19825
|
+
_t4 = _context6.v;
|
|
19796
19826
|
if (!(pendingMessage && channel && action.type !== RESEND_MESSAGE)) {
|
|
19797
|
-
|
|
19827
|
+
_context6.n = 20;
|
|
19798
19828
|
break;
|
|
19799
19829
|
}
|
|
19800
19830
|
connectionIsDisconnected = store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED;
|
|
19801
19831
|
if (!(isAddToPendingMessagesMap && connectionIsDisconnected)) {
|
|
19802
|
-
|
|
19832
|
+
_context6.n = 19;
|
|
19803
19833
|
break;
|
|
19804
19834
|
}
|
|
19805
|
-
|
|
19835
|
+
_context6.n = 18;
|
|
19806
19836
|
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19807
|
-
case 17:
|
|
19808
|
-
_context5.n = 19;
|
|
19809
|
-
break;
|
|
19810
19837
|
case 18:
|
|
19811
|
-
|
|
19812
|
-
|
|
19838
|
+
_context6.n = 20;
|
|
19839
|
+
break;
|
|
19813
19840
|
case 19:
|
|
19841
|
+
_context6.n = 20;
|
|
19842
|
+
return effects.put(removePendingMessageAC(channel.id, pendingMessage.tid));
|
|
19843
|
+
case 20:
|
|
19814
19844
|
if (!(channel && messageTid)) {
|
|
19815
|
-
|
|
19845
|
+
_context6.n = 21;
|
|
19816
19846
|
break;
|
|
19817
19847
|
}
|
|
19818
19848
|
updateMessageOnMap(channel.id, {
|
|
@@ -19822,33 +19852,33 @@ function forwardMessage(action) {
|
|
|
19822
19852
|
}
|
|
19823
19853
|
});
|
|
19824
19854
|
if (!(activeChannelId === channel.id)) {
|
|
19825
|
-
|
|
19855
|
+
_context6.n = 21;
|
|
19826
19856
|
break;
|
|
19827
19857
|
}
|
|
19828
19858
|
updateMessageOnAllMessages(messageTid, {
|
|
19829
19859
|
state: MESSAGE_STATUS.FAILED
|
|
19830
19860
|
});
|
|
19831
|
-
|
|
19861
|
+
_context6.n = 21;
|
|
19832
19862
|
return effects.put(updateMessageAC(messageTid, {
|
|
19833
19863
|
state: MESSAGE_STATUS.FAILED
|
|
19834
19864
|
}));
|
|
19835
|
-
case 20:
|
|
19836
|
-
log.error('error on forward message ... ', _t4);
|
|
19837
19865
|
case 21:
|
|
19838
|
-
|
|
19839
|
-
_context5.n = 22;
|
|
19840
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19866
|
+
log.error('error on forward message ... ', _t4);
|
|
19841
19867
|
case 22:
|
|
19842
|
-
|
|
19868
|
+
_context6.p = 22;
|
|
19869
|
+
_context6.n = 23;
|
|
19870
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19843
19871
|
case 23:
|
|
19844
|
-
return
|
|
19872
|
+
return _context6.f(22);
|
|
19873
|
+
case 24:
|
|
19874
|
+
return _context6.a(2);
|
|
19845
19875
|
}
|
|
19846
|
-
}, _marked3$1, null, [[1,
|
|
19876
|
+
}, _marked3$1, null, [[1, 17, 22, 24]]);
|
|
19847
19877
|
}
|
|
19848
19878
|
function resendMessage(action) {
|
|
19849
19879
|
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isVoiceMessage;
|
|
19850
|
-
return _regenerator().w(function (
|
|
19851
|
-
while (1) switch (
|
|
19880
|
+
return _regenerator().w(function (_context7) {
|
|
19881
|
+
while (1) switch (_context7.n) {
|
|
19852
19882
|
case 0:
|
|
19853
19883
|
payload = action.payload;
|
|
19854
19884
|
message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId;
|
|
@@ -19862,33 +19892,33 @@ function resendMessage(action) {
|
|
|
19862
19892
|
store.dispatch(sendTextMessageAC(message, channelId, connectionState, false));
|
|
19863
19893
|
}
|
|
19864
19894
|
case 1:
|
|
19865
|
-
return
|
|
19895
|
+
return _context7.a(2);
|
|
19866
19896
|
}
|
|
19867
19897
|
}, _marked4$1);
|
|
19868
19898
|
}
|
|
19869
19899
|
function deleteMessage(action) {
|
|
19870
19900
|
var payload, messageId, channelId, deleteOption, channel, deletedMessage, messageToUpdate, _t5;
|
|
19871
|
-
return _regenerator().w(function (
|
|
19872
|
-
while (1) switch (
|
|
19901
|
+
return _regenerator().w(function (_context8) {
|
|
19902
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
19873
19903
|
case 0:
|
|
19874
|
-
|
|
19904
|
+
_context8.p = 0;
|
|
19875
19905
|
payload = action.payload;
|
|
19876
19906
|
messageId = payload.messageId, channelId = payload.channelId, deleteOption = payload.deleteOption;
|
|
19877
|
-
|
|
19907
|
+
_context8.n = 1;
|
|
19878
19908
|
return effects.call(getChannelFromMap, channelId);
|
|
19879
19909
|
case 1:
|
|
19880
|
-
channel =
|
|
19910
|
+
channel = _context8.v;
|
|
19881
19911
|
if (!channel) {
|
|
19882
19912
|
channel = getChannelFromAllChannels(channelId);
|
|
19883
19913
|
if (channel) {
|
|
19884
19914
|
setChannelInMap(channel);
|
|
19885
19915
|
}
|
|
19886
19916
|
}
|
|
19887
|
-
|
|
19917
|
+
_context8.n = 2;
|
|
19888
19918
|
return effects.call(channel.deleteMessageById, messageId, deleteOption === 'forMe');
|
|
19889
19919
|
case 2:
|
|
19890
|
-
deletedMessage =
|
|
19891
|
-
|
|
19920
|
+
deletedMessage = _context8.v;
|
|
19921
|
+
_context8.n = 3;
|
|
19892
19922
|
return effects.put(updateMessageAC(deletedMessage.id, deletedMessage));
|
|
19893
19923
|
case 3:
|
|
19894
19924
|
updateMessageOnMap(channel.id, {
|
|
@@ -19899,35 +19929,35 @@ function deleteMessage(action) {
|
|
|
19899
19929
|
messageToUpdate = JSON.parse(JSON.stringify(deletedMessage));
|
|
19900
19930
|
updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
|
|
19901
19931
|
if (!(channel.lastMessage.id === messageId)) {
|
|
19902
|
-
|
|
19932
|
+
_context8.n = 4;
|
|
19903
19933
|
break;
|
|
19904
19934
|
}
|
|
19905
|
-
|
|
19935
|
+
_context8.n = 4;
|
|
19906
19936
|
return effects.put(updateChannelLastMessageAC(messageToUpdate, channel));
|
|
19907
19937
|
case 4:
|
|
19908
|
-
|
|
19938
|
+
_context8.n = 6;
|
|
19909
19939
|
break;
|
|
19910
19940
|
case 5:
|
|
19911
|
-
|
|
19912
|
-
_t5 =
|
|
19941
|
+
_context8.p = 5;
|
|
19942
|
+
_t5 = _context8.v;
|
|
19913
19943
|
log.error('ERROR in delete message', _t5.message);
|
|
19914
19944
|
case 6:
|
|
19915
|
-
return
|
|
19945
|
+
return _context8.a(2);
|
|
19916
19946
|
}
|
|
19917
19947
|
}, _marked5$1, null, [[0, 5]]);
|
|
19918
19948
|
}
|
|
19919
19949
|
function editMessage(action) {
|
|
19920
19950
|
var payload, message, channelId, channel, linkAttachments, anotherAttachments, linkAttachmentsToSend, editedMessage, messageToUpdate, _t6;
|
|
19921
|
-
return _regenerator().w(function (
|
|
19922
|
-
while (1) switch (
|
|
19951
|
+
return _regenerator().w(function (_context9) {
|
|
19952
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
19923
19953
|
case 0:
|
|
19924
|
-
|
|
19954
|
+
_context9.p = 0;
|
|
19925
19955
|
payload = action.payload;
|
|
19926
19956
|
message = payload.message, channelId = payload.channelId;
|
|
19927
|
-
|
|
19957
|
+
_context9.n = 1;
|
|
19928
19958
|
return effects.call(getChannelFromMap, channelId);
|
|
19929
19959
|
case 1:
|
|
19930
|
-
channel =
|
|
19960
|
+
channel = _context9.v;
|
|
19931
19961
|
if (!channel) {
|
|
19932
19962
|
channel = getChannelFromAllChannels(channelId);
|
|
19933
19963
|
if (channel) {
|
|
@@ -19949,7 +19979,7 @@ function editMessage(action) {
|
|
|
19949
19979
|
});
|
|
19950
19980
|
message.attachments = [].concat(anotherAttachments, linkAttachmentsToSend);
|
|
19951
19981
|
}
|
|
19952
|
-
|
|
19982
|
+
_context9.n = 2;
|
|
19953
19983
|
return effects.call(channel.editMessage, _extends({}, message, {
|
|
19954
19984
|
metadata: isJSON(message.metadata) ? message.metadata : JSON.stringify(message.metadata),
|
|
19955
19985
|
attachments: message.attachments.map(function (att) {
|
|
@@ -19959,8 +19989,8 @@ function editMessage(action) {
|
|
|
19959
19989
|
})
|
|
19960
19990
|
}));
|
|
19961
19991
|
case 2:
|
|
19962
|
-
editedMessage =
|
|
19963
|
-
|
|
19992
|
+
editedMessage = _context9.v;
|
|
19993
|
+
_context9.n = 3;
|
|
19964
19994
|
return effects.put(updateMessageAC(editedMessage.id, editedMessage));
|
|
19965
19995
|
case 3:
|
|
19966
19996
|
updateMessageOnMap(channel.id, {
|
|
@@ -19969,54 +19999,54 @@ function editMessage(action) {
|
|
|
19969
19999
|
});
|
|
19970
20000
|
updateMessageOnAllMessages(message.id, editedMessage);
|
|
19971
20001
|
if (!(channel.lastMessage.id === message.id)) {
|
|
19972
|
-
|
|
20002
|
+
_context9.n = 4;
|
|
19973
20003
|
break;
|
|
19974
20004
|
}
|
|
19975
20005
|
messageToUpdate = JSON.parse(JSON.stringify(editedMessage));
|
|
19976
20006
|
updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
|
|
19977
|
-
|
|
20007
|
+
_context9.n = 4;
|
|
19978
20008
|
return effects.put(updateChannelLastMessageAC(messageToUpdate, channel));
|
|
19979
20009
|
case 4:
|
|
19980
|
-
|
|
20010
|
+
_context9.n = 6;
|
|
19981
20011
|
break;
|
|
19982
20012
|
case 5:
|
|
19983
|
-
|
|
19984
|
-
_t6 =
|
|
20013
|
+
_context9.p = 5;
|
|
20014
|
+
_t6 = _context9.v;
|
|
19985
20015
|
log.error('ERROR in edit message', _t6.message);
|
|
19986
20016
|
case 6:
|
|
19987
|
-
return
|
|
20017
|
+
return _context9.a(2);
|
|
19988
20018
|
}
|
|
19989
20019
|
}, _marked6$1, null, [[0, 5]]);
|
|
19990
20020
|
}
|
|
19991
|
-
var sendPendingMessages = /*#__PURE__*/_regenerator().m(function
|
|
20021
|
+
var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee4(connectionState) {
|
|
19992
20022
|
var pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9;
|
|
19993
|
-
return _regenerator().w(function (
|
|
19994
|
-
while (1) switch (
|
|
20023
|
+
return _regenerator().w(function (_context0) {
|
|
20024
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
19995
20025
|
case 0:
|
|
19996
20026
|
pendingMessagesMap = _extends({}, getPendingMessagesMap());
|
|
19997
20027
|
_t7 = _regeneratorKeys(pendingMessagesMap);
|
|
19998
20028
|
case 1:
|
|
19999
20029
|
if ((_t8 = _t7()).done) {
|
|
20000
|
-
|
|
20030
|
+
_context0.n = 12;
|
|
20001
20031
|
break;
|
|
20002
20032
|
}
|
|
20003
20033
|
channelId = _t8.value;
|
|
20004
20034
|
_iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
20005
20035
|
case 2:
|
|
20006
20036
|
if ((_step = _iterator()).done) {
|
|
20007
|
-
|
|
20037
|
+
_context0.n = 11;
|
|
20008
20038
|
break;
|
|
20009
20039
|
}
|
|
20010
20040
|
msg = _step.value;
|
|
20011
20041
|
attachments = msg === null || msg === void 0 ? void 0 : (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
20012
20042
|
return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
|
|
20013
20043
|
});
|
|
20014
|
-
|
|
20044
|
+
_context0.p = 3;
|
|
20015
20045
|
if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
|
|
20016
|
-
|
|
20046
|
+
_context0.n = 5;
|
|
20017
20047
|
break;
|
|
20018
20048
|
}
|
|
20019
|
-
|
|
20049
|
+
_context0.n = 4;
|
|
20020
20050
|
return effects.call(forwardMessage, {
|
|
20021
20051
|
type: RESEND_MESSAGE,
|
|
20022
20052
|
payload: {
|
|
@@ -20028,14 +20058,14 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connec
|
|
|
20028
20058
|
}
|
|
20029
20059
|
});
|
|
20030
20060
|
case 4:
|
|
20031
|
-
|
|
20061
|
+
_context0.n = 8;
|
|
20032
20062
|
break;
|
|
20033
20063
|
case 5:
|
|
20034
20064
|
if (!(attachments && attachments.length > 0)) {
|
|
20035
|
-
|
|
20065
|
+
_context0.n = 7;
|
|
20036
20066
|
break;
|
|
20037
20067
|
}
|
|
20038
|
-
|
|
20068
|
+
_context0.n = 6;
|
|
20039
20069
|
return effects.call(sendMessage, {
|
|
20040
20070
|
type: RESEND_MESSAGE,
|
|
20041
20071
|
payload: {
|
|
@@ -20048,10 +20078,10 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connec
|
|
|
20048
20078
|
}
|
|
20049
20079
|
});
|
|
20050
20080
|
case 6:
|
|
20051
|
-
|
|
20081
|
+
_context0.n = 8;
|
|
20052
20082
|
break;
|
|
20053
20083
|
case 7:
|
|
20054
|
-
|
|
20084
|
+
_context0.n = 8;
|
|
20055
20085
|
return effects.call(sendTextMessage, {
|
|
20056
20086
|
type: RESEND_MESSAGE,
|
|
20057
20087
|
payload: {
|
|
@@ -20062,44 +20092,72 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connec
|
|
|
20062
20092
|
}
|
|
20063
20093
|
});
|
|
20064
20094
|
case 8:
|
|
20065
|
-
|
|
20095
|
+
_context0.n = 10;
|
|
20066
20096
|
break;
|
|
20067
20097
|
case 9:
|
|
20068
|
-
|
|
20069
|
-
_t9 =
|
|
20098
|
+
_context0.p = 9;
|
|
20099
|
+
_t9 = _context0.v;
|
|
20070
20100
|
log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t9);
|
|
20071
20101
|
case 10:
|
|
20072
|
-
|
|
20102
|
+
_context0.n = 2;
|
|
20073
20103
|
break;
|
|
20074
20104
|
case 11:
|
|
20075
|
-
|
|
20105
|
+
_context0.n = 1;
|
|
20076
20106
|
break;
|
|
20077
20107
|
case 12:
|
|
20078
20108
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
20079
20109
|
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
20080
|
-
|
|
20110
|
+
_context0.n = 13;
|
|
20081
20111
|
break;
|
|
20082
20112
|
}
|
|
20083
|
-
|
|
20113
|
+
_context0.n = 13;
|
|
20084
20114
|
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
20085
20115
|
case 13:
|
|
20086
|
-
return
|
|
20116
|
+
return _context0.a(2);
|
|
20087
20117
|
}
|
|
20088
|
-
},
|
|
20118
|
+
}, _callee4, null, [[3, 9]]);
|
|
20119
|
+
});
|
|
20120
|
+
var updateMessages = /*#__PURE__*/_regenerator().m(function _callee5(channel, updatedMessages) {
|
|
20121
|
+
var _messages, _Object$values;
|
|
20122
|
+
var previousAllMessages, messages, lastMessageId, setMappedAllMessages, allMessagesAfterLastMessage;
|
|
20123
|
+
return _regenerator().w(function (_context1) {
|
|
20124
|
+
while (1) switch (_context1.n) {
|
|
20125
|
+
case 0:
|
|
20126
|
+
previousAllMessages = getAllMessages();
|
|
20127
|
+
messages = [].concat(updatedMessages);
|
|
20128
|
+
lastMessageId = (_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.id;
|
|
20129
|
+
setMappedAllMessages = {};
|
|
20130
|
+
previousAllMessages.forEach(function (msg) {
|
|
20131
|
+
if (msg.channelId === channel.id) {
|
|
20132
|
+
setMappedAllMessages[msg.id || msg.tid || ''] = msg;
|
|
20133
|
+
}
|
|
20134
|
+
});
|
|
20135
|
+
allMessagesAfterLastMessage = lastMessageId ? (_Object$values = Object.values(setMappedAllMessages || {})) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (msg) {
|
|
20136
|
+
return msg.id > lastMessageId || !msg.id;
|
|
20137
|
+
}) : Object.values(setMappedAllMessages || {});
|
|
20138
|
+
messages = [].concat(messages, allMessagesAfterLastMessage || []);
|
|
20139
|
+
setMessagesToMap(channel.id, messages);
|
|
20140
|
+
setAllMessages(messages);
|
|
20141
|
+
_context1.n = 1;
|
|
20142
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(messages))));
|
|
20143
|
+
case 1:
|
|
20144
|
+
return _context1.a(2);
|
|
20145
|
+
}
|
|
20146
|
+
}, _callee5);
|
|
20089
20147
|
});
|
|
20090
20148
|
function getMessagesQuery(action) {
|
|
20091
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, scrollToMessage, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3,
|
|
20092
|
-
return _regenerator().w(function (
|
|
20093
|
-
while (1) switch (
|
|
20149
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, scrollToMessage, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
|
|
20150
|
+
return _regenerator().w(function (_context10) {
|
|
20151
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
20094
20152
|
case 0:
|
|
20095
|
-
|
|
20096
|
-
|
|
20153
|
+
_context10.p = 0;
|
|
20154
|
+
_context10.n = 1;
|
|
20097
20155
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
20098
20156
|
case 1:
|
|
20099
20157
|
_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, scrollToMessage = _action$payload.scrollToMessage;
|
|
20100
20158
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
20101
20159
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
20102
|
-
|
|
20160
|
+
_context10.n = 76;
|
|
20103
20161
|
break;
|
|
20104
20162
|
}
|
|
20105
20163
|
SceytChatClient = getClient();
|
|
@@ -20107,14 +20165,14 @@ function getMessagesQuery(action) {
|
|
|
20107
20165
|
messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
|
|
20108
20166
|
messageQueryBuilder.reverse(true);
|
|
20109
20167
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20110
|
-
|
|
20168
|
+
_context10.n = 3;
|
|
20111
20169
|
break;
|
|
20112
20170
|
}
|
|
20113
|
-
|
|
20171
|
+
_context10.n = 2;
|
|
20114
20172
|
return effects.call(messageQueryBuilder.build);
|
|
20115
20173
|
case 2:
|
|
20116
|
-
_t0 =
|
|
20117
|
-
|
|
20174
|
+
_t0 = _context10.v;
|
|
20175
|
+
_context10.n = 4;
|
|
20118
20176
|
break;
|
|
20119
20177
|
case 3:
|
|
20120
20178
|
_t0 = null;
|
|
@@ -20129,27 +20187,27 @@ function getMessagesQuery(action) {
|
|
|
20129
20187
|
hasNext: false
|
|
20130
20188
|
};
|
|
20131
20189
|
if (!loadWithLastMessage) {
|
|
20132
|
-
|
|
20190
|
+
_context10.n = 19;
|
|
20133
20191
|
break;
|
|
20134
20192
|
}
|
|
20135
20193
|
allMessages = getAllMessages();
|
|
20136
20194
|
havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
|
|
20137
20195
|
if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
|
|
20138
|
-
|
|
20196
|
+
_context10.n = 14;
|
|
20139
20197
|
break;
|
|
20140
20198
|
}
|
|
20141
20199
|
setHasPrevCached(false);
|
|
20142
20200
|
setMessagesToMap(channel.id, []);
|
|
20143
20201
|
setAllMessages([]);
|
|
20144
20202
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20145
|
-
|
|
20203
|
+
_context10.n = 6;
|
|
20146
20204
|
break;
|
|
20147
20205
|
}
|
|
20148
|
-
|
|
20206
|
+
_context10.n = 5;
|
|
20149
20207
|
return effects.call(messageQuery.loadPreviousMessageId, '0');
|
|
20150
20208
|
case 5:
|
|
20151
|
-
_t1 =
|
|
20152
|
-
|
|
20209
|
+
_t1 = _context10.v;
|
|
20210
|
+
_context10.n = 7;
|
|
20153
20211
|
break;
|
|
20154
20212
|
case 6:
|
|
20155
20213
|
_t1 = {
|
|
@@ -20159,19 +20217,19 @@ function getMessagesQuery(action) {
|
|
|
20159
20217
|
case 7:
|
|
20160
20218
|
result = _t1;
|
|
20161
20219
|
if (!(result.messages.length === 50)) {
|
|
20162
|
-
|
|
20220
|
+
_context10.n = 11;
|
|
20163
20221
|
break;
|
|
20164
20222
|
}
|
|
20165
20223
|
messageQuery.limit = 30;
|
|
20166
20224
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20167
|
-
|
|
20225
|
+
_context10.n = 9;
|
|
20168
20226
|
break;
|
|
20169
20227
|
}
|
|
20170
|
-
|
|
20228
|
+
_context10.n = 8;
|
|
20171
20229
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20172
20230
|
case 8:
|
|
20173
|
-
_t10 =
|
|
20174
|
-
|
|
20231
|
+
_t10 = _context10.v;
|
|
20232
|
+
_context10.n = 10;
|
|
20175
20233
|
break;
|
|
20176
20234
|
case 9:
|
|
20177
20235
|
_t10 = {
|
|
@@ -20195,40 +20253,40 @@ function getMessagesQuery(action) {
|
|
|
20195
20253
|
return !messagesMap[msg.tid || ''];
|
|
20196
20254
|
});
|
|
20197
20255
|
result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
|
|
20198
|
-
|
|
20256
|
+
_context10.n = 12;
|
|
20199
20257
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20200
20258
|
case 12:
|
|
20201
20259
|
setMessagesToMap(channel.id, result.messages);
|
|
20202
20260
|
setAllMessages(result.messages);
|
|
20203
|
-
|
|
20261
|
+
_context10.n = 13;
|
|
20204
20262
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20205
20263
|
case 13:
|
|
20206
|
-
|
|
20264
|
+
_context10.n = 16;
|
|
20207
20265
|
break;
|
|
20208
20266
|
case 14:
|
|
20209
20267
|
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
20210
|
-
|
|
20268
|
+
_context10.n = 15;
|
|
20211
20269
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20212
20270
|
case 15:
|
|
20213
|
-
|
|
20271
|
+
_context10.n = 16;
|
|
20214
20272
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20215
20273
|
case 16:
|
|
20216
|
-
|
|
20274
|
+
_context10.n = 17;
|
|
20217
20275
|
return effects.put(setMessagesHasNextAC(false));
|
|
20218
20276
|
case 17:
|
|
20219
20277
|
setHasNextCached(false);
|
|
20220
20278
|
if (!(messageId && scrollToMessage)) {
|
|
20221
|
-
|
|
20279
|
+
_context10.n = 18;
|
|
20222
20280
|
break;
|
|
20223
20281
|
}
|
|
20224
|
-
|
|
20282
|
+
_context10.n = 18;
|
|
20225
20283
|
return effects.put(setScrollToMessagesAC(messageId, highlight, behavior));
|
|
20226
20284
|
case 18:
|
|
20227
|
-
|
|
20285
|
+
_context10.n = 72;
|
|
20228
20286
|
break;
|
|
20229
20287
|
case 19:
|
|
20230
20288
|
if (!messageId) {
|
|
20231
|
-
|
|
20289
|
+
_context10.n = 38;
|
|
20232
20290
|
break;
|
|
20233
20291
|
}
|
|
20234
20292
|
_allMessages = getAllMessages();
|
|
@@ -20237,32 +20295,32 @@ function getMessagesQuery(action) {
|
|
|
20237
20295
|
});
|
|
20238
20296
|
maxLengthPart = MESSAGES_MAX_LENGTH / 2;
|
|
20239
20297
|
if (!(messageIndex >= maxLengthPart)) {
|
|
20240
|
-
|
|
20298
|
+
_context10.n = 22;
|
|
20241
20299
|
break;
|
|
20242
20300
|
}
|
|
20243
20301
|
result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
|
|
20244
|
-
|
|
20302
|
+
_context10.n = 20;
|
|
20245
20303
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20246
20304
|
case 20:
|
|
20247
20305
|
setHasPrevCached(messageIndex > maxLengthPart);
|
|
20248
20306
|
setHasNextCached(_allMessages.length > maxLengthPart);
|
|
20249
|
-
|
|
20307
|
+
_context10.n = 21;
|
|
20250
20308
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20251
20309
|
case 21:
|
|
20252
|
-
|
|
20310
|
+
_context10.n = 34;
|
|
20253
20311
|
break;
|
|
20254
20312
|
case 22:
|
|
20255
20313
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
20256
20314
|
log.info('load by message id from server ...............', messageId);
|
|
20257
20315
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20258
|
-
|
|
20316
|
+
_context10.n = 24;
|
|
20259
20317
|
break;
|
|
20260
20318
|
}
|
|
20261
|
-
|
|
20319
|
+
_context10.n = 23;
|
|
20262
20320
|
return effects.call(messageQuery.loadNearMessageId, messageId);
|
|
20263
20321
|
case 23:
|
|
20264
|
-
_t11 =
|
|
20265
|
-
|
|
20322
|
+
_t11 = _context10.v;
|
|
20323
|
+
_context10.n = 25;
|
|
20266
20324
|
break;
|
|
20267
20325
|
case 24:
|
|
20268
20326
|
_t11 = {
|
|
@@ -20272,19 +20330,19 @@ function getMessagesQuery(action) {
|
|
|
20272
20330
|
case 25:
|
|
20273
20331
|
result = _t11;
|
|
20274
20332
|
if (!(result.messages.length === 50)) {
|
|
20275
|
-
|
|
20333
|
+
_context10.n = 32;
|
|
20276
20334
|
break;
|
|
20277
20335
|
}
|
|
20278
20336
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20279
20337
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20280
|
-
|
|
20338
|
+
_context10.n = 27;
|
|
20281
20339
|
break;
|
|
20282
20340
|
}
|
|
20283
|
-
|
|
20341
|
+
_context10.n = 26;
|
|
20284
20342
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20285
20343
|
case 26:
|
|
20286
|
-
_t12 =
|
|
20287
|
-
|
|
20344
|
+
_t12 = _context10.v;
|
|
20345
|
+
_context10.n = 28;
|
|
20288
20346
|
break;
|
|
20289
20347
|
case 27:
|
|
20290
20348
|
_t12 = {
|
|
@@ -20295,14 +20353,14 @@ function getMessagesQuery(action) {
|
|
|
20295
20353
|
_secondResult = _t12;
|
|
20296
20354
|
messageQuery.reverse = false;
|
|
20297
20355
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20298
|
-
|
|
20356
|
+
_context10.n = 30;
|
|
20299
20357
|
break;
|
|
20300
20358
|
}
|
|
20301
|
-
|
|
20359
|
+
_context10.n = 29;
|
|
20302
20360
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
20303
20361
|
case 29:
|
|
20304
|
-
_t13 =
|
|
20305
|
-
|
|
20362
|
+
_t13 = _context10.v;
|
|
20363
|
+
_context10.n = 31;
|
|
20306
20364
|
break;
|
|
20307
20365
|
case 30:
|
|
20308
20366
|
_t13 = {
|
|
@@ -20314,10 +20372,10 @@ function getMessagesQuery(action) {
|
|
|
20314
20372
|
result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
|
|
20315
20373
|
result.hasNext = _secondResult.hasNext;
|
|
20316
20374
|
messageQuery.reverse = true;
|
|
20317
|
-
|
|
20375
|
+
_context10.n = 32;
|
|
20318
20376
|
return effects.put(setMessagesHasPrevAC(_secondResult.hasNext));
|
|
20319
20377
|
case 32:
|
|
20320
|
-
|
|
20378
|
+
_context10.n = 33;
|
|
20321
20379
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20322
20380
|
case 33:
|
|
20323
20381
|
setMessagesToMap(channel.id, result.messages);
|
|
@@ -20325,42 +20383,42 @@ function getMessagesQuery(action) {
|
|
|
20325
20383
|
setHasPrevCached(false);
|
|
20326
20384
|
setHasNextCached(false);
|
|
20327
20385
|
case 34:
|
|
20328
|
-
|
|
20386
|
+
_context10.n = 35;
|
|
20329
20387
|
return effects.put(setMessagesHasNextAC(true));
|
|
20330
20388
|
case 35:
|
|
20331
20389
|
if (!scrollToMessage) {
|
|
20332
|
-
|
|
20390
|
+
_context10.n = 36;
|
|
20333
20391
|
break;
|
|
20334
20392
|
}
|
|
20335
|
-
|
|
20393
|
+
_context10.n = 36;
|
|
20336
20394
|
return effects.put(setScrollToMessagesAC(messageId, true, behavior));
|
|
20337
20395
|
case 36:
|
|
20338
|
-
|
|
20396
|
+
_context10.n = 37;
|
|
20339
20397
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20340
20398
|
case 37:
|
|
20341
|
-
|
|
20399
|
+
_context10.n = 72;
|
|
20342
20400
|
break;
|
|
20343
20401
|
case 38:
|
|
20344
20402
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
20345
|
-
|
|
20403
|
+
_context10.n = 61;
|
|
20346
20404
|
break;
|
|
20347
20405
|
}
|
|
20348
20406
|
setMessagesToMap(channel.id, []);
|
|
20349
20407
|
setAllMessages([]);
|
|
20350
20408
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
20351
20409
|
if (!Number(channel.lastDisplayedMessageId)) {
|
|
20352
|
-
|
|
20410
|
+
_context10.n = 50;
|
|
20353
20411
|
break;
|
|
20354
20412
|
}
|
|
20355
20413
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20356
|
-
|
|
20414
|
+
_context10.n = 40;
|
|
20357
20415
|
break;
|
|
20358
20416
|
}
|
|
20359
|
-
|
|
20417
|
+
_context10.n = 39;
|
|
20360
20418
|
return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
|
|
20361
20419
|
case 39:
|
|
20362
|
-
_t14 =
|
|
20363
|
-
|
|
20420
|
+
_t14 = _context10.v;
|
|
20421
|
+
_context10.n = 41;
|
|
20364
20422
|
break;
|
|
20365
20423
|
case 40:
|
|
20366
20424
|
_t14 = {
|
|
@@ -20370,19 +20428,19 @@ function getMessagesQuery(action) {
|
|
|
20370
20428
|
case 41:
|
|
20371
20429
|
result = _t14;
|
|
20372
20430
|
if (!(result.messages.length === 50)) {
|
|
20373
|
-
|
|
20431
|
+
_context10.n = 49;
|
|
20374
20432
|
break;
|
|
20375
20433
|
}
|
|
20376
20434
|
messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
|
|
20377
20435
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20378
|
-
|
|
20436
|
+
_context10.n = 43;
|
|
20379
20437
|
break;
|
|
20380
20438
|
}
|
|
20381
|
-
|
|
20439
|
+
_context10.n = 42;
|
|
20382
20440
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20383
20441
|
case 42:
|
|
20384
|
-
_t15 =
|
|
20385
|
-
|
|
20442
|
+
_t15 = _context10.v;
|
|
20443
|
+
_context10.n = 44;
|
|
20386
20444
|
break;
|
|
20387
20445
|
case 43:
|
|
20388
20446
|
_t15 = {
|
|
@@ -20392,19 +20450,19 @@ function getMessagesQuery(action) {
|
|
|
20392
20450
|
case 44:
|
|
20393
20451
|
_secondResult2 = _t15;
|
|
20394
20452
|
if (!(channel.newMessageCount > 25)) {
|
|
20395
|
-
|
|
20453
|
+
_context10.n = 48;
|
|
20396
20454
|
break;
|
|
20397
20455
|
}
|
|
20398
20456
|
messageQuery.reverse = false;
|
|
20399
20457
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20400
|
-
|
|
20458
|
+
_context10.n = 46;
|
|
20401
20459
|
break;
|
|
20402
20460
|
}
|
|
20403
|
-
|
|
20461
|
+
_context10.n = 45;
|
|
20404
20462
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
20405
20463
|
case 45:
|
|
20406
|
-
_t16 =
|
|
20407
|
-
|
|
20464
|
+
_t16 = _context10.v;
|
|
20465
|
+
_context10.n = 47;
|
|
20408
20466
|
break;
|
|
20409
20467
|
case 46:
|
|
20410
20468
|
_t16 = {
|
|
@@ -20415,23 +20473,23 @@ function getMessagesQuery(action) {
|
|
|
20415
20473
|
_thirdResult = _t16;
|
|
20416
20474
|
result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
|
|
20417
20475
|
messageQuery.reverse = true;
|
|
20418
|
-
|
|
20476
|
+
_context10.n = 49;
|
|
20419
20477
|
break;
|
|
20420
20478
|
case 48:
|
|
20421
20479
|
result.messages = [].concat(_secondResult2.messages, result.messages);
|
|
20422
20480
|
case 49:
|
|
20423
|
-
|
|
20481
|
+
_context10.n = 57;
|
|
20424
20482
|
break;
|
|
20425
20483
|
case 50:
|
|
20426
20484
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20427
|
-
|
|
20485
|
+
_context10.n = 52;
|
|
20428
20486
|
break;
|
|
20429
20487
|
}
|
|
20430
|
-
|
|
20488
|
+
_context10.n = 51;
|
|
20431
20489
|
return effects.call(messageQuery.loadPrevious);
|
|
20432
20490
|
case 51:
|
|
20433
|
-
_t17 =
|
|
20434
|
-
|
|
20491
|
+
_t17 = _context10.v;
|
|
20492
|
+
_context10.n = 53;
|
|
20435
20493
|
break;
|
|
20436
20494
|
case 52:
|
|
20437
20495
|
_t17 = {
|
|
@@ -20441,19 +20499,19 @@ function getMessagesQuery(action) {
|
|
|
20441
20499
|
case 53:
|
|
20442
20500
|
result = _t17;
|
|
20443
20501
|
if (!(result.messages.length === 50)) {
|
|
20444
|
-
|
|
20502
|
+
_context10.n = 57;
|
|
20445
20503
|
break;
|
|
20446
20504
|
}
|
|
20447
20505
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20448
20506
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20449
|
-
|
|
20507
|
+
_context10.n = 55;
|
|
20450
20508
|
break;
|
|
20451
20509
|
}
|
|
20452
|
-
|
|
20510
|
+
_context10.n = 54;
|
|
20453
20511
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20454
20512
|
case 54:
|
|
20455
|
-
_t18 =
|
|
20456
|
-
|
|
20513
|
+
_t18 = _context10.v;
|
|
20514
|
+
_context10.n = 56;
|
|
20457
20515
|
break;
|
|
20458
20516
|
case 55:
|
|
20459
20517
|
_t18 = {
|
|
@@ -20465,42 +20523,41 @@ function getMessagesQuery(action) {
|
|
|
20465
20523
|
result.messages = [].concat(_secondResult3.messages, result.messages);
|
|
20466
20524
|
result.hasNext = _secondResult3.hasNext;
|
|
20467
20525
|
case 57:
|
|
20468
|
-
|
|
20526
|
+
_context10.n = 58;
|
|
20469
20527
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20470
20528
|
case 58:
|
|
20471
|
-
|
|
20529
|
+
_context10.n = 59;
|
|
20472
20530
|
return effects.put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
|
|
20473
20531
|
case 59:
|
|
20474
20532
|
setMessagesToMap(channel.id, result.messages);
|
|
20475
20533
|
setAllMessages([].concat(result.messages));
|
|
20476
|
-
|
|
20534
|
+
_context10.n = 60;
|
|
20477
20535
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20478
20536
|
case 60:
|
|
20479
|
-
|
|
20537
|
+
_context10.n = 72;
|
|
20480
20538
|
break;
|
|
20481
20539
|
case 61:
|
|
20482
|
-
previousAllMessages = getAllMessages();
|
|
20483
20540
|
setMessagesToMap(channel.id, []);
|
|
20484
20541
|
setAllMessages([]);
|
|
20485
20542
|
if (!(cachedMessages && cachedMessages.length)) {
|
|
20486
|
-
|
|
20543
|
+
_context10.n = 62;
|
|
20487
20544
|
break;
|
|
20488
20545
|
}
|
|
20489
20546
|
setMessagesToMap(channel.id, []);
|
|
20490
20547
|
setAllMessages([].concat(cachedMessages));
|
|
20491
|
-
|
|
20548
|
+
_context10.n = 62;
|
|
20492
20549
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
|
|
20493
20550
|
case 62:
|
|
20494
20551
|
log.info('load message from server');
|
|
20495
20552
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20496
|
-
|
|
20553
|
+
_context10.n = 64;
|
|
20497
20554
|
break;
|
|
20498
20555
|
}
|
|
20499
|
-
|
|
20556
|
+
_context10.n = 63;
|
|
20500
20557
|
return effects.call(messageQuery.loadPrevious);
|
|
20501
20558
|
case 63:
|
|
20502
|
-
_t19 =
|
|
20503
|
-
|
|
20559
|
+
_t19 = _context10.v;
|
|
20560
|
+
_context10.n = 65;
|
|
20504
20561
|
break;
|
|
20505
20562
|
case 64:
|
|
20506
20563
|
_t19 = {
|
|
@@ -20510,19 +20567,19 @@ function getMessagesQuery(action) {
|
|
|
20510
20567
|
case 65:
|
|
20511
20568
|
result = _t19;
|
|
20512
20569
|
if (!(result.messages.length === 50)) {
|
|
20513
|
-
|
|
20570
|
+
_context10.n = 69;
|
|
20514
20571
|
break;
|
|
20515
20572
|
}
|
|
20516
20573
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20517
20574
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20518
|
-
|
|
20575
|
+
_context10.n = 67;
|
|
20519
20576
|
break;
|
|
20520
20577
|
}
|
|
20521
|
-
|
|
20578
|
+
_context10.n = 66;
|
|
20522
20579
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20523
20580
|
case 66:
|
|
20524
|
-
_t20 =
|
|
20525
|
-
|
|
20581
|
+
_t20 = _context10.v;
|
|
20582
|
+
_context10.n = 68;
|
|
20526
20583
|
break;
|
|
20527
20584
|
case 67:
|
|
20528
20585
|
_t20 = {
|
|
@@ -20543,37 +20600,18 @@ function getMessagesQuery(action) {
|
|
|
20543
20600
|
updateMessageOnAllMessages(msg.id, updatedMessage || msg);
|
|
20544
20601
|
updatedMessages.push(updatedMessage || msg);
|
|
20545
20602
|
});
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
setMappedAllMessages = {};
|
|
20549
|
-
previousAllMessages.forEach(function (msg) {
|
|
20550
|
-
if (msg.channelId === channel.id) {
|
|
20551
|
-
setMappedAllMessages[msg.id] = msg;
|
|
20552
|
-
}
|
|
20553
|
-
});
|
|
20554
|
-
_allMessages2.forEach(function (msg) {
|
|
20555
|
-
if (msg.channelId === channel.id) {
|
|
20556
|
-
setMappedAllMessages[msg.id] = msg;
|
|
20557
|
-
}
|
|
20558
|
-
});
|
|
20559
|
-
allMessagesAfterLastMessage = lastMessageId ? (_Object$values = Object.values(setMappedAllMessages || {})) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (msg) {
|
|
20560
|
-
return msg.id > lastMessageId;
|
|
20561
|
-
}) : Object.values(setMappedAllMessages || {});
|
|
20562
|
-
updatedMessages = [].concat(updatedMessages, allMessagesAfterLastMessage || []);
|
|
20563
|
-
setMessagesToMap(channel.id, updatedMessages);
|
|
20564
|
-
setAllMessages(updatedMessages);
|
|
20565
|
-
_context0.n = 70;
|
|
20566
|
-
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
20603
|
+
_context10.n = 70;
|
|
20604
|
+
return effects.call(updateMessages, channel, updatedMessages);
|
|
20567
20605
|
case 70:
|
|
20568
|
-
|
|
20606
|
+
_context10.n = 71;
|
|
20569
20607
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20570
20608
|
case 71:
|
|
20571
|
-
|
|
20609
|
+
_context10.n = 72;
|
|
20572
20610
|
return effects.put(setMessagesHasNextAC(false));
|
|
20573
20611
|
case 72:
|
|
20574
20612
|
pendingMessages = getPendingMessages(channel.id);
|
|
20575
20613
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
20576
|
-
|
|
20614
|
+
_context10.n = 73;
|
|
20577
20615
|
break;
|
|
20578
20616
|
}
|
|
20579
20617
|
_messagesMap = {};
|
|
@@ -20583,76 +20621,76 @@ function getMessagesQuery(action) {
|
|
|
20583
20621
|
filteredPendingMessages = pendingMessages.filter(function (msg) {
|
|
20584
20622
|
return !_messagesMap[msg.tid || ''];
|
|
20585
20623
|
});
|
|
20586
|
-
|
|
20624
|
+
_context10.n = 73;
|
|
20587
20625
|
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
20588
20626
|
case 73:
|
|
20589
20627
|
waitToSendPendingMessages = store.getState().UserReducer.waitToSendPendingMessages;
|
|
20590
20628
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED && waitToSendPendingMessages)) {
|
|
20591
|
-
|
|
20629
|
+
_context10.n = 75;
|
|
20592
20630
|
break;
|
|
20593
20631
|
}
|
|
20594
|
-
|
|
20632
|
+
_context10.n = 74;
|
|
20595
20633
|
return effects.put(setWaitToSendPendingMessagesAC(false));
|
|
20596
20634
|
case 74:
|
|
20597
|
-
|
|
20635
|
+
_context10.n = 75;
|
|
20598
20636
|
return effects.spawn(sendPendingMessages, connectionState);
|
|
20599
20637
|
case 75:
|
|
20600
|
-
|
|
20638
|
+
_context10.n = 77;
|
|
20601
20639
|
break;
|
|
20602
20640
|
case 76:
|
|
20603
20641
|
if (!channel.isMockChannel) {
|
|
20604
|
-
|
|
20642
|
+
_context10.n = 77;
|
|
20605
20643
|
break;
|
|
20606
20644
|
}
|
|
20607
|
-
|
|
20645
|
+
_context10.n = 77;
|
|
20608
20646
|
return effects.put(setMessagesAC([]));
|
|
20609
20647
|
case 77:
|
|
20610
|
-
|
|
20648
|
+
_context10.n = 79;
|
|
20611
20649
|
break;
|
|
20612
20650
|
case 78:
|
|
20613
|
-
|
|
20614
|
-
_t21 =
|
|
20651
|
+
_context10.p = 78;
|
|
20652
|
+
_t21 = _context10.v;
|
|
20615
20653
|
log.error('error in message query', _t21);
|
|
20616
20654
|
case 79:
|
|
20617
|
-
|
|
20618
|
-
|
|
20655
|
+
_context10.p = 79;
|
|
20656
|
+
_context10.n = 80;
|
|
20619
20657
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20620
20658
|
case 80:
|
|
20621
|
-
return
|
|
20659
|
+
return _context10.f(79);
|
|
20622
20660
|
case 81:
|
|
20623
|
-
return
|
|
20661
|
+
return _context10.a(2);
|
|
20624
20662
|
}
|
|
20625
20663
|
}, _marked7$1, null, [[0, 78, 79, 81]]);
|
|
20626
20664
|
}
|
|
20627
20665
|
function getMessageQuery(action) {
|
|
20628
20666
|
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t22;
|
|
20629
|
-
return _regenerator().w(function (
|
|
20630
|
-
while (1) switch (
|
|
20667
|
+
return _regenerator().w(function (_context11) {
|
|
20668
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
20631
20669
|
case 0:
|
|
20632
|
-
|
|
20670
|
+
_context11.p = 0;
|
|
20633
20671
|
payload = action.payload;
|
|
20634
20672
|
channelId = payload.channelId, messageId = payload.messageId;
|
|
20635
|
-
|
|
20673
|
+
_context11.n = 1;
|
|
20636
20674
|
return effects.call(getChannelFromAllChannels, channelId);
|
|
20637
20675
|
case 1:
|
|
20638
|
-
channel =
|
|
20676
|
+
channel = _context11.v;
|
|
20639
20677
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
20640
20678
|
if (!(!channel || connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
20641
|
-
|
|
20679
|
+
_context11.n = 2;
|
|
20642
20680
|
break;
|
|
20643
20681
|
}
|
|
20644
|
-
return
|
|
20682
|
+
return _context11.a(2);
|
|
20645
20683
|
case 2:
|
|
20646
|
-
|
|
20684
|
+
_context11.n = 3;
|
|
20647
20685
|
return effects.call(channel.getMessagesById, [messageId]);
|
|
20648
20686
|
case 3:
|
|
20649
|
-
messages =
|
|
20687
|
+
messages = _context11.v;
|
|
20650
20688
|
fetchedMessage = messages && messages[0] ? JSON.parse(JSON.stringify(messages[0])) : null;
|
|
20651
20689
|
if (!fetchedMessage) {
|
|
20652
|
-
|
|
20690
|
+
_context11.n = 6;
|
|
20653
20691
|
break;
|
|
20654
20692
|
}
|
|
20655
|
-
|
|
20693
|
+
_context11.n = 4;
|
|
20656
20694
|
return effects.put(updateMessageAC(messageId, fetchedMessage));
|
|
20657
20695
|
case 4:
|
|
20658
20696
|
updateMessageOnMap(channel.id, {
|
|
@@ -20660,45 +20698,45 @@ function getMessageQuery(action) {
|
|
|
20660
20698
|
params: fetchedMessage
|
|
20661
20699
|
});
|
|
20662
20700
|
updateMessageOnAllMessages(messageId, fetchedMessage);
|
|
20663
|
-
|
|
20701
|
+
_context11.n = 5;
|
|
20664
20702
|
return effects.put(setScrollToMessagesAC(messageId, false));
|
|
20665
20703
|
case 5:
|
|
20666
20704
|
if (!(channel.lastMessage && channel.lastMessage.id === messageId)) {
|
|
20667
|
-
|
|
20705
|
+
_context11.n = 6;
|
|
20668
20706
|
break;
|
|
20669
20707
|
}
|
|
20670
20708
|
updateChannelLastMessageOnAllChannels(channel.id, fetchedMessage);
|
|
20671
|
-
|
|
20709
|
+
_context11.n = 6;
|
|
20672
20710
|
return effects.put(updateChannelLastMessageAC(fetchedMessage, channel));
|
|
20673
20711
|
case 6:
|
|
20674
|
-
|
|
20712
|
+
_context11.n = 8;
|
|
20675
20713
|
break;
|
|
20676
20714
|
case 7:
|
|
20677
|
-
|
|
20678
|
-
_t22 =
|
|
20715
|
+
_context11.p = 7;
|
|
20716
|
+
_t22 = _context11.v;
|
|
20679
20717
|
log.error('error in message query', _t22);
|
|
20680
20718
|
case 8:
|
|
20681
|
-
return
|
|
20719
|
+
return _context11.a(2);
|
|
20682
20720
|
}
|
|
20683
20721
|
}, _marked8$1, null, [[0, 7]]);
|
|
20684
20722
|
}
|
|
20685
20723
|
function loadMoreMessages(action) {
|
|
20686
20724
|
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t23;
|
|
20687
|
-
return _regenerator().w(function (
|
|
20688
|
-
while (1) switch (
|
|
20725
|
+
return _regenerator().w(function (_context12) {
|
|
20726
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
20689
20727
|
case 0:
|
|
20690
|
-
|
|
20728
|
+
_context12.p = 0;
|
|
20691
20729
|
payload = action.payload;
|
|
20692
20730
|
limit = payload.limit, direction = payload.direction, channelId = payload.channelId, messageId = payload.messageId, hasNext = payload.hasNext;
|
|
20693
20731
|
SceytChatClient = getClient();
|
|
20694
20732
|
messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channelId);
|
|
20695
20733
|
messageQueryBuilder.reverse(true);
|
|
20696
|
-
|
|
20734
|
+
_context12.n = 1;
|
|
20697
20735
|
return effects.call(messageQueryBuilder.build);
|
|
20698
20736
|
case 1:
|
|
20699
|
-
messageQuery =
|
|
20737
|
+
messageQuery = _context12.v;
|
|
20700
20738
|
messageQuery.limit = limit || 5;
|
|
20701
|
-
|
|
20739
|
+
_context12.n = 2;
|
|
20702
20740
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
20703
20741
|
case 2:
|
|
20704
20742
|
result = {
|
|
@@ -20706,130 +20744,130 @@ function loadMoreMessages(action) {
|
|
|
20706
20744
|
hasNext: false
|
|
20707
20745
|
};
|
|
20708
20746
|
if (!(direction === MESSAGE_LOAD_DIRECTION.PREV)) {
|
|
20709
|
-
|
|
20747
|
+
_context12.n = 6;
|
|
20710
20748
|
break;
|
|
20711
20749
|
}
|
|
20712
20750
|
if (!getHasPrevCached()) {
|
|
20713
|
-
|
|
20751
|
+
_context12.n = 3;
|
|
20714
20752
|
break;
|
|
20715
20753
|
}
|
|
20716
20754
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
|
|
20717
|
-
|
|
20755
|
+
_context12.n = 5;
|
|
20718
20756
|
break;
|
|
20719
20757
|
case 3:
|
|
20720
20758
|
if (!hasNext) {
|
|
20721
|
-
|
|
20759
|
+
_context12.n = 5;
|
|
20722
20760
|
break;
|
|
20723
20761
|
}
|
|
20724
|
-
|
|
20762
|
+
_context12.n = 4;
|
|
20725
20763
|
return effects.call(messageQuery.loadPreviousMessageId, messageId);
|
|
20726
20764
|
case 4:
|
|
20727
|
-
result =
|
|
20765
|
+
result = _context12.v;
|
|
20728
20766
|
if (result.messages.length) {
|
|
20729
20767
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
|
|
20730
20768
|
setMessagesToMap(channelId, result.messages);
|
|
20731
20769
|
}
|
|
20732
|
-
|
|
20770
|
+
_context12.n = 5;
|
|
20733
20771
|
return effects.put(setMessagesHasPrevAC(result.hasNext));
|
|
20734
20772
|
case 5:
|
|
20735
|
-
|
|
20773
|
+
_context12.n = 10;
|
|
20736
20774
|
break;
|
|
20737
20775
|
case 6:
|
|
20738
20776
|
if (!getHasNextCached()) {
|
|
20739
|
-
|
|
20777
|
+
_context12.n = 7;
|
|
20740
20778
|
break;
|
|
20741
20779
|
}
|
|
20742
20780
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
20743
|
-
|
|
20781
|
+
_context12.n = 9;
|
|
20744
20782
|
break;
|
|
20745
20783
|
case 7:
|
|
20746
20784
|
if (!hasNext) {
|
|
20747
|
-
|
|
20785
|
+
_context12.n = 9;
|
|
20748
20786
|
break;
|
|
20749
20787
|
}
|
|
20750
20788
|
log.info('saga load next from server ... ', messageId);
|
|
20751
20789
|
messageQuery.reverse = false;
|
|
20752
|
-
|
|
20790
|
+
_context12.n = 8;
|
|
20753
20791
|
return effects.call(messageQuery.loadNextMessageId, messageId);
|
|
20754
20792
|
case 8:
|
|
20755
|
-
result =
|
|
20793
|
+
result = _context12.v;
|
|
20756
20794
|
if (result.messages.length) {
|
|
20757
20795
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
20758
20796
|
setMessagesToMap(channelId, result.messages);
|
|
20759
20797
|
}
|
|
20760
|
-
|
|
20798
|
+
_context12.n = 9;
|
|
20761
20799
|
return effects.put(setMessagesHasNextAC(result.hasNext));
|
|
20762
20800
|
case 9:
|
|
20763
|
-
|
|
20801
|
+
_context12.n = 10;
|
|
20764
20802
|
return effects.put(setMessagesHasPrevAC(true));
|
|
20765
20803
|
case 10:
|
|
20766
20804
|
if (!(result.messages && result.messages.length && result.messages.length > 0)) {
|
|
20767
|
-
|
|
20805
|
+
_context12.n = 12;
|
|
20768
20806
|
break;
|
|
20769
20807
|
}
|
|
20770
|
-
|
|
20808
|
+
_context12.n = 11;
|
|
20771
20809
|
return effects.put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
|
|
20772
20810
|
case 11:
|
|
20773
|
-
|
|
20811
|
+
_context12.n = 16;
|
|
20774
20812
|
break;
|
|
20775
20813
|
case 12:
|
|
20776
|
-
|
|
20814
|
+
_context12.n = 13;
|
|
20777
20815
|
return effects.put(addMessagesAC([], direction));
|
|
20778
20816
|
case 13:
|
|
20779
20817
|
if (!(direction === MESSAGE_LOAD_DIRECTION.NEXT)) {
|
|
20780
|
-
|
|
20818
|
+
_context12.n = 15;
|
|
20781
20819
|
break;
|
|
20782
20820
|
}
|
|
20783
|
-
|
|
20821
|
+
_context12.n = 14;
|
|
20784
20822
|
return effects.put(setMessagesHasNextAC(false));
|
|
20785
20823
|
case 14:
|
|
20786
|
-
|
|
20824
|
+
_context12.n = 16;
|
|
20787
20825
|
break;
|
|
20788
20826
|
case 15:
|
|
20789
|
-
|
|
20827
|
+
_context12.n = 16;
|
|
20790
20828
|
return effects.put(setMessagesHasPrevAC(false));
|
|
20791
20829
|
case 16:
|
|
20792
|
-
|
|
20830
|
+
_context12.n = 17;
|
|
20793
20831
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20794
20832
|
case 17:
|
|
20795
|
-
|
|
20833
|
+
_context12.n = 19;
|
|
20796
20834
|
break;
|
|
20797
20835
|
case 18:
|
|
20798
|
-
|
|
20799
|
-
_t23 =
|
|
20836
|
+
_context12.p = 18;
|
|
20837
|
+
_t23 = _context12.v;
|
|
20800
20838
|
log.error('error in load more messages', _t23);
|
|
20801
20839
|
case 19:
|
|
20802
|
-
return
|
|
20840
|
+
return _context12.a(2);
|
|
20803
20841
|
}
|
|
20804
20842
|
}, _marked9$1, null, [[0, 18]]);
|
|
20805
20843
|
}
|
|
20806
20844
|
function addReaction(action) {
|
|
20807
20845
|
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t24;
|
|
20808
|
-
return _regenerator().w(function (
|
|
20809
|
-
while (1) switch (
|
|
20846
|
+
return _regenerator().w(function (_context13) {
|
|
20847
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
20810
20848
|
case 0:
|
|
20811
|
-
|
|
20849
|
+
_context13.p = 0;
|
|
20812
20850
|
payload = action.payload;
|
|
20813
20851
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, score = payload.score, reason = payload.reason, enforceUnique = payload.enforceUnique;
|
|
20814
20852
|
user = getClient().user;
|
|
20815
|
-
|
|
20853
|
+
_context13.n = 1;
|
|
20816
20854
|
return effects.call(getChannelFromMap, channelId);
|
|
20817
20855
|
case 1:
|
|
20818
|
-
channel =
|
|
20856
|
+
channel = _context13.v;
|
|
20819
20857
|
if (!channel) {
|
|
20820
20858
|
channel = getChannelFromAllChannels(channelId);
|
|
20821
20859
|
if (channel) {
|
|
20822
20860
|
setChannelInMap(channel);
|
|
20823
20861
|
}
|
|
20824
20862
|
}
|
|
20825
|
-
|
|
20863
|
+
_context13.n = 2;
|
|
20826
20864
|
return effects.call(channel.addReaction, messageId, key, score, reason, enforceUnique);
|
|
20827
20865
|
case 2:
|
|
20828
|
-
_yield$call =
|
|
20866
|
+
_yield$call = _context13.v;
|
|
20829
20867
|
message = _yield$call.message;
|
|
20830
20868
|
reaction = _yield$call.reaction;
|
|
20831
20869
|
if (!(user.id === message.user.id)) {
|
|
20832
|
-
|
|
20870
|
+
_context13.n = 4;
|
|
20833
20871
|
break;
|
|
20834
20872
|
}
|
|
20835
20873
|
channelUpdateParam = {
|
|
@@ -20837,99 +20875,99 @@ function addReaction(action) {
|
|
|
20837
20875
|
lastReactedMessage: message,
|
|
20838
20876
|
newReactions: [reaction]
|
|
20839
20877
|
};
|
|
20840
|
-
|
|
20878
|
+
_context13.n = 3;
|
|
20841
20879
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
20842
20880
|
case 3:
|
|
20843
20881
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
20844
20882
|
case 4:
|
|
20845
|
-
|
|
20883
|
+
_context13.n = 5;
|
|
20846
20884
|
return effects.put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
20847
20885
|
case 5:
|
|
20848
|
-
|
|
20886
|
+
_context13.n = 6;
|
|
20849
20887
|
return effects.put(addReactionToListAC(reaction));
|
|
20850
20888
|
case 6:
|
|
20851
|
-
|
|
20889
|
+
_context13.n = 7;
|
|
20852
20890
|
return effects.put(addReactionToMessageAC(message, reaction, true));
|
|
20853
20891
|
case 7:
|
|
20854
20892
|
addReactionToMessageOnMap(channelId, message, reaction, true);
|
|
20855
20893
|
addReactionOnAllMessages(message, reaction, true);
|
|
20856
|
-
|
|
20894
|
+
_context13.n = 9;
|
|
20857
20895
|
break;
|
|
20858
20896
|
case 8:
|
|
20859
|
-
|
|
20860
|
-
_t24 =
|
|
20897
|
+
_context13.p = 8;
|
|
20898
|
+
_t24 = _context13.v;
|
|
20861
20899
|
log.error('ERROR in add reaction', _t24.message);
|
|
20862
20900
|
case 9:
|
|
20863
|
-
return
|
|
20901
|
+
return _context13.a(2);
|
|
20864
20902
|
}
|
|
20865
20903
|
}, _marked0$1, null, [[0, 8]]);
|
|
20866
20904
|
}
|
|
20867
20905
|
function deleteReaction(action) {
|
|
20868
20906
|
var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t25;
|
|
20869
|
-
return _regenerator().w(function (
|
|
20870
|
-
while (1) switch (
|
|
20907
|
+
return _regenerator().w(function (_context14) {
|
|
20908
|
+
while (1) switch (_context14.p = _context14.n) {
|
|
20871
20909
|
case 0:
|
|
20872
|
-
|
|
20910
|
+
_context14.p = 0;
|
|
20873
20911
|
payload = action.payload;
|
|
20874
20912
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, isLastReaction = payload.isLastReaction;
|
|
20875
|
-
|
|
20913
|
+
_context14.n = 1;
|
|
20876
20914
|
return effects.call(getChannelFromMap, channelId);
|
|
20877
20915
|
case 1:
|
|
20878
|
-
channel =
|
|
20916
|
+
channel = _context14.v;
|
|
20879
20917
|
if (!channel) {
|
|
20880
20918
|
channel = getChannelFromAllChannels(channelId);
|
|
20881
20919
|
if (channel) {
|
|
20882
20920
|
setChannelInMap(channel);
|
|
20883
20921
|
}
|
|
20884
20922
|
}
|
|
20885
|
-
|
|
20923
|
+
_context14.n = 2;
|
|
20886
20924
|
return effects.call(channel.deleteReaction, messageId, key);
|
|
20887
20925
|
case 2:
|
|
20888
|
-
_yield$call2 =
|
|
20926
|
+
_yield$call2 = _context14.v;
|
|
20889
20927
|
message = _yield$call2.message;
|
|
20890
20928
|
reaction = _yield$call2.reaction;
|
|
20891
20929
|
if (!isLastReaction) {
|
|
20892
|
-
|
|
20930
|
+
_context14.n = 4;
|
|
20893
20931
|
break;
|
|
20894
20932
|
}
|
|
20895
20933
|
channelUpdateParam = {
|
|
20896
20934
|
userMessageReactions: [],
|
|
20897
20935
|
lastReactedMessage: null
|
|
20898
20936
|
};
|
|
20899
|
-
|
|
20937
|
+
_context14.n = 3;
|
|
20900
20938
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
20901
20939
|
case 3:
|
|
20902
20940
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
20903
20941
|
case 4:
|
|
20904
|
-
|
|
20942
|
+
_context14.n = 5;
|
|
20905
20943
|
return effects.put(deleteReactionFromListAC(reaction));
|
|
20906
20944
|
case 5:
|
|
20907
|
-
|
|
20945
|
+
_context14.n = 6;
|
|
20908
20946
|
return effects.put(deleteReactionFromMessageAC(message, reaction, true));
|
|
20909
20947
|
case 6:
|
|
20910
20948
|
removeReactionToMessageOnMap(channelId, message, reaction, true);
|
|
20911
20949
|
removeReactionOnAllMessages(message, reaction, true);
|
|
20912
|
-
|
|
20950
|
+
_context14.n = 8;
|
|
20913
20951
|
break;
|
|
20914
20952
|
case 7:
|
|
20915
|
-
|
|
20916
|
-
_t25 =
|
|
20953
|
+
_context14.p = 7;
|
|
20954
|
+
_t25 = _context14.v;
|
|
20917
20955
|
log.error('ERROR in delete reaction', _t25.message);
|
|
20918
20956
|
case 8:
|
|
20919
|
-
return
|
|
20957
|
+
return _context14.a(2);
|
|
20920
20958
|
}
|
|
20921
20959
|
}, _marked1$1, null, [[0, 7]]);
|
|
20922
20960
|
}
|
|
20923
20961
|
function getReactions(action) {
|
|
20924
20962
|
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t26;
|
|
20925
|
-
return _regenerator().w(function (
|
|
20926
|
-
while (1) switch (
|
|
20963
|
+
return _regenerator().w(function (_context15) {
|
|
20964
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
20927
20965
|
case 0:
|
|
20928
|
-
|
|
20966
|
+
_context15.p = 0;
|
|
20929
20967
|
payload = action.payload;
|
|
20930
20968
|
messageId = payload.messageId, key = payload.key, limit = payload.limit;
|
|
20931
20969
|
SceytChatClient = getClient();
|
|
20932
|
-
|
|
20970
|
+
_context15.n = 1;
|
|
20933
20971
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
20934
20972
|
case 1:
|
|
20935
20973
|
reactionQueryBuilder = new SceytChatClient.ReactionListQueryBuilder(messageId);
|
|
@@ -20937,74 +20975,74 @@ function getReactions(action) {
|
|
|
20937
20975
|
if (key) {
|
|
20938
20976
|
reactionQueryBuilder.setKey(key);
|
|
20939
20977
|
}
|
|
20940
|
-
|
|
20978
|
+
_context15.n = 2;
|
|
20941
20979
|
return effects.call(reactionQueryBuilder.build);
|
|
20942
20980
|
case 2:
|
|
20943
|
-
reactionQuery =
|
|
20944
|
-
|
|
20981
|
+
reactionQuery = _context15.v;
|
|
20982
|
+
_context15.n = 3;
|
|
20945
20983
|
return effects.call(reactionQuery.loadNext);
|
|
20946
20984
|
case 3:
|
|
20947
|
-
result =
|
|
20985
|
+
result = _context15.v;
|
|
20948
20986
|
query.ReactionsQuery = reactionQuery;
|
|
20949
|
-
|
|
20987
|
+
_context15.n = 4;
|
|
20950
20988
|
return effects.put(setReactionsListAC(result.reactions, result.hasNext));
|
|
20951
20989
|
case 4:
|
|
20952
|
-
|
|
20990
|
+
_context15.n = 5;
|
|
20953
20991
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
20954
20992
|
case 5:
|
|
20955
|
-
|
|
20993
|
+
_context15.n = 7;
|
|
20956
20994
|
break;
|
|
20957
20995
|
case 6:
|
|
20958
|
-
|
|
20959
|
-
_t26 =
|
|
20996
|
+
_context15.p = 6;
|
|
20997
|
+
_t26 = _context15.v;
|
|
20960
20998
|
log.error('ERROR in get reactions', _t26.message);
|
|
20961
20999
|
case 7:
|
|
20962
|
-
return
|
|
21000
|
+
return _context15.a(2);
|
|
20963
21001
|
}
|
|
20964
21002
|
}, _marked10$1, null, [[0, 6]]);
|
|
20965
21003
|
}
|
|
20966
21004
|
function loadMoreReactions(action) {
|
|
20967
21005
|
var payload, limit, ReactionQuery, result, _t27;
|
|
20968
|
-
return _regenerator().w(function (
|
|
20969
|
-
while (1) switch (
|
|
21006
|
+
return _regenerator().w(function (_context16) {
|
|
21007
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
20970
21008
|
case 0:
|
|
20971
|
-
|
|
21009
|
+
_context16.p = 0;
|
|
20972
21010
|
payload = action.payload;
|
|
20973
21011
|
limit = payload.limit;
|
|
20974
|
-
|
|
21012
|
+
_context16.n = 1;
|
|
20975
21013
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
20976
21014
|
case 1:
|
|
20977
21015
|
ReactionQuery = query.ReactionsQuery;
|
|
20978
21016
|
if (limit) {
|
|
20979
21017
|
ReactionQuery.limit = limit;
|
|
20980
21018
|
}
|
|
20981
|
-
|
|
21019
|
+
_context16.n = 2;
|
|
20982
21020
|
return effects.call(ReactionQuery.loadNext);
|
|
20983
21021
|
case 2:
|
|
20984
|
-
result =
|
|
20985
|
-
|
|
21022
|
+
result = _context16.v;
|
|
21023
|
+
_context16.n = 3;
|
|
20986
21024
|
return effects.put(addReactionsToListAC(result.reactions, result.hasNext));
|
|
20987
21025
|
case 3:
|
|
20988
|
-
|
|
21026
|
+
_context16.n = 4;
|
|
20989
21027
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
20990
21028
|
case 4:
|
|
20991
|
-
|
|
21029
|
+
_context16.n = 6;
|
|
20992
21030
|
break;
|
|
20993
21031
|
case 5:
|
|
20994
|
-
|
|
20995
|
-
_t27 =
|
|
21032
|
+
_context16.p = 5;
|
|
21033
|
+
_t27 = _context16.v;
|
|
20996
21034
|
log.error('ERROR in load more reactions', _t27.message);
|
|
20997
21035
|
case 6:
|
|
20998
|
-
return
|
|
21036
|
+
return _context16.a(2);
|
|
20999
21037
|
}
|
|
21000
21038
|
}, _marked11$1, null, [[0, 5]]);
|
|
21001
21039
|
}
|
|
21002
21040
|
function getMessageAttachments(action) {
|
|
21003
21041
|
var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t28;
|
|
21004
|
-
return _regenerator().w(function (
|
|
21005
|
-
while (1) switch (
|
|
21042
|
+
return _regenerator().w(function (_context17) {
|
|
21043
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
21006
21044
|
case 0:
|
|
21007
|
-
|
|
21045
|
+
_context17.p = 0;
|
|
21008
21046
|
_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;
|
|
21009
21047
|
SceytChatClient = getClient();
|
|
21010
21048
|
typeList = [attachmentTypes.video, attachmentTypes.image, attachmentTypes.file, attachmentTypes.link, attachmentTypes.voice];
|
|
@@ -21019,244 +21057,244 @@ function getMessageAttachments(action) {
|
|
|
21019
21057
|
}
|
|
21020
21058
|
AttachmentByTypeQueryBuilder = new SceytChatClient.AttachmentListQueryBuilder(channelId, typeList);
|
|
21021
21059
|
AttachmentByTypeQueryBuilder.limit(limit || 34);
|
|
21022
|
-
|
|
21060
|
+
_context17.n = 1;
|
|
21023
21061
|
return effects.call(AttachmentByTypeQueryBuilder.build);
|
|
21024
21062
|
case 1:
|
|
21025
|
-
AttachmentByTypeQuery =
|
|
21063
|
+
AttachmentByTypeQuery = _context17.v;
|
|
21026
21064
|
if (forPopup) {
|
|
21027
21065
|
AttachmentByTypeQuery.reverse = true;
|
|
21028
21066
|
}
|
|
21029
21067
|
if (!(direction === queryDirection.NEXT)) {
|
|
21030
|
-
|
|
21068
|
+
_context17.n = 3;
|
|
21031
21069
|
break;
|
|
21032
21070
|
}
|
|
21033
|
-
|
|
21071
|
+
_context17.n = 2;
|
|
21034
21072
|
return effects.call(AttachmentByTypeQuery.loadPrevious);
|
|
21035
21073
|
case 2:
|
|
21036
|
-
result =
|
|
21037
|
-
|
|
21074
|
+
result = _context17.v;
|
|
21075
|
+
_context17.n = 7;
|
|
21038
21076
|
break;
|
|
21039
21077
|
case 3:
|
|
21040
21078
|
if (!(direction === queryDirection.NEAR)) {
|
|
21041
|
-
|
|
21079
|
+
_context17.n = 5;
|
|
21042
21080
|
break;
|
|
21043
21081
|
}
|
|
21044
|
-
|
|
21082
|
+
_context17.n = 4;
|
|
21045
21083
|
return effects.call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
|
|
21046
21084
|
case 4:
|
|
21047
|
-
result =
|
|
21048
|
-
|
|
21085
|
+
result = _context17.v;
|
|
21086
|
+
_context17.n = 7;
|
|
21049
21087
|
break;
|
|
21050
21088
|
case 5:
|
|
21051
|
-
|
|
21089
|
+
_context17.n = 6;
|
|
21052
21090
|
return effects.call(AttachmentByTypeQuery.loadPrevious);
|
|
21053
21091
|
case 6:
|
|
21054
|
-
result =
|
|
21092
|
+
result = _context17.v;
|
|
21055
21093
|
case 7:
|
|
21056
21094
|
if (!forPopup) {
|
|
21057
|
-
|
|
21095
|
+
_context17.n = 10;
|
|
21058
21096
|
break;
|
|
21059
21097
|
}
|
|
21060
21098
|
query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
|
|
21061
|
-
|
|
21099
|
+
_context17.n = 8;
|
|
21062
21100
|
return effects.put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
21063
21101
|
case 8:
|
|
21064
|
-
|
|
21102
|
+
_context17.n = 9;
|
|
21065
21103
|
return effects.put(setAttachmentsCompleteForPopupAC(result.hasNext));
|
|
21066
21104
|
case 9:
|
|
21067
|
-
|
|
21105
|
+
_context17.n = 12;
|
|
21068
21106
|
break;
|
|
21069
21107
|
case 10:
|
|
21070
21108
|
query.AttachmentByTypeQuery = AttachmentByTypeQuery;
|
|
21071
|
-
|
|
21109
|
+
_context17.n = 11;
|
|
21072
21110
|
return effects.put(setAttachmentsCompleteAC(result.hasNext));
|
|
21073
21111
|
case 11:
|
|
21074
|
-
|
|
21112
|
+
_context17.n = 12;
|
|
21075
21113
|
return effects.put(setAttachmentsAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
21076
21114
|
case 12:
|
|
21077
|
-
|
|
21115
|
+
_context17.n = 14;
|
|
21078
21116
|
break;
|
|
21079
21117
|
case 13:
|
|
21080
|
-
|
|
21081
|
-
_t28 =
|
|
21118
|
+
_context17.p = 13;
|
|
21119
|
+
_t28 = _context17.v;
|
|
21082
21120
|
log.error('error in message attachment query', _t28);
|
|
21083
21121
|
case 14:
|
|
21084
|
-
return
|
|
21122
|
+
return _context17.a(2);
|
|
21085
21123
|
}
|
|
21086
21124
|
}, _marked12$1, null, [[0, 13]]);
|
|
21087
21125
|
}
|
|
21088
21126
|
function loadMoreMessageAttachments(action) {
|
|
21089
21127
|
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t29;
|
|
21090
|
-
return _regenerator().w(function (
|
|
21091
|
-
while (1) switch (
|
|
21128
|
+
return _regenerator().w(function (_context18) {
|
|
21129
|
+
while (1) switch (_context18.p = _context18.n) {
|
|
21092
21130
|
case 0:
|
|
21093
|
-
|
|
21131
|
+
_context18.p = 0;
|
|
21094
21132
|
_action$payload3 = action.payload, limit = _action$payload3.limit, direction = _action$payload3.direction, forPopup = _action$payload3.forPopup;
|
|
21095
21133
|
if (forPopup) {
|
|
21096
21134
|
AttachmentQuery = query.AttachmentByTypeQueryForPopup;
|
|
21097
21135
|
} else {
|
|
21098
21136
|
AttachmentQuery = query.AttachmentByTypeQuery;
|
|
21099
21137
|
}
|
|
21100
|
-
|
|
21138
|
+
_context18.n = 1;
|
|
21101
21139
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
21102
21140
|
case 1:
|
|
21103
21141
|
AttachmentQuery.limit = limit;
|
|
21104
|
-
|
|
21142
|
+
_context18.n = 2;
|
|
21105
21143
|
return effects.call(AttachmentQuery.loadPrevious);
|
|
21106
21144
|
case 2:
|
|
21107
|
-
_yield$call3 =
|
|
21145
|
+
_yield$call3 = _context18.v;
|
|
21108
21146
|
attachments = _yield$call3.attachments;
|
|
21109
21147
|
hasNext = _yield$call3.hasNext;
|
|
21110
21148
|
if (!forPopup) {
|
|
21111
|
-
|
|
21149
|
+
_context18.n = 4;
|
|
21112
21150
|
break;
|
|
21113
21151
|
}
|
|
21114
|
-
|
|
21152
|
+
_context18.n = 3;
|
|
21115
21153
|
return effects.put(addAttachmentsForPopupAC(attachments, direction));
|
|
21116
21154
|
case 3:
|
|
21117
|
-
|
|
21155
|
+
_context18.n = 7;
|
|
21118
21156
|
break;
|
|
21119
21157
|
case 4:
|
|
21120
|
-
|
|
21158
|
+
_context18.n = 5;
|
|
21121
21159
|
return effects.put(setAttachmentsCompleteAC(hasNext));
|
|
21122
21160
|
case 5:
|
|
21123
|
-
|
|
21161
|
+
_context18.n = 6;
|
|
21124
21162
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
21125
21163
|
case 6:
|
|
21126
|
-
|
|
21164
|
+
_context18.n = 7;
|
|
21127
21165
|
return effects.put(addAttachmentsAC(attachments));
|
|
21128
21166
|
case 7:
|
|
21129
|
-
|
|
21167
|
+
_context18.n = 9;
|
|
21130
21168
|
break;
|
|
21131
21169
|
case 8:
|
|
21132
|
-
|
|
21133
|
-
_t29 =
|
|
21170
|
+
_context18.p = 8;
|
|
21171
|
+
_t29 = _context18.v;
|
|
21134
21172
|
log.error('error in message attachment query', _t29);
|
|
21135
21173
|
case 9:
|
|
21136
|
-
return
|
|
21174
|
+
return _context18.a(2);
|
|
21137
21175
|
}
|
|
21138
21176
|
}, _marked13$1, null, [[0, 8]]);
|
|
21139
21177
|
}
|
|
21140
21178
|
function pauseAttachmentUploading(action) {
|
|
21141
21179
|
var attachmentId, isPaused, _t30;
|
|
21142
|
-
return _regenerator().w(function (
|
|
21143
|
-
while (1) switch (
|
|
21180
|
+
return _regenerator().w(function (_context19) {
|
|
21181
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
21144
21182
|
case 0:
|
|
21145
|
-
|
|
21183
|
+
_context19.p = 0;
|
|
21146
21184
|
attachmentId = action.payload.attachmentId;
|
|
21147
21185
|
if (!getCustomUploader()) {
|
|
21148
|
-
|
|
21186
|
+
_context19.n = 1;
|
|
21149
21187
|
break;
|
|
21150
21188
|
}
|
|
21151
21189
|
isPaused = pauseUpload(attachmentId);
|
|
21152
21190
|
if (!isPaused) {
|
|
21153
|
-
|
|
21191
|
+
_context19.n = 1;
|
|
21154
21192
|
break;
|
|
21155
21193
|
}
|
|
21156
|
-
|
|
21194
|
+
_context19.n = 1;
|
|
21157
21195
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.PAUSED, attachmentId));
|
|
21158
21196
|
case 1:
|
|
21159
|
-
|
|
21197
|
+
_context19.n = 3;
|
|
21160
21198
|
break;
|
|
21161
21199
|
case 2:
|
|
21162
|
-
|
|
21163
|
-
_t30 =
|
|
21200
|
+
_context19.p = 2;
|
|
21201
|
+
_t30 = _context19.v;
|
|
21164
21202
|
log.error('error in pause attachment uploading', _t30);
|
|
21165
21203
|
case 3:
|
|
21166
|
-
return
|
|
21204
|
+
return _context19.a(2);
|
|
21167
21205
|
}
|
|
21168
21206
|
}, _marked14$1, null, [[0, 2]]);
|
|
21169
21207
|
}
|
|
21170
21208
|
function resumeAttachmentUploading(action) {
|
|
21171
21209
|
var attachmentId, isResumed, _t31;
|
|
21172
|
-
return _regenerator().w(function (
|
|
21173
|
-
while (1) switch (
|
|
21210
|
+
return _regenerator().w(function (_context20) {
|
|
21211
|
+
while (1) switch (_context20.p = _context20.n) {
|
|
21174
21212
|
case 0:
|
|
21175
|
-
|
|
21213
|
+
_context20.p = 0;
|
|
21176
21214
|
attachmentId = action.payload.attachmentId;
|
|
21177
21215
|
log.info('resume for attachment ... ', attachmentId);
|
|
21178
21216
|
if (!getCustomUploader()) {
|
|
21179
|
-
|
|
21217
|
+
_context20.n = 1;
|
|
21180
21218
|
break;
|
|
21181
21219
|
}
|
|
21182
21220
|
isResumed = resumeUpload(attachmentId);
|
|
21183
21221
|
if (!isResumed) {
|
|
21184
|
-
|
|
21222
|
+
_context20.n = 1;
|
|
21185
21223
|
break;
|
|
21186
21224
|
}
|
|
21187
|
-
|
|
21225
|
+
_context20.n = 1;
|
|
21188
21226
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
|
|
21189
21227
|
case 1:
|
|
21190
|
-
|
|
21228
|
+
_context20.n = 3;
|
|
21191
21229
|
break;
|
|
21192
21230
|
case 2:
|
|
21193
|
-
|
|
21194
|
-
_t31 =
|
|
21231
|
+
_context20.p = 2;
|
|
21232
|
+
_t31 = _context20.v;
|
|
21195
21233
|
log.error('error in resume attachment uploading', _t31);
|
|
21196
21234
|
case 3:
|
|
21197
|
-
return
|
|
21235
|
+
return _context20.a(2);
|
|
21198
21236
|
}
|
|
21199
21237
|
}, _marked15$1, null, [[0, 2]]);
|
|
21200
21238
|
}
|
|
21201
21239
|
function getMessageMarkers(action) {
|
|
21202
21240
|
var _action$payload4, messageId, channelId, deliveryStatus, sceytChatClient, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkers, _t32;
|
|
21203
|
-
return _regenerator().w(function (
|
|
21204
|
-
while (1) switch (
|
|
21241
|
+
return _regenerator().w(function (_context21) {
|
|
21242
|
+
while (1) switch (_context21.p = _context21.n) {
|
|
21205
21243
|
case 0:
|
|
21206
|
-
|
|
21207
|
-
|
|
21244
|
+
_context21.p = 0;
|
|
21245
|
+
_context21.n = 1;
|
|
21208
21246
|
return effects.put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADING));
|
|
21209
21247
|
case 1:
|
|
21210
21248
|
_action$payload4 = action.payload, messageId = _action$payload4.messageId, channelId = _action$payload4.channelId, deliveryStatus = _action$payload4.deliveryStatus;
|
|
21211
21249
|
sceytChatClient = getClient();
|
|
21212
21250
|
if (!sceytChatClient) {
|
|
21213
|
-
|
|
21251
|
+
_context21.n = 4;
|
|
21214
21252
|
break;
|
|
21215
21253
|
}
|
|
21216
21254
|
messageMarkerListQueryBuilder = new sceytChatClient.MessageMarkerListQueryBuilder(channelId, String(messageId), deliveryStatus);
|
|
21217
|
-
|
|
21255
|
+
_context21.n = 2;
|
|
21218
21256
|
return effects.call(messageMarkerListQueryBuilder.build);
|
|
21219
21257
|
case 2:
|
|
21220
|
-
messageMarkerListQuery =
|
|
21221
|
-
|
|
21258
|
+
messageMarkerListQuery = _context21.v;
|
|
21259
|
+
_context21.n = 3;
|
|
21222
21260
|
return effects.call(messageMarkerListQuery.loadNext);
|
|
21223
21261
|
case 3:
|
|
21224
|
-
messageMarkers =
|
|
21225
|
-
|
|
21262
|
+
messageMarkers = _context21.v;
|
|
21263
|
+
_context21.n = 4;
|
|
21226
21264
|
return effects.put(setMessageMarkersAC(channelId, messageId, messageMarkers.markers, deliveryStatus));
|
|
21227
21265
|
case 4:
|
|
21228
|
-
|
|
21266
|
+
_context21.n = 6;
|
|
21229
21267
|
break;
|
|
21230
21268
|
case 5:
|
|
21231
|
-
|
|
21232
|
-
_t32 =
|
|
21269
|
+
_context21.p = 5;
|
|
21270
|
+
_t32 = _context21.v;
|
|
21233
21271
|
log.error('error in get message markers', _t32);
|
|
21234
21272
|
case 6:
|
|
21235
|
-
|
|
21236
|
-
|
|
21273
|
+
_context21.p = 6;
|
|
21274
|
+
_context21.n = 7;
|
|
21237
21275
|
return effects.put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADED));
|
|
21238
21276
|
case 7:
|
|
21239
|
-
return
|
|
21277
|
+
return _context21.f(6);
|
|
21240
21278
|
case 8:
|
|
21241
|
-
return
|
|
21279
|
+
return _context21.a(2);
|
|
21242
21280
|
}
|
|
21243
21281
|
}, _marked16$1, null, [[0, 5, 6, 8]]);
|
|
21244
21282
|
}
|
|
21245
21283
|
function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
21246
21284
|
var _user$presence, _message$pollDetails, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4;
|
|
21247
21285
|
var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7, _iterator2, _step2, obj;
|
|
21248
|
-
return _regenerator().w(function (
|
|
21249
|
-
while (1) switch (
|
|
21286
|
+
return _regenerator().w(function (_context22) {
|
|
21287
|
+
while (1) switch (_context22.n) {
|
|
21250
21288
|
case 0:
|
|
21251
|
-
|
|
21289
|
+
_context22.n = 1;
|
|
21252
21290
|
return effects.call(getChannelFromMap, channelId);
|
|
21253
21291
|
case 1:
|
|
21254
|
-
channel =
|
|
21292
|
+
channel = _context22.v;
|
|
21255
21293
|
if (message.pollDetails) {
|
|
21256
|
-
|
|
21294
|
+
_context22.n = 2;
|
|
21257
21295
|
break;
|
|
21258
21296
|
}
|
|
21259
|
-
return
|
|
21297
|
+
return _context22.a(2);
|
|
21260
21298
|
case 2:
|
|
21261
21299
|
user = getClient().user;
|
|
21262
21300
|
vote = {
|
|
@@ -21294,13 +21332,13 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21294
21332
|
incrementVotesPerOptionCount: 1
|
|
21295
21333
|
});
|
|
21296
21334
|
if (isResend) {
|
|
21297
|
-
|
|
21335
|
+
_context22.n = 5;
|
|
21298
21336
|
break;
|
|
21299
21337
|
}
|
|
21300
21338
|
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21301
21339
|
case 3:
|
|
21302
21340
|
if ((_step2 = _iterator2()).done) {
|
|
21303
|
-
|
|
21341
|
+
_context22.n = 5;
|
|
21304
21342
|
break;
|
|
21305
21343
|
}
|
|
21306
21344
|
obj = _step2.value;
|
|
@@ -21309,46 +21347,46 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21309
21347
|
params: {}
|
|
21310
21348
|
}, obj);
|
|
21311
21349
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21312
|
-
|
|
21350
|
+
_context22.n = 4;
|
|
21313
21351
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21314
21352
|
case 4:
|
|
21315
|
-
|
|
21353
|
+
_context22.n = 3;
|
|
21316
21354
|
break;
|
|
21317
21355
|
case 5:
|
|
21318
21356
|
if (!channel) {
|
|
21319
|
-
|
|
21357
|
+
_context22.n = 7;
|
|
21320
21358
|
break;
|
|
21321
21359
|
}
|
|
21322
|
-
|
|
21360
|
+
_context22.n = 6;
|
|
21323
21361
|
return effects.call(channel.addVote, message.id, pollId, [optionId]);
|
|
21324
21362
|
case 6:
|
|
21325
|
-
|
|
21363
|
+
_context22.n = 7;
|
|
21326
21364
|
return effects.put(removePendingPollActionAC(message.id, 'ADD_POLL_VOTE', optionId));
|
|
21327
21365
|
case 7:
|
|
21328
|
-
return
|
|
21366
|
+
return _context22.a(2);
|
|
21329
21367
|
}
|
|
21330
21368
|
}, _marked17$1);
|
|
21331
21369
|
}
|
|
21332
21370
|
function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
21333
21371
|
var channel, obj;
|
|
21334
|
-
return _regenerator().w(function (
|
|
21335
|
-
while (1) switch (
|
|
21372
|
+
return _regenerator().w(function (_context23) {
|
|
21373
|
+
while (1) switch (_context23.n) {
|
|
21336
21374
|
case 0:
|
|
21337
|
-
|
|
21375
|
+
_context23.n = 1;
|
|
21338
21376
|
return effects.call(getChannelFromMap, channelId);
|
|
21339
21377
|
case 1:
|
|
21340
|
-
channel =
|
|
21378
|
+
channel = _context23.v;
|
|
21341
21379
|
if (channel) {
|
|
21342
|
-
|
|
21380
|
+
_context23.n = 2;
|
|
21343
21381
|
break;
|
|
21344
21382
|
}
|
|
21345
|
-
return
|
|
21383
|
+
return _context23.a(2);
|
|
21346
21384
|
case 2:
|
|
21347
21385
|
if (message.pollDetails) {
|
|
21348
|
-
|
|
21386
|
+
_context23.n = 3;
|
|
21349
21387
|
break;
|
|
21350
21388
|
}
|
|
21351
|
-
return
|
|
21389
|
+
return _context23.a(2);
|
|
21352
21390
|
case 3:
|
|
21353
21391
|
obj = {
|
|
21354
21392
|
type: 'addOwn',
|
|
@@ -21360,24 +21398,24 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
|
21360
21398
|
params: {}
|
|
21361
21399
|
}, obj);
|
|
21362
21400
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21363
|
-
|
|
21401
|
+
_context23.n = 4;
|
|
21364
21402
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21365
21403
|
case 4:
|
|
21366
|
-
return
|
|
21404
|
+
return _context23.a(2);
|
|
21367
21405
|
}
|
|
21368
21406
|
}, _marked18$1);
|
|
21369
21407
|
}
|
|
21370
21408
|
function addPollVote(action) {
|
|
21371
21409
|
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;
|
|
21372
|
-
return _regenerator().w(function (
|
|
21373
|
-
while (1) switch (
|
|
21410
|
+
return _regenerator().w(function (_context24) {
|
|
21411
|
+
while (1) switch (_context24.p = _context24.n) {
|
|
21374
21412
|
case 0:
|
|
21375
|
-
|
|
21413
|
+
_context24.p = 0;
|
|
21376
21414
|
payload = action.payload;
|
|
21377
21415
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21378
21416
|
sceytChatClient = getClient();
|
|
21379
21417
|
if (!sceytChatClient) {
|
|
21380
|
-
|
|
21418
|
+
_context24.n = 7;
|
|
21381
21419
|
break;
|
|
21382
21420
|
}
|
|
21383
21421
|
connectionState = sceytChatClient.connectionState;
|
|
@@ -21404,7 +21442,7 @@ function addPollVote(action) {
|
|
|
21404
21442
|
}
|
|
21405
21443
|
};
|
|
21406
21444
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21407
|
-
|
|
21445
|
+
_context24.n = 6;
|
|
21408
21446
|
break;
|
|
21409
21447
|
}
|
|
21410
21448
|
pendingAction = {
|
|
@@ -21416,22 +21454,22 @@ function addPollVote(action) {
|
|
|
21416
21454
|
};
|
|
21417
21455
|
conflictCheck = checkPendingPollActionConflict(pendingAction);
|
|
21418
21456
|
if (!(conflictCheck.hasConflict && !conflictCheck.shouldSkip)) {
|
|
21419
|
-
|
|
21457
|
+
_context24.n = 4;
|
|
21420
21458
|
break;
|
|
21421
21459
|
}
|
|
21422
|
-
|
|
21460
|
+
_context24.n = 1;
|
|
21423
21461
|
return effects.call(getChannelFromMap, channelId);
|
|
21424
21462
|
case 1:
|
|
21425
|
-
channel =
|
|
21463
|
+
channel = _context24.v;
|
|
21426
21464
|
if (!channel) {
|
|
21427
|
-
|
|
21465
|
+
_context24.n = 3;
|
|
21428
21466
|
break;
|
|
21429
21467
|
}
|
|
21430
21468
|
currentMessage = ((_Object$values2 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.find(function (msg) {
|
|
21431
21469
|
return msg.id === message.id || msg.tid === message.id;
|
|
21432
21470
|
})) || message;
|
|
21433
21471
|
hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[pollId]) || false;
|
|
21434
|
-
|
|
21472
|
+
_context24.n = 2;
|
|
21435
21473
|
return effects.put(addPollVotesToListAC(pollId, optionId, [(_currentMessage$pollD = currentMessage.pollDetails) === null || _currentMessage$pollD === void 0 ? void 0 : (_currentMessage$pollD2 = _currentMessage$pollD.voteDetails) === null || _currentMessage$pollD2 === void 0 ? void 0 : (_currentMessage$pollD3 = _currentMessage$pollD2.ownVotes) === null || _currentMessage$pollD3 === void 0 ? void 0 : _currentMessage$pollD3[0]], hasNext, message.id));
|
|
21436
21474
|
case 2:
|
|
21437
21475
|
obj = {
|
|
@@ -21444,60 +21482,60 @@ function addPollVote(action) {
|
|
|
21444
21482
|
params: {}
|
|
21445
21483
|
}, obj);
|
|
21446
21484
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21447
|
-
|
|
21485
|
+
_context24.n = 3;
|
|
21448
21486
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21449
21487
|
case 3:
|
|
21450
|
-
|
|
21488
|
+
_context24.n = 5;
|
|
21451
21489
|
break;
|
|
21452
21490
|
case 4:
|
|
21453
21491
|
if (conflictCheck.shouldSkip) {
|
|
21454
|
-
|
|
21492
|
+
_context24.n = 5;
|
|
21455
21493
|
break;
|
|
21456
21494
|
}
|
|
21457
|
-
return
|
|
21495
|
+
return _context24.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
|
|
21458
21496
|
case 5:
|
|
21459
21497
|
if (!conflictCheck.shouldSkip) {
|
|
21460
21498
|
setPendingPollAction(pendingAction);
|
|
21461
21499
|
}
|
|
21462
|
-
return
|
|
21500
|
+
return _context24.a(2);
|
|
21463
21501
|
case 6:
|
|
21464
|
-
return
|
|
21502
|
+
return _context24.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message, isResend)), 7);
|
|
21465
21503
|
case 7:
|
|
21466
|
-
|
|
21504
|
+
_context24.n = 9;
|
|
21467
21505
|
break;
|
|
21468
21506
|
case 8:
|
|
21469
|
-
|
|
21470
|
-
_t33 =
|
|
21507
|
+
_context24.p = 8;
|
|
21508
|
+
_t33 = _context24.v;
|
|
21471
21509
|
log.error('error in add poll vote', _t33);
|
|
21472
21510
|
case 9:
|
|
21473
|
-
return
|
|
21511
|
+
return _context24.a(2);
|
|
21474
21512
|
}
|
|
21475
21513
|
}, _marked19$1, null, [[0, 8]]);
|
|
21476
21514
|
}
|
|
21477
21515
|
function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
21478
21516
|
var _message$pollDetails8, _message$pollDetails9, _message$pollDetails0;
|
|
21479
21517
|
var channel, vote, obj;
|
|
21480
|
-
return _regenerator().w(function (
|
|
21481
|
-
while (1) switch (
|
|
21518
|
+
return _regenerator().w(function (_context25) {
|
|
21519
|
+
while (1) switch (_context25.n) {
|
|
21482
21520
|
case 0:
|
|
21483
|
-
|
|
21521
|
+
_context25.n = 1;
|
|
21484
21522
|
return effects.call(getChannelFromMap, channelId);
|
|
21485
21523
|
case 1:
|
|
21486
|
-
channel =
|
|
21524
|
+
channel = _context25.v;
|
|
21487
21525
|
if (message.pollDetails) {
|
|
21488
|
-
|
|
21526
|
+
_context25.n = 2;
|
|
21489
21527
|
break;
|
|
21490
21528
|
}
|
|
21491
|
-
return
|
|
21529
|
+
return _context25.a(2);
|
|
21492
21530
|
case 2:
|
|
21493
21531
|
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) {
|
|
21494
21532
|
return vote.optionId === optionId;
|
|
21495
21533
|
});
|
|
21496
21534
|
if (vote) {
|
|
21497
|
-
|
|
21535
|
+
_context25.n = 3;
|
|
21498
21536
|
break;
|
|
21499
21537
|
}
|
|
21500
|
-
return
|
|
21538
|
+
return _context25.a(2);
|
|
21501
21539
|
case 3:
|
|
21502
21540
|
obj = {
|
|
21503
21541
|
type: 'deleteOwn',
|
|
@@ -21505,7 +21543,7 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21505
21543
|
incrementVotesPerOptionCount: -1
|
|
21506
21544
|
};
|
|
21507
21545
|
if (isResend) {
|
|
21508
|
-
|
|
21546
|
+
_context25.n = 4;
|
|
21509
21547
|
break;
|
|
21510
21548
|
}
|
|
21511
21549
|
updateMessageOnMap(channel.id, {
|
|
@@ -21513,43 +21551,43 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
|
|
|
21513
21551
|
params: {}
|
|
21514
21552
|
}, obj);
|
|
21515
21553
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21516
|
-
|
|
21554
|
+
_context25.n = 4;
|
|
21517
21555
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21518
21556
|
case 4:
|
|
21519
21557
|
if (!channel) {
|
|
21520
|
-
|
|
21558
|
+
_context25.n = 6;
|
|
21521
21559
|
break;
|
|
21522
21560
|
}
|
|
21523
|
-
|
|
21561
|
+
_context25.n = 5;
|
|
21524
21562
|
return effects.call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
21525
21563
|
case 5:
|
|
21526
|
-
|
|
21564
|
+
_context25.n = 6;
|
|
21527
21565
|
return effects.put(removePendingPollActionAC(message.id, 'DELETE_POLL_VOTE', optionId));
|
|
21528
21566
|
case 6:
|
|
21529
|
-
return
|
|
21567
|
+
return _context25.a(2);
|
|
21530
21568
|
}
|
|
21531
21569
|
}, _marked20$1);
|
|
21532
21570
|
}
|
|
21533
21571
|
function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote) {
|
|
21534
21572
|
var channel, obj;
|
|
21535
|
-
return _regenerator().w(function (
|
|
21536
|
-
while (1) switch (
|
|
21573
|
+
return _regenerator().w(function (_context26) {
|
|
21574
|
+
while (1) switch (_context26.n) {
|
|
21537
21575
|
case 0:
|
|
21538
|
-
|
|
21576
|
+
_context26.n = 1;
|
|
21539
21577
|
return effects.call(getChannelFromMap, channelId);
|
|
21540
21578
|
case 1:
|
|
21541
|
-
channel =
|
|
21579
|
+
channel = _context26.v;
|
|
21542
21580
|
if (channel) {
|
|
21543
|
-
|
|
21581
|
+
_context26.n = 2;
|
|
21544
21582
|
break;
|
|
21545
21583
|
}
|
|
21546
|
-
return
|
|
21584
|
+
return _context26.a(2);
|
|
21547
21585
|
case 2:
|
|
21548
21586
|
if (message.pollDetails) {
|
|
21549
|
-
|
|
21587
|
+
_context26.n = 3;
|
|
21550
21588
|
break;
|
|
21551
21589
|
}
|
|
21552
|
-
return
|
|
21590
|
+
return _context26.a(2);
|
|
21553
21591
|
case 3:
|
|
21554
21592
|
obj = {
|
|
21555
21593
|
type: 'deleteOwn',
|
|
@@ -21561,24 +21599,24 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
|
|
|
21561
21599
|
params: {}
|
|
21562
21600
|
}, obj);
|
|
21563
21601
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21564
|
-
|
|
21602
|
+
_context26.n = 4;
|
|
21565
21603
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21566
21604
|
case 4:
|
|
21567
|
-
return
|
|
21605
|
+
return _context26.a(2);
|
|
21568
21606
|
}
|
|
21569
21607
|
}, _marked21$1);
|
|
21570
21608
|
}
|
|
21571
21609
|
function deletePollVote(action) {
|
|
21572
21610
|
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;
|
|
21573
|
-
return _regenerator().w(function (
|
|
21574
|
-
while (1) switch (
|
|
21611
|
+
return _regenerator().w(function (_context27) {
|
|
21612
|
+
while (1) switch (_context27.p = _context27.n) {
|
|
21575
21613
|
case 0:
|
|
21576
|
-
|
|
21614
|
+
_context27.p = 0;
|
|
21577
21615
|
payload = action.payload;
|
|
21578
21616
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
|
|
21579
21617
|
sceytChatClient = getClient();
|
|
21580
21618
|
if (!sceytChatClient) {
|
|
21581
|
-
|
|
21619
|
+
_context27.n = 8;
|
|
21582
21620
|
break;
|
|
21583
21621
|
}
|
|
21584
21622
|
connectionState = sceytChatClient.connectionState;
|
|
@@ -21586,13 +21624,13 @@ function deletePollVote(action) {
|
|
|
21586
21624
|
return vote.optionId === optionId;
|
|
21587
21625
|
});
|
|
21588
21626
|
if (vote) {
|
|
21589
|
-
|
|
21627
|
+
_context27.n = 1;
|
|
21590
21628
|
break;
|
|
21591
21629
|
}
|
|
21592
|
-
return
|
|
21630
|
+
return _context27.a(2);
|
|
21593
21631
|
case 1:
|
|
21594
21632
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21595
|
-
|
|
21633
|
+
_context27.n = 7;
|
|
21596
21634
|
break;
|
|
21597
21635
|
}
|
|
21598
21636
|
pendingAction = {
|
|
@@ -21604,21 +21642,21 @@ function deletePollVote(action) {
|
|
|
21604
21642
|
};
|
|
21605
21643
|
conflictCheck = checkPendingPollActionConflict(pendingAction);
|
|
21606
21644
|
if (!(conflictCheck.hasConflict && conflictCheck.shouldSkip)) {
|
|
21607
|
-
|
|
21645
|
+
_context27.n = 5;
|
|
21608
21646
|
break;
|
|
21609
21647
|
}
|
|
21610
|
-
|
|
21648
|
+
_context27.n = 2;
|
|
21611
21649
|
return effects.call(getChannelFromMap, channelId);
|
|
21612
21650
|
case 2:
|
|
21613
|
-
channel =
|
|
21651
|
+
channel = _context27.v;
|
|
21614
21652
|
if (!channel) {
|
|
21615
|
-
|
|
21653
|
+
_context27.n = 4;
|
|
21616
21654
|
break;
|
|
21617
21655
|
}
|
|
21618
21656
|
currentMessage = ((_Object$values3 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.find(function (msg) {
|
|
21619
21657
|
return msg.id === message.id || msg.tid === message.id;
|
|
21620
21658
|
})) || message;
|
|
21621
|
-
|
|
21659
|
+
_context27.n = 3;
|
|
21622
21660
|
return effects.put(deletePollVotesFromListAC(pollId, optionId, [(_currentMessage$pollD4 = currentMessage.pollDetails) === null || _currentMessage$pollD4 === void 0 ? void 0 : (_currentMessage$pollD5 = _currentMessage$pollD4.voteDetails) === null || _currentMessage$pollD5 === void 0 ? void 0 : (_currentMessage$pollD6 = _currentMessage$pollD5.ownVotes) === null || _currentMessage$pollD6 === void 0 ? void 0 : _currentMessage$pollD6[0]], message.id));
|
|
21623
21661
|
case 3:
|
|
21624
21662
|
obj = {
|
|
@@ -21631,45 +21669,45 @@ function deletePollVote(action) {
|
|
|
21631
21669
|
params: {}
|
|
21632
21670
|
}, obj);
|
|
21633
21671
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21634
|
-
|
|
21672
|
+
_context27.n = 4;
|
|
21635
21673
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21636
21674
|
case 4:
|
|
21637
|
-
|
|
21675
|
+
_context27.n = 6;
|
|
21638
21676
|
break;
|
|
21639
21677
|
case 5:
|
|
21640
21678
|
if (conflictCheck.shouldSkip) {
|
|
21641
|
-
|
|
21679
|
+
_context27.n = 6;
|
|
21642
21680
|
break;
|
|
21643
21681
|
}
|
|
21644
|
-
return
|
|
21682
|
+
return _context27.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
|
|
21645
21683
|
case 6:
|
|
21646
21684
|
if (!conflictCheck.shouldSkip) {
|
|
21647
21685
|
setPendingPollAction(pendingAction);
|
|
21648
21686
|
}
|
|
21649
|
-
return
|
|
21687
|
+
return _context27.a(2);
|
|
21650
21688
|
case 7:
|
|
21651
|
-
return
|
|
21689
|
+
return _context27.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message, isResend)), 8);
|
|
21652
21690
|
case 8:
|
|
21653
|
-
|
|
21691
|
+
_context27.n = 10;
|
|
21654
21692
|
break;
|
|
21655
21693
|
case 9:
|
|
21656
|
-
|
|
21657
|
-
_t34 =
|
|
21694
|
+
_context27.p = 9;
|
|
21695
|
+
_t34 = _context27.v;
|
|
21658
21696
|
log.error('error in delete poll vote', _t34);
|
|
21659
21697
|
case 10:
|
|
21660
|
-
return
|
|
21698
|
+
return _context27.a(2);
|
|
21661
21699
|
}
|
|
21662
21700
|
}, _marked22$1, null, [[0, 9]]);
|
|
21663
21701
|
}
|
|
21664
21702
|
function executeClosePoll(channelId, pollId, message) {
|
|
21665
21703
|
var channel, obj;
|
|
21666
|
-
return _regenerator().w(function (
|
|
21667
|
-
while (1) switch (
|
|
21704
|
+
return _regenerator().w(function (_context28) {
|
|
21705
|
+
while (1) switch (_context28.n) {
|
|
21668
21706
|
case 0:
|
|
21669
|
-
|
|
21707
|
+
_context28.n = 1;
|
|
21670
21708
|
return effects.call(getChannelFromMap, channelId);
|
|
21671
21709
|
case 1:
|
|
21672
|
-
channel =
|
|
21710
|
+
channel = _context28.v;
|
|
21673
21711
|
obj = {
|
|
21674
21712
|
type: 'close',
|
|
21675
21713
|
incrementVotesPerOptionCount: 0
|
|
@@ -21679,37 +21717,37 @@ function executeClosePoll(channelId, pollId, message) {
|
|
|
21679
21717
|
params: {}
|
|
21680
21718
|
}, obj);
|
|
21681
21719
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21682
|
-
|
|
21720
|
+
_context28.n = 2;
|
|
21683
21721
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21684
21722
|
case 2:
|
|
21685
21723
|
if (!channel) {
|
|
21686
|
-
|
|
21724
|
+
_context28.n = 4;
|
|
21687
21725
|
break;
|
|
21688
21726
|
}
|
|
21689
|
-
|
|
21727
|
+
_context28.n = 3;
|
|
21690
21728
|
return effects.call(channel.closePoll, message.id, pollId);
|
|
21691
21729
|
case 3:
|
|
21692
|
-
|
|
21730
|
+
_context28.n = 4;
|
|
21693
21731
|
return effects.put(removePendingPollActionAC(message.id, 'CLOSE_POLL'));
|
|
21694
21732
|
case 4:
|
|
21695
|
-
return
|
|
21733
|
+
return _context28.a(2);
|
|
21696
21734
|
}
|
|
21697
21735
|
}, _marked23$1);
|
|
21698
21736
|
}
|
|
21699
21737
|
function updateMessageOptimisticallyForClosePoll(channelId, message) {
|
|
21700
21738
|
var channel, pollDetails;
|
|
21701
|
-
return _regenerator().w(function (
|
|
21702
|
-
while (1) switch (
|
|
21739
|
+
return _regenerator().w(function (_context29) {
|
|
21740
|
+
while (1) switch (_context29.n) {
|
|
21703
21741
|
case 0:
|
|
21704
|
-
|
|
21742
|
+
_context29.n = 1;
|
|
21705
21743
|
return effects.call(getChannelFromMap, channelId);
|
|
21706
21744
|
case 1:
|
|
21707
|
-
channel =
|
|
21745
|
+
channel = _context29.v;
|
|
21708
21746
|
if (channel) {
|
|
21709
|
-
|
|
21747
|
+
_context29.n = 2;
|
|
21710
21748
|
break;
|
|
21711
21749
|
}
|
|
21712
|
-
return
|
|
21750
|
+
return _context29.a(2);
|
|
21713
21751
|
case 2:
|
|
21714
21752
|
pollDetails = JSON.parse(JSON.stringify(message.pollDetails));
|
|
21715
21753
|
pollDetails.closed = true;
|
|
@@ -21723,34 +21761,34 @@ function updateMessageOptimisticallyForClosePoll(channelId, message) {
|
|
|
21723
21761
|
updateMessageOnAllMessages(message.id, {
|
|
21724
21762
|
pollDetails: pollDetails
|
|
21725
21763
|
});
|
|
21726
|
-
|
|
21764
|
+
_context29.n = 3;
|
|
21727
21765
|
return effects.put(updateMessageAC(message.id, {
|
|
21728
21766
|
pollDetails: pollDetails
|
|
21729
21767
|
}));
|
|
21730
21768
|
case 3:
|
|
21731
|
-
return
|
|
21769
|
+
return _context29.a(2);
|
|
21732
21770
|
}
|
|
21733
21771
|
}, _marked24$1);
|
|
21734
21772
|
}
|
|
21735
21773
|
function closePoll(action) {
|
|
21736
21774
|
var payload, channelId, pollId, message, sceytChatClient, connectionState, _t35;
|
|
21737
|
-
return _regenerator().w(function (
|
|
21738
|
-
while (1) switch (
|
|
21775
|
+
return _regenerator().w(function (_context30) {
|
|
21776
|
+
while (1) switch (_context30.p = _context30.n) {
|
|
21739
21777
|
case 0:
|
|
21740
|
-
|
|
21778
|
+
_context30.p = 0;
|
|
21741
21779
|
payload = action.payload;
|
|
21742
21780
|
channelId = payload.channelId, pollId = payload.pollId, message = payload.message;
|
|
21743
21781
|
sceytChatClient = getClient();
|
|
21744
21782
|
if (!sceytChatClient) {
|
|
21745
|
-
|
|
21783
|
+
_context30.n = 3;
|
|
21746
21784
|
break;
|
|
21747
21785
|
}
|
|
21748
21786
|
connectionState = sceytChatClient.connectionState;
|
|
21749
21787
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21750
|
-
|
|
21788
|
+
_context30.n = 2;
|
|
21751
21789
|
break;
|
|
21752
21790
|
}
|
|
21753
|
-
return
|
|
21791
|
+
return _context30.d(_regeneratorValues(updateMessageOptimisticallyForClosePoll(channelId, message)), 1);
|
|
21754
21792
|
case 1:
|
|
21755
21793
|
setPendingPollAction({
|
|
21756
21794
|
type: 'CLOSE_POLL',
|
|
@@ -21758,38 +21796,38 @@ function closePoll(action) {
|
|
|
21758
21796
|
pollId: pollId,
|
|
21759
21797
|
message: message
|
|
21760
21798
|
});
|
|
21761
|
-
return
|
|
21799
|
+
return _context30.a(2);
|
|
21762
21800
|
case 2:
|
|
21763
|
-
return
|
|
21801
|
+
return _context30.d(_regeneratorValues(executeClosePoll(channelId, pollId, message)), 3);
|
|
21764
21802
|
case 3:
|
|
21765
|
-
|
|
21803
|
+
_context30.n = 5;
|
|
21766
21804
|
break;
|
|
21767
21805
|
case 4:
|
|
21768
|
-
|
|
21769
|
-
_t35 =
|
|
21806
|
+
_context30.p = 4;
|
|
21807
|
+
_t35 = _context30.v;
|
|
21770
21808
|
log.error('error in close poll', _t35);
|
|
21771
21809
|
case 5:
|
|
21772
|
-
return
|
|
21810
|
+
return _context30.a(2);
|
|
21773
21811
|
}
|
|
21774
21812
|
}, _marked25$1, null, [[0, 4]]);
|
|
21775
21813
|
}
|
|
21776
21814
|
function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
21777
21815
|
var channel, _iterator3, _step3, obj;
|
|
21778
|
-
return _regenerator().w(function (
|
|
21779
|
-
while (1) switch (
|
|
21816
|
+
return _regenerator().w(function (_context31) {
|
|
21817
|
+
while (1) switch (_context31.n) {
|
|
21780
21818
|
case 0:
|
|
21781
|
-
|
|
21819
|
+
_context31.n = 1;
|
|
21782
21820
|
return effects.call(getChannelFromMap, channelId);
|
|
21783
21821
|
case 1:
|
|
21784
|
-
channel =
|
|
21822
|
+
channel = _context31.v;
|
|
21785
21823
|
if (isResend) {
|
|
21786
|
-
|
|
21824
|
+
_context31.n = 4;
|
|
21787
21825
|
break;
|
|
21788
21826
|
}
|
|
21789
21827
|
_iterator3 = _createForOfIteratorHelperLoose(objs);
|
|
21790
21828
|
case 2:
|
|
21791
21829
|
if ((_step3 = _iterator3()).done) {
|
|
21792
|
-
|
|
21830
|
+
_context31.n = 4;
|
|
21793
21831
|
break;
|
|
21794
21832
|
}
|
|
21795
21833
|
obj = _step3.value;
|
|
@@ -21798,45 +21836,45 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
21798
21836
|
params: {}
|
|
21799
21837
|
}, obj);
|
|
21800
21838
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21801
|
-
|
|
21839
|
+
_context31.n = 3;
|
|
21802
21840
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21803
21841
|
case 3:
|
|
21804
|
-
|
|
21842
|
+
_context31.n = 2;
|
|
21805
21843
|
break;
|
|
21806
21844
|
case 4:
|
|
21807
21845
|
if (!channel) {
|
|
21808
|
-
|
|
21846
|
+
_context31.n = 6;
|
|
21809
21847
|
break;
|
|
21810
21848
|
}
|
|
21811
|
-
|
|
21849
|
+
_context31.n = 5;
|
|
21812
21850
|
return effects.call(channel.retractVote, message.id, pollId);
|
|
21813
21851
|
case 5:
|
|
21814
|
-
|
|
21852
|
+
_context31.n = 6;
|
|
21815
21853
|
return effects.put(removePendingPollActionAC(message.id || '', 'RETRACT_POLL_VOTE'));
|
|
21816
21854
|
case 6:
|
|
21817
|
-
return
|
|
21855
|
+
return _context31.a(2);
|
|
21818
21856
|
}
|
|
21819
21857
|
}, _marked26$1);
|
|
21820
21858
|
}
|
|
21821
21859
|
function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
|
|
21822
21860
|
var channel, _iterator4, _step4, obj;
|
|
21823
|
-
return _regenerator().w(function (
|
|
21824
|
-
while (1) switch (
|
|
21861
|
+
return _regenerator().w(function (_context32) {
|
|
21862
|
+
while (1) switch (_context32.n) {
|
|
21825
21863
|
case 0:
|
|
21826
|
-
|
|
21864
|
+
_context32.n = 1;
|
|
21827
21865
|
return effects.call(getChannelFromMap, channelId);
|
|
21828
21866
|
case 1:
|
|
21829
|
-
channel =
|
|
21867
|
+
channel = _context32.v;
|
|
21830
21868
|
if (channel) {
|
|
21831
|
-
|
|
21869
|
+
_context32.n = 2;
|
|
21832
21870
|
break;
|
|
21833
21871
|
}
|
|
21834
|
-
return
|
|
21872
|
+
return _context32.a(2);
|
|
21835
21873
|
case 2:
|
|
21836
21874
|
_iterator4 = _createForOfIteratorHelperLoose(objs);
|
|
21837
21875
|
case 3:
|
|
21838
21876
|
if ((_step4 = _iterator4()).done) {
|
|
21839
|
-
|
|
21877
|
+
_context32.n = 5;
|
|
21840
21878
|
break;
|
|
21841
21879
|
}
|
|
21842
21880
|
obj = _step4.value;
|
|
@@ -21845,27 +21883,27 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
21845
21883
|
params: {}
|
|
21846
21884
|
});
|
|
21847
21885
|
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21848
|
-
|
|
21886
|
+
_context32.n = 4;
|
|
21849
21887
|
return effects.put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21850
21888
|
case 4:
|
|
21851
|
-
|
|
21889
|
+
_context32.n = 3;
|
|
21852
21890
|
break;
|
|
21853
21891
|
case 5:
|
|
21854
|
-
return
|
|
21892
|
+
return _context32.a(2);
|
|
21855
21893
|
}
|
|
21856
21894
|
}, _marked27$1);
|
|
21857
21895
|
}
|
|
21858
21896
|
function retractPollVote(action) {
|
|
21859
21897
|
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator5, _step5, _message$pollDetails12, _message$pollDetails13, vote, _t36;
|
|
21860
|
-
return _regenerator().w(function (
|
|
21861
|
-
while (1) switch (
|
|
21898
|
+
return _regenerator().w(function (_context33) {
|
|
21899
|
+
while (1) switch (_context33.p = _context33.n) {
|
|
21862
21900
|
case 0:
|
|
21863
|
-
|
|
21901
|
+
_context33.p = 0;
|
|
21864
21902
|
payload = action.payload;
|
|
21865
21903
|
channelId = payload.channelId, pollId = payload.pollId, message = payload.message, isResend = payload.isResend;
|
|
21866
21904
|
sceytChatClient = getClient();
|
|
21867
21905
|
if (!sceytChatClient) {
|
|
21868
|
-
|
|
21906
|
+
_context33.n = 3;
|
|
21869
21907
|
break;
|
|
21870
21908
|
}
|
|
21871
21909
|
connectionState = sceytChatClient.connectionState;
|
|
@@ -21879,10 +21917,10 @@ function retractPollVote(action) {
|
|
|
21879
21917
|
});
|
|
21880
21918
|
}
|
|
21881
21919
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21882
|
-
|
|
21920
|
+
_context33.n = 2;
|
|
21883
21921
|
break;
|
|
21884
21922
|
}
|
|
21885
|
-
return
|
|
21923
|
+
return _context33.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)), 1);
|
|
21886
21924
|
case 1:
|
|
21887
21925
|
setPendingPollAction({
|
|
21888
21926
|
type: 'RETRACT_POLL_VOTE',
|
|
@@ -21890,39 +21928,39 @@ function retractPollVote(action) {
|
|
|
21890
21928
|
pollId: pollId,
|
|
21891
21929
|
message: message
|
|
21892
21930
|
});
|
|
21893
|
-
return
|
|
21931
|
+
return _context33.a(2);
|
|
21894
21932
|
case 2:
|
|
21895
|
-
return
|
|
21933
|
+
return _context33.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, message, objs, isResend)), 3);
|
|
21896
21934
|
case 3:
|
|
21897
|
-
|
|
21935
|
+
_context33.n = 5;
|
|
21898
21936
|
break;
|
|
21899
21937
|
case 4:
|
|
21900
|
-
|
|
21901
|
-
_t36 =
|
|
21938
|
+
_context33.p = 4;
|
|
21939
|
+
_t36 = _context33.v;
|
|
21902
21940
|
log.error('error in retract poll vote', _t36);
|
|
21903
21941
|
case 5:
|
|
21904
|
-
return
|
|
21942
|
+
return _context33.a(2);
|
|
21905
21943
|
}
|
|
21906
21944
|
}, _marked28$1, null, [[0, 4]]);
|
|
21907
21945
|
}
|
|
21908
21946
|
function resendPendingPollActions(action) {
|
|
21909
21947
|
var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t37;
|
|
21910
|
-
return _regenerator().w(function (
|
|
21911
|
-
while (1) switch (
|
|
21948
|
+
return _regenerator().w(function (_context34) {
|
|
21949
|
+
while (1) switch (_context34.p = _context34.n) {
|
|
21912
21950
|
case 0:
|
|
21913
|
-
|
|
21951
|
+
_context34.p = 0;
|
|
21914
21952
|
payload = action.payload;
|
|
21915
21953
|
connectionState = payload.connectionState;
|
|
21916
21954
|
sceytChatClient = getClient();
|
|
21917
21955
|
if (!(!sceytChatClient || connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21918
|
-
|
|
21956
|
+
_context34.n = 1;
|
|
21919
21957
|
break;
|
|
21920
21958
|
}
|
|
21921
|
-
return
|
|
21959
|
+
return _context34.a(2);
|
|
21922
21960
|
case 1:
|
|
21923
21961
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
21924
21962
|
pendingPollActionsMapCopy = JSON.parse(JSON.stringify(pendingPollActionsMap));
|
|
21925
|
-
|
|
21963
|
+
_context34.n = 2;
|
|
21926
21964
|
return effects.call(function () {
|
|
21927
21965
|
return new Promise(function (resolve) {
|
|
21928
21966
|
return setTimeout(resolve, 1000);
|
|
@@ -21958,32 +21996,32 @@ function resendPendingPollActions(action) {
|
|
|
21958
21996
|
}
|
|
21959
21997
|
});
|
|
21960
21998
|
});
|
|
21961
|
-
|
|
21999
|
+
_context34.n = 4;
|
|
21962
22000
|
break;
|
|
21963
22001
|
case 3:
|
|
21964
|
-
|
|
21965
|
-
_t37 =
|
|
22002
|
+
_context34.p = 3;
|
|
22003
|
+
_t37 = _context34.v;
|
|
21966
22004
|
log.error('error in resend pending poll actions', _t37);
|
|
21967
22005
|
case 4:
|
|
21968
|
-
return
|
|
22006
|
+
return _context34.a(2);
|
|
21969
22007
|
}
|
|
21970
22008
|
}, _marked29$1, null, [[0, 3]]);
|
|
21971
22009
|
}
|
|
21972
22010
|
function getPollVotes(action) {
|
|
21973
22011
|
var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes, _t38;
|
|
21974
|
-
return _regenerator().w(function (
|
|
21975
|
-
while (1) switch (
|
|
22012
|
+
return _regenerator().w(function (_context35) {
|
|
22013
|
+
while (1) switch (_context35.p = _context35.n) {
|
|
21976
22014
|
case 0:
|
|
21977
|
-
|
|
22015
|
+
_context35.p = 0;
|
|
21978
22016
|
payload = action.payload;
|
|
21979
22017
|
messageId = payload.messageId, pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
|
|
21980
22018
|
key = pollId + "_" + optionId;
|
|
21981
|
-
|
|
22019
|
+
_context35.n = 1;
|
|
21982
22020
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
|
|
21983
22021
|
case 1:
|
|
21984
22022
|
SceytChatClient = getClient();
|
|
21985
22023
|
if (!(!SceytChatClient || !SceytChatClient.PollVotesQueryBuilder)) {
|
|
21986
|
-
|
|
22024
|
+
_context35.n = 2;
|
|
21987
22025
|
break;
|
|
21988
22026
|
}
|
|
21989
22027
|
throw new Error('SceytChatClient or PollVotesQueryBuilder not available');
|
|
@@ -21991,14 +22029,14 @@ function getPollVotes(action) {
|
|
|
21991
22029
|
queryBuilder = new SceytChatClient.PollVotesQueryBuilder(messageId, pollId);
|
|
21992
22030
|
queryBuilder.setOptionId(optionId);
|
|
21993
22031
|
queryBuilder.limit(limit || 20);
|
|
21994
|
-
|
|
22032
|
+
_context35.n = 3;
|
|
21995
22033
|
return effects.call(queryBuilder.build);
|
|
21996
22034
|
case 3:
|
|
21997
|
-
pollVotesQuery =
|
|
21998
|
-
|
|
22035
|
+
pollVotesQuery = _context35.v;
|
|
22036
|
+
_context35.n = 4;
|
|
21999
22037
|
return effects.call(pollVotesQuery.loadNext);
|
|
22000
22038
|
case 4:
|
|
22001
|
-
result =
|
|
22039
|
+
result = _context35.v;
|
|
22002
22040
|
if (!query.PollVotesQueries) {
|
|
22003
22041
|
query.PollVotesQueries = {};
|
|
22004
22042
|
}
|
|
@@ -22026,39 +22064,39 @@ function getPollVotes(action) {
|
|
|
22026
22064
|
}
|
|
22027
22065
|
};
|
|
22028
22066
|
});
|
|
22029
|
-
|
|
22067
|
+
_context35.n = 5;
|
|
22030
22068
|
return effects.put(setPollVotesListAC(pollId, optionId, formattedVotes, result.hasNext || false));
|
|
22031
22069
|
case 5:
|
|
22032
|
-
|
|
22070
|
+
_context35.n = 6;
|
|
22033
22071
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
|
|
22034
22072
|
case 6:
|
|
22035
|
-
|
|
22073
|
+
_context35.n = 8;
|
|
22036
22074
|
break;
|
|
22037
22075
|
case 7:
|
|
22038
|
-
|
|
22039
|
-
_t38 =
|
|
22076
|
+
_context35.p = 7;
|
|
22077
|
+
_t38 = _context35.v;
|
|
22040
22078
|
log.error('ERROR in get poll votes', _t38);
|
|
22041
|
-
|
|
22079
|
+
_context35.n = 8;
|
|
22042
22080
|
return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
|
|
22043
22081
|
case 8:
|
|
22044
|
-
return
|
|
22082
|
+
return _context35.a(2);
|
|
22045
22083
|
}
|
|
22046
22084
|
}, _marked30$1, null, [[0, 7]]);
|
|
22047
22085
|
}
|
|
22048
22086
|
function loadMorePollVotes(action) {
|
|
22049
22087
|
var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes, _t39;
|
|
22050
|
-
return _regenerator().w(function (
|
|
22051
|
-
while (1) switch (
|
|
22088
|
+
return _regenerator().w(function (_context36) {
|
|
22089
|
+
while (1) switch (_context36.p = _context36.n) {
|
|
22052
22090
|
case 0:
|
|
22053
|
-
|
|
22091
|
+
_context36.p = 0;
|
|
22054
22092
|
payload = action.payload;
|
|
22055
22093
|
pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
|
|
22056
22094
|
key = pollId + "_" + optionId;
|
|
22057
|
-
|
|
22095
|
+
_context36.n = 1;
|
|
22058
22096
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
|
|
22059
22097
|
case 1:
|
|
22060
22098
|
if (!(!query.PollVotesQueries || !query.PollVotesQueries[key])) {
|
|
22061
|
-
|
|
22099
|
+
_context36.n = 2;
|
|
22062
22100
|
break;
|
|
22063
22101
|
}
|
|
22064
22102
|
throw new Error('Poll votes query not found');
|
|
@@ -22067,10 +22105,10 @@ function loadMorePollVotes(action) {
|
|
|
22067
22105
|
if (limit && pollVotesQuery.limit < limit) {
|
|
22068
22106
|
pollVotesQuery.limit = limit;
|
|
22069
22107
|
}
|
|
22070
|
-
|
|
22108
|
+
_context36.n = 3;
|
|
22071
22109
|
return effects.call(pollVotesQuery.loadNext);
|
|
22072
22110
|
case 3:
|
|
22073
|
-
result =
|
|
22111
|
+
result = _context36.v;
|
|
22074
22112
|
formattedVotes = (result.votes || []).map(function (vote) {
|
|
22075
22113
|
return {
|
|
22076
22114
|
optionId: vote.optionId || optionId,
|
|
@@ -22094,105 +22132,105 @@ function loadMorePollVotes(action) {
|
|
|
22094
22132
|
}
|
|
22095
22133
|
};
|
|
22096
22134
|
});
|
|
22097
|
-
|
|
22135
|
+
_context36.n = 4;
|
|
22098
22136
|
return effects.put(addPollVotesToListAC(pollId, optionId, formattedVotes, result.hasNext || false));
|
|
22099
22137
|
case 4:
|
|
22100
|
-
|
|
22138
|
+
_context36.n = 5;
|
|
22101
22139
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
|
|
22102
22140
|
case 5:
|
|
22103
|
-
|
|
22141
|
+
_context36.n = 7;
|
|
22104
22142
|
break;
|
|
22105
22143
|
case 6:
|
|
22106
|
-
|
|
22107
|
-
_t39 =
|
|
22144
|
+
_context36.p = 6;
|
|
22145
|
+
_t39 = _context36.v;
|
|
22108
22146
|
log.error('ERROR in load more poll votes', _t39);
|
|
22109
|
-
|
|
22147
|
+
_context36.n = 7;
|
|
22110
22148
|
return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
|
|
22111
22149
|
case 7:
|
|
22112
|
-
return
|
|
22150
|
+
return _context36.a(2);
|
|
22113
22151
|
}
|
|
22114
22152
|
}, _marked31$1, null, [[0, 6]]);
|
|
22115
22153
|
}
|
|
22116
22154
|
function MessageSaga() {
|
|
22117
|
-
return _regenerator().w(function (
|
|
22118
|
-
while (1) switch (
|
|
22155
|
+
return _regenerator().w(function (_context37) {
|
|
22156
|
+
while (1) switch (_context37.n) {
|
|
22119
22157
|
case 0:
|
|
22120
|
-
|
|
22158
|
+
_context37.n = 1;
|
|
22121
22159
|
return effects.takeEvery(SEND_MESSAGE, sendMessage);
|
|
22122
22160
|
case 1:
|
|
22123
|
-
|
|
22161
|
+
_context37.n = 2;
|
|
22124
22162
|
return effects.takeEvery(SEND_TEXT_MESSAGE, sendTextMessage);
|
|
22125
22163
|
case 2:
|
|
22126
|
-
|
|
22164
|
+
_context37.n = 3;
|
|
22127
22165
|
return effects.takeEvery(FORWARD_MESSAGE, forwardMessage);
|
|
22128
22166
|
case 3:
|
|
22129
|
-
|
|
22167
|
+
_context37.n = 4;
|
|
22130
22168
|
return effects.takeEvery(RESEND_MESSAGE, resendMessage);
|
|
22131
22169
|
case 4:
|
|
22132
|
-
|
|
22170
|
+
_context37.n = 5;
|
|
22133
22171
|
return effects.takeLatest(EDIT_MESSAGE, editMessage);
|
|
22134
22172
|
case 5:
|
|
22135
|
-
|
|
22173
|
+
_context37.n = 6;
|
|
22136
22174
|
return effects.takeEvery(DELETE_MESSAGE, deleteMessage);
|
|
22137
22175
|
case 6:
|
|
22138
|
-
|
|
22176
|
+
_context37.n = 7;
|
|
22139
22177
|
return effects.takeLatest(GET_MESSAGES, getMessagesQuery);
|
|
22140
22178
|
case 7:
|
|
22141
|
-
|
|
22179
|
+
_context37.n = 8;
|
|
22142
22180
|
return effects.takeEvery(GET_MESSAGE, getMessageQuery);
|
|
22143
22181
|
case 8:
|
|
22144
|
-
|
|
22182
|
+
_context37.n = 9;
|
|
22145
22183
|
return effects.takeLatest(GET_MESSAGE_MARKERS, getMessageMarkers);
|
|
22146
22184
|
case 9:
|
|
22147
|
-
|
|
22185
|
+
_context37.n = 10;
|
|
22148
22186
|
return effects.takeLatest(GET_MESSAGES_ATTACHMENTS, getMessageAttachments);
|
|
22149
22187
|
case 10:
|
|
22150
|
-
|
|
22188
|
+
_context37.n = 11;
|
|
22151
22189
|
return effects.takeLatest(LOAD_MORE_MESSAGES_ATTACHMENTS, loadMoreMessageAttachments);
|
|
22152
22190
|
case 11:
|
|
22153
|
-
|
|
22191
|
+
_context37.n = 12;
|
|
22154
22192
|
return effects.takeLatest(ADD_REACTION, addReaction);
|
|
22155
22193
|
case 12:
|
|
22156
|
-
|
|
22194
|
+
_context37.n = 13;
|
|
22157
22195
|
return effects.takeLatest(DELETE_REACTION, deleteReaction);
|
|
22158
22196
|
case 13:
|
|
22159
|
-
|
|
22197
|
+
_context37.n = 14;
|
|
22160
22198
|
return effects.takeEvery(LOAD_MORE_MESSAGES, loadMoreMessages);
|
|
22161
22199
|
case 14:
|
|
22162
|
-
|
|
22200
|
+
_context37.n = 15;
|
|
22163
22201
|
return effects.takeEvery(GET_REACTIONS, getReactions);
|
|
22164
22202
|
case 15:
|
|
22165
|
-
|
|
22203
|
+
_context37.n = 16;
|
|
22166
22204
|
return effects.takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
|
|
22167
22205
|
case 16:
|
|
22168
|
-
|
|
22206
|
+
_context37.n = 17;
|
|
22169
22207
|
return effects.takeEvery(PAUSE_ATTACHMENT_UPLOADING, pauseAttachmentUploading);
|
|
22170
22208
|
case 17:
|
|
22171
|
-
|
|
22209
|
+
_context37.n = 18;
|
|
22172
22210
|
return effects.takeEvery(RESUME_ATTACHMENT_UPLOADING, resumeAttachmentUploading);
|
|
22173
22211
|
case 18:
|
|
22174
|
-
|
|
22212
|
+
_context37.n = 19;
|
|
22175
22213
|
return effects.takeEvery(ADD_POLL_VOTE, addPollVote);
|
|
22176
22214
|
case 19:
|
|
22177
|
-
|
|
22215
|
+
_context37.n = 20;
|
|
22178
22216
|
return effects.takeEvery(DELETE_POLL_VOTE, deletePollVote);
|
|
22179
22217
|
case 20:
|
|
22180
|
-
|
|
22218
|
+
_context37.n = 21;
|
|
22181
22219
|
return effects.takeEvery(CLOSE_POLL, closePoll);
|
|
22182
22220
|
case 21:
|
|
22183
|
-
|
|
22221
|
+
_context37.n = 22;
|
|
22184
22222
|
return effects.takeEvery(RETRACT_POLL_VOTE, retractPollVote);
|
|
22185
22223
|
case 22:
|
|
22186
|
-
|
|
22224
|
+
_context37.n = 23;
|
|
22187
22225
|
return effects.takeEvery(GET_POLL_VOTES, getPollVotes);
|
|
22188
22226
|
case 23:
|
|
22189
|
-
|
|
22227
|
+
_context37.n = 24;
|
|
22190
22228
|
return effects.takeEvery(LOAD_MORE_POLL_VOTES, loadMorePollVotes);
|
|
22191
22229
|
case 24:
|
|
22192
|
-
|
|
22230
|
+
_context37.n = 25;
|
|
22193
22231
|
return effects.takeEvery(RESEND_PENDING_POLL_ACTIONS, resendPendingPollActions);
|
|
22194
22232
|
case 25:
|
|
22195
|
-
return
|
|
22233
|
+
return _context37.a(2);
|
|
22196
22234
|
}
|
|
22197
22235
|
}, _marked32$1);
|
|
22198
22236
|
}
|
|
@@ -32773,45 +32811,44 @@ var AudioVisualization = function AudioVisualization(_ref) {
|
|
|
32773
32811
|
return Math.max(2, normalized);
|
|
32774
32812
|
});
|
|
32775
32813
|
}, [tmb, height]);
|
|
32776
|
-
var
|
|
32777
|
-
var
|
|
32778
|
-
|
|
32779
|
-
var barIndex = Math.floor(progressPercentage / 100 * normalizedBars.length);
|
|
32780
|
-
return Math.min(barIndex, normalizedBars.length - 1);
|
|
32781
|
-
}, [progressPercentage, normalizedBars.length]);
|
|
32814
|
+
var exactIndex = duration > 0 ? currentTime / duration * normalizedBars.length : 0;
|
|
32815
|
+
var floorIndex = Math.floor(exactIndex);
|
|
32816
|
+
var fractionalPart = exactIndex - floorIndex;
|
|
32782
32817
|
return /*#__PURE__*/React__default.createElement(Container$e, {
|
|
32783
32818
|
height: height
|
|
32784
32819
|
}, normalizedBars.map(function (barHeight, index) {
|
|
32785
|
-
var
|
|
32786
|
-
var
|
|
32787
|
-
var isLastPlayed = index === lastPlayedBarIndex;
|
|
32788
|
-
var finalHeight = isLastPlayed ? Math.min(barHeight * 1.3, height) : barHeight;
|
|
32820
|
+
var progressRatio = index < floorIndex ? 1 : index === floorIndex ? fractionalPart : 0;
|
|
32821
|
+
var barOpacity = progressRatio > 0 ? 0.8 + progressRatio * 0.2 : 0.8;
|
|
32789
32822
|
return /*#__PURE__*/React__default.createElement(Bar, {
|
|
32790
32823
|
key: index,
|
|
32791
|
-
height:
|
|
32824
|
+
height: barHeight,
|
|
32792
32825
|
width: barWidth,
|
|
32793
32826
|
gap: barGap,
|
|
32794
32827
|
radius: barRadius,
|
|
32795
|
-
|
|
32796
|
-
|
|
32828
|
+
waveColor: waveColor,
|
|
32829
|
+
progressColor: progressColor,
|
|
32830
|
+
progressRatio: progressRatio,
|
|
32831
|
+
barOpacity: barOpacity
|
|
32797
32832
|
});
|
|
32798
32833
|
}));
|
|
32799
32834
|
};
|
|
32800
32835
|
var Container$e = styled__default.div(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: ", "px;\n width: 100%;\n gap: 2px;\n"])), function (props) {
|
|
32801
32836
|
return props.height;
|
|
32802
32837
|
});
|
|
32803
|
-
var Bar = styled__default.div(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n
|
|
32838
|
+
var Bar = styled__default.div(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n position: relative;\n width: ", "px;\n height: ", "px;\n border-radius: ", "px;\n min-height: 2px;\n overflow: hidden;\n background-color: ", ";\n opacity: ", ";\n\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: ", "%;\n height: 100%;\n background-color: ", ";\n border-radius: inherit;\n will-change: width;\n transform: translateZ(0);\n }\n"])), function (props) {
|
|
32804
32839
|
return props.width;
|
|
32805
32840
|
}, function (props) {
|
|
32806
32841
|
return props.height;
|
|
32807
|
-
}, function (props) {
|
|
32808
|
-
return props.color;
|
|
32809
32842
|
}, function (props) {
|
|
32810
32843
|
return props.radius;
|
|
32811
32844
|
}, function (props) {
|
|
32812
|
-
return props.
|
|
32845
|
+
return props.waveColor;
|
|
32846
|
+
}, function (props) {
|
|
32847
|
+
return props.barOpacity;
|
|
32813
32848
|
}, function (props) {
|
|
32814
|
-
return props.
|
|
32849
|
+
return props.progressRatio * 100;
|
|
32850
|
+
}, function (props) {
|
|
32851
|
+
return props.progressColor;
|
|
32815
32852
|
});
|
|
32816
32853
|
|
|
32817
32854
|
var _templateObject$w, _templateObject2$s, _templateObject3$m, _templateObject4$i, _templateObject5$f, _templateObject6$d, _templateObject7$c;
|
|
@@ -33066,7 +33103,7 @@ var AudioVisualizationPlaceholder = styled__default.div(_templateObject4$i || (_
|
|
|
33066
33103
|
}, function (props) {
|
|
33067
33104
|
return props.hidden ? 'none' : 'auto';
|
|
33068
33105
|
});
|
|
33069
|
-
var AudioRate = styled__default.div(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n width: 30px;\n min-width: 30px;\n border-radius: 12px;\n font-weight: 600;\n font-size: 12px;\n line-height: 14px;\n color: ", ";\n height: 18px;\n box-sizing: border-box;\n margin-left:
|
|
33106
|
+
var AudioRate = styled__default.div(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n width: 30px;\n min-width: 30px;\n border-radius: 12px;\n font-weight: 600;\n font-size: 12px;\n line-height: 14px;\n color: ", ";\n height: 18px;\n box-sizing: border-box;\n margin-left: auto;\n cursor: pointer;\n\n & > span {\n margin-top: auto;\n line-height: 16px;\n font-size: 9px;\n }\n"])), function (props) {
|
|
33070
33107
|
return props.backgroundColor;
|
|
33071
33108
|
}, function (props) {
|
|
33072
33109
|
return props.color;
|
|
@@ -44355,9 +44392,7 @@ function DisappearingMessagesPopup(_ref) {
|
|
|
44355
44392
|
}, [selectedOption, customValue]);
|
|
44356
44393
|
var isValueUnchanged = React.useMemo(function () {
|
|
44357
44394
|
if (initialRender) return true;
|
|
44358
|
-
if (
|
|
44359
|
-
return true;
|
|
44360
|
-
} else if (selectedTimerValue * 1000 === currentTimer) {
|
|
44395
|
+
if ((selectedTimerValue || 0) * 1000 === (currentTimer || 0)) {
|
|
44361
44396
|
return true;
|
|
44362
44397
|
}
|
|
44363
44398
|
return false;
|