sceyt-chat-react-uikit 1.7.1-beta.1 → 1.7.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/index.d.ts +2 -1
- package/index.js +686 -516
- package/index.modern.js +531 -365
- package/package.json +1 -1
package/index.modern.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { createElement as createElement$1, useRef, useEffect, useLayoutEffect, useState, useMemo, useCallback, memo, createRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createSelectorHook, createDispatchHook, createStoreHook, shallowEqual, Provider } from 'react-redux';
|
|
3
3
|
import log from 'loglevel';
|
|
4
4
|
import createSagaMiddleware, { eventChannel } from 'redux-saga';
|
|
5
5
|
import FileSaver from 'file-saver';
|
|
@@ -10052,25 +10052,23 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
10052
10052
|
}
|
|
10053
10053
|
var updatedMessageData = null;
|
|
10054
10054
|
if (messagesMap[channelId]) {
|
|
10055
|
-
|
|
10055
|
+
var messagesList = [];
|
|
10056
|
+
for (var _iterator = _createForOfIteratorHelperLoose(messagesMap[channelId]), _step; !(_step = _iterator()).done;) {
|
|
10057
|
+
var mes = _step.value;
|
|
10056
10058
|
if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
|
|
10057
10059
|
if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
|
|
10058
10060
|
updatedMessageData = _extends({}, updatedMessage.params);
|
|
10059
|
-
|
|
10061
|
+
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10062
|
+
continue;
|
|
10060
10063
|
} else {
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
return index === self.findIndex(function (t) {
|
|
10065
|
-
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10066
|
-
});
|
|
10067
|
-
})
|
|
10068
|
-
});
|
|
10069
|
-
return updatedMessage;
|
|
10064
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params);
|
|
10065
|
+
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10066
|
+
continue;
|
|
10070
10067
|
}
|
|
10071
10068
|
}
|
|
10072
|
-
|
|
10073
|
-
}
|
|
10069
|
+
messagesList.push(mes);
|
|
10070
|
+
}
|
|
10071
|
+
messagesMap[channelId] = messagesList;
|
|
10074
10072
|
}
|
|
10075
10073
|
return updatedMessageData;
|
|
10076
10074
|
}
|
|
@@ -11093,12 +11091,13 @@ var ThemeReducer = (function (state, _ref) {
|
|
|
11093
11091
|
}
|
|
11094
11092
|
});
|
|
11095
11093
|
|
|
11096
|
-
var createChannelAC = function createChannelAC(channelData, dontCreateIfNotExists) {
|
|
11094
|
+
var createChannelAC = function createChannelAC(channelData, dontCreateIfNotExists, callback) {
|
|
11097
11095
|
return {
|
|
11098
11096
|
type: CREATE_CHANNEL,
|
|
11099
11097
|
payload: {
|
|
11100
11098
|
channelData: channelData,
|
|
11101
|
-
dontCreateIfNotExists: dontCreateIfNotExists
|
|
11099
|
+
dontCreateIfNotExists: dontCreateIfNotExists,
|
|
11100
|
+
callback: callback
|
|
11102
11101
|
}
|
|
11103
11102
|
};
|
|
11104
11103
|
};
|
|
@@ -11264,11 +11263,15 @@ var setActiveChannelAC = function setActiveChannelAC(channel) {
|
|
|
11264
11263
|
channel: channel
|
|
11265
11264
|
});
|
|
11266
11265
|
};
|
|
11267
|
-
var switchChannelActionAC = function switchChannelActionAC(channel) {
|
|
11266
|
+
var switchChannelActionAC = function switchChannelActionAC(channel, updateActiveChannel) {
|
|
11267
|
+
if (updateActiveChannel === void 0) {
|
|
11268
|
+
updateActiveChannel = true;
|
|
11269
|
+
}
|
|
11268
11270
|
return {
|
|
11269
11271
|
type: SWITCH_CHANNEL,
|
|
11270
11272
|
payload: {
|
|
11271
|
-
channel: channel
|
|
11273
|
+
channel: channel,
|
|
11274
|
+
updateActiveChannel: updateActiveChannel
|
|
11272
11275
|
}
|
|
11273
11276
|
};
|
|
11274
11277
|
};
|
|
@@ -11500,6 +11503,7 @@ var getChannelMentionsAC = function getChannelMentionsAC(channelId) {
|
|
|
11500
11503
|
};
|
|
11501
11504
|
|
|
11502
11505
|
var GET_MESSAGES = 'GET_MESSAGES';
|
|
11506
|
+
var GET_MESSAGE = 'GET_MESSAGE';
|
|
11503
11507
|
var LOAD_MORE_MESSAGES = 'LOAD_MORE_MESSAGES';
|
|
11504
11508
|
var SEND_MESSAGE = 'SEND_MESSAGE';
|
|
11505
11509
|
var SEND_TEXT_MESSAGE = 'SEND_TEXT_MESSAGE';
|
|
@@ -11608,6 +11612,16 @@ function getMessagesAC(channel, loadWithLastMessage, messageId, limit, withDeliv
|
|
|
11608
11612
|
}
|
|
11609
11613
|
};
|
|
11610
11614
|
}
|
|
11615
|
+
function getMessageAC(channelId, messageId, limit) {
|
|
11616
|
+
return {
|
|
11617
|
+
type: GET_MESSAGE,
|
|
11618
|
+
payload: {
|
|
11619
|
+
channelId: channelId,
|
|
11620
|
+
messageId: messageId,
|
|
11621
|
+
limit: limit
|
|
11622
|
+
}
|
|
11623
|
+
};
|
|
11624
|
+
}
|
|
11611
11625
|
function setScrollToMessagesAC(messageId, highlight) {
|
|
11612
11626
|
if (highlight === void 0) {
|
|
11613
11627
|
highlight = true;
|
|
@@ -14740,13 +14754,13 @@ var _marked$2 = /*#__PURE__*/_regenerator().m(createChannel),
|
|
|
14740
14754
|
_marked27 = /*#__PURE__*/_regenerator().m(watchForChannelEvents),
|
|
14741
14755
|
_marked28 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
|
|
14742
14756
|
function createChannel(action) {
|
|
14743
|
-
var payload, channelData, dontCreateIfNotExists, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, checkChannelExist, messageToSend, _allChannels, _memberId, _t;
|
|
14757
|
+
var payload, channelData, dontCreateIfNotExists, callback, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, checkChannelExist, messageToSend, _allChannels, _memberId, _t;
|
|
14744
14758
|
return _regenerator().w(function (_context) {
|
|
14745
14759
|
while (1) switch (_context.p = _context.n) {
|
|
14746
14760
|
case 0:
|
|
14747
14761
|
_context.p = 0;
|
|
14748
14762
|
payload = action.payload;
|
|
14749
|
-
channelData = payload.channelData, dontCreateIfNotExists = payload.dontCreateIfNotExists;
|
|
14763
|
+
channelData = payload.channelData, dontCreateIfNotExists = payload.dontCreateIfNotExists, callback = payload.callback;
|
|
14750
14764
|
SceytChatClient = getClient();
|
|
14751
14765
|
createChannelData = _extends({}, channelData);
|
|
14752
14766
|
if (!createChannelData.avatarFile) {
|
|
@@ -14782,8 +14796,8 @@ function createChannel(action) {
|
|
|
14782
14796
|
allChannels.forEach(function (channel) {
|
|
14783
14797
|
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
14784
14798
|
if (isSelfChannel) {
|
|
14785
|
-
var
|
|
14786
|
-
if (
|
|
14799
|
+
var _channel$members;
|
|
14800
|
+
if (((_channel$members = channel.members) === null || _channel$members === void 0 ? void 0 : _channel$members.length) === 1 && channel.members[0].id === memberId) {
|
|
14787
14801
|
channelIsExistOnAllChannels = true;
|
|
14788
14802
|
}
|
|
14789
14803
|
} else {
|
|
@@ -14873,7 +14887,7 @@ function createChannel(action) {
|
|
|
14873
14887
|
_context.n = 14;
|
|
14874
14888
|
return put(switchChannelActionAC(JSON.parse(JSON.stringify(_extends({}, createdChannel, {
|
|
14875
14889
|
isLinkedChannel: dontCreateIfNotExists
|
|
14876
|
-
})))));
|
|
14890
|
+
}))), !callback));
|
|
14877
14891
|
case 14:
|
|
14878
14892
|
if (dontCreateIfNotExists) {
|
|
14879
14893
|
if (!channelIsExistOnAllChannels) {
|
|
@@ -14903,19 +14917,27 @@ function createChannel(action) {
|
|
|
14903
14917
|
addChannelToAllChannels(createdChannel);
|
|
14904
14918
|
}
|
|
14905
14919
|
}
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14920
|
+
if (!callback) {
|
|
14921
|
+
_context.n = 15;
|
|
14922
|
+
break;
|
|
14923
|
+
}
|
|
14924
|
+
callback(createdChannel);
|
|
14925
|
+
_context.n = 16;
|
|
14910
14926
|
break;
|
|
14927
|
+
case 15:
|
|
14928
|
+
_context.n = 16;
|
|
14929
|
+
return call(setActiveChannelId, createdChannel.id);
|
|
14911
14930
|
case 16:
|
|
14912
|
-
_context.
|
|
14931
|
+
_context.n = 18;
|
|
14932
|
+
break;
|
|
14933
|
+
case 17:
|
|
14934
|
+
_context.p = 17;
|
|
14913
14935
|
_t = _context.v;
|
|
14914
14936
|
log.error(_t, 'Error on create channel');
|
|
14915
|
-
case
|
|
14937
|
+
case 18:
|
|
14916
14938
|
return _context.a(2);
|
|
14917
14939
|
}
|
|
14918
|
-
}, _marked$2, null, [[0,
|
|
14940
|
+
}, _marked$2, null, [[0, 17]]);
|
|
14919
14941
|
}
|
|
14920
14942
|
function getChannels(action) {
|
|
14921
14943
|
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;
|
|
@@ -15097,7 +15119,7 @@ function getChannels(action) {
|
|
|
15097
15119
|
}, _marked2$1, null, [[18, 20], [0, 23]]);
|
|
15098
15120
|
}
|
|
15099
15121
|
function searchChannels(action) {
|
|
15100
|
-
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
|
|
15122
|
+
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;
|
|
15101
15123
|
return _regenerator().w(function (_context3) {
|
|
15102
15124
|
while (1) switch (_context3.p = _context3.n) {
|
|
15103
15125
|
case 0:
|
|
@@ -15136,31 +15158,38 @@ function searchChannels(action) {
|
|
|
15136
15158
|
contactsList = [];
|
|
15137
15159
|
contactsWithChannelsMap = {};
|
|
15138
15160
|
lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
chatsGroups.push(channel);
|
|
15153
|
-
}
|
|
15154
|
-
} else {
|
|
15155
|
-
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15156
|
-
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15157
|
-
publicChannels.push(channel);
|
|
15158
|
-
} else {
|
|
15161
|
+
handleChannels = function handleChannels(channels) {
|
|
15162
|
+
channels.forEach(function (channel) {
|
|
15163
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15164
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15165
|
+
var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === SceytChatClient.user.id;
|
|
15166
|
+
var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
|
|
15167
|
+
return member.id !== SceytChatClient.user.id;
|
|
15168
|
+
});
|
|
15169
|
+
if (directChannelUser && contactsMap[directChannelUser.id]) {
|
|
15170
|
+
contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15171
|
+
}
|
|
15172
|
+
var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
|
|
15173
|
+
if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
|
|
15159
15174
|
chatsGroups.push(channel);
|
|
15160
15175
|
}
|
|
15176
|
+
} else {
|
|
15177
|
+
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15178
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15179
|
+
publicChannels.push(channel);
|
|
15180
|
+
} else {
|
|
15181
|
+
chatsGroups.push(channel);
|
|
15182
|
+
}
|
|
15183
|
+
}
|
|
15161
15184
|
}
|
|
15162
|
-
}
|
|
15163
|
-
}
|
|
15185
|
+
});
|
|
15186
|
+
};
|
|
15187
|
+
channelsMap = {};
|
|
15188
|
+
for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
|
|
15189
|
+
channel = _step.value;
|
|
15190
|
+
channelsMap[channel.id] = channel;
|
|
15191
|
+
}
|
|
15192
|
+
handleChannels(allChannels);
|
|
15164
15193
|
if (getFromContacts) {
|
|
15165
15194
|
Object.values(contactsMap).forEach(function (contact) {
|
|
15166
15195
|
if (!contactsWithChannelsMap[contact.id]) {
|
|
@@ -15194,6 +15223,13 @@ function searchChannels(action) {
|
|
|
15194
15223
|
return call(channelQuery.loadNextPage);
|
|
15195
15224
|
case 5:
|
|
15196
15225
|
channelsData = _context3.v;
|
|
15226
|
+
for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
|
|
15227
|
+
_channel = _step2.value;
|
|
15228
|
+
channelsMap[_channel.id] = _channel;
|
|
15229
|
+
}
|
|
15230
|
+
chatsGroups = [];
|
|
15231
|
+
publicChannels = [];
|
|
15232
|
+
handleChannels(Object.values(channelsMap));
|
|
15197
15233
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15198
15234
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15199
15235
|
});
|
|
@@ -15216,16 +15252,16 @@ function searchChannels(action) {
|
|
|
15216
15252
|
}, _marked3, null, [[0, 7]]);
|
|
15217
15253
|
}
|
|
15218
15254
|
function getChannelsForForward() {
|
|
15219
|
-
var
|
|
15255
|
+
var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
|
|
15220
15256
|
return _regenerator().w(function (_context4) {
|
|
15221
15257
|
while (1) switch (_context4.p = _context4.n) {
|
|
15222
15258
|
case 0:
|
|
15223
15259
|
_context4.p = 0;
|
|
15224
|
-
|
|
15260
|
+
_SceytChatClient = getClient();
|
|
15225
15261
|
_context4.n = 1;
|
|
15226
15262
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15227
15263
|
case 1:
|
|
15228
|
-
channelQueryBuilder = new
|
|
15264
|
+
channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
|
|
15229
15265
|
channelTypesFilter = getChannelTypesFilter();
|
|
15230
15266
|
channelQueryBuilder.order('lastMessage');
|
|
15231
15267
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15244,11 +15280,10 @@ function getChannelsForForward() {
|
|
|
15244
15280
|
return put(channelHasNextAC(channelsData.hasNext, true));
|
|
15245
15281
|
case 4:
|
|
15246
15282
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15247
|
-
var _channel$metadata2;
|
|
15248
15283
|
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15249
|
-
var isSelfChannel =
|
|
15284
|
+
var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === _SceytChatClient.user.id;
|
|
15250
15285
|
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) {
|
|
15251
|
-
return member.id && member.id !==
|
|
15286
|
+
return member.id && member.id !== _SceytChatClient.user.id;
|
|
15252
15287
|
}) : true;
|
|
15253
15288
|
});
|
|
15254
15289
|
_context4.n = 5;
|
|
@@ -15275,15 +15310,15 @@ function getChannelsForForward() {
|
|
|
15275
15310
|
}, _marked4, null, [[0, 8]]);
|
|
15276
15311
|
}
|
|
15277
15312
|
function searchChannelsForForward(action) {
|
|
15278
|
-
var payload, params,
|
|
15313
|
+
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;
|
|
15279
15314
|
return _regenerator().w(function (_context5) {
|
|
15280
15315
|
while (1) switch (_context5.p = _context5.n) {
|
|
15281
15316
|
case 0:
|
|
15282
15317
|
_context5.p = 0;
|
|
15283
15318
|
payload = action.payload;
|
|
15284
|
-
params = payload.params,
|
|
15285
|
-
|
|
15286
|
-
|
|
15319
|
+
params = payload.params, _contactsMap = payload.contactsMap;
|
|
15320
|
+
_SceytChatClient2 = getClient();
|
|
15321
|
+
_getFromContacts = getShowOnlyContactUsers();
|
|
15287
15322
|
_context5.n = 1;
|
|
15288
15323
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15289
15324
|
case 1:
|
|
@@ -15292,7 +15327,7 @@ function searchChannelsForForward(action) {
|
|
|
15292
15327
|
_context5.n = 6;
|
|
15293
15328
|
break;
|
|
15294
15329
|
}
|
|
15295
|
-
channelQueryBuilder = new
|
|
15330
|
+
channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
|
|
15296
15331
|
channelTypesFilter = getChannelTypesFilter();
|
|
15297
15332
|
types = [];
|
|
15298
15333
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15305,41 +15340,48 @@ function searchChannelsForForward(action) {
|
|
|
15305
15340
|
channelQueryBuilder.types(types);
|
|
15306
15341
|
}
|
|
15307
15342
|
allChannels = getAllChannels();
|
|
15308
|
-
|
|
15309
|
-
|
|
15343
|
+
_publicChannels = [];
|
|
15344
|
+
_chatsGroups = [];
|
|
15310
15345
|
contactsList = [];
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
|
|
15323
|
-
|
|
15324
|
-
|
|
15325
|
-
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15346
|
+
_contactsWithChannelsMap = {};
|
|
15347
|
+
_lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15348
|
+
handleChannels = function handleChannels(channels) {
|
|
15349
|
+
channels.forEach(function (channel) {
|
|
15350
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15351
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15352
|
+
var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === _SceytChatClient2.user.id;
|
|
15353
|
+
var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
|
|
15354
|
+
return member.id !== _SceytChatClient2.user.id;
|
|
15355
|
+
});
|
|
15356
|
+
if (directChannelUser && _contactsMap[directChannelUser.id]) {
|
|
15357
|
+
_contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15358
|
+
}
|
|
15359
|
+
var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
|
|
15360
|
+
if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
|
|
15361
|
+
_chatsGroups.push(channel);
|
|
15362
|
+
}
|
|
15363
|
+
} else {
|
|
15364
|
+
if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
|
|
15365
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15366
|
+
_publicChannels.push(channel);
|
|
15367
|
+
} else {
|
|
15368
|
+
_chatsGroups.push(channel);
|
|
15369
|
+
}
|
|
15334
15370
|
}
|
|
15335
15371
|
}
|
|
15336
|
-
}
|
|
15337
|
-
}
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15372
|
+
});
|
|
15373
|
+
};
|
|
15374
|
+
channelsMap = {};
|
|
15375
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
|
|
15376
|
+
channel = _step3.value;
|
|
15377
|
+
channelsMap[channel.id] = channel;
|
|
15378
|
+
}
|
|
15379
|
+
handleChannels(allChannels);
|
|
15380
|
+
if (_getFromContacts) {
|
|
15381
|
+
Object.values(_contactsMap).forEach(function (contact) {
|
|
15382
|
+
if (!_contactsWithChannelsMap[contact.id]) {
|
|
15341
15383
|
var userName = makeUsername(contact, undefined, true).toLowerCase();
|
|
15342
|
-
if (userName.includes(
|
|
15384
|
+
if (userName.includes(_lowerCaseSearchBy)) {
|
|
15343
15385
|
contactsList.push(contact);
|
|
15344
15386
|
}
|
|
15345
15387
|
}
|
|
@@ -15347,15 +15389,15 @@ function searchChannelsForForward(action) {
|
|
|
15347
15389
|
}
|
|
15348
15390
|
_context5.n = 2;
|
|
15349
15391
|
return put(setSearchedChannelsForForwardAC({
|
|
15350
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15351
|
-
channels: JSON.parse(JSON.stringify(
|
|
15392
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15393
|
+
channels: JSON.parse(JSON.stringify(_publicChannels)),
|
|
15352
15394
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15353
15395
|
}));
|
|
15354
15396
|
case 2:
|
|
15355
15397
|
_context5.n = 3;
|
|
15356
15398
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
|
|
15357
15399
|
case 3:
|
|
15358
|
-
channelQueryBuilder.query(
|
|
15400
|
+
channelQueryBuilder.query(_lowerCaseSearchBy);
|
|
15359
15401
|
channelQueryBuilder.limit(params.limit || 50);
|
|
15360
15402
|
channelQueryBuilder.order('lastMessage');
|
|
15361
15403
|
channelQueryBuilder.filterKey(['subject']);
|
|
@@ -15368,12 +15410,19 @@ function searchChannelsForForward(action) {
|
|
|
15368
15410
|
return call(channelQuery.loadNextPage);
|
|
15369
15411
|
case 5:
|
|
15370
15412
|
channelsData = _context5.v;
|
|
15413
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
|
|
15414
|
+
_channel2 = _step4.value;
|
|
15415
|
+
channelsMap[_channel2.id] = _channel2;
|
|
15416
|
+
}
|
|
15417
|
+
_chatsGroups = [];
|
|
15418
|
+
_publicChannels = [];
|
|
15419
|
+
handleChannels(Object.values(channelsMap));
|
|
15371
15420
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15372
15421
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15373
15422
|
});
|
|
15374
15423
|
_context5.n = 6;
|
|
15375
15424
|
return put(setSearchedChannelsForForwardAC({
|
|
15376
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15425
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15377
15426
|
channels: JSON.parse(JSON.stringify(channelsToAdd)),
|
|
15378
15427
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15379
15428
|
}));
|
|
@@ -15470,15 +15519,15 @@ function channelsLoadMore(action) {
|
|
|
15470
15519
|
}, _marked6, null, [[0, 9]]);
|
|
15471
15520
|
}
|
|
15472
15521
|
function getChannelMentions(action) {
|
|
15473
|
-
var payload, channelId,
|
|
15522
|
+
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
|
|
15474
15523
|
return _regenerator().w(function (_context7) {
|
|
15475
15524
|
while (1) switch (_context7.p = _context7.n) {
|
|
15476
15525
|
case 0:
|
|
15477
15526
|
_context7.p = 0;
|
|
15478
15527
|
payload = action.payload;
|
|
15479
15528
|
channelId = payload.channelId;
|
|
15480
|
-
|
|
15481
|
-
mentionsQueryBuilder = new
|
|
15529
|
+
_SceytChatClient3 = getClient();
|
|
15530
|
+
mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
|
|
15482
15531
|
mentionsQueryBuilder.setChannelId(channelId);
|
|
15483
15532
|
mentionsQueryBuilder.limit(10);
|
|
15484
15533
|
mentionsQueryBuilder.setDirection(queryDirection.NEXT);
|
|
@@ -15507,14 +15556,14 @@ function getChannelMentions(action) {
|
|
|
15507
15556
|
}, _marked7, null, [[0, 4]]);
|
|
15508
15557
|
}
|
|
15509
15558
|
function channelsForForwardLoadMore(action) {
|
|
15510
|
-
var payload, limit,
|
|
15559
|
+
var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
|
|
15511
15560
|
return _regenerator().w(function (_context8) {
|
|
15512
15561
|
while (1) switch (_context8.p = _context8.n) {
|
|
15513
15562
|
case 0:
|
|
15514
15563
|
_context8.p = 0;
|
|
15515
15564
|
payload = action.payload;
|
|
15516
15565
|
limit = payload.limit;
|
|
15517
|
-
|
|
15566
|
+
_SceytChatClient4 = getClient();
|
|
15518
15567
|
channelQueryForward = query.channelQueryForward;
|
|
15519
15568
|
if (limit) {
|
|
15520
15569
|
channelQueryForward.limit = limit;
|
|
@@ -15531,7 +15580,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15531
15580
|
case 3:
|
|
15532
15581
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15533
15582
|
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) {
|
|
15534
|
-
return member.id && member.id !==
|
|
15583
|
+
return member.id && member.id !== _SceytChatClient4.user.id;
|
|
15535
15584
|
}) : true;
|
|
15536
15585
|
});
|
|
15537
15586
|
_context8.n = 4;
|
|
@@ -15557,7 +15606,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15557
15606
|
}, _marked8, null, [[0, 7]]);
|
|
15558
15607
|
}
|
|
15559
15608
|
function markMessagesRead(action) {
|
|
15560
|
-
var payload, channelId, messageIds, channel, messageListMarker,
|
|
15609
|
+
var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
|
|
15561
15610
|
return _regenerator().w(function (_context9) {
|
|
15562
15611
|
while (1) switch (_context9.p = _context9.n) {
|
|
15563
15612
|
case 0:
|
|
@@ -15590,13 +15639,13 @@ function markMessagesRead(action) {
|
|
|
15590
15639
|
updateChannelOnAllChannels(channel.id, {
|
|
15591
15640
|
lastReadMessageId: channel.lastDisplayedMessageId
|
|
15592
15641
|
});
|
|
15593
|
-
|
|
15642
|
+
_iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
|
|
15594
15643
|
case 5:
|
|
15595
|
-
if ((
|
|
15644
|
+
if ((_step5 = _iterator5()).done) {
|
|
15596
15645
|
_context9.n = 8;
|
|
15597
15646
|
break;
|
|
15598
15647
|
}
|
|
15599
|
-
messageId =
|
|
15648
|
+
messageId = _step5.value;
|
|
15600
15649
|
updateParams = {
|
|
15601
15650
|
deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
|
|
15602
15651
|
userMarkers: [{
|
|
@@ -15667,15 +15716,15 @@ function markMessagesDelivered(action) {
|
|
|
15667
15716
|
}, _marked0, null, [[1, 4]]);
|
|
15668
15717
|
}
|
|
15669
15718
|
function switchChannel(action) {
|
|
15670
|
-
var payload, channel, channelToSwitch, existingChannel, addChannel,
|
|
15719
|
+
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
|
|
15671
15720
|
return _regenerator().w(function (_context1) {
|
|
15672
15721
|
while (1) switch (_context1.p = _context1.n) {
|
|
15673
15722
|
case 0:
|
|
15674
15723
|
_context1.p = 0;
|
|
15675
15724
|
payload = action.payload;
|
|
15676
|
-
channel = payload.channel;
|
|
15725
|
+
channel = payload.channel, updateActiveChannel = payload.updateActiveChannel;
|
|
15677
15726
|
channelToSwitch = channel;
|
|
15678
|
-
if (channel !== null && channel !== void 0 && channel.id) {
|
|
15727
|
+
if (!(!(channel !== null && channel !== void 0 && channel.id) && updateActiveChannel)) {
|
|
15679
15728
|
_context1.n = 3;
|
|
15680
15729
|
break;
|
|
15681
15730
|
}
|
|
@@ -15705,9 +15754,9 @@ function switchChannel(action) {
|
|
|
15705
15754
|
_context1.n = 8;
|
|
15706
15755
|
break;
|
|
15707
15756
|
case 5:
|
|
15708
|
-
|
|
15757
|
+
_SceytChatClient5 = getClient();
|
|
15709
15758
|
_context1.n = 6;
|
|
15710
|
-
return call(
|
|
15759
|
+
return call(_SceytChatClient5.getChannel, channel.id);
|
|
15711
15760
|
case 6:
|
|
15712
15761
|
fetchedChannel = _context1.v;
|
|
15713
15762
|
addChannelToAllChannels(fetchedChannel);
|
|
@@ -15723,6 +15772,10 @@ function switchChannel(action) {
|
|
|
15723
15772
|
channelFromMap = getChannelFromMap(channel.id);
|
|
15724
15773
|
channelToSwitch = _extends({}, channelToSwitch, channelFromMap);
|
|
15725
15774
|
case 10:
|
|
15775
|
+
if (!updateActiveChannel) {
|
|
15776
|
+
_context1.n = 13;
|
|
15777
|
+
break;
|
|
15778
|
+
}
|
|
15726
15779
|
currentActiveChannel = getChannelFromMap(getActiveChannelId());
|
|
15727
15780
|
_context1.n = 11;
|
|
15728
15781
|
return call(setUnreadScrollTo, true);
|
|
@@ -16139,14 +16192,14 @@ function blockChannel(action) {
|
|
|
16139
16192
|
}, _marked19, null, [[0, 5]]);
|
|
16140
16193
|
}
|
|
16141
16194
|
function updateChannel(action) {
|
|
16142
|
-
var payload, channelId, config,
|
|
16195
|
+
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
|
|
16143
16196
|
return _regenerator().w(function (_context20) {
|
|
16144
16197
|
while (1) switch (_context20.p = _context20.n) {
|
|
16145
16198
|
case 0:
|
|
16146
16199
|
_context20.p = 0;
|
|
16147
16200
|
payload = action.payload;
|
|
16148
16201
|
channelId = payload.channelId, config = payload.config;
|
|
16149
|
-
|
|
16202
|
+
_SceytChatClient6 = getClient();
|
|
16150
16203
|
_context20.n = 1;
|
|
16151
16204
|
return call(getChannelFromMap, channelId);
|
|
16152
16205
|
case 1:
|
|
@@ -16171,7 +16224,7 @@ function updateChannel(action) {
|
|
|
16171
16224
|
}
|
|
16172
16225
|
};
|
|
16173
16226
|
_context20.n = 2;
|
|
16174
|
-
return call(
|
|
16227
|
+
return call(_SceytChatClient6.uploadFile, fileToUpload);
|
|
16175
16228
|
case 2:
|
|
16176
16229
|
paramsToUpdate.avatarUrl = _context20.v;
|
|
16177
16230
|
case 3:
|
|
@@ -16215,15 +16268,15 @@ function updateChannel(action) {
|
|
|
16215
16268
|
}, _marked20, null, [[0, 6]]);
|
|
16216
16269
|
}
|
|
16217
16270
|
function checkUsersStatus() {
|
|
16218
|
-
var
|
|
16271
|
+
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
|
|
16219
16272
|
return _regenerator().w(function (_context21) {
|
|
16220
16273
|
while (1) switch (_context21.p = _context21.n) {
|
|
16221
16274
|
case 0:
|
|
16222
16275
|
_context21.p = 0;
|
|
16223
|
-
|
|
16276
|
+
_SceytChatClient7 = getClient();
|
|
16224
16277
|
usersForUpdate = Object.keys(usersMap);
|
|
16225
16278
|
_context21.n = 1;
|
|
16226
|
-
return call(
|
|
16279
|
+
return call(_SceytChatClient7.getUsers, usersForUpdate);
|
|
16227
16280
|
case 1:
|
|
16228
16281
|
updatedUsers = _context21.v;
|
|
16229
16282
|
usersToUpdateMap = {};
|
|
@@ -16481,14 +16534,14 @@ function deleteAllMessages(action) {
|
|
|
16481
16534
|
}, _marked25, null, [[0, 9]]);
|
|
16482
16535
|
}
|
|
16483
16536
|
function joinChannel(action) {
|
|
16484
|
-
var payload, channelId,
|
|
16537
|
+
var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
|
|
16485
16538
|
return _regenerator().w(function (_context26) {
|
|
16486
16539
|
while (1) switch (_context26.p = _context26.n) {
|
|
16487
16540
|
case 0:
|
|
16488
16541
|
_context26.p = 0;
|
|
16489
16542
|
payload = action.payload;
|
|
16490
16543
|
channelId = payload.channelId;
|
|
16491
|
-
|
|
16544
|
+
_SceytChatClient8 = getClient();
|
|
16492
16545
|
_context26.n = 1;
|
|
16493
16546
|
return call(getChannelFromMap, channelId);
|
|
16494
16547
|
case 1:
|
|
@@ -16501,7 +16554,7 @@ function joinChannel(action) {
|
|
|
16501
16554
|
break;
|
|
16502
16555
|
}
|
|
16503
16556
|
_context26.n = 2;
|
|
16504
|
-
return call(
|
|
16557
|
+
return call(_SceytChatClient8.getChannel, channelId);
|
|
16505
16558
|
case 2:
|
|
16506
16559
|
channel = _context26.v;
|
|
16507
16560
|
case 3:
|
|
@@ -17114,16 +17167,17 @@ var _marked$3 = /*#__PURE__*/_regenerator().m(sendMessage),
|
|
|
17114
17167
|
_marked5$1 = /*#__PURE__*/_regenerator().m(deleteMessage),
|
|
17115
17168
|
_marked6$1 = /*#__PURE__*/_regenerator().m(editMessage),
|
|
17116
17169
|
_marked7$1 = /*#__PURE__*/_regenerator().m(getMessagesQuery),
|
|
17117
|
-
_marked8$1 = /*#__PURE__*/_regenerator().m(
|
|
17118
|
-
_marked9$1 = /*#__PURE__*/_regenerator().m(
|
|
17119
|
-
_marked0$1 = /*#__PURE__*/_regenerator().m(
|
|
17120
|
-
_marked1$1 = /*#__PURE__*/_regenerator().m(
|
|
17121
|
-
_marked10$1 = /*#__PURE__*/_regenerator().m(
|
|
17122
|
-
_marked11$1 = /*#__PURE__*/_regenerator().m(
|
|
17123
|
-
_marked12$1 = /*#__PURE__*/_regenerator().m(
|
|
17124
|
-
_marked13$1 = /*#__PURE__*/_regenerator().m(
|
|
17125
|
-
_marked14$1 = /*#__PURE__*/_regenerator().m(
|
|
17126
|
-
_marked15$1 = /*#__PURE__*/_regenerator().m(
|
|
17170
|
+
_marked8$1 = /*#__PURE__*/_regenerator().m(getMessageQuery),
|
|
17171
|
+
_marked9$1 = /*#__PURE__*/_regenerator().m(loadMoreMessages),
|
|
17172
|
+
_marked0$1 = /*#__PURE__*/_regenerator().m(addReaction),
|
|
17173
|
+
_marked1$1 = /*#__PURE__*/_regenerator().m(deleteReaction),
|
|
17174
|
+
_marked10$1 = /*#__PURE__*/_regenerator().m(getReactions),
|
|
17175
|
+
_marked11$1 = /*#__PURE__*/_regenerator().m(loadMoreReactions),
|
|
17176
|
+
_marked12$1 = /*#__PURE__*/_regenerator().m(getMessageAttachments),
|
|
17177
|
+
_marked13$1 = /*#__PURE__*/_regenerator().m(loadMoreMessageAttachments),
|
|
17178
|
+
_marked14$1 = /*#__PURE__*/_regenerator().m(pauseAttachmentUploading),
|
|
17179
|
+
_marked15$1 = /*#__PURE__*/_regenerator().m(resumeAttachmentUploading),
|
|
17180
|
+
_marked16$1 = /*#__PURE__*/_regenerator().m(MessageSaga);
|
|
17127
17181
|
var handleUploadAttachments = function handleUploadAttachments(attachments, message, channel) {
|
|
17128
17182
|
try {
|
|
17129
17183
|
return Promise.resolve(Promise.all(attachments.map(function (attachment) {
|
|
@@ -17603,7 +17657,7 @@ function sendMessage(action) {
|
|
|
17603
17657
|
}, _marked$3, null, [[1, 18]]);
|
|
17604
17658
|
}
|
|
17605
17659
|
function sendTextMessage(action) {
|
|
17606
|
-
var payload, message, connectionState, channelId, channel, sendMessageTid, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend, pendingMessage, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
|
|
17660
|
+
var payload, message, connectionState, channelId, channel, sendMessageTid, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend, pendingMessage, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
|
|
17607
17661
|
return _regenerator().w(function (_context4) {
|
|
17608
17662
|
while (1) switch (_context4.p = _context4.n) {
|
|
17609
17663
|
case 0:
|
|
@@ -17622,6 +17676,7 @@ function sendTextMessage(action) {
|
|
|
17622
17676
|
setChannelInMap(channel);
|
|
17623
17677
|
}
|
|
17624
17678
|
}
|
|
17679
|
+
activeChannelId = getActiveChannelId();
|
|
17625
17680
|
_context4.p = 3;
|
|
17626
17681
|
if (!channel.isMockChannel) {
|
|
17627
17682
|
_context4.n = 6;
|
|
@@ -17657,7 +17712,7 @@ function sendTextMessage(action) {
|
|
|
17657
17712
|
attachments = [att];
|
|
17658
17713
|
}
|
|
17659
17714
|
messageBuilder = channel.createMessageBuilder();
|
|
17660
|
-
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === 'system' ? 0 : 1).setSilent(message.type === 'system').setMetadata(JSON.stringify(message.metadata));
|
|
17715
|
+
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount((message === null || message === void 0 ? void 0 : message.displayCount) !== undefined ? message.displayCount : message.type === 'system' ? 0 : 1).setSilent((message === null || message === void 0 ? void 0 : message.silent) !== undefined ? message.silent : message.type === 'system').setMetadata(JSON.stringify(message.metadata));
|
|
17661
17716
|
if (message.parentMessage) {
|
|
17662
17717
|
messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
|
|
17663
17718
|
}
|
|
@@ -17674,6 +17729,10 @@ function sendTextMessage(action) {
|
|
|
17674
17729
|
if (pendingMessage.metadata) {
|
|
17675
17730
|
pendingMessage.metadata = JSON.parse(pendingMessage.metadata);
|
|
17676
17731
|
}
|
|
17732
|
+
if (!(activeChannelId === channel.id)) {
|
|
17733
|
+
_context4.n = 8;
|
|
17734
|
+
break;
|
|
17735
|
+
}
|
|
17677
17736
|
_context4.n = 8;
|
|
17678
17737
|
return call(addPendingMessage, message, pendingMessage, channel);
|
|
17679
17738
|
case 8:
|
|
@@ -17710,8 +17769,13 @@ function sendTextMessage(action) {
|
|
|
17710
17769
|
metadata: messageResponse.metadata,
|
|
17711
17770
|
parentMessage: messageResponse.parentMessage,
|
|
17712
17771
|
repliedInThread: messageResponse.repliedInThread,
|
|
17713
|
-
createdAt: messageResponse.createdAt
|
|
17772
|
+
createdAt: messageResponse.createdAt,
|
|
17773
|
+
channelId: channel.id
|
|
17714
17774
|
};
|
|
17775
|
+
if (!(activeChannelId === channel.id)) {
|
|
17776
|
+
_context4.n = 13;
|
|
17777
|
+
break;
|
|
17778
|
+
}
|
|
17715
17779
|
_context4.n = 13;
|
|
17716
17780
|
return put(updateMessageAC(messageToSend.tid, messageUpdateData));
|
|
17717
17781
|
case 13:
|
|
@@ -17719,7 +17783,9 @@ function sendTextMessage(action) {
|
|
|
17719
17783
|
messageId: messageToSend.tid,
|
|
17720
17784
|
params: messageUpdateData
|
|
17721
17785
|
});
|
|
17722
|
-
|
|
17786
|
+
if (activeChannelId === channel.id) {
|
|
17787
|
+
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
17788
|
+
}
|
|
17723
17789
|
messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
|
|
17724
17790
|
updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
|
|
17725
17791
|
channelUpdateParam = {
|
|
@@ -17760,6 +17826,10 @@ function sendTextMessage(action) {
|
|
|
17760
17826
|
state: MESSAGE_STATUS.FAILED
|
|
17761
17827
|
}
|
|
17762
17828
|
});
|
|
17829
|
+
if (!(activeChannelId === channel.id)) {
|
|
17830
|
+
_context4.n = 21;
|
|
17831
|
+
break;
|
|
17832
|
+
}
|
|
17763
17833
|
updateMessageOnAllMessages(sendMessageTid, {
|
|
17764
17834
|
state: MESSAGE_STATUS.FAILED
|
|
17765
17835
|
});
|
|
@@ -18737,23 +18807,61 @@ function getMessagesQuery(action) {
|
|
|
18737
18807
|
}
|
|
18738
18808
|
}, _marked7$1, null, [[0, 49, 50, 52]]);
|
|
18739
18809
|
}
|
|
18740
|
-
function
|
|
18741
|
-
var payload,
|
|
18810
|
+
function getMessageQuery(action) {
|
|
18811
|
+
var payload, channelId, messageId, channel, messages, _t0;
|
|
18742
18812
|
return _regenerator().w(function (_context0) {
|
|
18743
18813
|
while (1) switch (_context0.p = _context0.n) {
|
|
18744
18814
|
case 0:
|
|
18745
18815
|
_context0.p = 0;
|
|
18746
18816
|
payload = action.payload;
|
|
18817
|
+
channelId = payload.channelId, messageId = payload.messageId;
|
|
18818
|
+
_context0.n = 1;
|
|
18819
|
+
return call(getChannelFromMap, channelId);
|
|
18820
|
+
case 1:
|
|
18821
|
+
channel = _context0.v;
|
|
18822
|
+
_context0.n = 2;
|
|
18823
|
+
return call(channel.getMessagesById, [messageId]);
|
|
18824
|
+
case 2:
|
|
18825
|
+
messages = _context0.v;
|
|
18826
|
+
_context0.n = 3;
|
|
18827
|
+
return put(updateMessageAC(messageId, messages[0]));
|
|
18828
|
+
case 3:
|
|
18829
|
+
updateMessageOnMap(channel.id, {
|
|
18830
|
+
messageId: messageId,
|
|
18831
|
+
params: messages[0]
|
|
18832
|
+
});
|
|
18833
|
+
updateMessageOnAllMessages(messageId, messages[0]);
|
|
18834
|
+
_context0.n = 4;
|
|
18835
|
+
return put(setScrollToMessagesAC(messageId, false));
|
|
18836
|
+
case 4:
|
|
18837
|
+
_context0.n = 6;
|
|
18838
|
+
break;
|
|
18839
|
+
case 5:
|
|
18840
|
+
_context0.p = 5;
|
|
18841
|
+
_t0 = _context0.v;
|
|
18842
|
+
log.error('error in message query', _t0);
|
|
18843
|
+
case 6:
|
|
18844
|
+
return _context0.a(2);
|
|
18845
|
+
}
|
|
18846
|
+
}, _marked8$1, null, [[0, 5]]);
|
|
18847
|
+
}
|
|
18848
|
+
function loadMoreMessages(action) {
|
|
18849
|
+
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t1;
|
|
18850
|
+
return _regenerator().w(function (_context1) {
|
|
18851
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
18852
|
+
case 0:
|
|
18853
|
+
_context1.p = 0;
|
|
18854
|
+
payload = action.payload;
|
|
18747
18855
|
limit = payload.limit, direction = payload.direction, channelId = payload.channelId, messageId = payload.messageId, hasNext = payload.hasNext;
|
|
18748
18856
|
SceytChatClient = getClient();
|
|
18749
18857
|
messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channelId);
|
|
18750
18858
|
messageQueryBuilder.reverse(true);
|
|
18751
|
-
|
|
18859
|
+
_context1.n = 1;
|
|
18752
18860
|
return call(messageQueryBuilder.build);
|
|
18753
18861
|
case 1:
|
|
18754
|
-
messageQuery =
|
|
18862
|
+
messageQuery = _context1.v;
|
|
18755
18863
|
messageQuery.limit = limit || 5;
|
|
18756
|
-
|
|
18864
|
+
_context1.n = 2;
|
|
18757
18865
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
18758
18866
|
case 2:
|
|
18759
18867
|
result = {
|
|
@@ -18761,116 +18869,116 @@ function loadMoreMessages(action) {
|
|
|
18761
18869
|
hasNext: false
|
|
18762
18870
|
};
|
|
18763
18871
|
if (!(direction === MESSAGE_LOAD_DIRECTION.PREV)) {
|
|
18764
|
-
|
|
18872
|
+
_context1.n = 6;
|
|
18765
18873
|
break;
|
|
18766
18874
|
}
|
|
18767
18875
|
if (!getHasPrevCached()) {
|
|
18768
|
-
|
|
18876
|
+
_context1.n = 3;
|
|
18769
18877
|
break;
|
|
18770
18878
|
}
|
|
18771
18879
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
|
|
18772
|
-
|
|
18880
|
+
_context1.n = 5;
|
|
18773
18881
|
break;
|
|
18774
18882
|
case 3:
|
|
18775
18883
|
if (!hasNext) {
|
|
18776
|
-
|
|
18884
|
+
_context1.n = 5;
|
|
18777
18885
|
break;
|
|
18778
18886
|
}
|
|
18779
|
-
|
|
18887
|
+
_context1.n = 4;
|
|
18780
18888
|
return call(messageQuery.loadPreviousMessageId, messageId);
|
|
18781
18889
|
case 4:
|
|
18782
|
-
result =
|
|
18890
|
+
result = _context1.v;
|
|
18783
18891
|
if (result.messages.length) {
|
|
18784
18892
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
|
|
18785
18893
|
}
|
|
18786
|
-
|
|
18894
|
+
_context1.n = 5;
|
|
18787
18895
|
return put(setMessagesHasPrevAC(result.hasNext));
|
|
18788
18896
|
case 5:
|
|
18789
|
-
|
|
18897
|
+
_context1.n = 10;
|
|
18790
18898
|
break;
|
|
18791
18899
|
case 6:
|
|
18792
18900
|
if (!getHasNextCached()) {
|
|
18793
|
-
|
|
18901
|
+
_context1.n = 7;
|
|
18794
18902
|
break;
|
|
18795
18903
|
}
|
|
18796
18904
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18797
|
-
|
|
18905
|
+
_context1.n = 9;
|
|
18798
18906
|
break;
|
|
18799
18907
|
case 7:
|
|
18800
18908
|
if (!hasNext) {
|
|
18801
|
-
|
|
18909
|
+
_context1.n = 9;
|
|
18802
18910
|
break;
|
|
18803
18911
|
}
|
|
18804
18912
|
log.info('saga load next from server ... ', messageId);
|
|
18805
18913
|
messageQuery.reverse = false;
|
|
18806
|
-
|
|
18914
|
+
_context1.n = 8;
|
|
18807
18915
|
return call(messageQuery.loadNextMessageId, messageId);
|
|
18808
18916
|
case 8:
|
|
18809
|
-
result =
|
|
18917
|
+
result = _context1.v;
|
|
18810
18918
|
log.info('result from server next ... ', result);
|
|
18811
18919
|
if (result.messages.length) {
|
|
18812
18920
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18813
18921
|
}
|
|
18814
|
-
|
|
18922
|
+
_context1.n = 9;
|
|
18815
18923
|
return put(setMessagesHasNextAC(result.hasNext));
|
|
18816
18924
|
case 9:
|
|
18817
|
-
|
|
18925
|
+
_context1.n = 10;
|
|
18818
18926
|
return put(setMessagesHasPrevAC(true));
|
|
18819
18927
|
case 10:
|
|
18820
18928
|
if (!(result.messages && result.messages.length && result.messages.length > 0)) {
|
|
18821
|
-
|
|
18929
|
+
_context1.n = 12;
|
|
18822
18930
|
break;
|
|
18823
18931
|
}
|
|
18824
|
-
|
|
18932
|
+
_context1.n = 11;
|
|
18825
18933
|
return put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
|
|
18826
18934
|
case 11:
|
|
18827
|
-
|
|
18935
|
+
_context1.n = 13;
|
|
18828
18936
|
break;
|
|
18829
18937
|
case 12:
|
|
18830
|
-
|
|
18938
|
+
_context1.n = 13;
|
|
18831
18939
|
return put(addMessagesAC([], direction));
|
|
18832
18940
|
case 13:
|
|
18833
|
-
|
|
18941
|
+
_context1.n = 14;
|
|
18834
18942
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18835
18943
|
case 14:
|
|
18836
|
-
|
|
18944
|
+
_context1.n = 16;
|
|
18837
18945
|
break;
|
|
18838
18946
|
case 15:
|
|
18839
|
-
|
|
18840
|
-
|
|
18841
|
-
log.error('error in load more messages',
|
|
18947
|
+
_context1.p = 15;
|
|
18948
|
+
_t1 = _context1.v;
|
|
18949
|
+
log.error('error in load more messages', _t1);
|
|
18842
18950
|
case 16:
|
|
18843
|
-
return
|
|
18951
|
+
return _context1.a(2);
|
|
18844
18952
|
}
|
|
18845
|
-
},
|
|
18953
|
+
}, _marked9$1, null, [[0, 15]]);
|
|
18846
18954
|
}
|
|
18847
18955
|
function addReaction(action) {
|
|
18848
|
-
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, _message2, reaction, channelUpdateParam,
|
|
18849
|
-
return _regenerator().w(function (
|
|
18850
|
-
while (1) switch (
|
|
18956
|
+
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, _message2, reaction, channelUpdateParam, _t10;
|
|
18957
|
+
return _regenerator().w(function (_context10) {
|
|
18958
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
18851
18959
|
case 0:
|
|
18852
|
-
|
|
18960
|
+
_context10.p = 0;
|
|
18853
18961
|
payload = action.payload;
|
|
18854
18962
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, score = payload.score, reason = payload.reason, enforceUnique = payload.enforceUnique;
|
|
18855
18963
|
user = getClient().user;
|
|
18856
|
-
|
|
18964
|
+
_context10.n = 1;
|
|
18857
18965
|
return call(getChannelFromMap, channelId);
|
|
18858
18966
|
case 1:
|
|
18859
|
-
channel =
|
|
18967
|
+
channel = _context10.v;
|
|
18860
18968
|
if (!channel) {
|
|
18861
18969
|
channel = getChannelFromAllChannels(channelId);
|
|
18862
18970
|
if (channel) {
|
|
18863
18971
|
setChannelInMap(channel);
|
|
18864
18972
|
}
|
|
18865
18973
|
}
|
|
18866
|
-
|
|
18974
|
+
_context10.n = 2;
|
|
18867
18975
|
return call(channel.addReaction, messageId, key, score, reason, enforceUnique);
|
|
18868
18976
|
case 2:
|
|
18869
|
-
_yield$call =
|
|
18977
|
+
_yield$call = _context10.v;
|
|
18870
18978
|
_message2 = _yield$call.message;
|
|
18871
18979
|
reaction = _yield$call.reaction;
|
|
18872
18980
|
if (!(user.id === _message2.user.id)) {
|
|
18873
|
-
|
|
18981
|
+
_context10.n = 4;
|
|
18874
18982
|
break;
|
|
18875
18983
|
}
|
|
18876
18984
|
channelUpdateParam = {
|
|
@@ -18878,100 +18986,100 @@ function addReaction(action) {
|
|
|
18878
18986
|
lastReactedMessage: _message2,
|
|
18879
18987
|
newReactions: [reaction]
|
|
18880
18988
|
};
|
|
18881
|
-
|
|
18989
|
+
_context10.n = 3;
|
|
18882
18990
|
return put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
18883
18991
|
case 3:
|
|
18884
18992
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
18885
18993
|
case 4:
|
|
18886
|
-
|
|
18994
|
+
_context10.n = 5;
|
|
18887
18995
|
return put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
18888
18996
|
case 5:
|
|
18889
|
-
|
|
18997
|
+
_context10.n = 6;
|
|
18890
18998
|
return put(addReactionToListAC(reaction));
|
|
18891
18999
|
case 6:
|
|
18892
|
-
|
|
19000
|
+
_context10.n = 7;
|
|
18893
19001
|
return put(addReactionToMessageAC(_message2, reaction, true));
|
|
18894
19002
|
case 7:
|
|
18895
19003
|
addReactionToMessageOnMap(channelId, _message2, reaction, true);
|
|
18896
19004
|
addReactionOnAllMessages(_message2, reaction, true);
|
|
18897
|
-
|
|
19005
|
+
_context10.n = 9;
|
|
18898
19006
|
break;
|
|
18899
19007
|
case 8:
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
log.error('ERROR in add reaction',
|
|
19008
|
+
_context10.p = 8;
|
|
19009
|
+
_t10 = _context10.v;
|
|
19010
|
+
log.error('ERROR in add reaction', _t10.message);
|
|
18903
19011
|
case 9:
|
|
18904
|
-
return
|
|
19012
|
+
return _context10.a(2);
|
|
18905
19013
|
}
|
|
18906
|
-
},
|
|
19014
|
+
}, _marked0$1, null, [[0, 8]]);
|
|
18907
19015
|
}
|
|
18908
19016
|
function deleteReaction(action) {
|
|
18909
|
-
var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, _message3, reaction, channelUpdateParam,
|
|
18910
|
-
return _regenerator().w(function (
|
|
18911
|
-
while (1) switch (
|
|
19017
|
+
var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, _message3, reaction, channelUpdateParam, _t11;
|
|
19018
|
+
return _regenerator().w(function (_context11) {
|
|
19019
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
18912
19020
|
case 0:
|
|
18913
|
-
|
|
19021
|
+
_context11.p = 0;
|
|
18914
19022
|
payload = action.payload;
|
|
18915
19023
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, isLastReaction = payload.isLastReaction;
|
|
18916
|
-
|
|
19024
|
+
_context11.n = 1;
|
|
18917
19025
|
return call(getChannelFromMap, channelId);
|
|
18918
19026
|
case 1:
|
|
18919
|
-
channel =
|
|
19027
|
+
channel = _context11.v;
|
|
18920
19028
|
if (!channel) {
|
|
18921
19029
|
channel = getChannelFromAllChannels(channelId);
|
|
18922
19030
|
if (channel) {
|
|
18923
19031
|
setChannelInMap(channel);
|
|
18924
19032
|
}
|
|
18925
19033
|
}
|
|
18926
|
-
|
|
19034
|
+
_context11.n = 2;
|
|
18927
19035
|
return call(channel.deleteReaction, messageId, key);
|
|
18928
19036
|
case 2:
|
|
18929
|
-
_yield$call2 =
|
|
19037
|
+
_yield$call2 = _context11.v;
|
|
18930
19038
|
_message3 = _yield$call2.message;
|
|
18931
19039
|
reaction = _yield$call2.reaction;
|
|
18932
19040
|
if (!isLastReaction) {
|
|
18933
|
-
|
|
19041
|
+
_context11.n = 4;
|
|
18934
19042
|
break;
|
|
18935
19043
|
}
|
|
18936
19044
|
channelUpdateParam = {
|
|
18937
19045
|
userMessageReactions: [],
|
|
18938
19046
|
lastReactedMessage: null
|
|
18939
19047
|
};
|
|
18940
|
-
|
|
19048
|
+
_context11.n = 3;
|
|
18941
19049
|
return put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
18942
19050
|
case 3:
|
|
18943
19051
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
18944
19052
|
case 4:
|
|
18945
19053
|
log.info('message received. ... ', _message3);
|
|
18946
|
-
|
|
19054
|
+
_context11.n = 5;
|
|
18947
19055
|
return put(deleteReactionFromListAC(reaction));
|
|
18948
19056
|
case 5:
|
|
18949
|
-
|
|
19057
|
+
_context11.n = 6;
|
|
18950
19058
|
return put(deleteReactionFromMessageAC(_message3, reaction, true));
|
|
18951
19059
|
case 6:
|
|
18952
19060
|
removeReactionToMessageOnMap(channelId, _message3, reaction, true);
|
|
18953
19061
|
removeReactionOnAllMessages(_message3, reaction, true);
|
|
18954
|
-
|
|
19062
|
+
_context11.n = 8;
|
|
18955
19063
|
break;
|
|
18956
19064
|
case 7:
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
log.error('ERROR in delete reaction',
|
|
19065
|
+
_context11.p = 7;
|
|
19066
|
+
_t11 = _context11.v;
|
|
19067
|
+
log.error('ERROR in delete reaction', _t11.message);
|
|
18960
19068
|
case 8:
|
|
18961
|
-
return
|
|
19069
|
+
return _context11.a(2);
|
|
18962
19070
|
}
|
|
18963
|
-
},
|
|
19071
|
+
}, _marked1$1, null, [[0, 7]]);
|
|
18964
19072
|
}
|
|
18965
19073
|
function getReactions(action) {
|
|
18966
|
-
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result,
|
|
18967
|
-
return _regenerator().w(function (
|
|
18968
|
-
while (1) switch (
|
|
19074
|
+
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t12;
|
|
19075
|
+
return _regenerator().w(function (_context12) {
|
|
19076
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
18969
19077
|
case 0:
|
|
18970
|
-
|
|
19078
|
+
_context12.p = 0;
|
|
18971
19079
|
payload = action.payload;
|
|
18972
19080
|
messageId = payload.messageId, key = payload.key, limit = payload.limit;
|
|
18973
19081
|
SceytChatClient = getClient();
|
|
18974
|
-
|
|
19082
|
+
_context12.n = 1;
|
|
18975
19083
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
18976
19084
|
case 1:
|
|
18977
19085
|
reactionQueryBuilder = new SceytChatClient.ReactionListQueryBuilder(messageId);
|
|
@@ -18979,74 +19087,74 @@ function getReactions(action) {
|
|
|
18979
19087
|
if (key) {
|
|
18980
19088
|
reactionQueryBuilder.setKey(key);
|
|
18981
19089
|
}
|
|
18982
|
-
|
|
19090
|
+
_context12.n = 2;
|
|
18983
19091
|
return call(reactionQueryBuilder.build);
|
|
18984
19092
|
case 2:
|
|
18985
|
-
reactionQuery =
|
|
18986
|
-
|
|
19093
|
+
reactionQuery = _context12.v;
|
|
19094
|
+
_context12.n = 3;
|
|
18987
19095
|
return call(reactionQuery.loadNext);
|
|
18988
19096
|
case 3:
|
|
18989
|
-
result =
|
|
19097
|
+
result = _context12.v;
|
|
18990
19098
|
query.ReactionsQuery = reactionQuery;
|
|
18991
|
-
|
|
19099
|
+
_context12.n = 4;
|
|
18992
19100
|
return put(setReactionsListAC(result.reactions, result.hasNext));
|
|
18993
19101
|
case 4:
|
|
18994
|
-
|
|
19102
|
+
_context12.n = 5;
|
|
18995
19103
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
18996
19104
|
case 5:
|
|
18997
|
-
|
|
19105
|
+
_context12.n = 7;
|
|
18998
19106
|
break;
|
|
18999
19107
|
case 6:
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
log.error('ERROR in get reactions',
|
|
19108
|
+
_context12.p = 6;
|
|
19109
|
+
_t12 = _context12.v;
|
|
19110
|
+
log.error('ERROR in get reactions', _t12.message);
|
|
19003
19111
|
case 7:
|
|
19004
|
-
return
|
|
19112
|
+
return _context12.a(2);
|
|
19005
19113
|
}
|
|
19006
|
-
},
|
|
19114
|
+
}, _marked10$1, null, [[0, 6]]);
|
|
19007
19115
|
}
|
|
19008
19116
|
function loadMoreReactions(action) {
|
|
19009
|
-
var payload, limit, ReactionQuery, result,
|
|
19010
|
-
return _regenerator().w(function (
|
|
19011
|
-
while (1) switch (
|
|
19117
|
+
var payload, limit, ReactionQuery, result, _t13;
|
|
19118
|
+
return _regenerator().w(function (_context13) {
|
|
19119
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
19012
19120
|
case 0:
|
|
19013
|
-
|
|
19121
|
+
_context13.p = 0;
|
|
19014
19122
|
payload = action.payload;
|
|
19015
19123
|
limit = payload.limit;
|
|
19016
|
-
|
|
19124
|
+
_context13.n = 1;
|
|
19017
19125
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
19018
19126
|
case 1:
|
|
19019
19127
|
ReactionQuery = query.ReactionsQuery;
|
|
19020
19128
|
if (limit) {
|
|
19021
19129
|
ReactionQuery.limit = limit;
|
|
19022
19130
|
}
|
|
19023
|
-
|
|
19131
|
+
_context13.n = 2;
|
|
19024
19132
|
return call(ReactionQuery.loadNext);
|
|
19025
19133
|
case 2:
|
|
19026
|
-
result =
|
|
19027
|
-
|
|
19134
|
+
result = _context13.v;
|
|
19135
|
+
_context13.n = 3;
|
|
19028
19136
|
return put(addReactionsToListAC(result.reactions, result.hasNext));
|
|
19029
19137
|
case 3:
|
|
19030
|
-
|
|
19138
|
+
_context13.n = 4;
|
|
19031
19139
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
19032
19140
|
case 4:
|
|
19033
|
-
|
|
19141
|
+
_context13.n = 6;
|
|
19034
19142
|
break;
|
|
19035
19143
|
case 5:
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
log.error('ERROR in load more reactions',
|
|
19144
|
+
_context13.p = 5;
|
|
19145
|
+
_t13 = _context13.v;
|
|
19146
|
+
log.error('ERROR in load more reactions', _t13.message);
|
|
19039
19147
|
case 6:
|
|
19040
|
-
return
|
|
19148
|
+
return _context13.a(2);
|
|
19041
19149
|
}
|
|
19042
|
-
},
|
|
19150
|
+
}, _marked11$1, null, [[0, 5]]);
|
|
19043
19151
|
}
|
|
19044
19152
|
function getMessageAttachments(action) {
|
|
19045
|
-
var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result,
|
|
19046
|
-
return _regenerator().w(function (
|
|
19047
|
-
while (1) switch (
|
|
19153
|
+
var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t14;
|
|
19154
|
+
return _regenerator().w(function (_context14) {
|
|
19155
|
+
while (1) switch (_context14.p = _context14.n) {
|
|
19048
19156
|
case 0:
|
|
19049
|
-
|
|
19157
|
+
_context14.p = 0;
|
|
19050
19158
|
_action$payload2 = action.payload, channelId = _action$payload2.channelId, attachmentType = _action$payload2.attachmentType, limit = _action$payload2.limit, direction = _action$payload2.direction, attachmentId = _action$payload2.attachmentId, forPopup = _action$payload2.forPopup;
|
|
19051
19159
|
SceytChatClient = getClient();
|
|
19052
19160
|
typeList = [attachmentTypes.video, attachmentTypes.image, attachmentTypes.file, attachmentTypes.link, attachmentTypes.voice];
|
|
@@ -19061,240 +19169,243 @@ function getMessageAttachments(action) {
|
|
|
19061
19169
|
}
|
|
19062
19170
|
AttachmentByTypeQueryBuilder = new SceytChatClient.AttachmentListQueryBuilder(channelId, typeList);
|
|
19063
19171
|
AttachmentByTypeQueryBuilder.limit(limit || 34);
|
|
19064
|
-
|
|
19172
|
+
_context14.n = 1;
|
|
19065
19173
|
return call(AttachmentByTypeQueryBuilder.build);
|
|
19066
19174
|
case 1:
|
|
19067
|
-
AttachmentByTypeQuery =
|
|
19175
|
+
AttachmentByTypeQuery = _context14.v;
|
|
19068
19176
|
if (forPopup) {
|
|
19069
19177
|
AttachmentByTypeQuery.reverse = true;
|
|
19070
19178
|
}
|
|
19071
19179
|
if (!(direction === queryDirection.NEXT)) {
|
|
19072
|
-
|
|
19180
|
+
_context14.n = 3;
|
|
19073
19181
|
break;
|
|
19074
19182
|
}
|
|
19075
|
-
|
|
19183
|
+
_context14.n = 2;
|
|
19076
19184
|
return call(AttachmentByTypeQuery.loadPrevious);
|
|
19077
19185
|
case 2:
|
|
19078
|
-
result =
|
|
19079
|
-
|
|
19186
|
+
result = _context14.v;
|
|
19187
|
+
_context14.n = 7;
|
|
19080
19188
|
break;
|
|
19081
19189
|
case 3:
|
|
19082
19190
|
if (!(direction === queryDirection.NEAR)) {
|
|
19083
|
-
|
|
19191
|
+
_context14.n = 5;
|
|
19084
19192
|
break;
|
|
19085
19193
|
}
|
|
19086
|
-
|
|
19194
|
+
_context14.n = 4;
|
|
19087
19195
|
return call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
|
|
19088
19196
|
case 4:
|
|
19089
|
-
result =
|
|
19090
|
-
|
|
19197
|
+
result = _context14.v;
|
|
19198
|
+
_context14.n = 7;
|
|
19091
19199
|
break;
|
|
19092
19200
|
case 5:
|
|
19093
|
-
|
|
19201
|
+
_context14.n = 6;
|
|
19094
19202
|
return call(AttachmentByTypeQuery.loadPrevious);
|
|
19095
19203
|
case 6:
|
|
19096
|
-
result =
|
|
19204
|
+
result = _context14.v;
|
|
19097
19205
|
case 7:
|
|
19098
19206
|
if (!forPopup) {
|
|
19099
|
-
|
|
19207
|
+
_context14.n = 10;
|
|
19100
19208
|
break;
|
|
19101
19209
|
}
|
|
19102
19210
|
query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
|
|
19103
|
-
|
|
19211
|
+
_context14.n = 8;
|
|
19104
19212
|
return put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
19105
19213
|
case 8:
|
|
19106
|
-
|
|
19214
|
+
_context14.n = 9;
|
|
19107
19215
|
return put(setAttachmentsCompleteForPopupAC(result.hasNext));
|
|
19108
19216
|
case 9:
|
|
19109
|
-
|
|
19217
|
+
_context14.n = 12;
|
|
19110
19218
|
break;
|
|
19111
19219
|
case 10:
|
|
19112
19220
|
query.AttachmentByTypeQuery = AttachmentByTypeQuery;
|
|
19113
|
-
|
|
19221
|
+
_context14.n = 11;
|
|
19114
19222
|
return put(setAttachmentsCompleteAC(result.hasNext));
|
|
19115
19223
|
case 11:
|
|
19116
|
-
|
|
19224
|
+
_context14.n = 12;
|
|
19117
19225
|
return put(setAttachmentsAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
19118
19226
|
case 12:
|
|
19119
|
-
|
|
19227
|
+
_context14.n = 14;
|
|
19120
19228
|
break;
|
|
19121
19229
|
case 13:
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
log.error('error in message attachment query',
|
|
19230
|
+
_context14.p = 13;
|
|
19231
|
+
_t14 = _context14.v;
|
|
19232
|
+
log.error('error in message attachment query', _t14);
|
|
19125
19233
|
case 14:
|
|
19126
|
-
return
|
|
19234
|
+
return _context14.a(2);
|
|
19127
19235
|
}
|
|
19128
|
-
},
|
|
19236
|
+
}, _marked12$1, null, [[0, 13]]);
|
|
19129
19237
|
}
|
|
19130
19238
|
function loadMoreMessageAttachments(action) {
|
|
19131
|
-
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext,
|
|
19132
|
-
return _regenerator().w(function (
|
|
19133
|
-
while (1) switch (
|
|
19239
|
+
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t15;
|
|
19240
|
+
return _regenerator().w(function (_context15) {
|
|
19241
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
19134
19242
|
case 0:
|
|
19135
|
-
|
|
19243
|
+
_context15.p = 0;
|
|
19136
19244
|
_action$payload3 = action.payload, limit = _action$payload3.limit, direction = _action$payload3.direction, forPopup = _action$payload3.forPopup;
|
|
19137
19245
|
if (forPopup) {
|
|
19138
19246
|
AttachmentQuery = query.AttachmentByTypeQueryForPopup;
|
|
19139
19247
|
} else {
|
|
19140
19248
|
AttachmentQuery = query.AttachmentByTypeQuery;
|
|
19141
19249
|
}
|
|
19142
|
-
|
|
19250
|
+
_context15.n = 1;
|
|
19143
19251
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19144
19252
|
case 1:
|
|
19145
19253
|
AttachmentQuery.limit = limit;
|
|
19146
|
-
|
|
19254
|
+
_context15.n = 2;
|
|
19147
19255
|
return call(AttachmentQuery.loadPrevious);
|
|
19148
19256
|
case 2:
|
|
19149
|
-
_yield$call3 =
|
|
19257
|
+
_yield$call3 = _context15.v;
|
|
19150
19258
|
attachments = _yield$call3.attachments;
|
|
19151
19259
|
hasNext = _yield$call3.hasNext;
|
|
19152
19260
|
if (!forPopup) {
|
|
19153
|
-
|
|
19261
|
+
_context15.n = 4;
|
|
19154
19262
|
break;
|
|
19155
19263
|
}
|
|
19156
|
-
|
|
19264
|
+
_context15.n = 3;
|
|
19157
19265
|
return put(addAttachmentsForPopupAC(attachments, direction));
|
|
19158
19266
|
case 3:
|
|
19159
|
-
|
|
19267
|
+
_context15.n = 7;
|
|
19160
19268
|
break;
|
|
19161
19269
|
case 4:
|
|
19162
|
-
|
|
19270
|
+
_context15.n = 5;
|
|
19163
19271
|
return put(setAttachmentsCompleteAC(hasNext));
|
|
19164
19272
|
case 5:
|
|
19165
|
-
|
|
19273
|
+
_context15.n = 6;
|
|
19166
19274
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19167
19275
|
case 6:
|
|
19168
|
-
|
|
19276
|
+
_context15.n = 7;
|
|
19169
19277
|
return put(addAttachmentsAC(attachments));
|
|
19170
19278
|
case 7:
|
|
19171
|
-
|
|
19279
|
+
_context15.n = 9;
|
|
19172
19280
|
break;
|
|
19173
19281
|
case 8:
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
log.error('error in message attachment query',
|
|
19282
|
+
_context15.p = 8;
|
|
19283
|
+
_t15 = _context15.v;
|
|
19284
|
+
log.error('error in message attachment query', _t15);
|
|
19177
19285
|
case 9:
|
|
19178
|
-
return
|
|
19286
|
+
return _context15.a(2);
|
|
19179
19287
|
}
|
|
19180
|
-
},
|
|
19288
|
+
}, _marked13$1, null, [[0, 8]]);
|
|
19181
19289
|
}
|
|
19182
19290
|
function pauseAttachmentUploading(action) {
|
|
19183
|
-
var attachmentId, isPaused,
|
|
19184
|
-
return _regenerator().w(function (
|
|
19185
|
-
while (1) switch (
|
|
19291
|
+
var attachmentId, isPaused, _t16;
|
|
19292
|
+
return _regenerator().w(function (_context16) {
|
|
19293
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
19186
19294
|
case 0:
|
|
19187
|
-
|
|
19295
|
+
_context16.p = 0;
|
|
19188
19296
|
attachmentId = action.payload.attachmentId;
|
|
19189
19297
|
if (!getCustomUploader()) {
|
|
19190
|
-
|
|
19298
|
+
_context16.n = 1;
|
|
19191
19299
|
break;
|
|
19192
19300
|
}
|
|
19193
19301
|
isPaused = pauseUpload(attachmentId);
|
|
19194
19302
|
if (!isPaused) {
|
|
19195
|
-
|
|
19303
|
+
_context16.n = 1;
|
|
19196
19304
|
break;
|
|
19197
19305
|
}
|
|
19198
|
-
|
|
19306
|
+
_context16.n = 1;
|
|
19199
19307
|
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.PAUSED, attachmentId));
|
|
19200
19308
|
case 1:
|
|
19201
|
-
|
|
19309
|
+
_context16.n = 3;
|
|
19202
19310
|
break;
|
|
19203
19311
|
case 2:
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
log.error('error in pause attachment uploading',
|
|
19312
|
+
_context16.p = 2;
|
|
19313
|
+
_t16 = _context16.v;
|
|
19314
|
+
log.error('error in pause attachment uploading', _t16);
|
|
19207
19315
|
case 3:
|
|
19208
|
-
return
|
|
19316
|
+
return _context16.a(2);
|
|
19209
19317
|
}
|
|
19210
|
-
},
|
|
19318
|
+
}, _marked14$1, null, [[0, 2]]);
|
|
19211
19319
|
}
|
|
19212
19320
|
function resumeAttachmentUploading(action) {
|
|
19213
|
-
var attachmentId, isResumed,
|
|
19214
|
-
return _regenerator().w(function (
|
|
19215
|
-
while (1) switch (
|
|
19321
|
+
var attachmentId, isResumed, _t17;
|
|
19322
|
+
return _regenerator().w(function (_context17) {
|
|
19323
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
19216
19324
|
case 0:
|
|
19217
|
-
|
|
19325
|
+
_context17.p = 0;
|
|
19218
19326
|
attachmentId = action.payload.attachmentId;
|
|
19219
19327
|
log.info('resume for attachment ... ', attachmentId);
|
|
19220
19328
|
if (!getCustomUploader()) {
|
|
19221
|
-
|
|
19329
|
+
_context17.n = 1;
|
|
19222
19330
|
break;
|
|
19223
19331
|
}
|
|
19224
19332
|
isResumed = resumeUpload(attachmentId);
|
|
19225
19333
|
if (!isResumed) {
|
|
19226
|
-
|
|
19334
|
+
_context17.n = 1;
|
|
19227
19335
|
break;
|
|
19228
19336
|
}
|
|
19229
|
-
|
|
19337
|
+
_context17.n = 1;
|
|
19230
19338
|
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
|
|
19231
19339
|
case 1:
|
|
19232
|
-
|
|
19340
|
+
_context17.n = 3;
|
|
19233
19341
|
break;
|
|
19234
19342
|
case 2:
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
log.error('error in resume attachment uploading',
|
|
19343
|
+
_context17.p = 2;
|
|
19344
|
+
_t17 = _context17.v;
|
|
19345
|
+
log.error('error in resume attachment uploading', _t17);
|
|
19238
19346
|
case 3:
|
|
19239
|
-
return
|
|
19347
|
+
return _context17.a(2);
|
|
19240
19348
|
}
|
|
19241
|
-
},
|
|
19349
|
+
}, _marked15$1, null, [[0, 2]]);
|
|
19242
19350
|
}
|
|
19243
19351
|
function MessageSaga() {
|
|
19244
|
-
return _regenerator().w(function (
|
|
19245
|
-
while (1) switch (
|
|
19352
|
+
return _regenerator().w(function (_context18) {
|
|
19353
|
+
while (1) switch (_context18.n) {
|
|
19246
19354
|
case 0:
|
|
19247
|
-
|
|
19355
|
+
_context18.n = 1;
|
|
19248
19356
|
return takeEvery(SEND_MESSAGE, sendMessage);
|
|
19249
19357
|
case 1:
|
|
19250
|
-
|
|
19358
|
+
_context18.n = 2;
|
|
19251
19359
|
return takeEvery(SEND_TEXT_MESSAGE, sendTextMessage);
|
|
19252
19360
|
case 2:
|
|
19253
|
-
|
|
19361
|
+
_context18.n = 3;
|
|
19254
19362
|
return takeEvery(FORWARD_MESSAGE, forwardMessage);
|
|
19255
19363
|
case 3:
|
|
19256
|
-
|
|
19364
|
+
_context18.n = 4;
|
|
19257
19365
|
return takeEvery(RESEND_MESSAGE, resendMessage);
|
|
19258
19366
|
case 4:
|
|
19259
|
-
|
|
19367
|
+
_context18.n = 5;
|
|
19260
19368
|
return takeLatest(EDIT_MESSAGE, editMessage);
|
|
19261
19369
|
case 5:
|
|
19262
|
-
|
|
19370
|
+
_context18.n = 6;
|
|
19263
19371
|
return takeEvery(DELETE_MESSAGE, deleteMessage);
|
|
19264
19372
|
case 6:
|
|
19265
|
-
|
|
19373
|
+
_context18.n = 7;
|
|
19266
19374
|
return takeLatest(GET_MESSAGES, getMessagesQuery);
|
|
19267
19375
|
case 7:
|
|
19268
|
-
|
|
19269
|
-
return takeLatest(
|
|
19376
|
+
_context18.n = 8;
|
|
19377
|
+
return takeLatest(GET_MESSAGE, getMessageQuery);
|
|
19270
19378
|
case 8:
|
|
19271
|
-
|
|
19272
|
-
return takeLatest(
|
|
19379
|
+
_context18.n = 9;
|
|
19380
|
+
return takeLatest(GET_MESSAGES_ATTACHMENTS, getMessageAttachments);
|
|
19273
19381
|
case 9:
|
|
19274
|
-
|
|
19275
|
-
return takeLatest(
|
|
19382
|
+
_context18.n = 10;
|
|
19383
|
+
return takeLatest(LOAD_MORE_MESSAGES_ATTACHMENTS, loadMoreMessageAttachments);
|
|
19276
19384
|
case 10:
|
|
19277
|
-
|
|
19278
|
-
return takeLatest(
|
|
19385
|
+
_context18.n = 11;
|
|
19386
|
+
return takeLatest(ADD_REACTION, addReaction);
|
|
19279
19387
|
case 11:
|
|
19280
|
-
|
|
19281
|
-
return
|
|
19388
|
+
_context18.n = 12;
|
|
19389
|
+
return takeLatest(DELETE_REACTION, deleteReaction);
|
|
19282
19390
|
case 12:
|
|
19283
|
-
|
|
19284
|
-
return takeEvery(
|
|
19391
|
+
_context18.n = 13;
|
|
19392
|
+
return takeEvery(LOAD_MORE_MESSAGES, loadMoreMessages);
|
|
19285
19393
|
case 13:
|
|
19286
|
-
|
|
19287
|
-
return takeEvery(
|
|
19394
|
+
_context18.n = 14;
|
|
19395
|
+
return takeEvery(GET_REACTIONS, getReactions);
|
|
19288
19396
|
case 14:
|
|
19289
|
-
|
|
19290
|
-
return takeEvery(
|
|
19397
|
+
_context18.n = 15;
|
|
19398
|
+
return takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
|
|
19291
19399
|
case 15:
|
|
19292
|
-
|
|
19293
|
-
return takeEvery(
|
|
19400
|
+
_context18.n = 16;
|
|
19401
|
+
return takeEvery(PAUSE_ATTACHMENT_UPLOADING, pauseAttachmentUploading);
|
|
19294
19402
|
case 16:
|
|
19295
|
-
|
|
19403
|
+
_context18.n = 17;
|
|
19404
|
+
return takeEvery(RESUME_ATTACHMENT_UPLOADING, resumeAttachmentUploading);
|
|
19405
|
+
case 17:
|
|
19406
|
+
return _context18.a(2);
|
|
19296
19407
|
}
|
|
19297
|
-
},
|
|
19408
|
+
}, _marked16$1);
|
|
19298
19409
|
}
|
|
19299
19410
|
|
|
19300
19411
|
var _marked$4 = /*#__PURE__*/_regenerator().m(getMembers),
|
|
@@ -20062,6 +20173,12 @@ var store = configureStore({
|
|
|
20062
20173
|
});
|
|
20063
20174
|
sagaMiddleware.run(rootSaga);
|
|
20064
20175
|
|
|
20176
|
+
var SceytReduxContext = /*#__PURE__*/React__default.createContext(null);
|
|
20177
|
+
|
|
20178
|
+
var useSelector = createSelectorHook(SceytReduxContext);
|
|
20179
|
+
var useDispatch = createDispatchHook(SceytReduxContext);
|
|
20180
|
+
var useStore = createStoreHook(SceytReduxContext);
|
|
20181
|
+
|
|
20065
20182
|
var channelsSelector = function channelsSelector(store) {
|
|
20066
20183
|
return store.ChannelReducer.channels;
|
|
20067
20184
|
};
|
|
@@ -20545,7 +20662,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
20545
20662
|
log.setLevel(logLevel);
|
|
20546
20663
|
}, []);
|
|
20547
20664
|
return /*#__PURE__*/React__default.createElement(Provider, {
|
|
20548
|
-
store: store
|
|
20665
|
+
store: store,
|
|
20666
|
+
context: SceytReduxContext
|
|
20549
20667
|
}, /*#__PURE__*/React__default.createElement(SceytChat, {
|
|
20550
20668
|
client: client,
|
|
20551
20669
|
theme: theme,
|
|
@@ -21002,7 +21120,6 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
|
|
|
21002
21120
|
}), channel.lastReactedMessage && '"')))));
|
|
21003
21121
|
};
|
|
21004
21122
|
var Channel = function Channel(_ref3) {
|
|
21005
|
-
var _channel$metadata;
|
|
21006
21123
|
var channel = _ref3.channel,
|
|
21007
21124
|
theme = _ref3.theme,
|
|
21008
21125
|
_ref3$showAvatar = _ref3.showAvatar,
|
|
@@ -21047,7 +21164,7 @@ var Channel = function Channel(_ref3) {
|
|
|
21047
21164
|
var activeChannel = useSelector(activeChannelSelector) || {};
|
|
21048
21165
|
var channelDraftIsRemoved = useSelector(channelMessageDraftIsRemovedSelector);
|
|
21049
21166
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
21050
|
-
var isSelfChannel = isDirectChannel &&
|
|
21167
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
21051
21168
|
var directChannelUser = isDirectChannel && channel.members.find(function (member) {
|
|
21052
21169
|
return member.id !== user.id;
|
|
21053
21170
|
});
|
|
@@ -23957,7 +24074,6 @@ function SvgInfo(props) {
|
|
|
23957
24074
|
|
|
23958
24075
|
var _templateObject$i, _templateObject2$g, _templateObject3$c, _templateObject4$a, _templateObject5$8, _templateObject6$6, _templateObject7$5, _templateObject8$5, _templateObject9$5, _templateObject0$4;
|
|
23959
24076
|
function ChatHeader(_ref) {
|
|
23960
|
-
var _activeChannel$metada;
|
|
23961
24077
|
var infoIcon = _ref.infoIcon,
|
|
23962
24078
|
backgroundColor = _ref.backgroundColor,
|
|
23963
24079
|
titleColor = _ref.titleColor,
|
|
@@ -23996,7 +24112,7 @@ function ChatHeader(_ref) {
|
|
|
23996
24112
|
var channelListHidden = useSelector(channelListHiddenSelector);
|
|
23997
24113
|
var channelDetailsIsOpen = useSelector(channelInfoIsOpenSelector, shallowEqual);
|
|
23998
24114
|
var isDirectChannel = activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
23999
|
-
var isSelfChannel = isDirectChannel &&
|
|
24115
|
+
var isSelfChannel = isDirectChannel && activeChannel.memberCount === 1 && activeChannel.members.length > 0 && activeChannel.members[0].id === user.id;
|
|
24000
24116
|
var directChannelUser = isDirectChannel && activeChannel.members.find(function (member) {
|
|
24001
24117
|
return member.id !== user.id;
|
|
24002
24118
|
});
|
|
@@ -24882,10 +24998,9 @@ function ForwardMessagePopup(_ref) {
|
|
|
24882
24998
|
setSearchValue('');
|
|
24883
24999
|
};
|
|
24884
25000
|
var handleChannelSelect = function handleChannelSelect(isSelected, channel) {
|
|
24885
|
-
var _channel$metadata;
|
|
24886
25001
|
var newSelectedChannels = [].concat(selectedChannels);
|
|
24887
25002
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
24888
|
-
var isSelfChannel = isDirectChannel &&
|
|
25003
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
24889
25004
|
var directChannelUser = isDirectChannel && channel.members.find(function (member) {
|
|
24890
25005
|
return member.id !== user.id;
|
|
24891
25006
|
});
|
|
@@ -24998,12 +25113,11 @@ function ForwardMessagePopup(_ref) {
|
|
|
24998
25113
|
color: textSecondary,
|
|
24999
25114
|
margin: '0 0 12px'
|
|
25000
25115
|
}, "Chats & Groups"), searchedChannels.chats_groups.map(function (channel) {
|
|
25001
|
-
var _channel$metadata2;
|
|
25002
25116
|
var isSelected = selectedChannels.findIndex(function (chan) {
|
|
25003
25117
|
return chan.id === channel.id;
|
|
25004
25118
|
}) >= 0;
|
|
25005
25119
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
25006
|
-
var isSelfChannel = isDirectChannel &&
|
|
25120
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
25007
25121
|
var directChannelUser = isDirectChannel && isSelfChannel ? user : channel.members.find(function (member) {
|
|
25008
25122
|
return member.id !== user.id;
|
|
25009
25123
|
});
|
|
@@ -25074,9 +25188,8 @@ function ForwardMessagePopup(_ref) {
|
|
|
25074
25188
|
}))), !searchedChannels.chats_groups.length && !searchedChannels.channels.length && (/*#__PURE__*/React__default.createElement(NoResults, {
|
|
25075
25189
|
color: textSecondary
|
|
25076
25190
|
}, "No channels found")))) : channels.map(function (channel) {
|
|
25077
|
-
var _channel$metadata3;
|
|
25078
25191
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
25079
|
-
var isSelfChannel = isDirectChannel &&
|
|
25192
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
25080
25193
|
var directChannelUser = isDirectChannel && isSelfChannel ? user : channel.members.find(function (member) {
|
|
25081
25194
|
return member.id !== user.id;
|
|
25082
25195
|
});
|
|
@@ -27004,7 +27117,7 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
27004
27117
|
preload: 'auto',
|
|
27005
27118
|
id: 'video',
|
|
27006
27119
|
src: file.attachmentUrl || videoUrl
|
|
27007
|
-
}), videoCurrentTime && (/*#__PURE__*/React__default.createElement(VideoControls, null, !isPreview && !!videoCurrentTime && !isRepliedMessage && !uploading && !isDetailsView && (
|
|
27120
|
+
}), videoCurrentTime && !isRepliedMessage && (/*#__PURE__*/React__default.createElement(VideoControls, null, !isPreview && !!videoCurrentTime && !isRepliedMessage && !uploading && !isDetailsView && (
|
|
27008
27121
|
/*#__PURE__*/
|
|
27009
27122
|
React__default.createElement(VideoPlayButton, null, /*#__PURE__*/React__default.createElement(SvgPlayVideo, null))), /*#__PURE__*/React__default.createElement(VideoTime, {
|
|
27010
27123
|
isDetailsView: isDetailsView,
|
|
@@ -31057,6 +31170,12 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31057
31170
|
var _useState = useState(null),
|
|
31058
31171
|
metadata = _useState[0],
|
|
31059
31172
|
setMetadata = _useState[1];
|
|
31173
|
+
var _useState2 = useState(true),
|
|
31174
|
+
imageLoadError = _useState2[0],
|
|
31175
|
+
setImageLoadError = _useState2[1];
|
|
31176
|
+
var _useState3 = useState(true),
|
|
31177
|
+
faviconLoadError = _useState3[0],
|
|
31178
|
+
setFaviconLoadError = _useState3[1];
|
|
31060
31179
|
var attachment = useMemo(function () {
|
|
31061
31180
|
return attachments.find(function (attachment) {
|
|
31062
31181
|
return attachment.type === attachmentTypes.link;
|
|
@@ -31078,6 +31197,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31078
31197
|
});
|
|
31079
31198
|
}, function () {
|
|
31080
31199
|
console.log('Failed to fetch OG metadata');
|
|
31200
|
+
setMetadata(null);
|
|
31081
31201
|
});
|
|
31082
31202
|
if (_temp && _temp.then) return _temp.then(function () {});
|
|
31083
31203
|
}
|
|
@@ -31129,13 +31249,25 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31129
31249
|
window.open(attachment === null || attachment === void 0 ? void 0 : attachment.url, '_blank');
|
|
31130
31250
|
}
|
|
31131
31251
|
}, /*#__PURE__*/React__default.createElement(ImageContainer, {
|
|
31132
|
-
showOGMetadata: !!showOGMetadata
|
|
31133
|
-
}, metadata !== null && metadata !== void 0 && (_metadata$og4 = metadata.og) !== null && _metadata$og4 !== void 0 && (_metadata$og4$image = _metadata$og4.image) !== null && _metadata$og4$image !== void 0 && (_metadata$og4$image$ = _metadata$og4$image[0]) !== null && _metadata$og4$image$ !== void 0 && _metadata$og4$image$.url ? /*#__PURE__*/React__default.createElement(Img, {
|
|
31252
|
+
showOGMetadata: !!showOGMetadata && !imageLoadError
|
|
31253
|
+
}, metadata !== null && metadata !== void 0 && (_metadata$og4 = metadata.og) !== null && _metadata$og4 !== void 0 && (_metadata$og4$image = _metadata$og4.image) !== null && _metadata$og4$image !== void 0 && (_metadata$og4$image$ = _metadata$og4$image[0]) !== null && _metadata$og4$image$ !== void 0 && _metadata$og4$image$.url ? (/*#__PURE__*/React__default.createElement(Img, {
|
|
31134
31254
|
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$og5 = metadata.og) === null || _metadata$og5 === void 0 ? void 0 : (_metadata$og5$image = _metadata$og5.image) === null || _metadata$og5$image === void 0 ? void 0 : (_metadata$og5$image$ = _metadata$og5$image[0]) === null || _metadata$og5$image$ === void 0 ? void 0 : _metadata$og5$image$.url,
|
|
31135
|
-
alt: 'OG metadata image'
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31255
|
+
alt: 'OG metadata image',
|
|
31256
|
+
onLoad: function onLoad() {
|
|
31257
|
+
return setImageLoadError(false);
|
|
31258
|
+
},
|
|
31259
|
+
onError: function onError() {
|
|
31260
|
+
return setImageLoadError(true);
|
|
31261
|
+
}
|
|
31262
|
+
})) : null), showOGMetadata ? (/*#__PURE__*/React__default.createElement(OGText, null, /*#__PURE__*/React__default.createElement(Url, null, ogUrl), metadata !== null && metadata !== void 0 && (_metadata$og6 = metadata.og) !== null && _metadata$og6 !== void 0 && _metadata$og6.title ? (/*#__PURE__*/React__default.createElement(Title, null, metadata !== null && metadata !== void 0 && (_metadata$og7 = metadata.og) !== null && _metadata$og7 !== void 0 && (_metadata$og7$favicon = _metadata$og7.favicon) !== null && _metadata$og7$favicon !== void 0 && _metadata$og7$favicon.url && !faviconLoadError ? (/*#__PURE__*/React__default.createElement(Favicon, {
|
|
31263
|
+
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$og8 = metadata.og) === null || _metadata$og8 === void 0 ? void 0 : (_metadata$og8$favicon = _metadata$og8.favicon) === null || _metadata$og8$favicon === void 0 ? void 0 : _metadata$og8$favicon.url,
|
|
31264
|
+
onLoad: function onLoad() {
|
|
31265
|
+
return setFaviconLoadError(false);
|
|
31266
|
+
},
|
|
31267
|
+
onError: function onError() {
|
|
31268
|
+
return setFaviconLoadError(true);
|
|
31269
|
+
}
|
|
31270
|
+
})) : null, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og9 = metadata.og) === null || _metadata$og9 === void 0 ? void 0 : _metadata$og9.title))) : null, metadata !== null && metadata !== void 0 && (_metadata$og0 = metadata.og) !== null && _metadata$og0 !== void 0 && _metadata$og0.description ? /*#__PURE__*/React__default.createElement(Desc, null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og1 = metadata.og) === null || _metadata$og1 === void 0 ? void 0 : _metadata$og1.description) : null)) : null));
|
|
31139
31271
|
};
|
|
31140
31272
|
var OGMetadataContainer = styled.div(_templateObject$A || (_templateObject$A = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: inherit;\n display: grid;\n grid-template-columns: 1fr;\n background-color: rgba(0, 0, 0, 0.034);\n border-radius: 6px;\n margin-bottom: 0.4rem;\n margin: 0 auto;\n margin-bottom: ", ";\n &:hover {\n background-color: rgba(0, 0, 0, 0.1);\n cursor: pointer;\n }\n"])), function (_ref2) {
|
|
31141
31273
|
var showOGMetadata = _ref2.showOGMetadata;
|
|
@@ -32383,7 +32515,7 @@ var Message$1 = function Message(_ref) {
|
|
|
32383
32515
|
})));
|
|
32384
32516
|
};
|
|
32385
32517
|
var Message$2 = /*#__PURE__*/React__default.memo(Message$1, function (prevProps, nextProps) {
|
|
32386
|
-
return prevProps.message.deliveryStatus === nextProps.message.deliveryStatus && prevProps.message.state === nextProps.message.state && prevProps.message.userReactions === nextProps.message.userReactions && prevProps.message.body === nextProps.message.body && prevProps.message.reactionTotals === nextProps.message.reactionTotals && prevProps.message.attachments === nextProps.message.attachments && prevProps.message.userMarkers === nextProps.message.userMarkers && prevProps.prevMessage === nextProps.prevMessage && prevProps.nextMessage === nextProps.nextMessage && prevProps.selectedMessagesMap === nextProps.selectedMessagesMap && prevProps.contactsMap === nextProps.contactsMap && prevProps.connectionStatus === nextProps.connectionStatus && prevProps.openedMessageMenuId === nextProps.openedMessageMenuId && prevProps.theme === nextProps.theme;
|
|
32518
|
+
return prevProps.message.deliveryStatus === nextProps.message.deliveryStatus && prevProps.message.state === nextProps.message.state && prevProps.message.userReactions === nextProps.message.userReactions && prevProps.message.body === nextProps.message.body && prevProps.message.reactionTotals === nextProps.message.reactionTotals && prevProps.message.attachments === nextProps.message.attachments && prevProps.message.metadata === nextProps.message.metadata && prevProps.message.userMarkers === nextProps.message.userMarkers && prevProps.prevMessage === nextProps.prevMessage && prevProps.nextMessage === nextProps.nextMessage && prevProps.selectedMessagesMap === nextProps.selectedMessagesMap && prevProps.contactsMap === nextProps.contactsMap && prevProps.connectionStatus === nextProps.connectionStatus && prevProps.openedMessageMenuId === nextProps.openedMessageMenuId && prevProps.theme === nextProps.theme;
|
|
32387
32519
|
});
|
|
32388
32520
|
var MessageReactionKey = styled.span(_templateObject$C || (_templateObject$C = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n font-family:\n apple color emoji,\n segoe ui emoji,\n noto color emoji,\n android emoji,\n emojisymbols,\n emojione mozilla,\n twemoji mozilla,\n segoe ui symbol;\n"])));
|
|
32389
32521
|
var ReactionItemCount = styled.span(_templateObject2$x || (_templateObject2$x = _taggedTemplateLiteralLoose(["\n margin-left: 2px;\n font-family: Inter, sans-serif;\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n"])), function (props) {
|
|
@@ -35983,8 +36115,12 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35983
36115
|
}
|
|
35984
36116
|
}, [currentRecordedFile]);
|
|
35985
36117
|
useEffect(function () {
|
|
36118
|
+
if (!showRecording) {
|
|
36119
|
+
setCurrentTime(0);
|
|
36120
|
+
}
|
|
35986
36121
|
return function () {
|
|
35987
36122
|
handleStopRecording();
|
|
36123
|
+
setCurrentTime(0);
|
|
35988
36124
|
};
|
|
35989
36125
|
}, [showRecording]);
|
|
35990
36126
|
useEffect(function () {
|
|
@@ -38068,7 +38204,6 @@ function SvgUnpin(props) {
|
|
|
38068
38204
|
|
|
38069
38205
|
var _templateObject$K, _templateObject2$F, _templateObject3$y, _templateObject4$t, _templateObject5$p, _templateObject6$l, _templateObject7$j, _templateObject8$h, _templateObject9$e, _templateObject0$d, _templateObject1$a, _templateObject10$6, _templateObject11$6, _templateObject12$5, _templateObject13$4, _templateObject14$3, _templateObject15$3, _templateObject16$3;
|
|
38070
38206
|
var Actions = function Actions(_ref) {
|
|
38071
|
-
var _channel$metadata;
|
|
38072
38207
|
var setActionsHeight = _ref.setActionsHeight,
|
|
38073
38208
|
channel = _ref.channel,
|
|
38074
38209
|
actionMenuOpen = _ref.actionMenuOpen,
|
|
@@ -38186,7 +38321,7 @@ var Actions = function Actions(_ref) {
|
|
|
38186
38321
|
var twoHours = oneHour * 2;
|
|
38187
38322
|
var oneDay = oneHour * 24;
|
|
38188
38323
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
38189
|
-
var isSelfChannel = isDirectChannel &&
|
|
38324
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
38190
38325
|
var directChannelUser = isDirectChannel && channel.members.find(function (member) {
|
|
38191
38326
|
return member.id !== user.id;
|
|
38192
38327
|
});
|
|
@@ -39255,7 +39390,7 @@ var Files = function Files(_ref) {
|
|
|
39255
39390
|
lineHeight: fileSizeLineHeight,
|
|
39256
39391
|
color: filePreviewSizeColor || textSecondary
|
|
39257
39392
|
}, file.size ? bytesToSize(file.size) : '')), /*#__PURE__*/React__default.createElement(DownloadWrapper, {
|
|
39258
|
-
visible: downloadingFilesMap[file.id],
|
|
39393
|
+
visible: !!downloadingFilesMap[file.id],
|
|
39259
39394
|
iconColor: accentColor,
|
|
39260
39395
|
onClick: function onClick() {
|
|
39261
39396
|
return handleDownloadFile(file);
|
|
@@ -40093,7 +40228,7 @@ var EditChannel = function EditChannel(_ref) {
|
|
|
40093
40228
|
|
|
40094
40229
|
var _templateObject$V, _templateObject2$O, _templateObject3$F, _templateObject4$z, _templateObject5$u, _templateObject6$p, _templateObject7$n, _templateObject8$l, _templateObject9$g, _templateObject0$e, _templateObject1$b, _templateObject10$7;
|
|
40095
40230
|
var Details = function Details(_ref) {
|
|
40096
|
-
var _activeChannel$
|
|
40231
|
+
var _activeChannel$member;
|
|
40097
40232
|
var detailsTitleText = _ref.detailsTitleText,
|
|
40098
40233
|
editDetailsTitleText = _ref.editDetailsTitleText,
|
|
40099
40234
|
detailsTitleFontSize = _ref.detailsTitleFontSize,
|
|
@@ -40248,7 +40383,7 @@ var Details = function Details(_ref) {
|
|
|
40248
40383
|
var detailsHeaderRef = useRef(null);
|
|
40249
40384
|
var openTimeOut = useRef(null);
|
|
40250
40385
|
var isDirectChannel = activeChannel && activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
40251
|
-
var isSelfChannel = isDirectChannel &&
|
|
40386
|
+
var isSelfChannel = isDirectChannel && activeChannel.memberCount === 1 && activeChannel.members.length > 0 && activeChannel.members[0].id === user.id;
|
|
40252
40387
|
var memberDisplayText = getChannelTypesMemberDisplayTextMap();
|
|
40253
40388
|
var displayMemberText = memberDisplayText && (memberDisplayText[activeChannel.type] ? activeChannel.memberCount > 1 ? memberDisplayText[activeChannel.type] + "s" : memberDisplayText[activeChannel.type] : activeChannel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || activeChannel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? activeChannel.memberCount > 1 ? 'subscribers' : 'subscriber' : activeChannel.memberCount > 1 ? 'members' : 'member');
|
|
40254
40389
|
var directChannelUser = isDirectChannel && (activeChannel.members.find(function (member) {
|
|
@@ -40362,7 +40497,7 @@ var Details = function Details(_ref) {
|
|
|
40362
40497
|
color: textSecondary,
|
|
40363
40498
|
fontSize: channelMembersFontSize,
|
|
40364
40499
|
lineHeight: channelMembersLineHeight
|
|
40365
|
-
}, showPhoneNumber ? "+" + (directChannelUser === null || directChannelUser === void 0 ? void 0 : directChannelUser.id) : hideUserPresence && directChannelUser && hideUserPresence(directChannelUser) ? '' : directChannelUser && directChannelUser.presence && (directChannelUser.presence.state === USER_PRESENCE_STATUS.ONLINE ? 'Online' : directChannelUser.presence.lastActiveAt && userLastActiveDateFormat(directChannelUser.presence.lastActiveAt)))) : (/*#__PURE__*/React__default.createElement(SubTitle, {
|
|
40500
|
+
}, showPhoneNumber && directChannelUser !== null && directChannelUser !== void 0 && directChannelUser.id ? "+" + (directChannelUser === null || directChannelUser === void 0 ? void 0 : directChannelUser.id) : hideUserPresence && directChannelUser && hideUserPresence(directChannelUser) ? '' : directChannelUser && directChannelUser.presence && (directChannelUser.presence.state === USER_PRESENCE_STATUS.ONLINE ? 'Online' : directChannelUser.presence.lastActiveAt && userLastActiveDateFormat(directChannelUser.presence.lastActiveAt)))) : (/*#__PURE__*/React__default.createElement(SubTitle, {
|
|
40366
40501
|
color: textSecondary,
|
|
40367
40502
|
fontSize: channelMembersFontSize,
|
|
40368
40503
|
lineHeight: channelMembersLineHeight
|
|
@@ -41083,5 +41218,36 @@ var UnreadCount$2 = styled.span(_templateObject2$Q || (_templateObject2$Q = _tag
|
|
|
41083
41218
|
return props.textColor || '#fff';
|
|
41084
41219
|
});
|
|
41085
41220
|
|
|
41086
|
-
|
|
41221
|
+
var createOrGetDirectChannel = function createOrGetDirectChannel(user, callback) {
|
|
41222
|
+
try {
|
|
41223
|
+
if (user) {
|
|
41224
|
+
store.dispatch(createChannelAC({
|
|
41225
|
+
metadata: '',
|
|
41226
|
+
type: DEFAULT_CHANNEL_TYPE.DIRECT,
|
|
41227
|
+
members: [_extends({}, user, {
|
|
41228
|
+
role: 'owner'
|
|
41229
|
+
})]
|
|
41230
|
+
}, false, callback));
|
|
41231
|
+
}
|
|
41232
|
+
return Promise.resolve();
|
|
41233
|
+
} catch (e) {
|
|
41234
|
+
return Promise.reject(e);
|
|
41235
|
+
}
|
|
41236
|
+
};
|
|
41237
|
+
var switchChannelActiveChannel = function switchChannelActiveChannel(channel) {
|
|
41238
|
+
try {
|
|
41239
|
+
store.dispatch(switchChannelActionAC(channel, true));
|
|
41240
|
+
return Promise.resolve();
|
|
41241
|
+
} catch (e) {
|
|
41242
|
+
return Promise.reject(e);
|
|
41243
|
+
}
|
|
41244
|
+
};
|
|
41245
|
+
var handleSendMessage = function handleSendMessage(message, channelId, connectionState) {
|
|
41246
|
+
return store.dispatch(sendTextMessageAC(message, channelId, connectionState));
|
|
41247
|
+
};
|
|
41248
|
+
var handleGetMessage = function handleGetMessage(channelId, messageId) {
|
|
41249
|
+
return store.dispatch(getMessageAC(channelId, messageId));
|
|
41250
|
+
};
|
|
41251
|
+
|
|
41252
|
+
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, FrequentlyEmojis, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, OGMetadata, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, createOrGetDirectChannel, handleGetMessage, handleSendMessage, switchChannelActiveChannel };
|
|
41087
41253
|
//# sourceMappingURL=index.modern.js.map
|