sceyt-chat-react-uikit 1.7.7-beta.2 → 1.7.7-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +172 -91
- package/index.modern.js +172 -91
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8999,7 +8999,8 @@ var handleVoteDetails = function handleVoteDetails(voteDetails, message) {
|
|
|
8999
8999
|
var vote = voteDetails.vote;
|
|
9000
9000
|
var optionId = vote.optionId;
|
|
9001
9001
|
var currentVotesPerOption = existingVoteDetails.votesPerOption || {};
|
|
9002
|
-
var
|
|
9002
|
+
var optionVotesCount = (currentVotesPerOption[optionId] || 0) + voteDetails.incrementVotesPerOptionCount;
|
|
9003
|
+
var newVotesPerOption = _extends({}, currentVotesPerOption, (_extends2 = {}, _extends2[optionId] = optionVotesCount >= 0 ? optionVotesCount : 0, _extends2));
|
|
9003
9004
|
var newVotes = existingVoteDetails.votes || [];
|
|
9004
9005
|
var newOwnVotes = existingVoteDetails.ownVotes || [];
|
|
9005
9006
|
if (voteDetails.type === 'add') {
|
|
@@ -15268,7 +15269,7 @@ function watchForEvents() {
|
|
|
15268
15269
|
objs.push({
|
|
15269
15270
|
type: vote.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15270
15271
|
vote: vote,
|
|
15271
|
-
incrementVotesPerOptionCount: -
|
|
15272
|
+
incrementVotesPerOptionCount: -1
|
|
15272
15273
|
});
|
|
15273
15274
|
}
|
|
15274
15275
|
for (_iterator3 = _createForOfIteratorHelperLoose(addedVotes); !(_step3 = _iterator3()).done;) {
|
|
@@ -15276,7 +15277,7 @@ function watchForEvents() {
|
|
|
15276
15277
|
objs.push({
|
|
15277
15278
|
type: _vote.user.id === SceytChatClient.user.id ? 'addOwn' : 'add',
|
|
15278
15279
|
vote: _vote,
|
|
15279
|
-
incrementVotesPerOptionCount:
|
|
15280
|
+
incrementVotesPerOptionCount: 1
|
|
15280
15281
|
});
|
|
15281
15282
|
}
|
|
15282
15283
|
_i = 0, _objs = objs;
|
|
@@ -15351,7 +15352,7 @@ function watchForEvents() {
|
|
|
15351
15352
|
_objs3.push({
|
|
15352
15353
|
type: _vote2.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15353
15354
|
vote: _vote2,
|
|
15354
|
-
incrementVotesPerOptionCount: -
|
|
15355
|
+
incrementVotesPerOptionCount: -1
|
|
15355
15356
|
});
|
|
15356
15357
|
}
|
|
15357
15358
|
_i3 = 0, _objs4 = _objs3;
|
|
@@ -15410,7 +15411,7 @@ function watchForEvents() {
|
|
|
15410
15411
|
_objs6.push({
|
|
15411
15412
|
type: _vote4.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15412
15413
|
vote: _vote4,
|
|
15413
|
-
incrementVotesPerOptionCount: -
|
|
15414
|
+
incrementVotesPerOptionCount: -1
|
|
15414
15415
|
});
|
|
15415
15416
|
}
|
|
15416
15417
|
_i5 = 0, _objs7 = _objs6;
|
|
@@ -16064,25 +16065,31 @@ function createChannel(action) {
|
|
|
16064
16065
|
}, _marked$2, null, [[0, 17]]);
|
|
16065
16066
|
}
|
|
16066
16067
|
function getChannels(action) {
|
|
16067
|
-
var _params$filter, _types, payload, params, SceytChatClient, channelQueryBuilder, channelTypesFilter, types, channelQuery, channelsData, channelList, channelId, activeChannel, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, channelMessageMap, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, i, allChannelsData, allChannelList, _t2, _t3, _t4;
|
|
16068
|
+
var _params$filter, _types, _activeChannel, _mappedChannels, _mappedChannels3, _mappedChannels4, payload, params, SceytChatClient, connectionStatus, channelQueryBuilder, channelTypesFilter, types, limit, channelQuery, channelsData, channelList, channelId, activeChannel, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys, _mappedChannels2, channelMessageMap, _activeChannel2, _activeChannel3, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, totalAllChannelsAdded, i, allChannelsData, allChannelList, _t2, _t3, _t4;
|
|
16068
16069
|
return _regenerator().w(function (_context2) {
|
|
16069
16070
|
while (1) switch (_context2.p = _context2.n) {
|
|
16070
16071
|
case 0:
|
|
16071
|
-
|
|
16072
|
+
log.info('[getChannels] start get channels');
|
|
16073
|
+
_context2.p = 1;
|
|
16072
16074
|
payload = action.payload;
|
|
16073
16075
|
params = payload.params;
|
|
16076
|
+
log.info('[getChannels] input params:', JSON.stringify(params));
|
|
16074
16077
|
SceytChatClient = getClient();
|
|
16075
|
-
|
|
16076
|
-
|
|
16078
|
+
connectionStatus = store.getState().UserReducer.connectionStatus;
|
|
16079
|
+
log.info('[getChannels] connection status:', connectionStatus);
|
|
16080
|
+
if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
|
|
16081
|
+
_context2.n = 2;
|
|
16077
16082
|
break;
|
|
16078
16083
|
}
|
|
16084
|
+
log.warn('[getChannels] connection not ready, aborting. Status:', connectionStatus);
|
|
16079
16085
|
return _context2.a(2);
|
|
16080
|
-
case 1:
|
|
16081
|
-
_context2.n = 2;
|
|
16082
|
-
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16083
16086
|
case 2:
|
|
16087
|
+
_context2.n = 3;
|
|
16088
|
+
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16089
|
+
case 3:
|
|
16084
16090
|
channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
|
|
16085
16091
|
channelTypesFilter = getChannelTypesFilter();
|
|
16092
|
+
log.info('[getChannels] channelTypesFilter:', JSON.stringify(channelTypesFilter));
|
|
16086
16093
|
types = [];
|
|
16087
16094
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
16088
16095
|
types = channelTypesFilter;
|
|
@@ -16090,59 +16097,77 @@ function getChannels(action) {
|
|
|
16090
16097
|
if (params !== null && params !== void 0 && (_params$filter = params.filter) !== null && _params$filter !== void 0 && _params$filter.channelType) {
|
|
16091
16098
|
types.push(params.filter.channelType);
|
|
16092
16099
|
}
|
|
16100
|
+
log.info('[getChannels] final types array:', JSON.stringify(types));
|
|
16093
16101
|
if ((_types = types) !== null && _types !== void 0 && _types.length) {
|
|
16094
16102
|
channelQueryBuilder.types(types);
|
|
16095
16103
|
}
|
|
16096
16104
|
if (params.memberCount) {
|
|
16105
|
+
log.info('[getChannels] setting memberCount filter:', params === null || params === void 0 ? void 0 : params.memberCount);
|
|
16097
16106
|
channelQueryBuilder.memberCount(params.memberCount);
|
|
16098
16107
|
}
|
|
16099
16108
|
channelQueryBuilder.order('lastMessage');
|
|
16100
|
-
|
|
16101
|
-
|
|
16109
|
+
limit = params.limit || 50;
|
|
16110
|
+
log.info('[getChannels] query limit:', limit);
|
|
16111
|
+
channelQueryBuilder.limit(limit);
|
|
16112
|
+
_context2.n = 4;
|
|
16102
16113
|
return effects.call(channelQueryBuilder.build);
|
|
16103
|
-
case
|
|
16114
|
+
case 4:
|
|
16104
16115
|
channelQuery = _context2.v;
|
|
16105
|
-
|
|
16116
|
+
log.info('[getChannels] query built successfully');
|
|
16117
|
+
_context2.n = 5;
|
|
16106
16118
|
return effects.call(channelQuery.loadNextPage);
|
|
16107
|
-
case
|
|
16119
|
+
case 5:
|
|
16108
16120
|
channelsData = _context2.v;
|
|
16109
16121
|
channelList = channelsData.channels;
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16122
|
+
log.info('[getChannels] channelsData received:', JSON.stringify({
|
|
16123
|
+
channelsCount: (channelList === null || channelList === void 0 ? void 0 : channelList.length) || 0,
|
|
16124
|
+
hasNext: channelsData.hasNext
|
|
16125
|
+
}));
|
|
16113
16126
|
_context2.n = 6;
|
|
16114
|
-
return effects.
|
|
16127
|
+
return effects.put(channelHasNextAC(channelsData.hasNext));
|
|
16115
16128
|
case 6:
|
|
16129
|
+
_context2.n = 7;
|
|
16130
|
+
return effects.call(getActiveChannelId);
|
|
16131
|
+
case 7:
|
|
16116
16132
|
channelId = _context2.v;
|
|
16133
|
+
log.info('[getChannels] active channelId:', channelId);
|
|
16117
16134
|
if (!channelId) {
|
|
16118
|
-
_context2.n =
|
|
16135
|
+
_context2.n = 9;
|
|
16119
16136
|
break;
|
|
16120
16137
|
}
|
|
16121
|
-
_context2.n =
|
|
16138
|
+
_context2.n = 8;
|
|
16122
16139
|
return effects.call(getChannelFromMap, channelId);
|
|
16123
|
-
case
|
|
16140
|
+
case 8:
|
|
16124
16141
|
_t2 = _context2.v;
|
|
16125
|
-
_context2.n =
|
|
16142
|
+
_context2.n = 10;
|
|
16126
16143
|
break;
|
|
16127
|
-
case 8:
|
|
16128
|
-
_t2 = null;
|
|
16129
16144
|
case 9:
|
|
16130
|
-
|
|
16131
|
-
_context2.n = 10;
|
|
16132
|
-
return effects.call(destroyChannelsMap);
|
|
16145
|
+
_t2 = null;
|
|
16133
16146
|
case 10:
|
|
16147
|
+
activeChannel = _t2;
|
|
16148
|
+
log.info('[getChannels] activeChannel from map:', activeChannel ? (_activeChannel = activeChannel) === null || _activeChannel === void 0 ? void 0 : _activeChannel.id : 'null');
|
|
16134
16149
|
_context2.n = 11;
|
|
16135
|
-
return effects.call(
|
|
16150
|
+
return effects.call(destroyChannelsMap);
|
|
16136
16151
|
case 11:
|
|
16152
|
+
log.info('[getChannels] channels map destroyed');
|
|
16153
|
+
_context2.n = 12;
|
|
16154
|
+
return effects.call(setChannelsInMap, channelList);
|
|
16155
|
+
case 12:
|
|
16137
16156
|
_yield$call = _context2.v;
|
|
16138
16157
|
mappedChannels = _yield$call.channels;
|
|
16139
16158
|
channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
|
|
16140
|
-
|
|
16141
|
-
|
|
16159
|
+
log.info('[getChannels] setChannelsInMap result:', JSON.stringify({
|
|
16160
|
+
mappedChannelsCount: ((_mappedChannels = mappedChannels) === null || _mappedChannels === void 0 ? void 0 : _mappedChannels.length) || 0,
|
|
16161
|
+
channelsForUpdateLastReactionMessageCount: (channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length) || 0
|
|
16162
|
+
}));
|
|
16163
|
+
log.info('channelsForUpdateLastReactionMessage', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16164
|
+
if (!(channelsForUpdateLastReactionMessage !== null && channelsForUpdateLastReactionMessage !== void 0 && channelsForUpdateLastReactionMessage.length)) {
|
|
16165
|
+
_context2.n = 14;
|
|
16142
16166
|
break;
|
|
16143
16167
|
}
|
|
16168
|
+
log.info('[getChannels] processing channels for reaction message update:', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16144
16169
|
channelMessageMap = {};
|
|
16145
|
-
_context2.n =
|
|
16170
|
+
_context2.n = 13;
|
|
16146
16171
|
return effects.call(function () {
|
|
16147
16172
|
try {
|
|
16148
16173
|
return Promise.resolve(Promise.all(channelsForUpdateLastReactionMessage.map(function (channel) {
|
|
@@ -16150,9 +16175,10 @@ function getChannels(action) {
|
|
|
16150
16175
|
return Promise.resolve(new Promise(function (resolve) {
|
|
16151
16176
|
channel.getMessagesById([channel.newReactions[0].messageId]).then(function (messages) {
|
|
16152
16177
|
channelMessageMap[channel.id] = messages[0];
|
|
16178
|
+
log.info('[getChannels] successfully fetched reaction message for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16153
16179
|
resolve(true);
|
|
16154
16180
|
})["catch"](function (e) {
|
|
16155
|
-
log.error(e, 'Error on getMessagesById');
|
|
16181
|
+
log.error(e, 'Error on getMessagesById for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16156
16182
|
resolve(true);
|
|
16157
16183
|
});
|
|
16158
16184
|
}));
|
|
@@ -16164,89 +16190,124 @@ function getChannels(action) {
|
|
|
16164
16190
|
return Promise.reject(e);
|
|
16165
16191
|
}
|
|
16166
16192
|
});
|
|
16167
|
-
case
|
|
16193
|
+
case 13:
|
|
16194
|
+
log.info('[getChannels] reaction messages fetched:', channelMessageMap ? (_Object$keys = Object.keys(channelMessageMap)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length : 0);
|
|
16168
16195
|
mappedChannels = mappedChannels.map(function (channel) {
|
|
16169
16196
|
if (channelMessageMap[channel.id]) {
|
|
16170
16197
|
channel.lastReactedMessage = channelMessageMap[channel.id];
|
|
16171
16198
|
}
|
|
16172
16199
|
return channel;
|
|
16173
16200
|
});
|
|
16174
|
-
|
|
16175
|
-
_context2.n = 14;
|
|
16176
|
-
return effects.put(setChannelsAC(mappedChannels));
|
|
16201
|
+
log.info('[getChannels] mappedChannels updated with reaction messages, final count:', ((_mappedChannels2 = mappedChannels) === null || _mappedChannels2 === void 0 ? void 0 : _mappedChannels2.length) || 0);
|
|
16177
16202
|
case 14:
|
|
16203
|
+
log.info('[getChannels] setting channels in state, count:', ((_mappedChannels3 = mappedChannels) === null || _mappedChannels3 === void 0 ? void 0 : _mappedChannels3.length) || 0);
|
|
16204
|
+
_context2.n = 15;
|
|
16205
|
+
return effects.put(setChannelsAC(mappedChannels));
|
|
16206
|
+
case 15:
|
|
16178
16207
|
if (!channelId) {
|
|
16179
16208
|
activeChannel = channelList[0];
|
|
16209
|
+
log.info('[getChannels] no active channelId, setting first channel as active:', (_activeChannel2 = activeChannel) === null || _activeChannel2 === void 0 ? void 0 : _activeChannel2.id);
|
|
16180
16210
|
}
|
|
16181
16211
|
query.channelQuery = channelQuery;
|
|
16182
16212
|
if (!(activeChannel && getAutoSelectFitsChannel())) {
|
|
16183
|
-
_context2.n =
|
|
16213
|
+
_context2.n = 16;
|
|
16184
16214
|
break;
|
|
16185
16215
|
}
|
|
16186
|
-
|
|
16187
|
-
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
16188
|
-
case 15:
|
|
16216
|
+
log.info('[getChannels] auto-selecting channel:', (_activeChannel3 = activeChannel) === null || _activeChannel3 === void 0 ? void 0 : _activeChannel3.id);
|
|
16189
16217
|
_context2.n = 16;
|
|
16190
|
-
return effects.put(
|
|
16218
|
+
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
16191
16219
|
case 16:
|
|
16220
|
+
_context2.n = 17;
|
|
16221
|
+
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
|
|
16222
|
+
case 17:
|
|
16192
16223
|
hiddenList = store.getState().ChannelReducer.hideChannelList;
|
|
16224
|
+
log.info('[getChannels] hiddenList state:', hiddenList);
|
|
16193
16225
|
if (hiddenList) {
|
|
16194
|
-
_context2.n =
|
|
16226
|
+
_context2.n = 27;
|
|
16195
16227
|
break;
|
|
16196
16228
|
}
|
|
16229
|
+
log.info('[getChannels] starting all channels query (hiddenList is false)');
|
|
16197
16230
|
allChannelsQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
|
|
16198
16231
|
allChannelsQueryBuilder.order('lastMessage');
|
|
16199
16232
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
16200
16233
|
allChannelsQueryBuilder.types(channelTypesFilter);
|
|
16234
|
+
log.info('[getChannels] allChannelsQuery types:', JSON.stringify(channelTypesFilter));
|
|
16201
16235
|
}
|
|
16202
16236
|
if (params !== null && params !== void 0 && params.memberCount) {
|
|
16203
16237
|
allChannelsQueryBuilder.memberCount(params.memberCount);
|
|
16238
|
+
log.info('[getChannels] allChannelsQuery memberCount:', params === null || params === void 0 ? void 0 : params.memberCount);
|
|
16204
16239
|
}
|
|
16205
16240
|
allChannelsQueryBuilder.limit(50);
|
|
16206
|
-
_context2.n =
|
|
16241
|
+
_context2.n = 18;
|
|
16207
16242
|
return effects.call(allChannelsQueryBuilder.build);
|
|
16208
|
-
case
|
|
16243
|
+
case 18:
|
|
16209
16244
|
allChannelsQuery = _context2.v;
|
|
16245
|
+
log.info('[getChannels] allChannelsQuery built');
|
|
16210
16246
|
hasNext = true;
|
|
16247
|
+
totalAllChannelsAdded = 0;
|
|
16211
16248
|
i = 0;
|
|
16212
|
-
case
|
|
16249
|
+
case 19:
|
|
16213
16250
|
if (!(i <= 4)) {
|
|
16214
|
-
_context2.n =
|
|
16251
|
+
_context2.n = 26;
|
|
16215
16252
|
break;
|
|
16216
16253
|
}
|
|
16217
16254
|
if (!hasNext) {
|
|
16218
|
-
_context2.n =
|
|
16255
|
+
_context2.n = 24;
|
|
16219
16256
|
break;
|
|
16220
16257
|
}
|
|
16221
|
-
_context2.p =
|
|
16222
|
-
|
|
16258
|
+
_context2.p = 20;
|
|
16259
|
+
log.info('[getChannels] loading all channels page:', i + 1);
|
|
16260
|
+
_context2.n = 21;
|
|
16223
16261
|
return effects.call(allChannelsQuery.loadNextPage);
|
|
16224
|
-
case
|
|
16262
|
+
case 21:
|
|
16225
16263
|
allChannelsData = _context2.v;
|
|
16226
16264
|
hasNext = allChannelsData.hasNext;
|
|
16227
16265
|
allChannelList = allChannelsData.channels;
|
|
16266
|
+
log.info('[getChannels] all channels page', i + 1, 'loaded:', JSON.stringify({
|
|
16267
|
+
channelsCount: (allChannelList === null || allChannelList === void 0 ? void 0 : allChannelList.length) || 0,
|
|
16268
|
+
hasNext: hasNext
|
|
16269
|
+
}));
|
|
16228
16270
|
addChannelsToAllChannels(allChannelList);
|
|
16229
|
-
|
|
16271
|
+
totalAllChannelsAdded += (allChannelList === null || allChannelList === void 0 ? void 0 : allChannelList.length) || 0;
|
|
16272
|
+
log.info('[getChannels] total all channels added so far:', totalAllChannelsAdded);
|
|
16273
|
+
_context2.n = 23;
|
|
16230
16274
|
break;
|
|
16231
|
-
case 21:
|
|
16232
|
-
_context2.p = 21;
|
|
16233
|
-
_t3 = _context2.v;
|
|
16234
|
-
log.error(_t3, 'Error on get all channels');
|
|
16235
16275
|
case 22:
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16276
|
+
_context2.p = 22;
|
|
16277
|
+
_t3 = _context2.v;
|
|
16278
|
+
log.error(_t3, 'Error on get all channels page:', i + 1);
|
|
16239
16279
|
case 23:
|
|
16240
16280
|
_context2.n = 25;
|
|
16241
16281
|
break;
|
|
16242
16282
|
case 24:
|
|
16243
|
-
|
|
16244
|
-
_t4 = _context2.v;
|
|
16245
|
-
log.error(JSON.stringify(_t4), 'Error on get channels');
|
|
16283
|
+
log.info('[getChannels] no more pages available, stopping at iteration:', i);
|
|
16246
16284
|
case 25:
|
|
16285
|
+
i++;
|
|
16286
|
+
_context2.n = 19;
|
|
16287
|
+
break;
|
|
16288
|
+
case 26:
|
|
16289
|
+
log.info('[getChannels] all channels query completed, total channels added:', totalAllChannelsAdded);
|
|
16290
|
+
_context2.n = 28;
|
|
16291
|
+
break;
|
|
16292
|
+
case 27:
|
|
16293
|
+
log.info('[getChannels] skipping all channels query (hiddenList is true)');
|
|
16294
|
+
case 28:
|
|
16295
|
+
log.info('[getChannels] completed successfully. Final mapped channels count:', ((_mappedChannels4 = mappedChannels) === null || _mappedChannels4 === void 0 ? void 0 : _mappedChannels4.length) || 0);
|
|
16296
|
+
_context2.n = 30;
|
|
16297
|
+
break;
|
|
16298
|
+
case 29:
|
|
16299
|
+
_context2.p = 29;
|
|
16300
|
+
_t4 = _context2.v;
|
|
16301
|
+
log.error('[getChannels] error occurred:', JSON.stringify(_t4), 'Error on get channels');
|
|
16302
|
+
log.error('[getChannels] error details:', {
|
|
16303
|
+
message: _t4.message,
|
|
16304
|
+
code: _t4.code,
|
|
16305
|
+
stack: _t4.stack
|
|
16306
|
+
});
|
|
16307
|
+
case 30:
|
|
16247
16308
|
return _context2.a(2);
|
|
16248
16309
|
}
|
|
16249
|
-
}, _marked2$1, null, [[
|
|
16310
|
+
}, _marked2$1, null, [[20, 22], [1, 29]]);
|
|
16250
16311
|
}
|
|
16251
16312
|
function searchChannels(action) {
|
|
16252
16313
|
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator, _step, channel, channelQuery, channelsData, _iterator2, _step2, _channel, channelsToAdd, _t5;
|
|
@@ -19389,7 +19450,7 @@ function forwardMessage(action) {
|
|
|
19389
19450
|
allowVoteRetract: message.pollDetails.allowVoteRetract
|
|
19390
19451
|
};
|
|
19391
19452
|
}
|
|
19392
|
-
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisableMentionsCount(getDisableFrowardMentionsCount()).setMetadata(message.metadata ? JSON.stringify(message.metadata) : '').setForwardingMessageId(message.forwardingDetails ? message.forwardingDetails.messageId : message.id).setPollDetails(pollDetails);
|
|
19453
|
+
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisableMentionsCount(getDisableFrowardMentionsCount()).setMetadata(message.metadata ? isJSON(message.metadata) ? message.metadata : JSON.stringify(message.metadata) : '').setForwardingMessageId(message.forwardingDetails ? message.forwardingDetails.messageId : message.id).setPollDetails(pollDetails);
|
|
19393
19454
|
messageToSend = messageBuilder.create();
|
|
19394
19455
|
pendingMessage = _extends({}, messageToSend, {
|
|
19395
19456
|
createdAt: new Date(Date.now())
|
|
@@ -19648,7 +19709,7 @@ function editMessage(action) {
|
|
|
19648
19709
|
}, _marked6$1, null, [[0, 5]]);
|
|
19649
19710
|
}
|
|
19650
19711
|
function getMessagesQuery(action) {
|
|
19651
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, pendingMessagesMap, channelId, _iterator, _step, msg, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
19712
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
19652
19713
|
return _regenerator().w(function (_context9) {
|
|
19653
19714
|
while (1) switch (_context9.p = _context9.n) {
|
|
19654
19715
|
case 0:
|
|
@@ -19659,7 +19720,7 @@ function getMessagesQuery(action) {
|
|
|
19659
19720
|
_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;
|
|
19660
19721
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
19661
19722
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
19662
|
-
_context9.n =
|
|
19723
|
+
_context9.n = 82;
|
|
19663
19724
|
break;
|
|
19664
19725
|
}
|
|
19665
19726
|
SceytChatClient = getClient();
|
|
@@ -20143,24 +20204,31 @@ function getMessagesQuery(action) {
|
|
|
20143
20204
|
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
20144
20205
|
case 73:
|
|
20145
20206
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20146
|
-
_context9.n =
|
|
20207
|
+
_context9.n = 81;
|
|
20147
20208
|
break;
|
|
20148
20209
|
}
|
|
20149
20210
|
pendingMessagesMap = getPendingMessagesMap();
|
|
20150
20211
|
_t18 = _regeneratorKeys(pendingMessagesMap);
|
|
20151
20212
|
case 74:
|
|
20152
20213
|
if ((_t19 = _t18()).done) {
|
|
20153
|
-
_context9.n =
|
|
20214
|
+
_context9.n = 80;
|
|
20154
20215
|
break;
|
|
20155
20216
|
}
|
|
20156
20217
|
channelId = _t19.value;
|
|
20157
20218
|
_iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
20158
20219
|
case 75:
|
|
20159
20220
|
if ((_step = _iterator()).done) {
|
|
20160
|
-
_context9.n =
|
|
20221
|
+
_context9.n = 79;
|
|
20161
20222
|
break;
|
|
20162
20223
|
}
|
|
20163
20224
|
msg = _step.value;
|
|
20225
|
+
attachments = (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
20226
|
+
return att.type !== attachmentTypes.link;
|
|
20227
|
+
});
|
|
20228
|
+
if (!(attachments && attachments.length > 0)) {
|
|
20229
|
+
_context9.n = 77;
|
|
20230
|
+
break;
|
|
20231
|
+
}
|
|
20164
20232
|
_context9.n = 76;
|
|
20165
20233
|
return effects.call(sendMessage, {
|
|
20166
20234
|
type: RESEND_MESSAGE,
|
|
@@ -20171,46 +20239,59 @@ function getMessagesQuery(action) {
|
|
|
20171
20239
|
}
|
|
20172
20240
|
});
|
|
20173
20241
|
case 76:
|
|
20174
|
-
_context9.n =
|
|
20242
|
+
_context9.n = 78;
|
|
20175
20243
|
break;
|
|
20176
20244
|
case 77:
|
|
20245
|
+
_context9.n = 78;
|
|
20246
|
+
return effects.call(sendTextMessage, {
|
|
20247
|
+
type: RESEND_MESSAGE,
|
|
20248
|
+
payload: {
|
|
20249
|
+
message: msg,
|
|
20250
|
+
connectionState: connectionState,
|
|
20251
|
+
channelId: channelId
|
|
20252
|
+
}
|
|
20253
|
+
});
|
|
20254
|
+
case 78:
|
|
20255
|
+
_context9.n = 75;
|
|
20256
|
+
break;
|
|
20257
|
+
case 79:
|
|
20177
20258
|
_context9.n = 74;
|
|
20178
20259
|
break;
|
|
20179
|
-
case
|
|
20260
|
+
case 80:
|
|
20180
20261
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
20181
20262
|
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
20182
|
-
_context9.n =
|
|
20263
|
+
_context9.n = 81;
|
|
20183
20264
|
break;
|
|
20184
20265
|
}
|
|
20185
|
-
_context9.n = 79;
|
|
20186
|
-
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
20187
|
-
case 79:
|
|
20188
20266
|
_context9.n = 81;
|
|
20267
|
+
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
20268
|
+
case 81:
|
|
20269
|
+
_context9.n = 83;
|
|
20189
20270
|
break;
|
|
20190
|
-
case
|
|
20271
|
+
case 82:
|
|
20191
20272
|
if (!channel.isMockChannel) {
|
|
20192
|
-
_context9.n =
|
|
20273
|
+
_context9.n = 83;
|
|
20193
20274
|
break;
|
|
20194
20275
|
}
|
|
20195
|
-
_context9.n = 81;
|
|
20196
|
-
return effects.put(setMessagesAC([]));
|
|
20197
|
-
case 81:
|
|
20198
20276
|
_context9.n = 83;
|
|
20277
|
+
return effects.put(setMessagesAC([]));
|
|
20278
|
+
case 83:
|
|
20279
|
+
_context9.n = 85;
|
|
20199
20280
|
break;
|
|
20200
|
-
case
|
|
20201
|
-
_context9.p =
|
|
20281
|
+
case 84:
|
|
20282
|
+
_context9.p = 84;
|
|
20202
20283
|
_t20 = _context9.v;
|
|
20203
20284
|
log.error('error in message query', _t20);
|
|
20204
|
-
case 83:
|
|
20205
|
-
_context9.p = 83;
|
|
20206
|
-
_context9.n = 84;
|
|
20207
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20208
|
-
case 84:
|
|
20209
|
-
return _context9.f(83);
|
|
20210
20285
|
case 85:
|
|
20286
|
+
_context9.p = 85;
|
|
20287
|
+
_context9.n = 86;
|
|
20288
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20289
|
+
case 86:
|
|
20290
|
+
return _context9.f(85);
|
|
20291
|
+
case 87:
|
|
20211
20292
|
return _context9.a(2);
|
|
20212
20293
|
}
|
|
20213
|
-
}, _marked7$1, null, [[0,
|
|
20294
|
+
}, _marked7$1, null, [[0, 84, 85, 87]]);
|
|
20214
20295
|
}
|
|
20215
20296
|
function getMessageQuery(action) {
|
|
20216
20297
|
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t21;
|
package/index.modern.js
CHANGED
|
@@ -8998,7 +8998,8 @@ var handleVoteDetails = function handleVoteDetails(voteDetails, message) {
|
|
|
8998
8998
|
var vote = voteDetails.vote;
|
|
8999
8999
|
var optionId = vote.optionId;
|
|
9000
9000
|
var currentVotesPerOption = existingVoteDetails.votesPerOption || {};
|
|
9001
|
-
var
|
|
9001
|
+
var optionVotesCount = (currentVotesPerOption[optionId] || 0) + voteDetails.incrementVotesPerOptionCount;
|
|
9002
|
+
var newVotesPerOption = _extends({}, currentVotesPerOption, (_extends2 = {}, _extends2[optionId] = optionVotesCount >= 0 ? optionVotesCount : 0, _extends2));
|
|
9002
9003
|
var newVotes = existingVoteDetails.votes || [];
|
|
9003
9004
|
var newOwnVotes = existingVoteDetails.ownVotes || [];
|
|
9004
9005
|
if (voteDetails.type === 'add') {
|
|
@@ -15267,7 +15268,7 @@ function watchForEvents() {
|
|
|
15267
15268
|
objs.push({
|
|
15268
15269
|
type: vote.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15269
15270
|
vote: vote,
|
|
15270
|
-
incrementVotesPerOptionCount: -
|
|
15271
|
+
incrementVotesPerOptionCount: -1
|
|
15271
15272
|
});
|
|
15272
15273
|
}
|
|
15273
15274
|
for (_iterator3 = _createForOfIteratorHelperLoose(addedVotes); !(_step3 = _iterator3()).done;) {
|
|
@@ -15275,7 +15276,7 @@ function watchForEvents() {
|
|
|
15275
15276
|
objs.push({
|
|
15276
15277
|
type: _vote.user.id === SceytChatClient.user.id ? 'addOwn' : 'add',
|
|
15277
15278
|
vote: _vote,
|
|
15278
|
-
incrementVotesPerOptionCount:
|
|
15279
|
+
incrementVotesPerOptionCount: 1
|
|
15279
15280
|
});
|
|
15280
15281
|
}
|
|
15281
15282
|
_i = 0, _objs = objs;
|
|
@@ -15350,7 +15351,7 @@ function watchForEvents() {
|
|
|
15350
15351
|
_objs3.push({
|
|
15351
15352
|
type: _vote2.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15352
15353
|
vote: _vote2,
|
|
15353
|
-
incrementVotesPerOptionCount: -
|
|
15354
|
+
incrementVotesPerOptionCount: -1
|
|
15354
15355
|
});
|
|
15355
15356
|
}
|
|
15356
15357
|
_i3 = 0, _objs4 = _objs3;
|
|
@@ -15409,7 +15410,7 @@ function watchForEvents() {
|
|
|
15409
15410
|
_objs6.push({
|
|
15410
15411
|
type: _vote4.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15411
15412
|
vote: _vote4,
|
|
15412
|
-
incrementVotesPerOptionCount: -
|
|
15413
|
+
incrementVotesPerOptionCount: -1
|
|
15413
15414
|
});
|
|
15414
15415
|
}
|
|
15415
15416
|
_i5 = 0, _objs7 = _objs6;
|
|
@@ -16063,25 +16064,31 @@ function createChannel(action) {
|
|
|
16063
16064
|
}, _marked$2, null, [[0, 17]]);
|
|
16064
16065
|
}
|
|
16065
16066
|
function getChannels(action) {
|
|
16066
|
-
var _params$filter, _types, payload, params, SceytChatClient, channelQueryBuilder, channelTypesFilter, types, channelQuery, channelsData, channelList, channelId, activeChannel, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, channelMessageMap, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, i, allChannelsData, allChannelList, _t2, _t3, _t4;
|
|
16067
|
+
var _params$filter, _types, _activeChannel, _mappedChannels, _mappedChannels3, _mappedChannels4, payload, params, SceytChatClient, connectionStatus, channelQueryBuilder, channelTypesFilter, types, limit, channelQuery, channelsData, channelList, channelId, activeChannel, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys, _mappedChannels2, channelMessageMap, _activeChannel2, _activeChannel3, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, totalAllChannelsAdded, i, allChannelsData, allChannelList, _t2, _t3, _t4;
|
|
16067
16068
|
return _regenerator().w(function (_context2) {
|
|
16068
16069
|
while (1) switch (_context2.p = _context2.n) {
|
|
16069
16070
|
case 0:
|
|
16070
|
-
|
|
16071
|
+
log.info('[getChannels] start get channels');
|
|
16072
|
+
_context2.p = 1;
|
|
16071
16073
|
payload = action.payload;
|
|
16072
16074
|
params = payload.params;
|
|
16075
|
+
log.info('[getChannels] input params:', JSON.stringify(params));
|
|
16073
16076
|
SceytChatClient = getClient();
|
|
16074
|
-
|
|
16075
|
-
|
|
16077
|
+
connectionStatus = store.getState().UserReducer.connectionStatus;
|
|
16078
|
+
log.info('[getChannels] connection status:', connectionStatus);
|
|
16079
|
+
if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
|
|
16080
|
+
_context2.n = 2;
|
|
16076
16081
|
break;
|
|
16077
16082
|
}
|
|
16083
|
+
log.warn('[getChannels] connection not ready, aborting. Status:', connectionStatus);
|
|
16078
16084
|
return _context2.a(2);
|
|
16079
|
-
case 1:
|
|
16080
|
-
_context2.n = 2;
|
|
16081
|
-
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16082
16085
|
case 2:
|
|
16086
|
+
_context2.n = 3;
|
|
16087
|
+
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16088
|
+
case 3:
|
|
16083
16089
|
channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
|
|
16084
16090
|
channelTypesFilter = getChannelTypesFilter();
|
|
16091
|
+
log.info('[getChannels] channelTypesFilter:', JSON.stringify(channelTypesFilter));
|
|
16085
16092
|
types = [];
|
|
16086
16093
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
16087
16094
|
types = channelTypesFilter;
|
|
@@ -16089,59 +16096,77 @@ function getChannels(action) {
|
|
|
16089
16096
|
if (params !== null && params !== void 0 && (_params$filter = params.filter) !== null && _params$filter !== void 0 && _params$filter.channelType) {
|
|
16090
16097
|
types.push(params.filter.channelType);
|
|
16091
16098
|
}
|
|
16099
|
+
log.info('[getChannels] final types array:', JSON.stringify(types));
|
|
16092
16100
|
if ((_types = types) !== null && _types !== void 0 && _types.length) {
|
|
16093
16101
|
channelQueryBuilder.types(types);
|
|
16094
16102
|
}
|
|
16095
16103
|
if (params.memberCount) {
|
|
16104
|
+
log.info('[getChannels] setting memberCount filter:', params === null || params === void 0 ? void 0 : params.memberCount);
|
|
16096
16105
|
channelQueryBuilder.memberCount(params.memberCount);
|
|
16097
16106
|
}
|
|
16098
16107
|
channelQueryBuilder.order('lastMessage');
|
|
16099
|
-
|
|
16100
|
-
|
|
16108
|
+
limit = params.limit || 50;
|
|
16109
|
+
log.info('[getChannels] query limit:', limit);
|
|
16110
|
+
channelQueryBuilder.limit(limit);
|
|
16111
|
+
_context2.n = 4;
|
|
16101
16112
|
return call(channelQueryBuilder.build);
|
|
16102
|
-
case
|
|
16113
|
+
case 4:
|
|
16103
16114
|
channelQuery = _context2.v;
|
|
16104
|
-
|
|
16115
|
+
log.info('[getChannels] query built successfully');
|
|
16116
|
+
_context2.n = 5;
|
|
16105
16117
|
return call(channelQuery.loadNextPage);
|
|
16106
|
-
case
|
|
16118
|
+
case 5:
|
|
16107
16119
|
channelsData = _context2.v;
|
|
16108
16120
|
channelList = channelsData.channels;
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16121
|
+
log.info('[getChannels] channelsData received:', JSON.stringify({
|
|
16122
|
+
channelsCount: (channelList === null || channelList === void 0 ? void 0 : channelList.length) || 0,
|
|
16123
|
+
hasNext: channelsData.hasNext
|
|
16124
|
+
}));
|
|
16112
16125
|
_context2.n = 6;
|
|
16113
|
-
return
|
|
16126
|
+
return put(channelHasNextAC(channelsData.hasNext));
|
|
16114
16127
|
case 6:
|
|
16128
|
+
_context2.n = 7;
|
|
16129
|
+
return call(getActiveChannelId);
|
|
16130
|
+
case 7:
|
|
16115
16131
|
channelId = _context2.v;
|
|
16132
|
+
log.info('[getChannels] active channelId:', channelId);
|
|
16116
16133
|
if (!channelId) {
|
|
16117
|
-
_context2.n =
|
|
16134
|
+
_context2.n = 9;
|
|
16118
16135
|
break;
|
|
16119
16136
|
}
|
|
16120
|
-
_context2.n =
|
|
16137
|
+
_context2.n = 8;
|
|
16121
16138
|
return call(getChannelFromMap, channelId);
|
|
16122
|
-
case
|
|
16139
|
+
case 8:
|
|
16123
16140
|
_t2 = _context2.v;
|
|
16124
|
-
_context2.n =
|
|
16141
|
+
_context2.n = 10;
|
|
16125
16142
|
break;
|
|
16126
|
-
case 8:
|
|
16127
|
-
_t2 = null;
|
|
16128
16143
|
case 9:
|
|
16129
|
-
|
|
16130
|
-
_context2.n = 10;
|
|
16131
|
-
return call(destroyChannelsMap);
|
|
16144
|
+
_t2 = null;
|
|
16132
16145
|
case 10:
|
|
16146
|
+
activeChannel = _t2;
|
|
16147
|
+
log.info('[getChannels] activeChannel from map:', activeChannel ? (_activeChannel = activeChannel) === null || _activeChannel === void 0 ? void 0 : _activeChannel.id : 'null');
|
|
16133
16148
|
_context2.n = 11;
|
|
16134
|
-
return call(
|
|
16149
|
+
return call(destroyChannelsMap);
|
|
16135
16150
|
case 11:
|
|
16151
|
+
log.info('[getChannels] channels map destroyed');
|
|
16152
|
+
_context2.n = 12;
|
|
16153
|
+
return call(setChannelsInMap, channelList);
|
|
16154
|
+
case 12:
|
|
16136
16155
|
_yield$call = _context2.v;
|
|
16137
16156
|
mappedChannels = _yield$call.channels;
|
|
16138
16157
|
channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
|
|
16139
|
-
|
|
16140
|
-
|
|
16158
|
+
log.info('[getChannels] setChannelsInMap result:', JSON.stringify({
|
|
16159
|
+
mappedChannelsCount: ((_mappedChannels = mappedChannels) === null || _mappedChannels === void 0 ? void 0 : _mappedChannels.length) || 0,
|
|
16160
|
+
channelsForUpdateLastReactionMessageCount: (channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length) || 0
|
|
16161
|
+
}));
|
|
16162
|
+
log.info('channelsForUpdateLastReactionMessage', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16163
|
+
if (!(channelsForUpdateLastReactionMessage !== null && channelsForUpdateLastReactionMessage !== void 0 && channelsForUpdateLastReactionMessage.length)) {
|
|
16164
|
+
_context2.n = 14;
|
|
16141
16165
|
break;
|
|
16142
16166
|
}
|
|
16167
|
+
log.info('[getChannels] processing channels for reaction message update:', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16143
16168
|
channelMessageMap = {};
|
|
16144
|
-
_context2.n =
|
|
16169
|
+
_context2.n = 13;
|
|
16145
16170
|
return call(function () {
|
|
16146
16171
|
try {
|
|
16147
16172
|
return Promise.resolve(Promise.all(channelsForUpdateLastReactionMessage.map(function (channel) {
|
|
@@ -16149,9 +16174,10 @@ function getChannels(action) {
|
|
|
16149
16174
|
return Promise.resolve(new Promise(function (resolve) {
|
|
16150
16175
|
channel.getMessagesById([channel.newReactions[0].messageId]).then(function (messages) {
|
|
16151
16176
|
channelMessageMap[channel.id] = messages[0];
|
|
16177
|
+
log.info('[getChannels] successfully fetched reaction message for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16152
16178
|
resolve(true);
|
|
16153
16179
|
})["catch"](function (e) {
|
|
16154
|
-
log.error(e, 'Error on getMessagesById');
|
|
16180
|
+
log.error(e, 'Error on getMessagesById for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16155
16181
|
resolve(true);
|
|
16156
16182
|
});
|
|
16157
16183
|
}));
|
|
@@ -16163,89 +16189,124 @@ function getChannels(action) {
|
|
|
16163
16189
|
return Promise.reject(e);
|
|
16164
16190
|
}
|
|
16165
16191
|
});
|
|
16166
|
-
case
|
|
16192
|
+
case 13:
|
|
16193
|
+
log.info('[getChannels] reaction messages fetched:', channelMessageMap ? (_Object$keys = Object.keys(channelMessageMap)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length : 0);
|
|
16167
16194
|
mappedChannels = mappedChannels.map(function (channel) {
|
|
16168
16195
|
if (channelMessageMap[channel.id]) {
|
|
16169
16196
|
channel.lastReactedMessage = channelMessageMap[channel.id];
|
|
16170
16197
|
}
|
|
16171
16198
|
return channel;
|
|
16172
16199
|
});
|
|
16173
|
-
|
|
16174
|
-
_context2.n = 14;
|
|
16175
|
-
return put(setChannelsAC(mappedChannels));
|
|
16200
|
+
log.info('[getChannels] mappedChannels updated with reaction messages, final count:', ((_mappedChannels2 = mappedChannels) === null || _mappedChannels2 === void 0 ? void 0 : _mappedChannels2.length) || 0);
|
|
16176
16201
|
case 14:
|
|
16202
|
+
log.info('[getChannels] setting channels in state, count:', ((_mappedChannels3 = mappedChannels) === null || _mappedChannels3 === void 0 ? void 0 : _mappedChannels3.length) || 0);
|
|
16203
|
+
_context2.n = 15;
|
|
16204
|
+
return put(setChannelsAC(mappedChannels));
|
|
16205
|
+
case 15:
|
|
16177
16206
|
if (!channelId) {
|
|
16178
16207
|
activeChannel = channelList[0];
|
|
16208
|
+
log.info('[getChannels] no active channelId, setting first channel as active:', (_activeChannel2 = activeChannel) === null || _activeChannel2 === void 0 ? void 0 : _activeChannel2.id);
|
|
16179
16209
|
}
|
|
16180
16210
|
query.channelQuery = channelQuery;
|
|
16181
16211
|
if (!(activeChannel && getAutoSelectFitsChannel())) {
|
|
16182
|
-
_context2.n =
|
|
16212
|
+
_context2.n = 16;
|
|
16183
16213
|
break;
|
|
16184
16214
|
}
|
|
16185
|
-
|
|
16186
|
-
return put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
16187
|
-
case 15:
|
|
16215
|
+
log.info('[getChannels] auto-selecting channel:', (_activeChannel3 = activeChannel) === null || _activeChannel3 === void 0 ? void 0 : _activeChannel3.id);
|
|
16188
16216
|
_context2.n = 16;
|
|
16189
|
-
return put(
|
|
16217
|
+
return put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
16190
16218
|
case 16:
|
|
16219
|
+
_context2.n = 17;
|
|
16220
|
+
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
|
|
16221
|
+
case 17:
|
|
16191
16222
|
hiddenList = store.getState().ChannelReducer.hideChannelList;
|
|
16223
|
+
log.info('[getChannels] hiddenList state:', hiddenList);
|
|
16192
16224
|
if (hiddenList) {
|
|
16193
|
-
_context2.n =
|
|
16225
|
+
_context2.n = 27;
|
|
16194
16226
|
break;
|
|
16195
16227
|
}
|
|
16228
|
+
log.info('[getChannels] starting all channels query (hiddenList is false)');
|
|
16196
16229
|
allChannelsQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
|
|
16197
16230
|
allChannelsQueryBuilder.order('lastMessage');
|
|
16198
16231
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
16199
16232
|
allChannelsQueryBuilder.types(channelTypesFilter);
|
|
16233
|
+
log.info('[getChannels] allChannelsQuery types:', JSON.stringify(channelTypesFilter));
|
|
16200
16234
|
}
|
|
16201
16235
|
if (params !== null && params !== void 0 && params.memberCount) {
|
|
16202
16236
|
allChannelsQueryBuilder.memberCount(params.memberCount);
|
|
16237
|
+
log.info('[getChannels] allChannelsQuery memberCount:', params === null || params === void 0 ? void 0 : params.memberCount);
|
|
16203
16238
|
}
|
|
16204
16239
|
allChannelsQueryBuilder.limit(50);
|
|
16205
|
-
_context2.n =
|
|
16240
|
+
_context2.n = 18;
|
|
16206
16241
|
return call(allChannelsQueryBuilder.build);
|
|
16207
|
-
case
|
|
16242
|
+
case 18:
|
|
16208
16243
|
allChannelsQuery = _context2.v;
|
|
16244
|
+
log.info('[getChannels] allChannelsQuery built');
|
|
16209
16245
|
hasNext = true;
|
|
16246
|
+
totalAllChannelsAdded = 0;
|
|
16210
16247
|
i = 0;
|
|
16211
|
-
case
|
|
16248
|
+
case 19:
|
|
16212
16249
|
if (!(i <= 4)) {
|
|
16213
|
-
_context2.n =
|
|
16250
|
+
_context2.n = 26;
|
|
16214
16251
|
break;
|
|
16215
16252
|
}
|
|
16216
16253
|
if (!hasNext) {
|
|
16217
|
-
_context2.n =
|
|
16254
|
+
_context2.n = 24;
|
|
16218
16255
|
break;
|
|
16219
16256
|
}
|
|
16220
|
-
_context2.p =
|
|
16221
|
-
|
|
16257
|
+
_context2.p = 20;
|
|
16258
|
+
log.info('[getChannels] loading all channels page:', i + 1);
|
|
16259
|
+
_context2.n = 21;
|
|
16222
16260
|
return call(allChannelsQuery.loadNextPage);
|
|
16223
|
-
case
|
|
16261
|
+
case 21:
|
|
16224
16262
|
allChannelsData = _context2.v;
|
|
16225
16263
|
hasNext = allChannelsData.hasNext;
|
|
16226
16264
|
allChannelList = allChannelsData.channels;
|
|
16265
|
+
log.info('[getChannels] all channels page', i + 1, 'loaded:', JSON.stringify({
|
|
16266
|
+
channelsCount: (allChannelList === null || allChannelList === void 0 ? void 0 : allChannelList.length) || 0,
|
|
16267
|
+
hasNext: hasNext
|
|
16268
|
+
}));
|
|
16227
16269
|
addChannelsToAllChannels(allChannelList);
|
|
16228
|
-
|
|
16270
|
+
totalAllChannelsAdded += (allChannelList === null || allChannelList === void 0 ? void 0 : allChannelList.length) || 0;
|
|
16271
|
+
log.info('[getChannels] total all channels added so far:', totalAllChannelsAdded);
|
|
16272
|
+
_context2.n = 23;
|
|
16229
16273
|
break;
|
|
16230
|
-
case 21:
|
|
16231
|
-
_context2.p = 21;
|
|
16232
|
-
_t3 = _context2.v;
|
|
16233
|
-
log.error(_t3, 'Error on get all channels');
|
|
16234
16274
|
case 22:
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16275
|
+
_context2.p = 22;
|
|
16276
|
+
_t3 = _context2.v;
|
|
16277
|
+
log.error(_t3, 'Error on get all channels page:', i + 1);
|
|
16238
16278
|
case 23:
|
|
16239
16279
|
_context2.n = 25;
|
|
16240
16280
|
break;
|
|
16241
16281
|
case 24:
|
|
16242
|
-
|
|
16243
|
-
_t4 = _context2.v;
|
|
16244
|
-
log.error(JSON.stringify(_t4), 'Error on get channels');
|
|
16282
|
+
log.info('[getChannels] no more pages available, stopping at iteration:', i);
|
|
16245
16283
|
case 25:
|
|
16284
|
+
i++;
|
|
16285
|
+
_context2.n = 19;
|
|
16286
|
+
break;
|
|
16287
|
+
case 26:
|
|
16288
|
+
log.info('[getChannels] all channels query completed, total channels added:', totalAllChannelsAdded);
|
|
16289
|
+
_context2.n = 28;
|
|
16290
|
+
break;
|
|
16291
|
+
case 27:
|
|
16292
|
+
log.info('[getChannels] skipping all channels query (hiddenList is true)');
|
|
16293
|
+
case 28:
|
|
16294
|
+
log.info('[getChannels] completed successfully. Final mapped channels count:', ((_mappedChannels4 = mappedChannels) === null || _mappedChannels4 === void 0 ? void 0 : _mappedChannels4.length) || 0);
|
|
16295
|
+
_context2.n = 30;
|
|
16296
|
+
break;
|
|
16297
|
+
case 29:
|
|
16298
|
+
_context2.p = 29;
|
|
16299
|
+
_t4 = _context2.v;
|
|
16300
|
+
log.error('[getChannels] error occurred:', JSON.stringify(_t4), 'Error on get channels');
|
|
16301
|
+
log.error('[getChannels] error details:', {
|
|
16302
|
+
message: _t4.message,
|
|
16303
|
+
code: _t4.code,
|
|
16304
|
+
stack: _t4.stack
|
|
16305
|
+
});
|
|
16306
|
+
case 30:
|
|
16246
16307
|
return _context2.a(2);
|
|
16247
16308
|
}
|
|
16248
|
-
}, _marked2$1, null, [[
|
|
16309
|
+
}, _marked2$1, null, [[20, 22], [1, 29]]);
|
|
16249
16310
|
}
|
|
16250
16311
|
function searchChannels(action) {
|
|
16251
16312
|
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator, _step, channel, channelQuery, channelsData, _iterator2, _step2, _channel, channelsToAdd, _t5;
|
|
@@ -19388,7 +19449,7 @@ function forwardMessage(action) {
|
|
|
19388
19449
|
allowVoteRetract: message.pollDetails.allowVoteRetract
|
|
19389
19450
|
};
|
|
19390
19451
|
}
|
|
19391
|
-
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisableMentionsCount(getDisableFrowardMentionsCount()).setMetadata(message.metadata ? JSON.stringify(message.metadata) : '').setForwardingMessageId(message.forwardingDetails ? message.forwardingDetails.messageId : message.id).setPollDetails(pollDetails);
|
|
19452
|
+
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisableMentionsCount(getDisableFrowardMentionsCount()).setMetadata(message.metadata ? isJSON(message.metadata) ? message.metadata : JSON.stringify(message.metadata) : '').setForwardingMessageId(message.forwardingDetails ? message.forwardingDetails.messageId : message.id).setPollDetails(pollDetails);
|
|
19392
19453
|
messageToSend = messageBuilder.create();
|
|
19393
19454
|
pendingMessage = _extends({}, messageToSend, {
|
|
19394
19455
|
createdAt: new Date(Date.now())
|
|
@@ -19647,7 +19708,7 @@ function editMessage(action) {
|
|
|
19647
19708
|
}, _marked6$1, null, [[0, 5]]);
|
|
19648
19709
|
}
|
|
19649
19710
|
function getMessagesQuery(action) {
|
|
19650
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, pendingMessagesMap, channelId, _iterator, _step, msg, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
19711
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
19651
19712
|
return _regenerator().w(function (_context9) {
|
|
19652
19713
|
while (1) switch (_context9.p = _context9.n) {
|
|
19653
19714
|
case 0:
|
|
@@ -19658,7 +19719,7 @@ function getMessagesQuery(action) {
|
|
|
19658
19719
|
_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;
|
|
19659
19720
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
19660
19721
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
19661
|
-
_context9.n =
|
|
19722
|
+
_context9.n = 82;
|
|
19662
19723
|
break;
|
|
19663
19724
|
}
|
|
19664
19725
|
SceytChatClient = getClient();
|
|
@@ -20142,24 +20203,31 @@ function getMessagesQuery(action) {
|
|
|
20142
20203
|
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
20143
20204
|
case 73:
|
|
20144
20205
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20145
|
-
_context9.n =
|
|
20206
|
+
_context9.n = 81;
|
|
20146
20207
|
break;
|
|
20147
20208
|
}
|
|
20148
20209
|
pendingMessagesMap = getPendingMessagesMap();
|
|
20149
20210
|
_t18 = _regeneratorKeys(pendingMessagesMap);
|
|
20150
20211
|
case 74:
|
|
20151
20212
|
if ((_t19 = _t18()).done) {
|
|
20152
|
-
_context9.n =
|
|
20213
|
+
_context9.n = 80;
|
|
20153
20214
|
break;
|
|
20154
20215
|
}
|
|
20155
20216
|
channelId = _t19.value;
|
|
20156
20217
|
_iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
20157
20218
|
case 75:
|
|
20158
20219
|
if ((_step = _iterator()).done) {
|
|
20159
|
-
_context9.n =
|
|
20220
|
+
_context9.n = 79;
|
|
20160
20221
|
break;
|
|
20161
20222
|
}
|
|
20162
20223
|
msg = _step.value;
|
|
20224
|
+
attachments = (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
20225
|
+
return att.type !== attachmentTypes.link;
|
|
20226
|
+
});
|
|
20227
|
+
if (!(attachments && attachments.length > 0)) {
|
|
20228
|
+
_context9.n = 77;
|
|
20229
|
+
break;
|
|
20230
|
+
}
|
|
20163
20231
|
_context9.n = 76;
|
|
20164
20232
|
return call(sendMessage, {
|
|
20165
20233
|
type: RESEND_MESSAGE,
|
|
@@ -20170,46 +20238,59 @@ function getMessagesQuery(action) {
|
|
|
20170
20238
|
}
|
|
20171
20239
|
});
|
|
20172
20240
|
case 76:
|
|
20173
|
-
_context9.n =
|
|
20241
|
+
_context9.n = 78;
|
|
20174
20242
|
break;
|
|
20175
20243
|
case 77:
|
|
20244
|
+
_context9.n = 78;
|
|
20245
|
+
return call(sendTextMessage, {
|
|
20246
|
+
type: RESEND_MESSAGE,
|
|
20247
|
+
payload: {
|
|
20248
|
+
message: msg,
|
|
20249
|
+
connectionState: connectionState,
|
|
20250
|
+
channelId: channelId
|
|
20251
|
+
}
|
|
20252
|
+
});
|
|
20253
|
+
case 78:
|
|
20254
|
+
_context9.n = 75;
|
|
20255
|
+
break;
|
|
20256
|
+
case 79:
|
|
20176
20257
|
_context9.n = 74;
|
|
20177
20258
|
break;
|
|
20178
|
-
case
|
|
20259
|
+
case 80:
|
|
20179
20260
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
20180
20261
|
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
20181
|
-
_context9.n =
|
|
20262
|
+
_context9.n = 81;
|
|
20182
20263
|
break;
|
|
20183
20264
|
}
|
|
20184
|
-
_context9.n = 79;
|
|
20185
|
-
return put(resendPendingPollActionsAC(connectionState));
|
|
20186
|
-
case 79:
|
|
20187
20265
|
_context9.n = 81;
|
|
20266
|
+
return put(resendPendingPollActionsAC(connectionState));
|
|
20267
|
+
case 81:
|
|
20268
|
+
_context9.n = 83;
|
|
20188
20269
|
break;
|
|
20189
|
-
case
|
|
20270
|
+
case 82:
|
|
20190
20271
|
if (!channel.isMockChannel) {
|
|
20191
|
-
_context9.n =
|
|
20272
|
+
_context9.n = 83;
|
|
20192
20273
|
break;
|
|
20193
20274
|
}
|
|
20194
|
-
_context9.n = 81;
|
|
20195
|
-
return put(setMessagesAC([]));
|
|
20196
|
-
case 81:
|
|
20197
20275
|
_context9.n = 83;
|
|
20276
|
+
return put(setMessagesAC([]));
|
|
20277
|
+
case 83:
|
|
20278
|
+
_context9.n = 85;
|
|
20198
20279
|
break;
|
|
20199
|
-
case
|
|
20200
|
-
_context9.p =
|
|
20280
|
+
case 84:
|
|
20281
|
+
_context9.p = 84;
|
|
20201
20282
|
_t20 = _context9.v;
|
|
20202
20283
|
log.error('error in message query', _t20);
|
|
20203
|
-
case 83:
|
|
20204
|
-
_context9.p = 83;
|
|
20205
|
-
_context9.n = 84;
|
|
20206
|
-
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20207
|
-
case 84:
|
|
20208
|
-
return _context9.f(83);
|
|
20209
20284
|
case 85:
|
|
20285
|
+
_context9.p = 85;
|
|
20286
|
+
_context9.n = 86;
|
|
20287
|
+
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20288
|
+
case 86:
|
|
20289
|
+
return _context9.f(85);
|
|
20290
|
+
case 87:
|
|
20210
20291
|
return _context9.a(2);
|
|
20211
20292
|
}
|
|
20212
|
-
}, _marked7$1, null, [[0,
|
|
20293
|
+
}, _marked7$1, null, [[0, 84, 85, 87]]);
|
|
20213
20294
|
}
|
|
20214
20295
|
function getMessageQuery(action) {
|
|
20215
20296
|
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t21;
|