sceyt-chat-react-uikit 1.7.1-beta.1 → 1.7.1-beta.11
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/Channel/index.d.ts +21 -1
- package/components/ChannelList/index.d.ts +4 -1
- package/components/index.d.ts +2 -1
- package/index.js +789 -552
- package/index.modern.js +634 -401
- 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,68 @@ 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
|
+
if (!(channel.lastMessage.id === messageId)) {
|
|
18838
|
+
_context0.n = 5;
|
|
18839
|
+
break;
|
|
18840
|
+
}
|
|
18841
|
+
_context0.n = 5;
|
|
18842
|
+
return put(updateChannelLastMessageAC(messages[0], channel));
|
|
18843
|
+
case 5:
|
|
18844
|
+
_context0.n = 7;
|
|
18845
|
+
break;
|
|
18846
|
+
case 6:
|
|
18847
|
+
_context0.p = 6;
|
|
18848
|
+
_t0 = _context0.v;
|
|
18849
|
+
log.error('error in message query', _t0);
|
|
18850
|
+
case 7:
|
|
18851
|
+
return _context0.a(2);
|
|
18852
|
+
}
|
|
18853
|
+
}, _marked8$1, null, [[0, 6]]);
|
|
18854
|
+
}
|
|
18855
|
+
function loadMoreMessages(action) {
|
|
18856
|
+
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t1;
|
|
18857
|
+
return _regenerator().w(function (_context1) {
|
|
18858
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
18859
|
+
case 0:
|
|
18860
|
+
_context1.p = 0;
|
|
18861
|
+
payload = action.payload;
|
|
18747
18862
|
limit = payload.limit, direction = payload.direction, channelId = payload.channelId, messageId = payload.messageId, hasNext = payload.hasNext;
|
|
18748
18863
|
SceytChatClient = getClient();
|
|
18749
18864
|
messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channelId);
|
|
18750
18865
|
messageQueryBuilder.reverse(true);
|
|
18751
|
-
|
|
18866
|
+
_context1.n = 1;
|
|
18752
18867
|
return call(messageQueryBuilder.build);
|
|
18753
18868
|
case 1:
|
|
18754
|
-
messageQuery =
|
|
18869
|
+
messageQuery = _context1.v;
|
|
18755
18870
|
messageQuery.limit = limit || 5;
|
|
18756
|
-
|
|
18871
|
+
_context1.n = 2;
|
|
18757
18872
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
18758
18873
|
case 2:
|
|
18759
18874
|
result = {
|
|
@@ -18761,116 +18876,116 @@ function loadMoreMessages(action) {
|
|
|
18761
18876
|
hasNext: false
|
|
18762
18877
|
};
|
|
18763
18878
|
if (!(direction === MESSAGE_LOAD_DIRECTION.PREV)) {
|
|
18764
|
-
|
|
18879
|
+
_context1.n = 6;
|
|
18765
18880
|
break;
|
|
18766
18881
|
}
|
|
18767
18882
|
if (!getHasPrevCached()) {
|
|
18768
|
-
|
|
18883
|
+
_context1.n = 3;
|
|
18769
18884
|
break;
|
|
18770
18885
|
}
|
|
18771
18886
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
|
|
18772
|
-
|
|
18887
|
+
_context1.n = 5;
|
|
18773
18888
|
break;
|
|
18774
18889
|
case 3:
|
|
18775
18890
|
if (!hasNext) {
|
|
18776
|
-
|
|
18891
|
+
_context1.n = 5;
|
|
18777
18892
|
break;
|
|
18778
18893
|
}
|
|
18779
|
-
|
|
18894
|
+
_context1.n = 4;
|
|
18780
18895
|
return call(messageQuery.loadPreviousMessageId, messageId);
|
|
18781
18896
|
case 4:
|
|
18782
|
-
result =
|
|
18897
|
+
result = _context1.v;
|
|
18783
18898
|
if (result.messages.length) {
|
|
18784
18899
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
|
|
18785
18900
|
}
|
|
18786
|
-
|
|
18901
|
+
_context1.n = 5;
|
|
18787
18902
|
return put(setMessagesHasPrevAC(result.hasNext));
|
|
18788
18903
|
case 5:
|
|
18789
|
-
|
|
18904
|
+
_context1.n = 10;
|
|
18790
18905
|
break;
|
|
18791
18906
|
case 6:
|
|
18792
18907
|
if (!getHasNextCached()) {
|
|
18793
|
-
|
|
18908
|
+
_context1.n = 7;
|
|
18794
18909
|
break;
|
|
18795
18910
|
}
|
|
18796
18911
|
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18797
|
-
|
|
18912
|
+
_context1.n = 9;
|
|
18798
18913
|
break;
|
|
18799
18914
|
case 7:
|
|
18800
18915
|
if (!hasNext) {
|
|
18801
|
-
|
|
18916
|
+
_context1.n = 9;
|
|
18802
18917
|
break;
|
|
18803
18918
|
}
|
|
18804
18919
|
log.info('saga load next from server ... ', messageId);
|
|
18805
18920
|
messageQuery.reverse = false;
|
|
18806
|
-
|
|
18921
|
+
_context1.n = 8;
|
|
18807
18922
|
return call(messageQuery.loadNextMessageId, messageId);
|
|
18808
18923
|
case 8:
|
|
18809
|
-
result =
|
|
18924
|
+
result = _context1.v;
|
|
18810
18925
|
log.info('result from server next ... ', result);
|
|
18811
18926
|
if (result.messages.length) {
|
|
18812
18927
|
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18813
18928
|
}
|
|
18814
|
-
|
|
18929
|
+
_context1.n = 9;
|
|
18815
18930
|
return put(setMessagesHasNextAC(result.hasNext));
|
|
18816
18931
|
case 9:
|
|
18817
|
-
|
|
18932
|
+
_context1.n = 10;
|
|
18818
18933
|
return put(setMessagesHasPrevAC(true));
|
|
18819
18934
|
case 10:
|
|
18820
18935
|
if (!(result.messages && result.messages.length && result.messages.length > 0)) {
|
|
18821
|
-
|
|
18936
|
+
_context1.n = 12;
|
|
18822
18937
|
break;
|
|
18823
18938
|
}
|
|
18824
|
-
|
|
18939
|
+
_context1.n = 11;
|
|
18825
18940
|
return put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
|
|
18826
18941
|
case 11:
|
|
18827
|
-
|
|
18942
|
+
_context1.n = 13;
|
|
18828
18943
|
break;
|
|
18829
18944
|
case 12:
|
|
18830
|
-
|
|
18945
|
+
_context1.n = 13;
|
|
18831
18946
|
return put(addMessagesAC([], direction));
|
|
18832
18947
|
case 13:
|
|
18833
|
-
|
|
18948
|
+
_context1.n = 14;
|
|
18834
18949
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18835
18950
|
case 14:
|
|
18836
|
-
|
|
18951
|
+
_context1.n = 16;
|
|
18837
18952
|
break;
|
|
18838
18953
|
case 15:
|
|
18839
|
-
|
|
18840
|
-
|
|
18841
|
-
log.error('error in load more messages',
|
|
18954
|
+
_context1.p = 15;
|
|
18955
|
+
_t1 = _context1.v;
|
|
18956
|
+
log.error('error in load more messages', _t1);
|
|
18842
18957
|
case 16:
|
|
18843
|
-
return
|
|
18958
|
+
return _context1.a(2);
|
|
18844
18959
|
}
|
|
18845
|
-
},
|
|
18960
|
+
}, _marked9$1, null, [[0, 15]]);
|
|
18846
18961
|
}
|
|
18847
18962
|
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 (
|
|
18963
|
+
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, _message2, reaction, channelUpdateParam, _t10;
|
|
18964
|
+
return _regenerator().w(function (_context10) {
|
|
18965
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
18851
18966
|
case 0:
|
|
18852
|
-
|
|
18967
|
+
_context10.p = 0;
|
|
18853
18968
|
payload = action.payload;
|
|
18854
18969
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, score = payload.score, reason = payload.reason, enforceUnique = payload.enforceUnique;
|
|
18855
18970
|
user = getClient().user;
|
|
18856
|
-
|
|
18971
|
+
_context10.n = 1;
|
|
18857
18972
|
return call(getChannelFromMap, channelId);
|
|
18858
18973
|
case 1:
|
|
18859
|
-
channel =
|
|
18974
|
+
channel = _context10.v;
|
|
18860
18975
|
if (!channel) {
|
|
18861
18976
|
channel = getChannelFromAllChannels(channelId);
|
|
18862
18977
|
if (channel) {
|
|
18863
18978
|
setChannelInMap(channel);
|
|
18864
18979
|
}
|
|
18865
18980
|
}
|
|
18866
|
-
|
|
18981
|
+
_context10.n = 2;
|
|
18867
18982
|
return call(channel.addReaction, messageId, key, score, reason, enforceUnique);
|
|
18868
18983
|
case 2:
|
|
18869
|
-
_yield$call =
|
|
18984
|
+
_yield$call = _context10.v;
|
|
18870
18985
|
_message2 = _yield$call.message;
|
|
18871
18986
|
reaction = _yield$call.reaction;
|
|
18872
18987
|
if (!(user.id === _message2.user.id)) {
|
|
18873
|
-
|
|
18988
|
+
_context10.n = 4;
|
|
18874
18989
|
break;
|
|
18875
18990
|
}
|
|
18876
18991
|
channelUpdateParam = {
|
|
@@ -18878,100 +18993,100 @@ function addReaction(action) {
|
|
|
18878
18993
|
lastReactedMessage: _message2,
|
|
18879
18994
|
newReactions: [reaction]
|
|
18880
18995
|
};
|
|
18881
|
-
|
|
18996
|
+
_context10.n = 3;
|
|
18882
18997
|
return put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
18883
18998
|
case 3:
|
|
18884
18999
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
18885
19000
|
case 4:
|
|
18886
|
-
|
|
19001
|
+
_context10.n = 5;
|
|
18887
19002
|
return put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
18888
19003
|
case 5:
|
|
18889
|
-
|
|
19004
|
+
_context10.n = 6;
|
|
18890
19005
|
return put(addReactionToListAC(reaction));
|
|
18891
19006
|
case 6:
|
|
18892
|
-
|
|
19007
|
+
_context10.n = 7;
|
|
18893
19008
|
return put(addReactionToMessageAC(_message2, reaction, true));
|
|
18894
19009
|
case 7:
|
|
18895
19010
|
addReactionToMessageOnMap(channelId, _message2, reaction, true);
|
|
18896
19011
|
addReactionOnAllMessages(_message2, reaction, true);
|
|
18897
|
-
|
|
19012
|
+
_context10.n = 9;
|
|
18898
19013
|
break;
|
|
18899
19014
|
case 8:
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
log.error('ERROR in add reaction',
|
|
19015
|
+
_context10.p = 8;
|
|
19016
|
+
_t10 = _context10.v;
|
|
19017
|
+
log.error('ERROR in add reaction', _t10.message);
|
|
18903
19018
|
case 9:
|
|
18904
|
-
return
|
|
19019
|
+
return _context10.a(2);
|
|
18905
19020
|
}
|
|
18906
|
-
},
|
|
19021
|
+
}, _marked0$1, null, [[0, 8]]);
|
|
18907
19022
|
}
|
|
18908
19023
|
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 (
|
|
19024
|
+
var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, _message3, reaction, channelUpdateParam, _t11;
|
|
19025
|
+
return _regenerator().w(function (_context11) {
|
|
19026
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
18912
19027
|
case 0:
|
|
18913
|
-
|
|
19028
|
+
_context11.p = 0;
|
|
18914
19029
|
payload = action.payload;
|
|
18915
19030
|
channelId = payload.channelId, messageId = payload.messageId, key = payload.key, isLastReaction = payload.isLastReaction;
|
|
18916
|
-
|
|
19031
|
+
_context11.n = 1;
|
|
18917
19032
|
return call(getChannelFromMap, channelId);
|
|
18918
19033
|
case 1:
|
|
18919
|
-
channel =
|
|
19034
|
+
channel = _context11.v;
|
|
18920
19035
|
if (!channel) {
|
|
18921
19036
|
channel = getChannelFromAllChannels(channelId);
|
|
18922
19037
|
if (channel) {
|
|
18923
19038
|
setChannelInMap(channel);
|
|
18924
19039
|
}
|
|
18925
19040
|
}
|
|
18926
|
-
|
|
19041
|
+
_context11.n = 2;
|
|
18927
19042
|
return call(channel.deleteReaction, messageId, key);
|
|
18928
19043
|
case 2:
|
|
18929
|
-
_yield$call2 =
|
|
19044
|
+
_yield$call2 = _context11.v;
|
|
18930
19045
|
_message3 = _yield$call2.message;
|
|
18931
19046
|
reaction = _yield$call2.reaction;
|
|
18932
19047
|
if (!isLastReaction) {
|
|
18933
|
-
|
|
19048
|
+
_context11.n = 4;
|
|
18934
19049
|
break;
|
|
18935
19050
|
}
|
|
18936
19051
|
channelUpdateParam = {
|
|
18937
19052
|
userMessageReactions: [],
|
|
18938
19053
|
lastReactedMessage: null
|
|
18939
19054
|
};
|
|
18940
|
-
|
|
19055
|
+
_context11.n = 3;
|
|
18941
19056
|
return put(updateChannelDataAC(channel.id, channelUpdateParam));
|
|
18942
19057
|
case 3:
|
|
18943
19058
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
18944
19059
|
case 4:
|
|
18945
19060
|
log.info('message received. ... ', _message3);
|
|
18946
|
-
|
|
19061
|
+
_context11.n = 5;
|
|
18947
19062
|
return put(deleteReactionFromListAC(reaction));
|
|
18948
19063
|
case 5:
|
|
18949
|
-
|
|
19064
|
+
_context11.n = 6;
|
|
18950
19065
|
return put(deleteReactionFromMessageAC(_message3, reaction, true));
|
|
18951
19066
|
case 6:
|
|
18952
19067
|
removeReactionToMessageOnMap(channelId, _message3, reaction, true);
|
|
18953
19068
|
removeReactionOnAllMessages(_message3, reaction, true);
|
|
18954
|
-
|
|
19069
|
+
_context11.n = 8;
|
|
18955
19070
|
break;
|
|
18956
19071
|
case 7:
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
log.error('ERROR in delete reaction',
|
|
19072
|
+
_context11.p = 7;
|
|
19073
|
+
_t11 = _context11.v;
|
|
19074
|
+
log.error('ERROR in delete reaction', _t11.message);
|
|
18960
19075
|
case 8:
|
|
18961
|
-
return
|
|
19076
|
+
return _context11.a(2);
|
|
18962
19077
|
}
|
|
18963
|
-
},
|
|
19078
|
+
}, _marked1$1, null, [[0, 7]]);
|
|
18964
19079
|
}
|
|
18965
19080
|
function getReactions(action) {
|
|
18966
|
-
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result,
|
|
18967
|
-
return _regenerator().w(function (
|
|
18968
|
-
while (1) switch (
|
|
19081
|
+
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t12;
|
|
19082
|
+
return _regenerator().w(function (_context12) {
|
|
19083
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
18969
19084
|
case 0:
|
|
18970
|
-
|
|
19085
|
+
_context12.p = 0;
|
|
18971
19086
|
payload = action.payload;
|
|
18972
19087
|
messageId = payload.messageId, key = payload.key, limit = payload.limit;
|
|
18973
19088
|
SceytChatClient = getClient();
|
|
18974
|
-
|
|
19089
|
+
_context12.n = 1;
|
|
18975
19090
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
18976
19091
|
case 1:
|
|
18977
19092
|
reactionQueryBuilder = new SceytChatClient.ReactionListQueryBuilder(messageId);
|
|
@@ -18979,74 +19094,74 @@ function getReactions(action) {
|
|
|
18979
19094
|
if (key) {
|
|
18980
19095
|
reactionQueryBuilder.setKey(key);
|
|
18981
19096
|
}
|
|
18982
|
-
|
|
19097
|
+
_context12.n = 2;
|
|
18983
19098
|
return call(reactionQueryBuilder.build);
|
|
18984
19099
|
case 2:
|
|
18985
|
-
reactionQuery =
|
|
18986
|
-
|
|
19100
|
+
reactionQuery = _context12.v;
|
|
19101
|
+
_context12.n = 3;
|
|
18987
19102
|
return call(reactionQuery.loadNext);
|
|
18988
19103
|
case 3:
|
|
18989
|
-
result =
|
|
19104
|
+
result = _context12.v;
|
|
18990
19105
|
query.ReactionsQuery = reactionQuery;
|
|
18991
|
-
|
|
19106
|
+
_context12.n = 4;
|
|
18992
19107
|
return put(setReactionsListAC(result.reactions, result.hasNext));
|
|
18993
19108
|
case 4:
|
|
18994
|
-
|
|
19109
|
+
_context12.n = 5;
|
|
18995
19110
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
18996
19111
|
case 5:
|
|
18997
|
-
|
|
19112
|
+
_context12.n = 7;
|
|
18998
19113
|
break;
|
|
18999
19114
|
case 6:
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
log.error('ERROR in get reactions',
|
|
19115
|
+
_context12.p = 6;
|
|
19116
|
+
_t12 = _context12.v;
|
|
19117
|
+
log.error('ERROR in get reactions', _t12.message);
|
|
19003
19118
|
case 7:
|
|
19004
|
-
return
|
|
19119
|
+
return _context12.a(2);
|
|
19005
19120
|
}
|
|
19006
|
-
},
|
|
19121
|
+
}, _marked10$1, null, [[0, 6]]);
|
|
19007
19122
|
}
|
|
19008
19123
|
function loadMoreReactions(action) {
|
|
19009
|
-
var payload, limit, ReactionQuery, result,
|
|
19010
|
-
return _regenerator().w(function (
|
|
19011
|
-
while (1) switch (
|
|
19124
|
+
var payload, limit, ReactionQuery, result, _t13;
|
|
19125
|
+
return _regenerator().w(function (_context13) {
|
|
19126
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
19012
19127
|
case 0:
|
|
19013
|
-
|
|
19128
|
+
_context13.p = 0;
|
|
19014
19129
|
payload = action.payload;
|
|
19015
19130
|
limit = payload.limit;
|
|
19016
|
-
|
|
19131
|
+
_context13.n = 1;
|
|
19017
19132
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
|
|
19018
19133
|
case 1:
|
|
19019
19134
|
ReactionQuery = query.ReactionsQuery;
|
|
19020
19135
|
if (limit) {
|
|
19021
19136
|
ReactionQuery.limit = limit;
|
|
19022
19137
|
}
|
|
19023
|
-
|
|
19138
|
+
_context13.n = 2;
|
|
19024
19139
|
return call(ReactionQuery.loadNext);
|
|
19025
19140
|
case 2:
|
|
19026
|
-
result =
|
|
19027
|
-
|
|
19141
|
+
result = _context13.v;
|
|
19142
|
+
_context13.n = 3;
|
|
19028
19143
|
return put(addReactionsToListAC(result.reactions, result.hasNext));
|
|
19029
19144
|
case 3:
|
|
19030
|
-
|
|
19145
|
+
_context13.n = 4;
|
|
19031
19146
|
return put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
19032
19147
|
case 4:
|
|
19033
|
-
|
|
19148
|
+
_context13.n = 6;
|
|
19034
19149
|
break;
|
|
19035
19150
|
case 5:
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
log.error('ERROR in load more reactions',
|
|
19151
|
+
_context13.p = 5;
|
|
19152
|
+
_t13 = _context13.v;
|
|
19153
|
+
log.error('ERROR in load more reactions', _t13.message);
|
|
19039
19154
|
case 6:
|
|
19040
|
-
return
|
|
19155
|
+
return _context13.a(2);
|
|
19041
19156
|
}
|
|
19042
|
-
},
|
|
19157
|
+
}, _marked11$1, null, [[0, 5]]);
|
|
19043
19158
|
}
|
|
19044
19159
|
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 (
|
|
19160
|
+
var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t14;
|
|
19161
|
+
return _regenerator().w(function (_context14) {
|
|
19162
|
+
while (1) switch (_context14.p = _context14.n) {
|
|
19048
19163
|
case 0:
|
|
19049
|
-
|
|
19164
|
+
_context14.p = 0;
|
|
19050
19165
|
_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
19166
|
SceytChatClient = getClient();
|
|
19052
19167
|
typeList = [attachmentTypes.video, attachmentTypes.image, attachmentTypes.file, attachmentTypes.link, attachmentTypes.voice];
|
|
@@ -19061,240 +19176,243 @@ function getMessageAttachments(action) {
|
|
|
19061
19176
|
}
|
|
19062
19177
|
AttachmentByTypeQueryBuilder = new SceytChatClient.AttachmentListQueryBuilder(channelId, typeList);
|
|
19063
19178
|
AttachmentByTypeQueryBuilder.limit(limit || 34);
|
|
19064
|
-
|
|
19179
|
+
_context14.n = 1;
|
|
19065
19180
|
return call(AttachmentByTypeQueryBuilder.build);
|
|
19066
19181
|
case 1:
|
|
19067
|
-
AttachmentByTypeQuery =
|
|
19182
|
+
AttachmentByTypeQuery = _context14.v;
|
|
19068
19183
|
if (forPopup) {
|
|
19069
19184
|
AttachmentByTypeQuery.reverse = true;
|
|
19070
19185
|
}
|
|
19071
19186
|
if (!(direction === queryDirection.NEXT)) {
|
|
19072
|
-
|
|
19187
|
+
_context14.n = 3;
|
|
19073
19188
|
break;
|
|
19074
19189
|
}
|
|
19075
|
-
|
|
19190
|
+
_context14.n = 2;
|
|
19076
19191
|
return call(AttachmentByTypeQuery.loadPrevious);
|
|
19077
19192
|
case 2:
|
|
19078
|
-
result =
|
|
19079
|
-
|
|
19193
|
+
result = _context14.v;
|
|
19194
|
+
_context14.n = 7;
|
|
19080
19195
|
break;
|
|
19081
19196
|
case 3:
|
|
19082
19197
|
if (!(direction === queryDirection.NEAR)) {
|
|
19083
|
-
|
|
19198
|
+
_context14.n = 5;
|
|
19084
19199
|
break;
|
|
19085
19200
|
}
|
|
19086
|
-
|
|
19201
|
+
_context14.n = 4;
|
|
19087
19202
|
return call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
|
|
19088
19203
|
case 4:
|
|
19089
|
-
result =
|
|
19090
|
-
|
|
19204
|
+
result = _context14.v;
|
|
19205
|
+
_context14.n = 7;
|
|
19091
19206
|
break;
|
|
19092
19207
|
case 5:
|
|
19093
|
-
|
|
19208
|
+
_context14.n = 6;
|
|
19094
19209
|
return call(AttachmentByTypeQuery.loadPrevious);
|
|
19095
19210
|
case 6:
|
|
19096
|
-
result =
|
|
19211
|
+
result = _context14.v;
|
|
19097
19212
|
case 7:
|
|
19098
19213
|
if (!forPopup) {
|
|
19099
|
-
|
|
19214
|
+
_context14.n = 10;
|
|
19100
19215
|
break;
|
|
19101
19216
|
}
|
|
19102
19217
|
query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
|
|
19103
|
-
|
|
19218
|
+
_context14.n = 8;
|
|
19104
19219
|
return put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
19105
19220
|
case 8:
|
|
19106
|
-
|
|
19221
|
+
_context14.n = 9;
|
|
19107
19222
|
return put(setAttachmentsCompleteForPopupAC(result.hasNext));
|
|
19108
19223
|
case 9:
|
|
19109
|
-
|
|
19224
|
+
_context14.n = 12;
|
|
19110
19225
|
break;
|
|
19111
19226
|
case 10:
|
|
19112
19227
|
query.AttachmentByTypeQuery = AttachmentByTypeQuery;
|
|
19113
|
-
|
|
19228
|
+
_context14.n = 11;
|
|
19114
19229
|
return put(setAttachmentsCompleteAC(result.hasNext));
|
|
19115
19230
|
case 11:
|
|
19116
|
-
|
|
19231
|
+
_context14.n = 12;
|
|
19117
19232
|
return put(setAttachmentsAC(JSON.parse(JSON.stringify(result.attachments))));
|
|
19118
19233
|
case 12:
|
|
19119
|
-
|
|
19234
|
+
_context14.n = 14;
|
|
19120
19235
|
break;
|
|
19121
19236
|
case 13:
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
log.error('error in message attachment query',
|
|
19237
|
+
_context14.p = 13;
|
|
19238
|
+
_t14 = _context14.v;
|
|
19239
|
+
log.error('error in message attachment query', _t14);
|
|
19125
19240
|
case 14:
|
|
19126
|
-
return
|
|
19241
|
+
return _context14.a(2);
|
|
19127
19242
|
}
|
|
19128
|
-
},
|
|
19243
|
+
}, _marked12$1, null, [[0, 13]]);
|
|
19129
19244
|
}
|
|
19130
19245
|
function loadMoreMessageAttachments(action) {
|
|
19131
|
-
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext,
|
|
19132
|
-
return _regenerator().w(function (
|
|
19133
|
-
while (1) switch (
|
|
19246
|
+
var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t15;
|
|
19247
|
+
return _regenerator().w(function (_context15) {
|
|
19248
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
19134
19249
|
case 0:
|
|
19135
|
-
|
|
19250
|
+
_context15.p = 0;
|
|
19136
19251
|
_action$payload3 = action.payload, limit = _action$payload3.limit, direction = _action$payload3.direction, forPopup = _action$payload3.forPopup;
|
|
19137
19252
|
if (forPopup) {
|
|
19138
19253
|
AttachmentQuery = query.AttachmentByTypeQueryForPopup;
|
|
19139
19254
|
} else {
|
|
19140
19255
|
AttachmentQuery = query.AttachmentByTypeQuery;
|
|
19141
19256
|
}
|
|
19142
|
-
|
|
19257
|
+
_context15.n = 1;
|
|
19143
19258
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19144
19259
|
case 1:
|
|
19145
19260
|
AttachmentQuery.limit = limit;
|
|
19146
|
-
|
|
19261
|
+
_context15.n = 2;
|
|
19147
19262
|
return call(AttachmentQuery.loadPrevious);
|
|
19148
19263
|
case 2:
|
|
19149
|
-
_yield$call3 =
|
|
19264
|
+
_yield$call3 = _context15.v;
|
|
19150
19265
|
attachments = _yield$call3.attachments;
|
|
19151
19266
|
hasNext = _yield$call3.hasNext;
|
|
19152
19267
|
if (!forPopup) {
|
|
19153
|
-
|
|
19268
|
+
_context15.n = 4;
|
|
19154
19269
|
break;
|
|
19155
19270
|
}
|
|
19156
|
-
|
|
19271
|
+
_context15.n = 3;
|
|
19157
19272
|
return put(addAttachmentsForPopupAC(attachments, direction));
|
|
19158
19273
|
case 3:
|
|
19159
|
-
|
|
19274
|
+
_context15.n = 7;
|
|
19160
19275
|
break;
|
|
19161
19276
|
case 4:
|
|
19162
|
-
|
|
19277
|
+
_context15.n = 5;
|
|
19163
19278
|
return put(setAttachmentsCompleteAC(hasNext));
|
|
19164
19279
|
case 5:
|
|
19165
|
-
|
|
19280
|
+
_context15.n = 6;
|
|
19166
19281
|
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19167
19282
|
case 6:
|
|
19168
|
-
|
|
19283
|
+
_context15.n = 7;
|
|
19169
19284
|
return put(addAttachmentsAC(attachments));
|
|
19170
19285
|
case 7:
|
|
19171
|
-
|
|
19286
|
+
_context15.n = 9;
|
|
19172
19287
|
break;
|
|
19173
19288
|
case 8:
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
log.error('error in message attachment query',
|
|
19289
|
+
_context15.p = 8;
|
|
19290
|
+
_t15 = _context15.v;
|
|
19291
|
+
log.error('error in message attachment query', _t15);
|
|
19177
19292
|
case 9:
|
|
19178
|
-
return
|
|
19293
|
+
return _context15.a(2);
|
|
19179
19294
|
}
|
|
19180
|
-
},
|
|
19295
|
+
}, _marked13$1, null, [[0, 8]]);
|
|
19181
19296
|
}
|
|
19182
19297
|
function pauseAttachmentUploading(action) {
|
|
19183
|
-
var attachmentId, isPaused,
|
|
19184
|
-
return _regenerator().w(function (
|
|
19185
|
-
while (1) switch (
|
|
19298
|
+
var attachmentId, isPaused, _t16;
|
|
19299
|
+
return _regenerator().w(function (_context16) {
|
|
19300
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
19186
19301
|
case 0:
|
|
19187
|
-
|
|
19302
|
+
_context16.p = 0;
|
|
19188
19303
|
attachmentId = action.payload.attachmentId;
|
|
19189
19304
|
if (!getCustomUploader()) {
|
|
19190
|
-
|
|
19305
|
+
_context16.n = 1;
|
|
19191
19306
|
break;
|
|
19192
19307
|
}
|
|
19193
19308
|
isPaused = pauseUpload(attachmentId);
|
|
19194
19309
|
if (!isPaused) {
|
|
19195
|
-
|
|
19310
|
+
_context16.n = 1;
|
|
19196
19311
|
break;
|
|
19197
19312
|
}
|
|
19198
|
-
|
|
19313
|
+
_context16.n = 1;
|
|
19199
19314
|
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.PAUSED, attachmentId));
|
|
19200
19315
|
case 1:
|
|
19201
|
-
|
|
19316
|
+
_context16.n = 3;
|
|
19202
19317
|
break;
|
|
19203
19318
|
case 2:
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
log.error('error in pause attachment uploading',
|
|
19319
|
+
_context16.p = 2;
|
|
19320
|
+
_t16 = _context16.v;
|
|
19321
|
+
log.error('error in pause attachment uploading', _t16);
|
|
19207
19322
|
case 3:
|
|
19208
|
-
return
|
|
19323
|
+
return _context16.a(2);
|
|
19209
19324
|
}
|
|
19210
|
-
},
|
|
19325
|
+
}, _marked14$1, null, [[0, 2]]);
|
|
19211
19326
|
}
|
|
19212
19327
|
function resumeAttachmentUploading(action) {
|
|
19213
|
-
var attachmentId, isResumed,
|
|
19214
|
-
return _regenerator().w(function (
|
|
19215
|
-
while (1) switch (
|
|
19328
|
+
var attachmentId, isResumed, _t17;
|
|
19329
|
+
return _regenerator().w(function (_context17) {
|
|
19330
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
19216
19331
|
case 0:
|
|
19217
|
-
|
|
19332
|
+
_context17.p = 0;
|
|
19218
19333
|
attachmentId = action.payload.attachmentId;
|
|
19219
19334
|
log.info('resume for attachment ... ', attachmentId);
|
|
19220
19335
|
if (!getCustomUploader()) {
|
|
19221
|
-
|
|
19336
|
+
_context17.n = 1;
|
|
19222
19337
|
break;
|
|
19223
19338
|
}
|
|
19224
19339
|
isResumed = resumeUpload(attachmentId);
|
|
19225
19340
|
if (!isResumed) {
|
|
19226
|
-
|
|
19341
|
+
_context17.n = 1;
|
|
19227
19342
|
break;
|
|
19228
19343
|
}
|
|
19229
|
-
|
|
19344
|
+
_context17.n = 1;
|
|
19230
19345
|
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
|
|
19231
19346
|
case 1:
|
|
19232
|
-
|
|
19347
|
+
_context17.n = 3;
|
|
19233
19348
|
break;
|
|
19234
19349
|
case 2:
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
log.error('error in resume attachment uploading',
|
|
19350
|
+
_context17.p = 2;
|
|
19351
|
+
_t17 = _context17.v;
|
|
19352
|
+
log.error('error in resume attachment uploading', _t17);
|
|
19238
19353
|
case 3:
|
|
19239
|
-
return
|
|
19354
|
+
return _context17.a(2);
|
|
19240
19355
|
}
|
|
19241
|
-
},
|
|
19356
|
+
}, _marked15$1, null, [[0, 2]]);
|
|
19242
19357
|
}
|
|
19243
19358
|
function MessageSaga() {
|
|
19244
|
-
return _regenerator().w(function (
|
|
19245
|
-
while (1) switch (
|
|
19359
|
+
return _regenerator().w(function (_context18) {
|
|
19360
|
+
while (1) switch (_context18.n) {
|
|
19246
19361
|
case 0:
|
|
19247
|
-
|
|
19362
|
+
_context18.n = 1;
|
|
19248
19363
|
return takeEvery(SEND_MESSAGE, sendMessage);
|
|
19249
19364
|
case 1:
|
|
19250
|
-
|
|
19365
|
+
_context18.n = 2;
|
|
19251
19366
|
return takeEvery(SEND_TEXT_MESSAGE, sendTextMessage);
|
|
19252
19367
|
case 2:
|
|
19253
|
-
|
|
19368
|
+
_context18.n = 3;
|
|
19254
19369
|
return takeEvery(FORWARD_MESSAGE, forwardMessage);
|
|
19255
19370
|
case 3:
|
|
19256
|
-
|
|
19371
|
+
_context18.n = 4;
|
|
19257
19372
|
return takeEvery(RESEND_MESSAGE, resendMessage);
|
|
19258
19373
|
case 4:
|
|
19259
|
-
|
|
19374
|
+
_context18.n = 5;
|
|
19260
19375
|
return takeLatest(EDIT_MESSAGE, editMessage);
|
|
19261
19376
|
case 5:
|
|
19262
|
-
|
|
19377
|
+
_context18.n = 6;
|
|
19263
19378
|
return takeEvery(DELETE_MESSAGE, deleteMessage);
|
|
19264
19379
|
case 6:
|
|
19265
|
-
|
|
19380
|
+
_context18.n = 7;
|
|
19266
19381
|
return takeLatest(GET_MESSAGES, getMessagesQuery);
|
|
19267
19382
|
case 7:
|
|
19268
|
-
|
|
19269
|
-
return takeLatest(
|
|
19383
|
+
_context18.n = 8;
|
|
19384
|
+
return takeLatest(GET_MESSAGE, getMessageQuery);
|
|
19270
19385
|
case 8:
|
|
19271
|
-
|
|
19272
|
-
return takeLatest(
|
|
19386
|
+
_context18.n = 9;
|
|
19387
|
+
return takeLatest(GET_MESSAGES_ATTACHMENTS, getMessageAttachments);
|
|
19273
19388
|
case 9:
|
|
19274
|
-
|
|
19275
|
-
return takeLatest(
|
|
19389
|
+
_context18.n = 10;
|
|
19390
|
+
return takeLatest(LOAD_MORE_MESSAGES_ATTACHMENTS, loadMoreMessageAttachments);
|
|
19276
19391
|
case 10:
|
|
19277
|
-
|
|
19278
|
-
return takeLatest(
|
|
19392
|
+
_context18.n = 11;
|
|
19393
|
+
return takeLatest(ADD_REACTION, addReaction);
|
|
19279
19394
|
case 11:
|
|
19280
|
-
|
|
19281
|
-
return
|
|
19395
|
+
_context18.n = 12;
|
|
19396
|
+
return takeLatest(DELETE_REACTION, deleteReaction);
|
|
19282
19397
|
case 12:
|
|
19283
|
-
|
|
19284
|
-
return takeEvery(
|
|
19398
|
+
_context18.n = 13;
|
|
19399
|
+
return takeEvery(LOAD_MORE_MESSAGES, loadMoreMessages);
|
|
19285
19400
|
case 13:
|
|
19286
|
-
|
|
19287
|
-
return takeEvery(
|
|
19401
|
+
_context18.n = 14;
|
|
19402
|
+
return takeEvery(GET_REACTIONS, getReactions);
|
|
19288
19403
|
case 14:
|
|
19289
|
-
|
|
19290
|
-
return takeEvery(
|
|
19404
|
+
_context18.n = 15;
|
|
19405
|
+
return takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
|
|
19291
19406
|
case 15:
|
|
19292
|
-
|
|
19293
|
-
return takeEvery(
|
|
19407
|
+
_context18.n = 16;
|
|
19408
|
+
return takeEvery(PAUSE_ATTACHMENT_UPLOADING, pauseAttachmentUploading);
|
|
19294
19409
|
case 16:
|
|
19295
|
-
|
|
19410
|
+
_context18.n = 17;
|
|
19411
|
+
return takeEvery(RESUME_ATTACHMENT_UPLOADING, resumeAttachmentUploading);
|
|
19412
|
+
case 17:
|
|
19413
|
+
return _context18.a(2);
|
|
19296
19414
|
}
|
|
19297
|
-
},
|
|
19415
|
+
}, _marked16$1);
|
|
19298
19416
|
}
|
|
19299
19417
|
|
|
19300
19418
|
var _marked$4 = /*#__PURE__*/_regenerator().m(getMembers),
|
|
@@ -20062,6 +20180,12 @@ var store = configureStore({
|
|
|
20062
20180
|
});
|
|
20063
20181
|
sagaMiddleware.run(rootSaga);
|
|
20064
20182
|
|
|
20183
|
+
var SceytReduxContext = /*#__PURE__*/React__default.createContext(null);
|
|
20184
|
+
|
|
20185
|
+
var useSelector = createSelectorHook(SceytReduxContext);
|
|
20186
|
+
var useDispatch = createDispatchHook(SceytReduxContext);
|
|
20187
|
+
var useStore = createStoreHook(SceytReduxContext);
|
|
20188
|
+
|
|
20065
20189
|
var channelsSelector = function channelsSelector(store) {
|
|
20066
20190
|
return store.ChannelReducer.channels;
|
|
20067
20191
|
};
|
|
@@ -20545,7 +20669,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
20545
20669
|
log.setLevel(logLevel);
|
|
20546
20670
|
}, []);
|
|
20547
20671
|
return /*#__PURE__*/React__default.createElement(Provider, {
|
|
20548
|
-
store: store
|
|
20672
|
+
store: store,
|
|
20673
|
+
context: SceytReduxContext
|
|
20549
20674
|
}, /*#__PURE__*/React__default.createElement(SceytChat, {
|
|
20550
20675
|
client: client,
|
|
20551
20676
|
theme: theme,
|
|
@@ -21002,7 +21127,6 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
|
|
|
21002
21127
|
}), channel.lastReactedMessage && '"')))));
|
|
21003
21128
|
};
|
|
21004
21129
|
var Channel = function Channel(_ref3) {
|
|
21005
|
-
var _channel$metadata;
|
|
21006
21130
|
var channel = _ref3.channel,
|
|
21007
21131
|
theme = _ref3.theme,
|
|
21008
21132
|
_ref3$showAvatar = _ref3.showAvatar,
|
|
@@ -21026,7 +21150,9 @@ var Channel = function Channel(_ref3) {
|
|
|
21026
21150
|
channelLastMessageTimeFontSize = _ref3.channelLastMessageTimeFontSize,
|
|
21027
21151
|
channelLastMessageHeight = _ref3.channelLastMessageHeight,
|
|
21028
21152
|
channelAvatarSize = _ref3.channelAvatarSize,
|
|
21029
|
-
channelAvatarTextSize = _ref3.channelAvatarTextSize
|
|
21153
|
+
channelAvatarTextSize = _ref3.channelAvatarTextSize,
|
|
21154
|
+
setSelectedChannel = _ref3.setSelectedChannel,
|
|
21155
|
+
getCustomLatestMessage = _ref3.getCustomLatestMessage;
|
|
21030
21156
|
var _useColor = useColors(),
|
|
21031
21157
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
21032
21158
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -21047,7 +21173,7 @@ var Channel = function Channel(_ref3) {
|
|
|
21047
21173
|
var activeChannel = useSelector(activeChannelSelector) || {};
|
|
21048
21174
|
var channelDraftIsRemoved = useSelector(channelMessageDraftIsRemovedSelector);
|
|
21049
21175
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
21050
|
-
var isSelfChannel = isDirectChannel &&
|
|
21176
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
21051
21177
|
var directChannelUser = isDirectChannel && channel.members.find(function (member) {
|
|
21052
21178
|
return member.id !== user.id;
|
|
21053
21179
|
});
|
|
@@ -21064,13 +21190,6 @@ var Channel = function Channel(_ref3) {
|
|
|
21064
21190
|
statusWidth = _useState3[0],
|
|
21065
21191
|
setStatusWidth = _useState3[1];
|
|
21066
21192
|
var avatarName = channel.subject || (isDirectChannel && directChannelUser ? directChannelUser.firstName || directChannelUser.id : isSelfChannel ? 'Me' : '');
|
|
21067
|
-
var handleChangeActiveChannel = function handleChangeActiveChannel(chan) {
|
|
21068
|
-
if (activeChannel.id !== chan.id) {
|
|
21069
|
-
dispatch(sendTypingAC(false));
|
|
21070
|
-
dispatch(clearMessagesAC());
|
|
21071
|
-
dispatch(switchChannelActionAC(chan));
|
|
21072
|
-
}
|
|
21073
|
-
};
|
|
21074
21193
|
var messageAuthorRef = useRef(null);
|
|
21075
21194
|
var messageTimeAndStatusRef = useRef(null);
|
|
21076
21195
|
useUpdatePresence(channel, true);
|
|
@@ -21155,6 +21274,40 @@ var Channel = function Channel(_ref3) {
|
|
|
21155
21274
|
isDirectChannel: isDirectChannel
|
|
21156
21275
|
});
|
|
21157
21276
|
}, [typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping, typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording, draftMessageText, lastMessage, user, contactsMap, getFromContacts, lastMessageMetas, accentColor, typingOrRecording, channel, isDirectChannel]);
|
|
21277
|
+
var getCustomLatestMessageComponent = useCallback(function (_ref4) {
|
|
21278
|
+
var lastMessage = _ref4.lastMessage,
|
|
21279
|
+
typingOrRecording = _ref4.typingOrRecording,
|
|
21280
|
+
draftMessageText = _ref4.draftMessageText,
|
|
21281
|
+
textSecondary = _ref4.textSecondary,
|
|
21282
|
+
channel = _ref4.channel,
|
|
21283
|
+
channelLastMessageFontSize = _ref4.channelLastMessageFontSize,
|
|
21284
|
+
channelLastMessageHeight = _ref4.channelLastMessageHeight,
|
|
21285
|
+
isDirectChannel = _ref4.isDirectChannel,
|
|
21286
|
+
textPrimary = _ref4.textPrimary,
|
|
21287
|
+
messageAuthorRef = _ref4.messageAuthorRef,
|
|
21288
|
+
contactsMap = _ref4.contactsMap,
|
|
21289
|
+
getFromContacts = _ref4.getFromContacts,
|
|
21290
|
+
warningColor = _ref4.warningColor,
|
|
21291
|
+
user = _ref4.user,
|
|
21292
|
+
MessageText = _ref4.MessageText;
|
|
21293
|
+
return getCustomLatestMessage && getCustomLatestMessage({
|
|
21294
|
+
lastMessage: lastMessage,
|
|
21295
|
+
typingOrRecording: typingOrRecording,
|
|
21296
|
+
draftMessageText: draftMessageText,
|
|
21297
|
+
textSecondary: textSecondary,
|
|
21298
|
+
channel: channel,
|
|
21299
|
+
channelLastMessageFontSize: channelLastMessageFontSize,
|
|
21300
|
+
channelLastMessageHeight: channelLastMessageHeight,
|
|
21301
|
+
isDirectChannel: isDirectChannel,
|
|
21302
|
+
textPrimary: textPrimary,
|
|
21303
|
+
messageAuthorRef: messageAuthorRef,
|
|
21304
|
+
contactsMap: contactsMap,
|
|
21305
|
+
getFromContacts: getFromContacts,
|
|
21306
|
+
warningColor: warningColor,
|
|
21307
|
+
user: user,
|
|
21308
|
+
MessageText: MessageText
|
|
21309
|
+
});
|
|
21310
|
+
}, [getCustomLatestMessage, lastMessage, typingOrRecording, draftMessageText, textSecondary, channel, channelLastMessageFontSize, channelLastMessageHeight, isDirectChannel, textPrimary, messageAuthorRef, contactsMap, getFromContacts, warningColor, user, MessageText]);
|
|
21158
21311
|
return /*#__PURE__*/React__default.createElement(Container$2, {
|
|
21159
21312
|
theme: theme,
|
|
21160
21313
|
selectedChannel: channel.id === activeChannel.id,
|
|
@@ -21165,7 +21318,7 @@ var Channel = function Channel(_ref3) {
|
|
|
21165
21318
|
selectedChannelBorderRadius: selectedChannelBorderRadius,
|
|
21166
21319
|
channelsMargin: channelsMargin,
|
|
21167
21320
|
onClick: function onClick() {
|
|
21168
|
-
return
|
|
21321
|
+
return setSelectedChannel(channel);
|
|
21169
21322
|
},
|
|
21170
21323
|
hoverBackground: channelHoverBackground || backgroundHovered
|
|
21171
21324
|
}, showAvatar && (/*#__PURE__*/React__default.createElement(AvatarWrapper, null, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
@@ -21191,7 +21344,23 @@ var Channel = function Channel(_ref3) {
|
|
|
21191
21344
|
avatarSize: channelAvatarSize
|
|
21192
21345
|
}, /*#__PURE__*/React__default.createElement("h3", null, channel.subject || (isDirectChannel && directChannelUser ? makeUsername(contactsMap && contactsMap[directChannelUser.id], directChannelUser, getFromContacts) : isSelfChannel ? 'Me' : '')), channel.muted && (/*#__PURE__*/React__default.createElement(MutedIcon, {
|
|
21193
21346
|
color: notificationsIsMutedIconColor || iconInactive
|
|
21194
|
-
}, notificationsIsMutedIcon || /*#__PURE__*/React__default.createElement(SvgUnmuteNotifications, null))),
|
|
21347
|
+
}, notificationsIsMutedIcon || /*#__PURE__*/React__default.createElement(SvgUnmuteNotifications, null))), getCustomLatestMessage ? getCustomLatestMessageComponent({
|
|
21348
|
+
lastMessage: lastMessage,
|
|
21349
|
+
typingOrRecording: typingOrRecording,
|
|
21350
|
+
draftMessageText: draftMessageText,
|
|
21351
|
+
textSecondary: textSecondary,
|
|
21352
|
+
channel: channel,
|
|
21353
|
+
channelLastMessageFontSize: channelLastMessageFontSize || '14px',
|
|
21354
|
+
channelLastMessageHeight: channelLastMessageHeight || '20px',
|
|
21355
|
+
isDirectChannel: isDirectChannel,
|
|
21356
|
+
textPrimary: textPrimary,
|
|
21357
|
+
messageAuthorRef: messageAuthorRef,
|
|
21358
|
+
contactsMap: contactsMap || {},
|
|
21359
|
+
getFromContacts: getFromContacts,
|
|
21360
|
+
warningColor: warningColor,
|
|
21361
|
+
user: user,
|
|
21362
|
+
MessageText: MessageText
|
|
21363
|
+
}) : (lastMessage || typingOrRecording.items.length > 0 || draftMessageText) && (/*#__PURE__*/React__default.createElement(LastMessage, {
|
|
21195
21364
|
color: textSecondary,
|
|
21196
21365
|
markedAsUnread: !!(channel.unread || channel.newMessageCount && channel.newMessageCount > 0),
|
|
21197
21366
|
unreadMentions: !!(channel.newMentionCount && channel.newMentionCount > 0),
|
|
@@ -21294,9 +21463,9 @@ var Container$2 = styled.div(_templateObject6$1 || (_templateObject6$1 = _tagged
|
|
|
21294
21463
|
return props.channelsMargin || '0 8px';
|
|
21295
21464
|
}, function (props) {
|
|
21296
21465
|
return props.selectedChannelBorderRadius || '12px';
|
|
21297
|
-
}, function (
|
|
21298
|
-
var selectedChannel =
|
|
21299
|
-
hoverBackground =
|
|
21466
|
+
}, function (_ref5) {
|
|
21467
|
+
var selectedChannel = _ref5.selectedChannel,
|
|
21468
|
+
hoverBackground = _ref5.hoverBackground;
|
|
21300
21469
|
return !selectedChannel && "\n background-color: " + hoverBackground + ";\n ";
|
|
21301
21470
|
}, UserStatus, function (props) {
|
|
21302
21471
|
return props.selectedChannel ? props.selectedBackgroundColor : props.hoverBackground;
|
|
@@ -21311,9 +21480,9 @@ var DraftMessageText = styled.span(_templateObject8$1 || (_templateObject8$1 = _
|
|
|
21311
21480
|
});
|
|
21312
21481
|
var LastMessageAuthor = styled.div(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n max-width: 120px;\n font-weight: 500;\n color: ", ";\n\n ", "\n & > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 100%;\n }\n"])), function (props) {
|
|
21313
21482
|
return props.color;
|
|
21314
|
-
}, function (
|
|
21315
|
-
var typing =
|
|
21316
|
-
recording =
|
|
21483
|
+
}, function (_ref6) {
|
|
21484
|
+
var typing = _ref6.typing,
|
|
21485
|
+
recording = _ref6.recording;
|
|
21317
21486
|
return (typing || recording) && "\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: calc(100% - " + (typing ? 62 : 76) + "px);\n ";
|
|
21318
21487
|
});
|
|
21319
21488
|
var Points = styled.span(_templateObject0$1 || (_templateObject0$1 = _taggedTemplateLiteralLoose(["\n margin-right: 4px;\n color: ", ";\n font-style: normal;\n"])), function (props) {
|
|
@@ -23231,7 +23400,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23231
23400
|
channelAvatarTextSize = _ref.channelAvatarTextSize,
|
|
23232
23401
|
searchChannelInputFontSize = _ref.searchChannelInputFontSize,
|
|
23233
23402
|
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize,
|
|
23234
|
-
searchChannelsPadding = _ref.searchChannelsPadding
|
|
23403
|
+
searchChannelsPadding = _ref.searchChannelsPadding,
|
|
23404
|
+
getCustomLatestMessage = _ref.getCustomLatestMessage;
|
|
23235
23405
|
var _useColor = useColors(),
|
|
23236
23406
|
background = _useColor[THEME_COLORS.BACKGROUND],
|
|
23237
23407
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -23299,11 +23469,6 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23299
23469
|
handleLoadMoreChannels();
|
|
23300
23470
|
}
|
|
23301
23471
|
};
|
|
23302
|
-
var handleChangeActiveChannel = function handleChangeActiveChannel(chan) {
|
|
23303
|
-
if (activeChannel.id !== chan.id) {
|
|
23304
|
-
dispatch(switchChannelActionAC(chan));
|
|
23305
|
-
}
|
|
23306
|
-
};
|
|
23307
23472
|
var handleCrateChatWithContact = function handleCrateChatWithContact(contact) {
|
|
23308
23473
|
if (contact) {
|
|
23309
23474
|
var channelData = {
|
|
@@ -23459,6 +23624,13 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23459
23624
|
setListWidthIsSet(false);
|
|
23460
23625
|
}
|
|
23461
23626
|
}, [channels]);
|
|
23627
|
+
var setSelectedChannel = function setSelectedChannel(channel) {
|
|
23628
|
+
if (activeChannel.id !== channel.id) {
|
|
23629
|
+
dispatch(sendTypingAC(false));
|
|
23630
|
+
dispatch(clearMessagesAC());
|
|
23631
|
+
dispatch(switchChannelActionAC(channel));
|
|
23632
|
+
}
|
|
23633
|
+
};
|
|
23462
23634
|
return /*#__PURE__*/React__default.createElement(Container$7, {
|
|
23463
23635
|
className: className,
|
|
23464
23636
|
withCustomList: !!List,
|
|
@@ -23503,13 +23675,13 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23503
23675
|
channels: channels,
|
|
23504
23676
|
searchedChannels: searchedChannels,
|
|
23505
23677
|
selectedChannel: activeChannel,
|
|
23506
|
-
setSelectedChannel:
|
|
23678
|
+
setSelectedChannel: setSelectedChannel,
|
|
23507
23679
|
loadMoreChannels: handleLoadMoreChannels,
|
|
23508
23680
|
searchValue: searchValue
|
|
23509
23681
|
}, !searchValue ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, channels.map(function (channel) {
|
|
23510
23682
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23511
23683
|
channel: channel,
|
|
23512
|
-
setSelectedChannel:
|
|
23684
|
+
setSelectedChannel: setSelectedChannel,
|
|
23513
23685
|
key: channel.id
|
|
23514
23686
|
})) : (/*#__PURE__*/React__default.createElement(Channel, {
|
|
23515
23687
|
theme: theme,
|
|
@@ -23535,7 +23707,9 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23535
23707
|
avatarBorderRadius: avatarBorderRadius,
|
|
23536
23708
|
channel: channel,
|
|
23537
23709
|
key: channel.id,
|
|
23538
|
-
contactsMap: contactsMap
|
|
23710
|
+
contactsMap: contactsMap,
|
|
23711
|
+
setSelectedChannel: setSelectedChannel,
|
|
23712
|
+
getCustomLatestMessage: getCustomLatestMessage
|
|
23539
23713
|
}));
|
|
23540
23714
|
}))) : channelsLoading === LOADING_STATE.LOADED && searchValue ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, searchedChannels !== null && searchedChannels !== void 0 && (_searchedChannels$cha = searchedChannels.chats_groups) !== null && _searchedChannels$cha !== void 0 && _searchedChannels$cha.length || searchedChannels !== null && searchedChannels !== void 0 && (_searchedChannels$cha2 = searchedChannels.channels) !== null && _searchedChannels$cha2 !== void 0 && _searchedChannels$cha2.length || searchedChannels !== null && searchedChannels !== void 0 && (_searchedChannels$con = searchedChannels.contacts) !== null && _searchedChannels$con !== void 0 && _searchedChannels$con.length ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, !!(searchedChannels.chats_groups && searchedChannels.chats_groups.length) && (/*#__PURE__*/React__default.createElement(DirectChannels, null, /*#__PURE__*/React__default.createElement(SearchedChannelsHeader, {
|
|
23541
23715
|
color: textSecondary,
|
|
@@ -23543,7 +23717,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23543
23717
|
}, "Chats & Groups"), searchedChannels.chats_groups.map(function (channel) {
|
|
23544
23718
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23545
23719
|
channel: channel,
|
|
23546
|
-
setSelectedChannel:
|
|
23720
|
+
setSelectedChannel: setSelectedChannel,
|
|
23547
23721
|
key: channel.id
|
|
23548
23722
|
})) : (/*#__PURE__*/React__default.createElement(Channel, {
|
|
23549
23723
|
theme: theme,
|
|
@@ -23569,7 +23743,9 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23569
23743
|
avatarBorderRadius: avatarBorderRadius,
|
|
23570
23744
|
channel: channel,
|
|
23571
23745
|
key: channel.id,
|
|
23572
|
-
contactsMap: contactsMap
|
|
23746
|
+
contactsMap: contactsMap,
|
|
23747
|
+
setSelectedChannel: setSelectedChannel,
|
|
23748
|
+
getCustomLatestMessage: getCustomLatestMessage
|
|
23573
23749
|
}));
|
|
23574
23750
|
}))), !!(searchedChannels.contacts && searchedChannels.contacts.length) && (/*#__PURE__*/React__default.createElement(GroupChannels, null, /*#__PURE__*/React__default.createElement(SearchedChannelsHeader, {
|
|
23575
23751
|
color: textSecondary,
|
|
@@ -23578,7 +23754,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23578
23754
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23579
23755
|
contact: contact,
|
|
23580
23756
|
createChatWithContact: handleCrateChatWithContact,
|
|
23581
|
-
setSelectedChannel:
|
|
23757
|
+
setSelectedChannel: setSelectedChannel,
|
|
23582
23758
|
key: contact.id
|
|
23583
23759
|
})) : (/*#__PURE__*/React__default.createElement(ContactItem, {
|
|
23584
23760
|
theme: theme,
|
|
@@ -23609,7 +23785,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23609
23785
|
}, "Channels"), searchedChannels.channels.map(function (channel) {
|
|
23610
23786
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23611
23787
|
channel: channel,
|
|
23612
|
-
setSelectedChannel:
|
|
23788
|
+
setSelectedChannel: setSelectedChannel,
|
|
23613
23789
|
key: channel.id
|
|
23614
23790
|
})) : (/*#__PURE__*/React__default.createElement(Channel, {
|
|
23615
23791
|
theme: theme,
|
|
@@ -23635,7 +23811,9 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23635
23811
|
avatarBorderRadius: avatarBorderRadius,
|
|
23636
23812
|
channel: channel,
|
|
23637
23813
|
key: channel.id,
|
|
23638
|
-
contactsMap: contactsMap
|
|
23814
|
+
contactsMap: contactsMap,
|
|
23815
|
+
setSelectedChannel: setSelectedChannel,
|
|
23816
|
+
getCustomLatestMessage: getCustomLatestMessage
|
|
23639
23817
|
}));
|
|
23640
23818
|
}))))) : (/*#__PURE__*/React__default.createElement(NoData, {
|
|
23641
23819
|
color: textSecondary,
|
|
@@ -23656,7 +23834,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23656
23834
|
}, channels.map(function (channel) {
|
|
23657
23835
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23658
23836
|
channel: channel,
|
|
23659
|
-
setSelectedChannel:
|
|
23837
|
+
setSelectedChannel: setSelectedChannel,
|
|
23660
23838
|
key: channel.id
|
|
23661
23839
|
})) : (/*#__PURE__*/React__default.createElement(Channel, {
|
|
23662
23840
|
theme: theme,
|
|
@@ -23682,7 +23860,9 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23682
23860
|
avatarBorderRadius: avatarBorderRadius,
|
|
23683
23861
|
channel: channel,
|
|
23684
23862
|
key: channel.id,
|
|
23685
|
-
contactsMap: contactsMap
|
|
23863
|
+
contactsMap: contactsMap,
|
|
23864
|
+
setSelectedChannel: setSelectedChannel,
|
|
23865
|
+
getCustomLatestMessage: getCustomLatestMessage
|
|
23686
23866
|
}));
|
|
23687
23867
|
}))), !!searchValue && (channelsLoading === LOADING_STATE.LOADED ? !((_searchedChannels$cha4 = searchedChannels.chats_groups) !== null && _searchedChannels$cha4 !== void 0 && _searchedChannels$cha4.length) && !((_searchedChannels$cha5 = searchedChannels.chats_groups) !== null && _searchedChannels$cha5 !== void 0 && _searchedChannels$cha5.length) && !((_searchedChannels$cha6 = searchedChannels.channels) !== null && _searchedChannels$cha6 !== void 0 && _searchedChannels$cha6.length) ? (/*#__PURE__*/React__default.createElement(NoData, {
|
|
23688
23868
|
color: textSecondary,
|
|
@@ -23693,7 +23873,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23693
23873
|
}, "Chats & Groups"), searchedChannels.chats_groups.map(function (channel) {
|
|
23694
23874
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23695
23875
|
channel: channel,
|
|
23696
|
-
setSelectedChannel:
|
|
23876
|
+
setSelectedChannel: setSelectedChannel,
|
|
23697
23877
|
key: channel.id
|
|
23698
23878
|
})) : (/*#__PURE__*/React__default.createElement(Channel, {
|
|
23699
23879
|
theme: theme,
|
|
@@ -23719,7 +23899,9 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23719
23899
|
avatarBorderRadius: avatarBorderRadius,
|
|
23720
23900
|
channel: channel,
|
|
23721
23901
|
contactsMap: contactsMap,
|
|
23722
|
-
key: channel.id
|
|
23902
|
+
key: channel.id,
|
|
23903
|
+
setSelectedChannel: setSelectedChannel,
|
|
23904
|
+
getCustomLatestMessage: getCustomLatestMessage
|
|
23723
23905
|
}));
|
|
23724
23906
|
}))), !!searchedChannels.channels.length && (/*#__PURE__*/React__default.createElement(GroupChannels, null, /*#__PURE__*/React__default.createElement(SearchedChannelsHeader, {
|
|
23725
23907
|
color: textSecondary,
|
|
@@ -23727,7 +23909,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23727
23909
|
}, "Channels"), searchedChannels.channels.map(function (channel) {
|
|
23728
23910
|
return ListItem ? (/*#__PURE__*/React__default.createElement(ListItem, {
|
|
23729
23911
|
channel: channel,
|
|
23730
|
-
setSelectedChannel:
|
|
23912
|
+
setSelectedChannel: setSelectedChannel,
|
|
23731
23913
|
key: channel.id
|
|
23732
23914
|
})) : (/*#__PURE__*/React__default.createElement(Channel, {
|
|
23733
23915
|
theme: theme,
|
|
@@ -23753,7 +23935,9 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
23753
23935
|
avatarBorderRadius: avatarBorderRadius,
|
|
23754
23936
|
channel: channel,
|
|
23755
23937
|
key: channel.id,
|
|
23756
|
-
contactsMap: contactsMap
|
|
23938
|
+
contactsMap: contactsMap,
|
|
23939
|
+
setSelectedChannel: setSelectedChannel,
|
|
23940
|
+
getCustomLatestMessage: getCustomLatestMessage
|
|
23757
23941
|
}));
|
|
23758
23942
|
}))))) : (/*#__PURE__*/React__default.createElement(LoadingWrapper, null, /*#__PURE__*/React__default.createElement(UploadingIcon, {
|
|
23759
23943
|
color: textFootnote
|
|
@@ -23957,7 +24141,6 @@ function SvgInfo(props) {
|
|
|
23957
24141
|
|
|
23958
24142
|
var _templateObject$i, _templateObject2$g, _templateObject3$c, _templateObject4$a, _templateObject5$8, _templateObject6$6, _templateObject7$5, _templateObject8$5, _templateObject9$5, _templateObject0$4;
|
|
23959
24143
|
function ChatHeader(_ref) {
|
|
23960
|
-
var _activeChannel$metada;
|
|
23961
24144
|
var infoIcon = _ref.infoIcon,
|
|
23962
24145
|
backgroundColor = _ref.backgroundColor,
|
|
23963
24146
|
titleColor = _ref.titleColor,
|
|
@@ -23996,7 +24179,7 @@ function ChatHeader(_ref) {
|
|
|
23996
24179
|
var channelListHidden = useSelector(channelListHiddenSelector);
|
|
23997
24180
|
var channelDetailsIsOpen = useSelector(channelInfoIsOpenSelector, shallowEqual);
|
|
23998
24181
|
var isDirectChannel = activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
23999
|
-
var isSelfChannel = isDirectChannel &&
|
|
24182
|
+
var isSelfChannel = isDirectChannel && activeChannel.memberCount === 1 && activeChannel.members.length > 0 && activeChannel.members[0].id === user.id;
|
|
24000
24183
|
var directChannelUser = isDirectChannel && activeChannel.members.find(function (member) {
|
|
24001
24184
|
return member.id !== user.id;
|
|
24002
24185
|
});
|
|
@@ -24882,10 +25065,9 @@ function ForwardMessagePopup(_ref) {
|
|
|
24882
25065
|
setSearchValue('');
|
|
24883
25066
|
};
|
|
24884
25067
|
var handleChannelSelect = function handleChannelSelect(isSelected, channel) {
|
|
24885
|
-
var _channel$metadata;
|
|
24886
25068
|
var newSelectedChannels = [].concat(selectedChannels);
|
|
24887
25069
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
24888
|
-
var isSelfChannel = isDirectChannel &&
|
|
25070
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
24889
25071
|
var directChannelUser = isDirectChannel && channel.members.find(function (member) {
|
|
24890
25072
|
return member.id !== user.id;
|
|
24891
25073
|
});
|
|
@@ -24998,12 +25180,11 @@ function ForwardMessagePopup(_ref) {
|
|
|
24998
25180
|
color: textSecondary,
|
|
24999
25181
|
margin: '0 0 12px'
|
|
25000
25182
|
}, "Chats & Groups"), searchedChannels.chats_groups.map(function (channel) {
|
|
25001
|
-
var _channel$metadata2;
|
|
25002
25183
|
var isSelected = selectedChannels.findIndex(function (chan) {
|
|
25003
25184
|
return chan.id === channel.id;
|
|
25004
25185
|
}) >= 0;
|
|
25005
25186
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
25006
|
-
var isSelfChannel = isDirectChannel &&
|
|
25187
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
25007
25188
|
var directChannelUser = isDirectChannel && isSelfChannel ? user : channel.members.find(function (member) {
|
|
25008
25189
|
return member.id !== user.id;
|
|
25009
25190
|
});
|
|
@@ -25074,9 +25255,8 @@ function ForwardMessagePopup(_ref) {
|
|
|
25074
25255
|
}))), !searchedChannels.chats_groups.length && !searchedChannels.channels.length && (/*#__PURE__*/React__default.createElement(NoResults, {
|
|
25075
25256
|
color: textSecondary
|
|
25076
25257
|
}, "No channels found")))) : channels.map(function (channel) {
|
|
25077
|
-
var _channel$metadata3;
|
|
25078
25258
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
25079
|
-
var isSelfChannel = isDirectChannel &&
|
|
25259
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
25080
25260
|
var directChannelUser = isDirectChannel && isSelfChannel ? user : channel.members.find(function (member) {
|
|
25081
25261
|
return member.id !== user.id;
|
|
25082
25262
|
});
|
|
@@ -27004,7 +27184,7 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
27004
27184
|
preload: 'auto',
|
|
27005
27185
|
id: 'video',
|
|
27006
27186
|
src: file.attachmentUrl || videoUrl
|
|
27007
|
-
}), videoCurrentTime && (/*#__PURE__*/React__default.createElement(VideoControls, null, !isPreview && !!videoCurrentTime && !isRepliedMessage && !uploading && !isDetailsView && (
|
|
27187
|
+
}), videoCurrentTime && !isRepliedMessage && (/*#__PURE__*/React__default.createElement(VideoControls, null, !isPreview && !!videoCurrentTime && !isRepliedMessage && !uploading && !isDetailsView && (
|
|
27008
27188
|
/*#__PURE__*/
|
|
27009
27189
|
React__default.createElement(VideoPlayButton, null, /*#__PURE__*/React__default.createElement(SvgPlayVideo, null))), /*#__PURE__*/React__default.createElement(VideoTime, {
|
|
27010
27190
|
isDetailsView: isDetailsView,
|
|
@@ -31057,6 +31237,12 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31057
31237
|
var _useState = useState(null),
|
|
31058
31238
|
metadata = _useState[0],
|
|
31059
31239
|
setMetadata = _useState[1];
|
|
31240
|
+
var _useState2 = useState(true),
|
|
31241
|
+
imageLoadError = _useState2[0],
|
|
31242
|
+
setImageLoadError = _useState2[1];
|
|
31243
|
+
var _useState3 = useState(true),
|
|
31244
|
+
faviconLoadError = _useState3[0],
|
|
31245
|
+
setFaviconLoadError = _useState3[1];
|
|
31060
31246
|
var attachment = useMemo(function () {
|
|
31061
31247
|
return attachments.find(function (attachment) {
|
|
31062
31248
|
return attachment.type === attachmentTypes.link;
|
|
@@ -31078,6 +31264,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31078
31264
|
});
|
|
31079
31265
|
}, function () {
|
|
31080
31266
|
console.log('Failed to fetch OG metadata');
|
|
31267
|
+
setMetadata(null);
|
|
31081
31268
|
});
|
|
31082
31269
|
if (_temp && _temp.then) return _temp.then(function () {});
|
|
31083
31270
|
}
|
|
@@ -31129,13 +31316,25 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31129
31316
|
window.open(attachment === null || attachment === void 0 ? void 0 : attachment.url, '_blank');
|
|
31130
31317
|
}
|
|
31131
31318
|
}, /*#__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, {
|
|
31319
|
+
showOGMetadata: !!showOGMetadata && !imageLoadError
|
|
31320
|
+
}, 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
31321
|
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
|
-
|
|
31322
|
+
alt: 'OG metadata image',
|
|
31323
|
+
onLoad: function onLoad() {
|
|
31324
|
+
return setImageLoadError(false);
|
|
31325
|
+
},
|
|
31326
|
+
onError: function onError() {
|
|
31327
|
+
return setImageLoadError(true);
|
|
31328
|
+
}
|
|
31329
|
+
})) : 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, {
|
|
31330
|
+
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,
|
|
31331
|
+
onLoad: function onLoad() {
|
|
31332
|
+
return setFaviconLoadError(false);
|
|
31333
|
+
},
|
|
31334
|
+
onError: function onError() {
|
|
31335
|
+
return setFaviconLoadError(true);
|
|
31336
|
+
}
|
|
31337
|
+
})) : 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
31338
|
};
|
|
31140
31339
|
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
31340
|
var showOGMetadata = _ref2.showOGMetadata;
|
|
@@ -32383,7 +32582,7 @@ var Message$1 = function Message(_ref) {
|
|
|
32383
32582
|
})));
|
|
32384
32583
|
};
|
|
32385
32584
|
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;
|
|
32585
|
+
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
32586
|
});
|
|
32388
32587
|
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
32588
|
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 +36182,12 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35983
36182
|
}
|
|
35984
36183
|
}, [currentRecordedFile]);
|
|
35985
36184
|
useEffect(function () {
|
|
36185
|
+
if (!showRecording) {
|
|
36186
|
+
setCurrentTime(0);
|
|
36187
|
+
}
|
|
35986
36188
|
return function () {
|
|
35987
36189
|
handleStopRecording();
|
|
36190
|
+
setCurrentTime(0);
|
|
35988
36191
|
};
|
|
35989
36192
|
}, [showRecording]);
|
|
35990
36193
|
useEffect(function () {
|
|
@@ -38068,7 +38271,6 @@ function SvgUnpin(props) {
|
|
|
38068
38271
|
|
|
38069
38272
|
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
38273
|
var Actions = function Actions(_ref) {
|
|
38071
|
-
var _channel$metadata;
|
|
38072
38274
|
var setActionsHeight = _ref.setActionsHeight,
|
|
38073
38275
|
channel = _ref.channel,
|
|
38074
38276
|
actionMenuOpen = _ref.actionMenuOpen,
|
|
@@ -38186,7 +38388,7 @@ var Actions = function Actions(_ref) {
|
|
|
38186
38388
|
var twoHours = oneHour * 2;
|
|
38187
38389
|
var oneDay = oneHour * 24;
|
|
38188
38390
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
38189
|
-
var isSelfChannel = isDirectChannel &&
|
|
38391
|
+
var isSelfChannel = isDirectChannel && channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === user.id;
|
|
38190
38392
|
var directChannelUser = isDirectChannel && channel.members.find(function (member) {
|
|
38191
38393
|
return member.id !== user.id;
|
|
38192
38394
|
});
|
|
@@ -39255,7 +39457,7 @@ var Files = function Files(_ref) {
|
|
|
39255
39457
|
lineHeight: fileSizeLineHeight,
|
|
39256
39458
|
color: filePreviewSizeColor || textSecondary
|
|
39257
39459
|
}, file.size ? bytesToSize(file.size) : '')), /*#__PURE__*/React__default.createElement(DownloadWrapper, {
|
|
39258
|
-
visible: downloadingFilesMap[file.id],
|
|
39460
|
+
visible: !!downloadingFilesMap[file.id],
|
|
39259
39461
|
iconColor: accentColor,
|
|
39260
39462
|
onClick: function onClick() {
|
|
39261
39463
|
return handleDownloadFile(file);
|
|
@@ -40093,7 +40295,7 @@ var EditChannel = function EditChannel(_ref) {
|
|
|
40093
40295
|
|
|
40094
40296
|
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
40297
|
var Details = function Details(_ref) {
|
|
40096
|
-
var _activeChannel$
|
|
40298
|
+
var _activeChannel$member;
|
|
40097
40299
|
var detailsTitleText = _ref.detailsTitleText,
|
|
40098
40300
|
editDetailsTitleText = _ref.editDetailsTitleText,
|
|
40099
40301
|
detailsTitleFontSize = _ref.detailsTitleFontSize,
|
|
@@ -40248,7 +40450,7 @@ var Details = function Details(_ref) {
|
|
|
40248
40450
|
var detailsHeaderRef = useRef(null);
|
|
40249
40451
|
var openTimeOut = useRef(null);
|
|
40250
40452
|
var isDirectChannel = activeChannel && activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
40251
|
-
var isSelfChannel = isDirectChannel &&
|
|
40453
|
+
var isSelfChannel = isDirectChannel && activeChannel.memberCount === 1 && activeChannel.members.length > 0 && activeChannel.members[0].id === user.id;
|
|
40252
40454
|
var memberDisplayText = getChannelTypesMemberDisplayTextMap();
|
|
40253
40455
|
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
40456
|
var directChannelUser = isDirectChannel && (activeChannel.members.find(function (member) {
|
|
@@ -40362,7 +40564,7 @@ var Details = function Details(_ref) {
|
|
|
40362
40564
|
color: textSecondary,
|
|
40363
40565
|
fontSize: channelMembersFontSize,
|
|
40364
40566
|
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, {
|
|
40567
|
+
}, 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
40568
|
color: textSecondary,
|
|
40367
40569
|
fontSize: channelMembersFontSize,
|
|
40368
40570
|
lineHeight: channelMembersLineHeight
|
|
@@ -41083,5 +41285,36 @@ var UnreadCount$2 = styled.span(_templateObject2$Q || (_templateObject2$Q = _tag
|
|
|
41083
41285
|
return props.textColor || '#fff';
|
|
41084
41286
|
});
|
|
41085
41287
|
|
|
41086
|
-
|
|
41288
|
+
var createOrGetDirectChannel = function createOrGetDirectChannel(user, callback) {
|
|
41289
|
+
try {
|
|
41290
|
+
if (user) {
|
|
41291
|
+
store.dispatch(createChannelAC({
|
|
41292
|
+
metadata: '',
|
|
41293
|
+
type: DEFAULT_CHANNEL_TYPE.DIRECT,
|
|
41294
|
+
members: [_extends({}, user, {
|
|
41295
|
+
role: 'owner'
|
|
41296
|
+
})]
|
|
41297
|
+
}, false, callback));
|
|
41298
|
+
}
|
|
41299
|
+
return Promise.resolve();
|
|
41300
|
+
} catch (e) {
|
|
41301
|
+
return Promise.reject(e);
|
|
41302
|
+
}
|
|
41303
|
+
};
|
|
41304
|
+
var switchChannelActiveChannel = function switchChannelActiveChannel(channel) {
|
|
41305
|
+
try {
|
|
41306
|
+
store.dispatch(switchChannelActionAC(channel, true));
|
|
41307
|
+
return Promise.resolve();
|
|
41308
|
+
} catch (e) {
|
|
41309
|
+
return Promise.reject(e);
|
|
41310
|
+
}
|
|
41311
|
+
};
|
|
41312
|
+
var handleSendMessage = function handleSendMessage(message, channelId, connectionState) {
|
|
41313
|
+
return store.dispatch(sendTextMessageAC(message, channelId, connectionState));
|
|
41314
|
+
};
|
|
41315
|
+
var handleGetMessage = function handleGetMessage(channelId, messageId) {
|
|
41316
|
+
return store.dispatch(getMessageAC(channelId, messageId));
|
|
41317
|
+
};
|
|
41318
|
+
|
|
41319
|
+
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
41320
|
//# sourceMappingURL=index.modern.js.map
|