sceyt-chat-react-uikit 1.7.1-beta.6 → 1.7.1-beta.7
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 +115 -89
- package/index.modern.js +115 -89
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -15147,7 +15147,7 @@ function getChannels(action) {
|
|
|
15147
15147
|
}, _marked2$1, null, [[18, 20], [0, 23]]);
|
|
15148
15148
|
}
|
|
15149
15149
|
function searchChannels(action) {
|
|
15150
|
-
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
|
|
15150
|
+
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;
|
|
15151
15151
|
return _regenerator().w(function (_context3) {
|
|
15152
15152
|
while (1) switch (_context3.p = _context3.n) {
|
|
15153
15153
|
case 0:
|
|
@@ -15186,31 +15186,39 @@ function searchChannels(action) {
|
|
|
15186
15186
|
contactsList = [];
|
|
15187
15187
|
contactsWithChannelsMap = {};
|
|
15188
15188
|
lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
}
|
|
15204
|
-
} else {
|
|
15205
|
-
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15206
|
-
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15207
|
-
publicChannels.push(channel);
|
|
15208
|
-
} else {
|
|
15189
|
+
handleChannels = function handleChannels(channels) {
|
|
15190
|
+
channels.forEach(function (channel) {
|
|
15191
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15192
|
+
var _channel$metadata;
|
|
15193
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15194
|
+
var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
|
|
15195
|
+
var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
|
|
15196
|
+
return member.id !== SceytChatClient.user.id;
|
|
15197
|
+
});
|
|
15198
|
+
if (directChannelUser && contactsMap[directChannelUser.id]) {
|
|
15199
|
+
contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15200
|
+
}
|
|
15201
|
+
var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
|
|
15202
|
+
if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
|
|
15209
15203
|
chatsGroups.push(channel);
|
|
15210
15204
|
}
|
|
15205
|
+
} else {
|
|
15206
|
+
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15207
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15208
|
+
publicChannels.push(channel);
|
|
15209
|
+
} else {
|
|
15210
|
+
chatsGroups.push(channel);
|
|
15211
|
+
}
|
|
15212
|
+
}
|
|
15211
15213
|
}
|
|
15212
|
-
}
|
|
15213
|
-
}
|
|
15214
|
+
});
|
|
15215
|
+
};
|
|
15216
|
+
channelsMap = {};
|
|
15217
|
+
for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
|
|
15218
|
+
channel = _step.value;
|
|
15219
|
+
channelsMap[channel.id] = channel;
|
|
15220
|
+
}
|
|
15221
|
+
handleChannels(allChannels);
|
|
15214
15222
|
if (getFromContacts) {
|
|
15215
15223
|
Object.values(contactsMap).forEach(function (contact) {
|
|
15216
15224
|
if (!contactsWithChannelsMap[contact.id]) {
|
|
@@ -15244,6 +15252,11 @@ function searchChannels(action) {
|
|
|
15244
15252
|
return effects.call(channelQuery.loadNextPage);
|
|
15245
15253
|
case 5:
|
|
15246
15254
|
channelsData = _context3.v;
|
|
15255
|
+
for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
|
|
15256
|
+
_channel = _step2.value;
|
|
15257
|
+
channelsMap[_channel.id] = _channel;
|
|
15258
|
+
}
|
|
15259
|
+
handleChannels(Object.values(channelsMap));
|
|
15247
15260
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15248
15261
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15249
15262
|
});
|
|
@@ -15266,16 +15279,16 @@ function searchChannels(action) {
|
|
|
15266
15279
|
}, _marked3, null, [[0, 7]]);
|
|
15267
15280
|
}
|
|
15268
15281
|
function getChannelsForForward() {
|
|
15269
|
-
var
|
|
15282
|
+
var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
|
|
15270
15283
|
return _regenerator().w(function (_context4) {
|
|
15271
15284
|
while (1) switch (_context4.p = _context4.n) {
|
|
15272
15285
|
case 0:
|
|
15273
15286
|
_context4.p = 0;
|
|
15274
|
-
|
|
15287
|
+
_SceytChatClient = getClient();
|
|
15275
15288
|
_context4.n = 1;
|
|
15276
15289
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15277
15290
|
case 1:
|
|
15278
|
-
channelQueryBuilder = new
|
|
15291
|
+
channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
|
|
15279
15292
|
channelTypesFilter = getChannelTypesFilter();
|
|
15280
15293
|
channelQueryBuilder.order('lastMessage');
|
|
15281
15294
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15298,7 +15311,7 @@ function getChannelsForForward() {
|
|
|
15298
15311
|
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15299
15312
|
var isSelfChannel = (_channel$metadata2 = channel.metadata) === null || _channel$metadata2 === void 0 ? void 0 : _channel$metadata2.s;
|
|
15300
15313
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
|
|
15301
|
-
return member.id && member.id !==
|
|
15314
|
+
return member.id && member.id !== _SceytChatClient.user.id;
|
|
15302
15315
|
}) : true;
|
|
15303
15316
|
});
|
|
15304
15317
|
_context4.n = 5;
|
|
@@ -15325,15 +15338,15 @@ function getChannelsForForward() {
|
|
|
15325
15338
|
}, _marked4, null, [[0, 8]]);
|
|
15326
15339
|
}
|
|
15327
15340
|
function searchChannelsForForward(action) {
|
|
15328
|
-
var payload, params,
|
|
15341
|
+
var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator3, _step3, channel, channelQuery, channelsData, _iterator4, _step4, _channel2, channelsToAdd, _t7;
|
|
15329
15342
|
return _regenerator().w(function (_context5) {
|
|
15330
15343
|
while (1) switch (_context5.p = _context5.n) {
|
|
15331
15344
|
case 0:
|
|
15332
15345
|
_context5.p = 0;
|
|
15333
15346
|
payload = action.payload;
|
|
15334
|
-
params = payload.params,
|
|
15335
|
-
|
|
15336
|
-
|
|
15347
|
+
params = payload.params, _contactsMap = payload.contactsMap;
|
|
15348
|
+
_SceytChatClient2 = getClient();
|
|
15349
|
+
_getFromContacts = getShowOnlyContactUsers();
|
|
15337
15350
|
_context5.n = 1;
|
|
15338
15351
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15339
15352
|
case 1:
|
|
@@ -15342,7 +15355,7 @@ function searchChannelsForForward(action) {
|
|
|
15342
15355
|
_context5.n = 6;
|
|
15343
15356
|
break;
|
|
15344
15357
|
}
|
|
15345
|
-
channelQueryBuilder = new
|
|
15358
|
+
channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
|
|
15346
15359
|
channelTypesFilter = getChannelTypesFilter();
|
|
15347
15360
|
types = [];
|
|
15348
15361
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15355,41 +15368,49 @@ function searchChannelsForForward(action) {
|
|
|
15355
15368
|
channelQueryBuilder.types(types);
|
|
15356
15369
|
}
|
|
15357
15370
|
allChannels = getAllChannels();
|
|
15358
|
-
|
|
15359
|
-
|
|
15371
|
+
_publicChannels = [];
|
|
15372
|
+
_chatsGroups = [];
|
|
15360
15373
|
contactsList = [];
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
if (channel.
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15374
|
+
_contactsWithChannelsMap = {};
|
|
15375
|
+
_lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15376
|
+
handleChannels = function handleChannels(channels) {
|
|
15377
|
+
channels.forEach(function (channel) {
|
|
15378
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15379
|
+
var _channel$metadata3;
|
|
15380
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15381
|
+
var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
|
|
15382
|
+
var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
|
|
15383
|
+
return member.id !== _SceytChatClient2.user.id;
|
|
15384
|
+
});
|
|
15385
|
+
if (directChannelUser && _contactsMap[directChannelUser.id]) {
|
|
15386
|
+
_contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15387
|
+
}
|
|
15388
|
+
var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
|
|
15389
|
+
if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
|
|
15390
|
+
_chatsGroups.push(channel);
|
|
15391
|
+
}
|
|
15392
|
+
} else {
|
|
15393
|
+
if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
|
|
15394
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15395
|
+
_publicChannels.push(channel);
|
|
15396
|
+
} else {
|
|
15397
|
+
_chatsGroups.push(channel);
|
|
15398
|
+
}
|
|
15384
15399
|
}
|
|
15385
15400
|
}
|
|
15386
|
-
}
|
|
15387
|
-
}
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15401
|
+
});
|
|
15402
|
+
};
|
|
15403
|
+
channelsMap = {};
|
|
15404
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
|
|
15405
|
+
channel = _step3.value;
|
|
15406
|
+
channelsMap[channel.id] = channel;
|
|
15407
|
+
}
|
|
15408
|
+
handleChannels(allChannels);
|
|
15409
|
+
if (_getFromContacts) {
|
|
15410
|
+
Object.values(_contactsMap).forEach(function (contact) {
|
|
15411
|
+
if (!_contactsWithChannelsMap[contact.id]) {
|
|
15391
15412
|
var userName = makeUsername(contact, undefined, true).toLowerCase();
|
|
15392
|
-
if (userName.includes(
|
|
15413
|
+
if (userName.includes(_lowerCaseSearchBy)) {
|
|
15393
15414
|
contactsList.push(contact);
|
|
15394
15415
|
}
|
|
15395
15416
|
}
|
|
@@ -15397,15 +15418,15 @@ function searchChannelsForForward(action) {
|
|
|
15397
15418
|
}
|
|
15398
15419
|
_context5.n = 2;
|
|
15399
15420
|
return effects.put(setSearchedChannelsForForwardAC({
|
|
15400
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15401
|
-
channels: JSON.parse(JSON.stringify(
|
|
15421
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15422
|
+
channels: JSON.parse(JSON.stringify(_publicChannels)),
|
|
15402
15423
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15403
15424
|
}));
|
|
15404
15425
|
case 2:
|
|
15405
15426
|
_context5.n = 3;
|
|
15406
15427
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
|
|
15407
15428
|
case 3:
|
|
15408
|
-
channelQueryBuilder.query(
|
|
15429
|
+
channelQueryBuilder.query(_lowerCaseSearchBy);
|
|
15409
15430
|
channelQueryBuilder.limit(params.limit || 50);
|
|
15410
15431
|
channelQueryBuilder.order('lastMessage');
|
|
15411
15432
|
channelQueryBuilder.filterKey(['subject']);
|
|
@@ -15418,12 +15439,17 @@ function searchChannelsForForward(action) {
|
|
|
15418
15439
|
return effects.call(channelQuery.loadNextPage);
|
|
15419
15440
|
case 5:
|
|
15420
15441
|
channelsData = _context5.v;
|
|
15442
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
|
|
15443
|
+
_channel2 = _step4.value;
|
|
15444
|
+
channelsMap[_channel2.id] = _channel2;
|
|
15445
|
+
}
|
|
15446
|
+
handleChannels(Object.values(channelsMap));
|
|
15421
15447
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15422
15448
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15423
15449
|
});
|
|
15424
15450
|
_context5.n = 6;
|
|
15425
15451
|
return effects.put(setSearchedChannelsForForwardAC({
|
|
15426
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15452
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15427
15453
|
channels: JSON.parse(JSON.stringify(channelsToAdd)),
|
|
15428
15454
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15429
15455
|
}));
|
|
@@ -15520,15 +15546,15 @@ function channelsLoadMore(action) {
|
|
|
15520
15546
|
}, _marked6, null, [[0, 9]]);
|
|
15521
15547
|
}
|
|
15522
15548
|
function getChannelMentions(action) {
|
|
15523
|
-
var payload, channelId,
|
|
15549
|
+
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
|
|
15524
15550
|
return _regenerator().w(function (_context7) {
|
|
15525
15551
|
while (1) switch (_context7.p = _context7.n) {
|
|
15526
15552
|
case 0:
|
|
15527
15553
|
_context7.p = 0;
|
|
15528
15554
|
payload = action.payload;
|
|
15529
15555
|
channelId = payload.channelId;
|
|
15530
|
-
|
|
15531
|
-
mentionsQueryBuilder = new
|
|
15556
|
+
_SceytChatClient3 = getClient();
|
|
15557
|
+
mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
|
|
15532
15558
|
mentionsQueryBuilder.setChannelId(channelId);
|
|
15533
15559
|
mentionsQueryBuilder.limit(10);
|
|
15534
15560
|
mentionsQueryBuilder.setDirection(queryDirection.NEXT);
|
|
@@ -15557,14 +15583,14 @@ function getChannelMentions(action) {
|
|
|
15557
15583
|
}, _marked7, null, [[0, 4]]);
|
|
15558
15584
|
}
|
|
15559
15585
|
function channelsForForwardLoadMore(action) {
|
|
15560
|
-
var payload, limit,
|
|
15586
|
+
var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
|
|
15561
15587
|
return _regenerator().w(function (_context8) {
|
|
15562
15588
|
while (1) switch (_context8.p = _context8.n) {
|
|
15563
15589
|
case 0:
|
|
15564
15590
|
_context8.p = 0;
|
|
15565
15591
|
payload = action.payload;
|
|
15566
15592
|
limit = payload.limit;
|
|
15567
|
-
|
|
15593
|
+
_SceytChatClient4 = getClient();
|
|
15568
15594
|
channelQueryForward = query.channelQueryForward;
|
|
15569
15595
|
if (limit) {
|
|
15570
15596
|
channelQueryForward.limit = limit;
|
|
@@ -15581,7 +15607,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15581
15607
|
case 3:
|
|
15582
15608
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15583
15609
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? channel.members.find(function (member) {
|
|
15584
|
-
return member.id && member.id !==
|
|
15610
|
+
return member.id && member.id !== _SceytChatClient4.user.id;
|
|
15585
15611
|
}) : true;
|
|
15586
15612
|
});
|
|
15587
15613
|
_context8.n = 4;
|
|
@@ -15607,7 +15633,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15607
15633
|
}, _marked8, null, [[0, 7]]);
|
|
15608
15634
|
}
|
|
15609
15635
|
function markMessagesRead(action) {
|
|
15610
|
-
var payload, channelId, messageIds, channel, messageListMarker,
|
|
15636
|
+
var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
|
|
15611
15637
|
return _regenerator().w(function (_context9) {
|
|
15612
15638
|
while (1) switch (_context9.p = _context9.n) {
|
|
15613
15639
|
case 0:
|
|
@@ -15640,13 +15666,13 @@ function markMessagesRead(action) {
|
|
|
15640
15666
|
updateChannelOnAllChannels(channel.id, {
|
|
15641
15667
|
lastReadMessageId: channel.lastDisplayedMessageId
|
|
15642
15668
|
});
|
|
15643
|
-
|
|
15669
|
+
_iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
|
|
15644
15670
|
case 5:
|
|
15645
|
-
if ((
|
|
15671
|
+
if ((_step5 = _iterator5()).done) {
|
|
15646
15672
|
_context9.n = 8;
|
|
15647
15673
|
break;
|
|
15648
15674
|
}
|
|
15649
|
-
messageId =
|
|
15675
|
+
messageId = _step5.value;
|
|
15650
15676
|
updateParams = {
|
|
15651
15677
|
deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
|
|
15652
15678
|
userMarkers: [{
|
|
@@ -15717,7 +15743,7 @@ function markMessagesDelivered(action) {
|
|
|
15717
15743
|
}, _marked0, null, [[1, 4]]);
|
|
15718
15744
|
}
|
|
15719
15745
|
function switchChannel(action) {
|
|
15720
|
-
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel,
|
|
15746
|
+
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
|
|
15721
15747
|
return _regenerator().w(function (_context1) {
|
|
15722
15748
|
while (1) switch (_context1.p = _context1.n) {
|
|
15723
15749
|
case 0:
|
|
@@ -15755,9 +15781,9 @@ function switchChannel(action) {
|
|
|
15755
15781
|
_context1.n = 8;
|
|
15756
15782
|
break;
|
|
15757
15783
|
case 5:
|
|
15758
|
-
|
|
15784
|
+
_SceytChatClient5 = getClient();
|
|
15759
15785
|
_context1.n = 6;
|
|
15760
|
-
return effects.call(
|
|
15786
|
+
return effects.call(_SceytChatClient5.getChannel, channel.id);
|
|
15761
15787
|
case 6:
|
|
15762
15788
|
fetchedChannel = _context1.v;
|
|
15763
15789
|
addChannelToAllChannels(fetchedChannel);
|
|
@@ -16193,14 +16219,14 @@ function blockChannel(action) {
|
|
|
16193
16219
|
}, _marked19, null, [[0, 5]]);
|
|
16194
16220
|
}
|
|
16195
16221
|
function updateChannel(action) {
|
|
16196
|
-
var payload, channelId, config,
|
|
16222
|
+
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
|
|
16197
16223
|
return _regenerator().w(function (_context20) {
|
|
16198
16224
|
while (1) switch (_context20.p = _context20.n) {
|
|
16199
16225
|
case 0:
|
|
16200
16226
|
_context20.p = 0;
|
|
16201
16227
|
payload = action.payload;
|
|
16202
16228
|
channelId = payload.channelId, config = payload.config;
|
|
16203
|
-
|
|
16229
|
+
_SceytChatClient6 = getClient();
|
|
16204
16230
|
_context20.n = 1;
|
|
16205
16231
|
return effects.call(getChannelFromMap, channelId);
|
|
16206
16232
|
case 1:
|
|
@@ -16225,7 +16251,7 @@ function updateChannel(action) {
|
|
|
16225
16251
|
}
|
|
16226
16252
|
};
|
|
16227
16253
|
_context20.n = 2;
|
|
16228
|
-
return effects.call(
|
|
16254
|
+
return effects.call(_SceytChatClient6.uploadFile, fileToUpload);
|
|
16229
16255
|
case 2:
|
|
16230
16256
|
paramsToUpdate.avatarUrl = _context20.v;
|
|
16231
16257
|
case 3:
|
|
@@ -16269,15 +16295,15 @@ function updateChannel(action) {
|
|
|
16269
16295
|
}, _marked20, null, [[0, 6]]);
|
|
16270
16296
|
}
|
|
16271
16297
|
function checkUsersStatus() {
|
|
16272
|
-
var
|
|
16298
|
+
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
|
|
16273
16299
|
return _regenerator().w(function (_context21) {
|
|
16274
16300
|
while (1) switch (_context21.p = _context21.n) {
|
|
16275
16301
|
case 0:
|
|
16276
16302
|
_context21.p = 0;
|
|
16277
|
-
|
|
16303
|
+
_SceytChatClient7 = getClient();
|
|
16278
16304
|
usersForUpdate = Object.keys(usersMap);
|
|
16279
16305
|
_context21.n = 1;
|
|
16280
|
-
return effects.call(
|
|
16306
|
+
return effects.call(_SceytChatClient7.getUsers, usersForUpdate);
|
|
16281
16307
|
case 1:
|
|
16282
16308
|
updatedUsers = _context21.v;
|
|
16283
16309
|
usersToUpdateMap = {};
|
|
@@ -16535,14 +16561,14 @@ function deleteAllMessages(action) {
|
|
|
16535
16561
|
}, _marked25, null, [[0, 9]]);
|
|
16536
16562
|
}
|
|
16537
16563
|
function joinChannel(action) {
|
|
16538
|
-
var payload, channelId,
|
|
16564
|
+
var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
|
|
16539
16565
|
return _regenerator().w(function (_context26) {
|
|
16540
16566
|
while (1) switch (_context26.p = _context26.n) {
|
|
16541
16567
|
case 0:
|
|
16542
16568
|
_context26.p = 0;
|
|
16543
16569
|
payload = action.payload;
|
|
16544
16570
|
channelId = payload.channelId;
|
|
16545
|
-
|
|
16571
|
+
_SceytChatClient8 = getClient();
|
|
16546
16572
|
_context26.n = 1;
|
|
16547
16573
|
return effects.call(getChannelFromMap, channelId);
|
|
16548
16574
|
case 1:
|
|
@@ -16555,7 +16581,7 @@ function joinChannel(action) {
|
|
|
16555
16581
|
break;
|
|
16556
16582
|
}
|
|
16557
16583
|
_context26.n = 2;
|
|
16558
|
-
return effects.call(
|
|
16584
|
+
return effects.call(_SceytChatClient8.getChannel, channelId);
|
|
16559
16585
|
case 2:
|
|
16560
16586
|
channel = _context26.v;
|
|
16561
16587
|
case 3:
|
package/index.modern.js
CHANGED
|
@@ -15126,7 +15126,7 @@ function getChannels(action) {
|
|
|
15126
15126
|
}, _marked2$1, null, [[18, 20], [0, 23]]);
|
|
15127
15127
|
}
|
|
15128
15128
|
function searchChannels(action) {
|
|
15129
|
-
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
|
|
15129
|
+
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;
|
|
15130
15130
|
return _regenerator().w(function (_context3) {
|
|
15131
15131
|
while (1) switch (_context3.p = _context3.n) {
|
|
15132
15132
|
case 0:
|
|
@@ -15165,31 +15165,39 @@ function searchChannels(action) {
|
|
|
15165
15165
|
contactsList = [];
|
|
15166
15166
|
contactsWithChannelsMap = {};
|
|
15167
15167
|
lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
}
|
|
15183
|
-
} else {
|
|
15184
|
-
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15185
|
-
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15186
|
-
publicChannels.push(channel);
|
|
15187
|
-
} else {
|
|
15168
|
+
handleChannels = function handleChannels(channels) {
|
|
15169
|
+
channels.forEach(function (channel) {
|
|
15170
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15171
|
+
var _channel$metadata;
|
|
15172
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15173
|
+
var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
|
|
15174
|
+
var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
|
|
15175
|
+
return member.id !== SceytChatClient.user.id;
|
|
15176
|
+
});
|
|
15177
|
+
if (directChannelUser && contactsMap[directChannelUser.id]) {
|
|
15178
|
+
contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15179
|
+
}
|
|
15180
|
+
var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
|
|
15181
|
+
if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
|
|
15188
15182
|
chatsGroups.push(channel);
|
|
15189
15183
|
}
|
|
15184
|
+
} else {
|
|
15185
|
+
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15186
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15187
|
+
publicChannels.push(channel);
|
|
15188
|
+
} else {
|
|
15189
|
+
chatsGroups.push(channel);
|
|
15190
|
+
}
|
|
15191
|
+
}
|
|
15190
15192
|
}
|
|
15191
|
-
}
|
|
15192
|
-
}
|
|
15193
|
+
});
|
|
15194
|
+
};
|
|
15195
|
+
channelsMap = {};
|
|
15196
|
+
for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
|
|
15197
|
+
channel = _step.value;
|
|
15198
|
+
channelsMap[channel.id] = channel;
|
|
15199
|
+
}
|
|
15200
|
+
handleChannels(allChannels);
|
|
15193
15201
|
if (getFromContacts) {
|
|
15194
15202
|
Object.values(contactsMap).forEach(function (contact) {
|
|
15195
15203
|
if (!contactsWithChannelsMap[contact.id]) {
|
|
@@ -15223,6 +15231,11 @@ function searchChannels(action) {
|
|
|
15223
15231
|
return call(channelQuery.loadNextPage);
|
|
15224
15232
|
case 5:
|
|
15225
15233
|
channelsData = _context3.v;
|
|
15234
|
+
for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
|
|
15235
|
+
_channel = _step2.value;
|
|
15236
|
+
channelsMap[_channel.id] = _channel;
|
|
15237
|
+
}
|
|
15238
|
+
handleChannels(Object.values(channelsMap));
|
|
15226
15239
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15227
15240
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15228
15241
|
});
|
|
@@ -15245,16 +15258,16 @@ function searchChannels(action) {
|
|
|
15245
15258
|
}, _marked3, null, [[0, 7]]);
|
|
15246
15259
|
}
|
|
15247
15260
|
function getChannelsForForward() {
|
|
15248
|
-
var
|
|
15261
|
+
var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
|
|
15249
15262
|
return _regenerator().w(function (_context4) {
|
|
15250
15263
|
while (1) switch (_context4.p = _context4.n) {
|
|
15251
15264
|
case 0:
|
|
15252
15265
|
_context4.p = 0;
|
|
15253
|
-
|
|
15266
|
+
_SceytChatClient = getClient();
|
|
15254
15267
|
_context4.n = 1;
|
|
15255
15268
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15256
15269
|
case 1:
|
|
15257
|
-
channelQueryBuilder = new
|
|
15270
|
+
channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
|
|
15258
15271
|
channelTypesFilter = getChannelTypesFilter();
|
|
15259
15272
|
channelQueryBuilder.order('lastMessage');
|
|
15260
15273
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15277,7 +15290,7 @@ function getChannelsForForward() {
|
|
|
15277
15290
|
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15278
15291
|
var isSelfChannel = (_channel$metadata2 = channel.metadata) === null || _channel$metadata2 === void 0 ? void 0 : _channel$metadata2.s;
|
|
15279
15292
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
|
|
15280
|
-
return member.id && member.id !==
|
|
15293
|
+
return member.id && member.id !== _SceytChatClient.user.id;
|
|
15281
15294
|
}) : true;
|
|
15282
15295
|
});
|
|
15283
15296
|
_context4.n = 5;
|
|
@@ -15304,15 +15317,15 @@ function getChannelsForForward() {
|
|
|
15304
15317
|
}, _marked4, null, [[0, 8]]);
|
|
15305
15318
|
}
|
|
15306
15319
|
function searchChannelsForForward(action) {
|
|
15307
|
-
var payload, params,
|
|
15320
|
+
var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator3, _step3, channel, channelQuery, channelsData, _iterator4, _step4, _channel2, channelsToAdd, _t7;
|
|
15308
15321
|
return _regenerator().w(function (_context5) {
|
|
15309
15322
|
while (1) switch (_context5.p = _context5.n) {
|
|
15310
15323
|
case 0:
|
|
15311
15324
|
_context5.p = 0;
|
|
15312
15325
|
payload = action.payload;
|
|
15313
|
-
params = payload.params,
|
|
15314
|
-
|
|
15315
|
-
|
|
15326
|
+
params = payload.params, _contactsMap = payload.contactsMap;
|
|
15327
|
+
_SceytChatClient2 = getClient();
|
|
15328
|
+
_getFromContacts = getShowOnlyContactUsers();
|
|
15316
15329
|
_context5.n = 1;
|
|
15317
15330
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15318
15331
|
case 1:
|
|
@@ -15321,7 +15334,7 @@ function searchChannelsForForward(action) {
|
|
|
15321
15334
|
_context5.n = 6;
|
|
15322
15335
|
break;
|
|
15323
15336
|
}
|
|
15324
|
-
channelQueryBuilder = new
|
|
15337
|
+
channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
|
|
15325
15338
|
channelTypesFilter = getChannelTypesFilter();
|
|
15326
15339
|
types = [];
|
|
15327
15340
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15334,41 +15347,49 @@ function searchChannelsForForward(action) {
|
|
|
15334
15347
|
channelQueryBuilder.types(types);
|
|
15335
15348
|
}
|
|
15336
15349
|
allChannels = getAllChannels();
|
|
15337
|
-
|
|
15338
|
-
|
|
15350
|
+
_publicChannels = [];
|
|
15351
|
+
_chatsGroups = [];
|
|
15339
15352
|
contactsList = [];
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
if (channel.
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15353
|
+
_contactsWithChannelsMap = {};
|
|
15354
|
+
_lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15355
|
+
handleChannels = function handleChannels(channels) {
|
|
15356
|
+
channels.forEach(function (channel) {
|
|
15357
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15358
|
+
var _channel$metadata3;
|
|
15359
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15360
|
+
var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
|
|
15361
|
+
var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
|
|
15362
|
+
return member.id !== _SceytChatClient2.user.id;
|
|
15363
|
+
});
|
|
15364
|
+
if (directChannelUser && _contactsMap[directChannelUser.id]) {
|
|
15365
|
+
_contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15366
|
+
}
|
|
15367
|
+
var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
|
|
15368
|
+
if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
|
|
15369
|
+
_chatsGroups.push(channel);
|
|
15370
|
+
}
|
|
15371
|
+
} else {
|
|
15372
|
+
if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
|
|
15373
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15374
|
+
_publicChannels.push(channel);
|
|
15375
|
+
} else {
|
|
15376
|
+
_chatsGroups.push(channel);
|
|
15377
|
+
}
|
|
15363
15378
|
}
|
|
15364
15379
|
}
|
|
15365
|
-
}
|
|
15366
|
-
}
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15380
|
+
});
|
|
15381
|
+
};
|
|
15382
|
+
channelsMap = {};
|
|
15383
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
|
|
15384
|
+
channel = _step3.value;
|
|
15385
|
+
channelsMap[channel.id] = channel;
|
|
15386
|
+
}
|
|
15387
|
+
handleChannels(allChannels);
|
|
15388
|
+
if (_getFromContacts) {
|
|
15389
|
+
Object.values(_contactsMap).forEach(function (contact) {
|
|
15390
|
+
if (!_contactsWithChannelsMap[contact.id]) {
|
|
15370
15391
|
var userName = makeUsername(contact, undefined, true).toLowerCase();
|
|
15371
|
-
if (userName.includes(
|
|
15392
|
+
if (userName.includes(_lowerCaseSearchBy)) {
|
|
15372
15393
|
contactsList.push(contact);
|
|
15373
15394
|
}
|
|
15374
15395
|
}
|
|
@@ -15376,15 +15397,15 @@ function searchChannelsForForward(action) {
|
|
|
15376
15397
|
}
|
|
15377
15398
|
_context5.n = 2;
|
|
15378
15399
|
return put(setSearchedChannelsForForwardAC({
|
|
15379
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15380
|
-
channels: JSON.parse(JSON.stringify(
|
|
15400
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15401
|
+
channels: JSON.parse(JSON.stringify(_publicChannels)),
|
|
15381
15402
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15382
15403
|
}));
|
|
15383
15404
|
case 2:
|
|
15384
15405
|
_context5.n = 3;
|
|
15385
15406
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
|
|
15386
15407
|
case 3:
|
|
15387
|
-
channelQueryBuilder.query(
|
|
15408
|
+
channelQueryBuilder.query(_lowerCaseSearchBy);
|
|
15388
15409
|
channelQueryBuilder.limit(params.limit || 50);
|
|
15389
15410
|
channelQueryBuilder.order('lastMessage');
|
|
15390
15411
|
channelQueryBuilder.filterKey(['subject']);
|
|
@@ -15397,12 +15418,17 @@ function searchChannelsForForward(action) {
|
|
|
15397
15418
|
return call(channelQuery.loadNextPage);
|
|
15398
15419
|
case 5:
|
|
15399
15420
|
channelsData = _context5.v;
|
|
15421
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
|
|
15422
|
+
_channel2 = _step4.value;
|
|
15423
|
+
channelsMap[_channel2.id] = _channel2;
|
|
15424
|
+
}
|
|
15425
|
+
handleChannels(Object.values(channelsMap));
|
|
15400
15426
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15401
15427
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15402
15428
|
});
|
|
15403
15429
|
_context5.n = 6;
|
|
15404
15430
|
return put(setSearchedChannelsForForwardAC({
|
|
15405
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15431
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15406
15432
|
channels: JSON.parse(JSON.stringify(channelsToAdd)),
|
|
15407
15433
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15408
15434
|
}));
|
|
@@ -15499,15 +15525,15 @@ function channelsLoadMore(action) {
|
|
|
15499
15525
|
}, _marked6, null, [[0, 9]]);
|
|
15500
15526
|
}
|
|
15501
15527
|
function getChannelMentions(action) {
|
|
15502
|
-
var payload, channelId,
|
|
15528
|
+
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
|
|
15503
15529
|
return _regenerator().w(function (_context7) {
|
|
15504
15530
|
while (1) switch (_context7.p = _context7.n) {
|
|
15505
15531
|
case 0:
|
|
15506
15532
|
_context7.p = 0;
|
|
15507
15533
|
payload = action.payload;
|
|
15508
15534
|
channelId = payload.channelId;
|
|
15509
|
-
|
|
15510
|
-
mentionsQueryBuilder = new
|
|
15535
|
+
_SceytChatClient3 = getClient();
|
|
15536
|
+
mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
|
|
15511
15537
|
mentionsQueryBuilder.setChannelId(channelId);
|
|
15512
15538
|
mentionsQueryBuilder.limit(10);
|
|
15513
15539
|
mentionsQueryBuilder.setDirection(queryDirection.NEXT);
|
|
@@ -15536,14 +15562,14 @@ function getChannelMentions(action) {
|
|
|
15536
15562
|
}, _marked7, null, [[0, 4]]);
|
|
15537
15563
|
}
|
|
15538
15564
|
function channelsForForwardLoadMore(action) {
|
|
15539
|
-
var payload, limit,
|
|
15565
|
+
var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
|
|
15540
15566
|
return _regenerator().w(function (_context8) {
|
|
15541
15567
|
while (1) switch (_context8.p = _context8.n) {
|
|
15542
15568
|
case 0:
|
|
15543
15569
|
_context8.p = 0;
|
|
15544
15570
|
payload = action.payload;
|
|
15545
15571
|
limit = payload.limit;
|
|
15546
|
-
|
|
15572
|
+
_SceytChatClient4 = getClient();
|
|
15547
15573
|
channelQueryForward = query.channelQueryForward;
|
|
15548
15574
|
if (limit) {
|
|
15549
15575
|
channelQueryForward.limit = limit;
|
|
@@ -15560,7 +15586,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15560
15586
|
case 3:
|
|
15561
15587
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15562
15588
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? channel.members.find(function (member) {
|
|
15563
|
-
return member.id && member.id !==
|
|
15589
|
+
return member.id && member.id !== _SceytChatClient4.user.id;
|
|
15564
15590
|
}) : true;
|
|
15565
15591
|
});
|
|
15566
15592
|
_context8.n = 4;
|
|
@@ -15586,7 +15612,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15586
15612
|
}, _marked8, null, [[0, 7]]);
|
|
15587
15613
|
}
|
|
15588
15614
|
function markMessagesRead(action) {
|
|
15589
|
-
var payload, channelId, messageIds, channel, messageListMarker,
|
|
15615
|
+
var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
|
|
15590
15616
|
return _regenerator().w(function (_context9) {
|
|
15591
15617
|
while (1) switch (_context9.p = _context9.n) {
|
|
15592
15618
|
case 0:
|
|
@@ -15619,13 +15645,13 @@ function markMessagesRead(action) {
|
|
|
15619
15645
|
updateChannelOnAllChannels(channel.id, {
|
|
15620
15646
|
lastReadMessageId: channel.lastDisplayedMessageId
|
|
15621
15647
|
});
|
|
15622
|
-
|
|
15648
|
+
_iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
|
|
15623
15649
|
case 5:
|
|
15624
|
-
if ((
|
|
15650
|
+
if ((_step5 = _iterator5()).done) {
|
|
15625
15651
|
_context9.n = 8;
|
|
15626
15652
|
break;
|
|
15627
15653
|
}
|
|
15628
|
-
messageId =
|
|
15654
|
+
messageId = _step5.value;
|
|
15629
15655
|
updateParams = {
|
|
15630
15656
|
deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
|
|
15631
15657
|
userMarkers: [{
|
|
@@ -15696,7 +15722,7 @@ function markMessagesDelivered(action) {
|
|
|
15696
15722
|
}, _marked0, null, [[1, 4]]);
|
|
15697
15723
|
}
|
|
15698
15724
|
function switchChannel(action) {
|
|
15699
|
-
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel,
|
|
15725
|
+
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
|
|
15700
15726
|
return _regenerator().w(function (_context1) {
|
|
15701
15727
|
while (1) switch (_context1.p = _context1.n) {
|
|
15702
15728
|
case 0:
|
|
@@ -15734,9 +15760,9 @@ function switchChannel(action) {
|
|
|
15734
15760
|
_context1.n = 8;
|
|
15735
15761
|
break;
|
|
15736
15762
|
case 5:
|
|
15737
|
-
|
|
15763
|
+
_SceytChatClient5 = getClient();
|
|
15738
15764
|
_context1.n = 6;
|
|
15739
|
-
return call(
|
|
15765
|
+
return call(_SceytChatClient5.getChannel, channel.id);
|
|
15740
15766
|
case 6:
|
|
15741
15767
|
fetchedChannel = _context1.v;
|
|
15742
15768
|
addChannelToAllChannels(fetchedChannel);
|
|
@@ -16172,14 +16198,14 @@ function blockChannel(action) {
|
|
|
16172
16198
|
}, _marked19, null, [[0, 5]]);
|
|
16173
16199
|
}
|
|
16174
16200
|
function updateChannel(action) {
|
|
16175
|
-
var payload, channelId, config,
|
|
16201
|
+
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
|
|
16176
16202
|
return _regenerator().w(function (_context20) {
|
|
16177
16203
|
while (1) switch (_context20.p = _context20.n) {
|
|
16178
16204
|
case 0:
|
|
16179
16205
|
_context20.p = 0;
|
|
16180
16206
|
payload = action.payload;
|
|
16181
16207
|
channelId = payload.channelId, config = payload.config;
|
|
16182
|
-
|
|
16208
|
+
_SceytChatClient6 = getClient();
|
|
16183
16209
|
_context20.n = 1;
|
|
16184
16210
|
return call(getChannelFromMap, channelId);
|
|
16185
16211
|
case 1:
|
|
@@ -16204,7 +16230,7 @@ function updateChannel(action) {
|
|
|
16204
16230
|
}
|
|
16205
16231
|
};
|
|
16206
16232
|
_context20.n = 2;
|
|
16207
|
-
return call(
|
|
16233
|
+
return call(_SceytChatClient6.uploadFile, fileToUpload);
|
|
16208
16234
|
case 2:
|
|
16209
16235
|
paramsToUpdate.avatarUrl = _context20.v;
|
|
16210
16236
|
case 3:
|
|
@@ -16248,15 +16274,15 @@ function updateChannel(action) {
|
|
|
16248
16274
|
}, _marked20, null, [[0, 6]]);
|
|
16249
16275
|
}
|
|
16250
16276
|
function checkUsersStatus() {
|
|
16251
|
-
var
|
|
16277
|
+
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
|
|
16252
16278
|
return _regenerator().w(function (_context21) {
|
|
16253
16279
|
while (1) switch (_context21.p = _context21.n) {
|
|
16254
16280
|
case 0:
|
|
16255
16281
|
_context21.p = 0;
|
|
16256
|
-
|
|
16282
|
+
_SceytChatClient7 = getClient();
|
|
16257
16283
|
usersForUpdate = Object.keys(usersMap);
|
|
16258
16284
|
_context21.n = 1;
|
|
16259
|
-
return call(
|
|
16285
|
+
return call(_SceytChatClient7.getUsers, usersForUpdate);
|
|
16260
16286
|
case 1:
|
|
16261
16287
|
updatedUsers = _context21.v;
|
|
16262
16288
|
usersToUpdateMap = {};
|
|
@@ -16514,14 +16540,14 @@ function deleteAllMessages(action) {
|
|
|
16514
16540
|
}, _marked25, null, [[0, 9]]);
|
|
16515
16541
|
}
|
|
16516
16542
|
function joinChannel(action) {
|
|
16517
|
-
var payload, channelId,
|
|
16543
|
+
var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
|
|
16518
16544
|
return _regenerator().w(function (_context26) {
|
|
16519
16545
|
while (1) switch (_context26.p = _context26.n) {
|
|
16520
16546
|
case 0:
|
|
16521
16547
|
_context26.p = 0;
|
|
16522
16548
|
payload = action.payload;
|
|
16523
16549
|
channelId = payload.channelId;
|
|
16524
|
-
|
|
16550
|
+
_SceytChatClient8 = getClient();
|
|
16525
16551
|
_context26.n = 1;
|
|
16526
16552
|
return call(getChannelFromMap, channelId);
|
|
16527
16553
|
case 1:
|
|
@@ -16534,7 +16560,7 @@ function joinChannel(action) {
|
|
|
16534
16560
|
break;
|
|
16535
16561
|
}
|
|
16536
16562
|
_context26.n = 2;
|
|
16537
|
-
return call(
|
|
16563
|
+
return call(_SceytChatClient8.getChannel, channelId);
|
|
16538
16564
|
case 2:
|
|
16539
16565
|
channel = _context26.v;
|
|
16540
16566
|
case 3:
|