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