sceyt-chat-react-uikit 1.7.6 → 1.7.7-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ChatContainer/index.d.ts +2 -1
- package/components/Message/OGMetadata/index.d.ts +2 -1
- package/components/SceytChat/index.d.ts +1 -1
- package/index.js +1027 -781
- package/index.modern.js +1027 -781
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8999,7 +8999,8 @@ var handleVoteDetails = function handleVoteDetails(voteDetails, message) {
|
|
|
8999
8999
|
var vote = voteDetails.vote;
|
|
9000
9000
|
var optionId = vote.optionId;
|
|
9001
9001
|
var currentVotesPerOption = existingVoteDetails.votesPerOption || {};
|
|
9002
|
-
var
|
|
9002
|
+
var optionVotesCount = (currentVotesPerOption[optionId] || 0) + voteDetails.incrementVotesPerOptionCount;
|
|
9003
|
+
var newVotesPerOption = _extends({}, currentVotesPerOption, (_extends2 = {}, _extends2[optionId] = optionVotesCount >= 0 ? optionVotesCount : 0, _extends2));
|
|
9003
9004
|
var newVotes = existingVoteDetails.votes || [];
|
|
9004
9005
|
var newOwnVotes = existingVoteDetails.ownVotes || [];
|
|
9005
9006
|
if (voteDetails.type === 'add') {
|
|
@@ -9033,6 +9034,7 @@ var showChannelDetails = false;
|
|
|
9033
9034
|
var channelTypesFilter = [];
|
|
9034
9035
|
var memberCount = 10;
|
|
9035
9036
|
var disableFrowardMentionsCount = false;
|
|
9037
|
+
var onUpdateChannel = function onUpdateChannel() {};
|
|
9036
9038
|
var useInviteLink = false;
|
|
9037
9039
|
var inviteLinkOptions = null;
|
|
9038
9040
|
function setBaseUrlForInviteMembers(url) {
|
|
@@ -9147,6 +9149,12 @@ function setDisableFrowardMentionsCount(disable) {
|
|
|
9147
9149
|
function getDisableFrowardMentionsCount() {
|
|
9148
9150
|
return disableFrowardMentionsCount;
|
|
9149
9151
|
}
|
|
9152
|
+
function setOnUpdateChannel(callback) {
|
|
9153
|
+
onUpdateChannel = callback;
|
|
9154
|
+
}
|
|
9155
|
+
function getOnUpdateChannel() {
|
|
9156
|
+
return onUpdateChannel;
|
|
9157
|
+
}
|
|
9150
9158
|
var handleNewMessages;
|
|
9151
9159
|
function setHandleNewMessages(callback) {
|
|
9152
9160
|
handleNewMessages = callback;
|
|
@@ -10884,7 +10892,7 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
|
|
|
10884
10892
|
} else {
|
|
10885
10893
|
var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(mes, updatedMessage.params.deliveryStatus);
|
|
10886
10894
|
updatedMessageData = _extends({}, mes, updatedMessage.params, statusUpdatedMessage);
|
|
10887
|
-
var voteDetailsData = void 0;
|
|
10895
|
+
var voteDetailsData = mes === null || mes === void 0 ? void 0 : mes.pollDetails;
|
|
10888
10896
|
if (voteDetails) {
|
|
10889
10897
|
voteDetailsData = handleVoteDetails(voteDetails, updatedMessageData);
|
|
10890
10898
|
}
|
|
@@ -11948,6 +11956,26 @@ var _memberSlice$actions = memberSlice.actions,
|
|
|
11948
11956
|
getRolesFail = _memberSlice$actions.getRolesFail;
|
|
11949
11957
|
var MembersReducer = memberSlice.reducer;
|
|
11950
11958
|
|
|
11959
|
+
var SET_CONTACT_LOADING_STATE = 'SET_CONTACT_LOADING_STATE';
|
|
11960
|
+
var GET_CONTACTS = 'GET_CONTACTS';
|
|
11961
|
+
var GET_USERS = 'GET_USERS';
|
|
11962
|
+
var LOAD_MORE_USERS = 'LOAD_MORE_USERS';
|
|
11963
|
+
var BLOCK_USERS = 'BLOCK_USERS';
|
|
11964
|
+
var UNBLOCK_USERS = 'UNBLOCK_USERS';
|
|
11965
|
+
var UPDATE_PROFILE = 'UPDATE_PROFILE';
|
|
11966
|
+
var CHECK_USER_STATUS = 'CHECK_USER_STATUS';
|
|
11967
|
+
var CONNECTION_EVENT_TYPES = {
|
|
11968
|
+
TOKEN_WILL_EXPIRE: 'TOKEN_WILL_EXPIRE',
|
|
11969
|
+
CONNECTION_STATUS_CHANGED: 'CONNECTION_STATUS_CHANGED',
|
|
11970
|
+
TOKEN_EXPIRED: 'TOKEN_EXPIRED'
|
|
11971
|
+
};
|
|
11972
|
+
var CONNECTION_STATUS = {
|
|
11973
|
+
CONNECTING: 'Connecting',
|
|
11974
|
+
CONNECTED: 'Connected',
|
|
11975
|
+
CONNECTING_FAILED: 'Failed',
|
|
11976
|
+
DISCONNECTED: 'Disconnected'
|
|
11977
|
+
};
|
|
11978
|
+
|
|
11951
11979
|
var initialState$3 = {
|
|
11952
11980
|
connectionStatus: '',
|
|
11953
11981
|
contactList: [],
|
|
@@ -11961,7 +11989,8 @@ var initialState$3 = {
|
|
|
11961
11989
|
lastName: '',
|
|
11962
11990
|
state: ''
|
|
11963
11991
|
},
|
|
11964
|
-
browserTabIsActive: true
|
|
11992
|
+
browserTabIsActive: true,
|
|
11993
|
+
waitToSendPendingMessages: false
|
|
11965
11994
|
};
|
|
11966
11995
|
var userSlice = createSlice({
|
|
11967
11996
|
name: 'users',
|
|
@@ -11969,6 +11998,9 @@ var userSlice = createSlice({
|
|
|
11969
11998
|
reducers: {
|
|
11970
11999
|
setConnectionStatus: function setConnectionStatus(state, action) {
|
|
11971
12000
|
state.connectionStatus = action.payload.status;
|
|
12001
|
+
if (action.payload.status === CONNECTION_STATUS.CONNECTED) {
|
|
12002
|
+
state.waitToSendPendingMessages = true;
|
|
12003
|
+
}
|
|
11972
12004
|
},
|
|
11973
12005
|
setUser: function setUser(state, action) {
|
|
11974
12006
|
state.user = _extends({}, action.payload.user);
|
|
@@ -12000,6 +12032,9 @@ var userSlice = createSlice({
|
|
|
12000
12032
|
},
|
|
12001
12033
|
setBrowserTabIsActive: function setBrowserTabIsActive(state, action) {
|
|
12002
12034
|
state.browserTabIsActive = action.payload.state;
|
|
12035
|
+
},
|
|
12036
|
+
setWaitToSendPendingMessages: function setWaitToSendPendingMessages(state, action) {
|
|
12037
|
+
state.waitToSendPendingMessages = action.payload.state;
|
|
12003
12038
|
}
|
|
12004
12039
|
},
|
|
12005
12040
|
extraReducers: function extraReducers(builder) {
|
|
@@ -12017,7 +12052,8 @@ var _userSlice$actions = userSlice.actions,
|
|
|
12017
12052
|
updateUserMap = _userSlice$actions.updateUserMap,
|
|
12018
12053
|
setContacts = _userSlice$actions.setContacts,
|
|
12019
12054
|
updateUserProfile = _userSlice$actions.updateUserProfile,
|
|
12020
|
-
setBrowserTabIsActive = _userSlice$actions.setBrowserTabIsActive
|
|
12055
|
+
setBrowserTabIsActive = _userSlice$actions.setBrowserTabIsActive,
|
|
12056
|
+
setWaitToSendPendingMessages = _userSlice$actions.setWaitToSendPendingMessages;
|
|
12021
12057
|
var UserReducer = userSlice.reducer;
|
|
12022
12058
|
|
|
12023
12059
|
var SET_THEME = 'SET_THEME';
|
|
@@ -12700,26 +12736,6 @@ var joinChannelWithInviteKeyAC = function joinChannelWithInviteKeyAC(key) {
|
|
|
12700
12736
|
};
|
|
12701
12737
|
};
|
|
12702
12738
|
|
|
12703
|
-
var SET_CONTACT_LOADING_STATE = 'SET_CONTACT_LOADING_STATE';
|
|
12704
|
-
var GET_CONTACTS = 'GET_CONTACTS';
|
|
12705
|
-
var GET_USERS = 'GET_USERS';
|
|
12706
|
-
var LOAD_MORE_USERS = 'LOAD_MORE_USERS';
|
|
12707
|
-
var BLOCK_USERS = 'BLOCK_USERS';
|
|
12708
|
-
var UNBLOCK_USERS = 'UNBLOCK_USERS';
|
|
12709
|
-
var UPDATE_PROFILE = 'UPDATE_PROFILE';
|
|
12710
|
-
var CHECK_USER_STATUS = 'CHECK_USER_STATUS';
|
|
12711
|
-
var CONNECTION_EVENT_TYPES = {
|
|
12712
|
-
TOKEN_WILL_EXPIRE: 'TOKEN_WILL_EXPIRE',
|
|
12713
|
-
CONNECTION_STATUS_CHANGED: 'CONNECTION_STATUS_CHANGED',
|
|
12714
|
-
TOKEN_EXPIRED: 'TOKEN_EXPIRED'
|
|
12715
|
-
};
|
|
12716
|
-
var CONNECTION_STATUS = {
|
|
12717
|
-
CONNECTING: 'Connecting',
|
|
12718
|
-
CONNECTED: 'Connected',
|
|
12719
|
-
CONNECTING_FAILED: 'Failed',
|
|
12720
|
-
DISCONNECTED: 'Disconnected'
|
|
12721
|
-
};
|
|
12722
|
-
|
|
12723
12739
|
var getUsersAC = function getUsersAC(params) {
|
|
12724
12740
|
return {
|
|
12725
12741
|
type: GET_USERS,
|
|
@@ -12831,6 +12847,11 @@ var updateUserStatusOnMapAC = function updateUserStatusOnMapAC(usersMap) {
|
|
|
12831
12847
|
usersMap: usersMap
|
|
12832
12848
|
});
|
|
12833
12849
|
};
|
|
12850
|
+
var setWaitToSendPendingMessagesAC = function setWaitToSendPendingMessagesAC(state) {
|
|
12851
|
+
return setWaitToSendPendingMessages({
|
|
12852
|
+
state: state
|
|
12853
|
+
});
|
|
12854
|
+
};
|
|
12834
12855
|
|
|
12835
12856
|
var userDisplayNameFromContact = false;
|
|
12836
12857
|
var setShowOnlyContactUsers = function setShowOnlyContactUsers(value) {
|
|
@@ -14520,7 +14541,7 @@ function watchForEvents() {
|
|
|
14520
14541
|
};
|
|
14521
14542
|
});
|
|
14522
14543
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
14523
|
-
var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3,
|
|
14544
|
+
var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, onUpdateChannel, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _channel5, fields, _activeChannelId4, _groupName3, _channel6, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel7, _activeChannelId6, updateLastMessage, markersMap, activeChannelMessages, _iterator, _step, messageId, isPendingMessage, lastMessage, _channelId, _channel8, _channel9, deletedMessage, _activeChannelId7, _channelExists7, _channel0, _message, _activeChannelId8, _channelExists8, _channel1, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _pollDetailsData$chan, _pollDetailsData$chan2, _channel10, pollDetails, _messageId, pollDetailsData, _activeChannelId0, addedVotes, deletedVotes, objs, _iterator2, _step2, vote, _iterator3, _step3, _vote, _i, _objs, obj, _store$getState$Messa, key, hasNext, _i2, _objs2, _obj, _pollDetailsData$chan3, _channel11, _pollDetails, _messageId2, _pollDetailsData, _activeChannelId1, _deletedVotes, _objs3, _iterator4, _step4, _vote2, _i3, _objs4, _obj2, _i4, _objs5, _obj3, _pollDetailsData2$cha, _channel12, _pollDetails2, _messageId3, _activeChannelId10, _pollDetailsData2, retractedVotes, _objs6, _iterator5, _step5, _vote4, _i5, _objs7, _obj4, _iterator6, _step6, _vote3, _channel13, _messageId4, _activeChannelId11, _obj5, _channel14, _user, _message3, _reaction, channelFromMap, _isSelf, _activeChannelId12, _channelUpdateParams, _channel15, _updatedChannel, _channel16, _activeChannelId13, channelExist, _channel17, _channel18, _channel19, _channel20, _channel21, _channel22, _channel23, _groupName5, _channel24, _groupName6, _channel25, members, _activeChannelId14, i, _channel26, _channel27, _channelId2, from, name, status, _t, _t2;
|
|
14524
14545
|
return _regenerator().w(function (_context) {
|
|
14525
14546
|
while (1) switch (_context.p = _context.n) {
|
|
14526
14547
|
case 0:
|
|
@@ -14787,10 +14808,33 @@ function watchForEvents() {
|
|
|
14787
14808
|
});
|
|
14788
14809
|
return _context.a(3, 183);
|
|
14789
14810
|
case 46:
|
|
14811
|
+
onUpdateChannel = getOnUpdateChannel();
|
|
14790
14812
|
log.info('channel UPDATE_CHANNEL ... ');
|
|
14791
14813
|
updatedChannel = args.updatedChannel;
|
|
14792
14814
|
_channelExists5 = checkChannelExists(updatedChannel.id);
|
|
14793
14815
|
subject = updatedChannel.subject, avatarUrl = updatedChannel.avatarUrl, muted = updatedChannel.muted, mutedTill = updatedChannel.mutedTill, metadata = updatedChannel.metadata;
|
|
14816
|
+
_channel5 = getChannelFromMap(updatedChannel.id);
|
|
14817
|
+
fields = [];
|
|
14818
|
+
if (_channel5) {
|
|
14819
|
+
if (_channel5.subject !== subject) {
|
|
14820
|
+
fields.push('subject');
|
|
14821
|
+
}
|
|
14822
|
+
if (_channel5.avatarUrl !== avatarUrl) {
|
|
14823
|
+
fields.push('avatarUrl');
|
|
14824
|
+
}
|
|
14825
|
+
if (_channel5.muted !== muted) {
|
|
14826
|
+
fields.push('muted');
|
|
14827
|
+
}
|
|
14828
|
+
if (_channel5.mutedTill !== mutedTill) {
|
|
14829
|
+
fields.push('mutedTill');
|
|
14830
|
+
}
|
|
14831
|
+
if (_channel5.metadata !== isJSON(metadata) ? JSON.parse(metadata) : metadata) {
|
|
14832
|
+
fields.push('metadata');
|
|
14833
|
+
}
|
|
14834
|
+
}
|
|
14835
|
+
if (onUpdateChannel) {
|
|
14836
|
+
onUpdateChannel(updatedChannel, fields);
|
|
14837
|
+
}
|
|
14794
14838
|
if (!_channelExists5) {
|
|
14795
14839
|
_context.n = 49;
|
|
14796
14840
|
break;
|
|
@@ -14834,18 +14878,18 @@ function watchForEvents() {
|
|
|
14834
14878
|
});
|
|
14835
14879
|
return _context.a(3, 183);
|
|
14836
14880
|
case 51:
|
|
14837
|
-
|
|
14838
|
-
log.info('channel MESSAGE ... id : ', message.id, ', channel.id: ',
|
|
14839
|
-
messageToHandle = handleNewMessages ? handleNewMessages(message,
|
|
14881
|
+
_channel6 = args.channel, message = args.message;
|
|
14882
|
+
log.info('channel MESSAGE ... id : ', message.id, ', channel.id: ', _channel6.id);
|
|
14883
|
+
messageToHandle = handleNewMessages ? handleNewMessages(message, _channel6) : message;
|
|
14840
14884
|
_channelFilterTypes = getChannelTypesFilter();
|
|
14841
|
-
if (!(messageToHandle &&
|
|
14885
|
+
if (!(messageToHandle && _channel6 && (_channelFilterTypes !== null && _channelFilterTypes !== void 0 && _channelFilterTypes.length ? _channelFilterTypes.includes(_channel6.type) : true))) {
|
|
14842
14886
|
_context.n = 65;
|
|
14843
14887
|
break;
|
|
14844
14888
|
}
|
|
14845
|
-
|
|
14889
|
+
_channel6.metadata = isJSON(_channel6.metadata) ? JSON.parse(_channel6.metadata) : _channel6.metadata;
|
|
14846
14890
|
_activeChannelId5 = getActiveChannelId();
|
|
14847
|
-
_channelExists6 = checkChannelExists(
|
|
14848
|
-
channelForAdd = JSON.parse(JSON.stringify(
|
|
14891
|
+
_channelExists6 = checkChannelExists(_channel6.id);
|
|
14892
|
+
channelForAdd = JSON.parse(JSON.stringify(_channel6));
|
|
14849
14893
|
_context.n = 52;
|
|
14850
14894
|
return effects.put(addChannelAC(channelForAdd));
|
|
14851
14895
|
case 52:
|
|
@@ -14853,7 +14897,7 @@ function watchForEvents() {
|
|
|
14853
14897
|
_context.n = 53;
|
|
14854
14898
|
break;
|
|
14855
14899
|
}
|
|
14856
|
-
setChannelInMap(
|
|
14900
|
+
setChannelInMap(_channel6);
|
|
14857
14901
|
_context.n = 54;
|
|
14858
14902
|
break;
|
|
14859
14903
|
case 53:
|
|
@@ -14864,7 +14908,7 @@ function watchForEvents() {
|
|
|
14864
14908
|
_context.n = 54;
|
|
14865
14909
|
return effects.put(updateChannelLastMessageAC(message, channelForAdd));
|
|
14866
14910
|
case 54:
|
|
14867
|
-
if (!(
|
|
14911
|
+
if (!(_channel6.id === _activeChannelId5)) {
|
|
14868
14912
|
_context.n = 56;
|
|
14869
14913
|
break;
|
|
14870
14914
|
}
|
|
@@ -14884,9 +14928,9 @@ function watchForEvents() {
|
|
|
14884
14928
|
_context.n = 56;
|
|
14885
14929
|
return effects.put(scrollToNewMessageAC(true, false, true));
|
|
14886
14930
|
case 56:
|
|
14887
|
-
addMessageToMap(
|
|
14931
|
+
addMessageToMap(_channel6.id, message);
|
|
14888
14932
|
_context.n = 57;
|
|
14889
|
-
return effects.put(updateChannelDataAC(
|
|
14933
|
+
return effects.put(updateChannelDataAC(_channel6.id, {
|
|
14890
14934
|
messageCount: channelForAdd.messageCount,
|
|
14891
14935
|
unread: channelForAdd.unread,
|
|
14892
14936
|
newMessageCount: channelForAdd.newMessageCount,
|
|
@@ -14902,9 +14946,9 @@ function watchForEvents() {
|
|
|
14902
14946
|
lastReactedMessage: null
|
|
14903
14947
|
}));
|
|
14904
14948
|
case 57:
|
|
14905
|
-
_groupName4 = getChannelGroupName(
|
|
14949
|
+
_groupName4 = getChannelGroupName(_channel6);
|
|
14906
14950
|
_context.n = 58;
|
|
14907
|
-
return effects.put(updateSearchedChannelDataAC(
|
|
14951
|
+
return effects.put(updateSearchedChannelDataAC(_channel6.id, {
|
|
14908
14952
|
messageCount: channelForAdd.messageCount,
|
|
14909
14953
|
unread: channelForAdd.unread,
|
|
14910
14954
|
newMessageCount: channelForAdd.newMessageCount,
|
|
@@ -14921,7 +14965,7 @@ function watchForEvents() {
|
|
|
14921
14965
|
}, _groupName4));
|
|
14922
14966
|
case 58:
|
|
14923
14967
|
showNotifications = getShowNotifications();
|
|
14924
|
-
if (!(showNotifications && !message.silent && message.user.id !== SceytChatClient.user.id && !
|
|
14968
|
+
if (!(showNotifications && !message.silent && message.user.id !== SceytChatClient.user.id && !_channel6.muted)) {
|
|
14925
14969
|
_context.n = 61;
|
|
14926
14970
|
break;
|
|
14927
14971
|
}
|
|
@@ -14933,7 +14977,7 @@ function watchForEvents() {
|
|
|
14933
14977
|
return effects.select(browserTabIsActiveSelector);
|
|
14934
14978
|
case 59:
|
|
14935
14979
|
tabIsActive = _context.v;
|
|
14936
|
-
if (!(document.visibilityState !== 'visible' || !tabIsActive ||
|
|
14980
|
+
if (!(document.visibilityState !== 'visible' || !tabIsActive || _channel6.id !== _activeChannelId5)) {
|
|
14937
14981
|
_context.n = 61;
|
|
14938
14982
|
break;
|
|
14939
14983
|
}
|
|
@@ -14956,7 +15000,7 @@ function watchForEvents() {
|
|
|
14956
15000
|
accentColor: accentColor,
|
|
14957
15001
|
textSecondary: textSecondary
|
|
14958
15002
|
});
|
|
14959
|
-
setNotification(messageBody, message.user,
|
|
15003
|
+
setNotification(messageBody, message.user, _channel6, undefined, message.attachments && message.attachments.length ? message.attachments.find(function (att) {
|
|
14960
15004
|
return att.type !== attachmentTypes.link;
|
|
14961
15005
|
}) : undefined);
|
|
14962
15006
|
case 61:
|
|
@@ -14971,9 +15015,9 @@ function watchForEvents() {
|
|
|
14971
15015
|
break;
|
|
14972
15016
|
case 63:
|
|
14973
15017
|
_context.n = 64;
|
|
14974
|
-
return effects.put(markMessagesAsDeliveredAC(
|
|
15018
|
+
return effects.put(markMessagesAsDeliveredAC(_channel6.id, [message.id]));
|
|
14975
15019
|
case 64:
|
|
14976
|
-
updateChannelOnAllChannels(
|
|
15020
|
+
updateChannelOnAllChannels(_channel6.id, {
|
|
14977
15021
|
messageCount: channelForAdd.messageCount,
|
|
14978
15022
|
unread: channelForAdd.unread,
|
|
14979
15023
|
newMessageCount: channelForAdd.newMessageCount,
|
|
@@ -14985,10 +15029,10 @@ function watchForEvents() {
|
|
|
14985
15029
|
lastMessage: channelForAdd.lastMessage,
|
|
14986
15030
|
messages: channelForAdd.messages,
|
|
14987
15031
|
newReactions: channelForAdd.newReactions,
|
|
14988
|
-
lastReactedMessage:
|
|
14989
|
-
userMessageReactions:
|
|
15032
|
+
lastReactedMessage: _channel6.lastReactedMessage,
|
|
15033
|
+
userMessageReactions: _channel6.userMessageReactions
|
|
14990
15034
|
});
|
|
14991
|
-
updateChannelLastMessageOnAllChannels(
|
|
15035
|
+
updateChannelLastMessageOnAllChannels(_channel6.id, _channel6.lastMessage);
|
|
14992
15036
|
case 65:
|
|
14993
15037
|
return _context.a(3, 183);
|
|
14994
15038
|
case 66:
|
|
@@ -14996,9 +15040,9 @@ function watchForEvents() {
|
|
|
14996
15040
|
_context.n = 67;
|
|
14997
15041
|
return effects.call(getChannelFromMap, channelId);
|
|
14998
15042
|
case 67:
|
|
14999
|
-
|
|
15000
|
-
log.info('channel MESSAGE_MARKERS_RECEIVED ... channel: ',
|
|
15001
|
-
if (!
|
|
15043
|
+
_channel7 = _context.v;
|
|
15044
|
+
log.info('channel MESSAGE_MARKERS_RECEIVED ... channel: ', _channel7, 'markers list: ', markerList);
|
|
15045
|
+
if (!_channel7) {
|
|
15002
15046
|
_context.n = 78;
|
|
15003
15047
|
break;
|
|
15004
15048
|
}
|
|
@@ -15034,8 +15078,8 @@ function watchForEvents() {
|
|
|
15034
15078
|
}
|
|
15035
15079
|
case 72:
|
|
15036
15080
|
markersMap[messageId] = true;
|
|
15037
|
-
if (
|
|
15038
|
-
if (
|
|
15081
|
+
if (_channel7) {
|
|
15082
|
+
if (_channel7.lastMessage && messageId === _channel7.lastMessage.id) {
|
|
15039
15083
|
updateLastMessage = true;
|
|
15040
15084
|
}
|
|
15041
15085
|
}
|
|
@@ -15051,10 +15095,10 @@ function watchForEvents() {
|
|
|
15051
15095
|
_context.n = 75;
|
|
15052
15096
|
break;
|
|
15053
15097
|
}
|
|
15054
|
-
lastMessage = _extends({},
|
|
15055
|
-
updateChannelLastMessageOnAllChannels(
|
|
15098
|
+
lastMessage = _extends({}, _channel7.lastMessage, updateMessageDeliveryStatusAndMarkers(_channel7.lastMessage, markerList.name));
|
|
15099
|
+
updateChannelLastMessageOnAllChannels(_channel7.id, lastMessage);
|
|
15056
15100
|
_context.n = 75;
|
|
15057
|
-
return effects.put(updateChannelLastMessageStatusAC(lastMessage,
|
|
15101
|
+
return effects.put(updateChannelLastMessageStatusAC(lastMessage, _channel7));
|
|
15058
15102
|
case 75:
|
|
15059
15103
|
if (!(_activeChannelId6 === channelId)) {
|
|
15060
15104
|
_context.n = 77;
|
|
@@ -15065,7 +15109,7 @@ function watchForEvents() {
|
|
|
15065
15109
|
case 76:
|
|
15066
15110
|
updateMarkersOnAllMessages(markersMap, markerList.name);
|
|
15067
15111
|
case 77:
|
|
15068
|
-
updateMessageStatusOnMap(
|
|
15112
|
+
updateMessageStatusOnMap(_channel7.id, {
|
|
15069
15113
|
name: markerList.name,
|
|
15070
15114
|
markersMap: markersMap
|
|
15071
15115
|
});
|
|
@@ -15077,21 +15121,21 @@ function watchForEvents() {
|
|
|
15077
15121
|
case 79:
|
|
15078
15122
|
_channelId = args.channelId;
|
|
15079
15123
|
log.info('channel DELETE ... ');
|
|
15080
|
-
|
|
15124
|
+
_channel8 = getChannelFromMap(_channelId);
|
|
15081
15125
|
_context.n = 80;
|
|
15082
|
-
return effects.put(setChannelToRemoveAC(
|
|
15126
|
+
return effects.put(setChannelToRemoveAC(_channel8));
|
|
15083
15127
|
case 80:
|
|
15084
15128
|
deleteChannelFromAllChannels(_channelId);
|
|
15085
15129
|
return _context.a(3, 183);
|
|
15086
15130
|
case 81:
|
|
15087
|
-
|
|
15131
|
+
_channel9 = args.channel, deletedMessage = args.deletedMessage;
|
|
15088
15132
|
_context.n = 82;
|
|
15089
15133
|
return effects.call(getActiveChannelId);
|
|
15090
15134
|
case 82:
|
|
15091
15135
|
_activeChannelId7 = _context.v;
|
|
15092
15136
|
log.info('channel DELETE_MESSAGE ... ');
|
|
15093
|
-
_channelExists7 = checkChannelExists(
|
|
15094
|
-
if (!(
|
|
15137
|
+
_channelExists7 = checkChannelExists(_channel9.id);
|
|
15138
|
+
if (!(_channel9.id === _activeChannelId7)) {
|
|
15095
15139
|
_context.n = 83;
|
|
15096
15140
|
break;
|
|
15097
15141
|
}
|
|
@@ -15099,7 +15143,7 @@ function watchForEvents() {
|
|
|
15099
15143
|
_context.n = 83;
|
|
15100
15144
|
return effects.put(updateMessageAC(deletedMessage.id, deletedMessage));
|
|
15101
15145
|
case 83:
|
|
15102
|
-
updateMessageOnMap(
|
|
15146
|
+
updateMessageOnMap(_channel9.id, {
|
|
15103
15147
|
messageId: deletedMessage.id,
|
|
15104
15148
|
params: deletedMessage
|
|
15105
15149
|
});
|
|
@@ -15108,33 +15152,33 @@ function watchForEvents() {
|
|
|
15108
15152
|
break;
|
|
15109
15153
|
}
|
|
15110
15154
|
_context.n = 84;
|
|
15111
|
-
return effects.put(updateChannelDataAC(
|
|
15112
|
-
newMessageCount:
|
|
15113
|
-
muted:
|
|
15114
|
-
mutedTill:
|
|
15155
|
+
return effects.put(updateChannelDataAC(_channel9.id, {
|
|
15156
|
+
newMessageCount: _channel9.newMessageCount,
|
|
15157
|
+
muted: _channel9.muted,
|
|
15158
|
+
mutedTill: _channel9.mutedTill
|
|
15115
15159
|
}));
|
|
15116
15160
|
case 84:
|
|
15117
|
-
if (!(
|
|
15161
|
+
if (!(_channel9.lastMessage.id === deletedMessage.id)) {
|
|
15118
15162
|
_context.n = 85;
|
|
15119
15163
|
break;
|
|
15120
15164
|
}
|
|
15121
15165
|
_context.n = 85;
|
|
15122
|
-
return effects.put(updateChannelLastMessageAC(deletedMessage,
|
|
15166
|
+
return effects.put(updateChannelLastMessageAC(deletedMessage, _channel9));
|
|
15123
15167
|
case 85:
|
|
15124
|
-
updateChannelOnAllChannels(
|
|
15125
|
-
newMessageCount:
|
|
15126
|
-
muted:
|
|
15127
|
-
mutedTill:
|
|
15168
|
+
updateChannelOnAllChannels(_channel9.id, {
|
|
15169
|
+
newMessageCount: _channel9.newMessageCount,
|
|
15170
|
+
muted: _channel9.muted,
|
|
15171
|
+
mutedTill: _channel9.mutedTill
|
|
15128
15172
|
}, deletedMessage);
|
|
15129
15173
|
return _context.a(3, 183);
|
|
15130
15174
|
case 86:
|
|
15131
|
-
|
|
15175
|
+
_channel0 = args.channel, _message = args.message;
|
|
15132
15176
|
_context.n = 87;
|
|
15133
15177
|
return effects.call(getActiveChannelId);
|
|
15134
15178
|
case 87:
|
|
15135
15179
|
_activeChannelId8 = _context.v;
|
|
15136
|
-
_channelExists8 = checkChannelExists(
|
|
15137
|
-
if (!(
|
|
15180
|
+
_channelExists8 = checkChannelExists(_channel0.id);
|
|
15181
|
+
if (!(_channel0.id === _activeChannelId8)) {
|
|
15138
15182
|
_context.n = 89;
|
|
15139
15183
|
break;
|
|
15140
15184
|
}
|
|
@@ -15161,29 +15205,29 @@ function watchForEvents() {
|
|
|
15161
15205
|
_context.n = 90;
|
|
15162
15206
|
break;
|
|
15163
15207
|
}
|
|
15164
|
-
if (!(
|
|
15208
|
+
if (!(_channel0.lastMessage.id === _message.id)) {
|
|
15165
15209
|
_context.n = 90;
|
|
15166
15210
|
break;
|
|
15167
15211
|
}
|
|
15168
15212
|
_context.n = 90;
|
|
15169
|
-
return effects.put(updateChannelLastMessageAC(_message,
|
|
15213
|
+
return effects.put(updateChannelLastMessageAC(_message, _channel0));
|
|
15170
15214
|
case 90:
|
|
15171
|
-
if (checkChannelExistsOnMessagesMap(
|
|
15172
|
-
updateMessageOnMap(
|
|
15215
|
+
if (checkChannelExistsOnMessagesMap(_channel0.id)) {
|
|
15216
|
+
updateMessageOnMap(_channel0.id, {
|
|
15173
15217
|
messageId: _message.id,
|
|
15174
15218
|
params: _message
|
|
15175
15219
|
});
|
|
15176
15220
|
}
|
|
15177
|
-
updateChannelOnAllChannels(
|
|
15221
|
+
updateChannelOnAllChannels(_channel0.id, {}, _message);
|
|
15178
15222
|
return _context.a(3, 183);
|
|
15179
15223
|
case 91:
|
|
15180
|
-
|
|
15224
|
+
_channel1 = args.channel, user = args.user, _message2 = args.message, reaction = args.reaction;
|
|
15181
15225
|
isSelf = user.id === SceytChatClient.user.id;
|
|
15182
15226
|
_context.n = 92;
|
|
15183
15227
|
return effects.call(getActiveChannelId);
|
|
15184
15228
|
case 92:
|
|
15185
15229
|
_activeChannelId9 = _context.v;
|
|
15186
|
-
if (!(
|
|
15230
|
+
if (!(_channel1.id === _activeChannelId9)) {
|
|
15187
15231
|
_context.n = 94;
|
|
15188
15232
|
break;
|
|
15189
15233
|
}
|
|
@@ -15200,7 +15244,7 @@ function watchForEvents() {
|
|
|
15200
15244
|
_context.n = 96;
|
|
15201
15245
|
break;
|
|
15202
15246
|
}
|
|
15203
|
-
if (!(document.visibilityState !== 'visible' ||
|
|
15247
|
+
if (!(document.visibilityState !== 'visible' || _channel1.id !== _activeChannelId9)) {
|
|
15204
15248
|
_context.n = 96;
|
|
15205
15249
|
break;
|
|
15206
15250
|
}
|
|
@@ -15223,38 +15267,38 @@ function watchForEvents() {
|
|
|
15223
15267
|
accentColor: _accentColor,
|
|
15224
15268
|
textSecondary: _textSecondary
|
|
15225
15269
|
});
|
|
15226
|
-
setNotification(_messageBody, reaction.user,
|
|
15270
|
+
setNotification(_messageBody, reaction.user, _channel1, reaction.key, _message2.attachments && _message2.attachments.length ? _message2.attachments.find(function (att) {
|
|
15227
15271
|
return att.type !== attachmentTypes.link;
|
|
15228
15272
|
}) : undefined);
|
|
15229
15273
|
case 96:
|
|
15230
|
-
if (!(
|
|
15274
|
+
if (!(_channel1.newReactions && _channel1.newReactions.length)) {
|
|
15231
15275
|
_context.n = 97;
|
|
15232
15276
|
break;
|
|
15233
15277
|
}
|
|
15234
15278
|
channelUpdateParams = {
|
|
15235
|
-
userMessageReactions:
|
|
15279
|
+
userMessageReactions: _channel1.newReactions,
|
|
15236
15280
|
lastReactedMessage: _message2,
|
|
15237
|
-
newReactions:
|
|
15238
|
-
muted:
|
|
15239
|
-
mutedTill:
|
|
15281
|
+
newReactions: _channel1.newReactions,
|
|
15282
|
+
muted: _channel1.muted,
|
|
15283
|
+
mutedTill: _channel1.mutedTill
|
|
15240
15284
|
};
|
|
15241
15285
|
_context.n = 97;
|
|
15242
|
-
return effects.put(updateChannelDataAC(
|
|
15286
|
+
return effects.put(updateChannelDataAC(_channel1.id, channelUpdateParams));
|
|
15243
15287
|
case 97:
|
|
15244
|
-
updateChannelOnAllChannels(
|
|
15245
|
-
userMessageReactions:
|
|
15288
|
+
updateChannelOnAllChannels(_channel1.id, {
|
|
15289
|
+
userMessageReactions: _channel1.newReactions,
|
|
15246
15290
|
lastReactedMessage: _message2,
|
|
15247
|
-
newReactions:
|
|
15248
|
-
muted:
|
|
15249
|
-
mutedTill:
|
|
15291
|
+
newReactions: _channel1.newReactions,
|
|
15292
|
+
muted: _channel1.muted,
|
|
15293
|
+
mutedTill: _channel1.mutedTill
|
|
15250
15294
|
});
|
|
15251
15295
|
case 98:
|
|
15252
|
-
if (checkChannelExistsOnMessagesMap(
|
|
15253
|
-
addReactionToMessageOnMap(
|
|
15296
|
+
if (checkChannelExistsOnMessagesMap(_channel1.id)) {
|
|
15297
|
+
addReactionToMessageOnMap(_channel1.id, _message2, reaction, true);
|
|
15254
15298
|
}
|
|
15255
15299
|
return _context.a(3, 183);
|
|
15256
15300
|
case 99:
|
|
15257
|
-
|
|
15301
|
+
_channel10 = args.channel, pollDetails = args.pollDetails, _messageId = args.messageId;
|
|
15258
15302
|
pollDetailsData = pollDetails;
|
|
15259
15303
|
_context.n = 100;
|
|
15260
15304
|
return effects.call(getActiveChannelId);
|
|
@@ -15268,7 +15312,7 @@ function watchForEvents() {
|
|
|
15268
15312
|
objs.push({
|
|
15269
15313
|
type: vote.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15270
15314
|
vote: vote,
|
|
15271
|
-
incrementVotesPerOptionCount: -
|
|
15315
|
+
incrementVotesPerOptionCount: -1
|
|
15272
15316
|
});
|
|
15273
15317
|
}
|
|
15274
15318
|
for (_iterator3 = _createForOfIteratorHelperLoose(addedVotes); !(_step3 = _iterator3()).done;) {
|
|
@@ -15276,7 +15320,7 @@ function watchForEvents() {
|
|
|
15276
15320
|
objs.push({
|
|
15277
15321
|
type: _vote.user.id === SceytChatClient.user.id ? 'addOwn' : 'add',
|
|
15278
15322
|
vote: _vote,
|
|
15279
|
-
incrementVotesPerOptionCount:
|
|
15323
|
+
incrementVotesPerOptionCount: 1
|
|
15280
15324
|
});
|
|
15281
15325
|
}
|
|
15282
15326
|
_i = 0, _objs = objs;
|
|
@@ -15316,7 +15360,7 @@ function watchForEvents() {
|
|
|
15316
15360
|
break;
|
|
15317
15361
|
}
|
|
15318
15362
|
_obj = _objs2[_i2];
|
|
15319
|
-
updateMessageOnMap(
|
|
15363
|
+
updateMessageOnMap(_channel10.id, {
|
|
15320
15364
|
messageId: _messageId,
|
|
15321
15365
|
params: {}
|
|
15322
15366
|
}, {
|
|
@@ -15324,7 +15368,7 @@ function watchForEvents() {
|
|
|
15324
15368
|
vote: _obj.vote,
|
|
15325
15369
|
incrementVotesPerOptionCount: _obj.incrementVotesPerOptionCount
|
|
15326
15370
|
});
|
|
15327
|
-
if (!(
|
|
15371
|
+
if (!(_channel10.id === _activeChannelId0)) {
|
|
15328
15372
|
_context.n = 107;
|
|
15329
15373
|
break;
|
|
15330
15374
|
}
|
|
@@ -15338,7 +15382,7 @@ function watchForEvents() {
|
|
|
15338
15382
|
case 108:
|
|
15339
15383
|
return _context.a(3, 183);
|
|
15340
15384
|
case 109:
|
|
15341
|
-
|
|
15385
|
+
_channel11 = args.channel, _pollDetails = args.pollDetails, _messageId2 = args.messageId;
|
|
15342
15386
|
_pollDetailsData = _pollDetails;
|
|
15343
15387
|
_context.n = 110;
|
|
15344
15388
|
return effects.call(getActiveChannelId);
|
|
@@ -15351,7 +15395,7 @@ function watchForEvents() {
|
|
|
15351
15395
|
_objs3.push({
|
|
15352
15396
|
type: _vote2.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15353
15397
|
vote: _vote2,
|
|
15354
|
-
incrementVotesPerOptionCount: -
|
|
15398
|
+
incrementVotesPerOptionCount: -1
|
|
15355
15399
|
});
|
|
15356
15400
|
}
|
|
15357
15401
|
_i3 = 0, _objs4 = _objs3;
|
|
@@ -15379,11 +15423,11 @@ function watchForEvents() {
|
|
|
15379
15423
|
break;
|
|
15380
15424
|
}
|
|
15381
15425
|
_obj3 = _objs5[_i4];
|
|
15382
|
-
updateMessageOnMap(
|
|
15426
|
+
updateMessageOnMap(_channel11.id, {
|
|
15383
15427
|
messageId: _messageId2,
|
|
15384
15428
|
params: {}
|
|
15385
15429
|
}, _obj3);
|
|
15386
|
-
if (!(
|
|
15430
|
+
if (!(_channel11.id === _activeChannelId1)) {
|
|
15387
15431
|
_context.n = 115;
|
|
15388
15432
|
break;
|
|
15389
15433
|
}
|
|
@@ -15397,7 +15441,7 @@ function watchForEvents() {
|
|
|
15397
15441
|
case 116:
|
|
15398
15442
|
return _context.a(3, 183);
|
|
15399
15443
|
case 117:
|
|
15400
|
-
|
|
15444
|
+
_channel12 = args.channel, _pollDetails2 = args.pollDetails, _messageId3 = args.messageId;
|
|
15401
15445
|
_context.n = 118;
|
|
15402
15446
|
return effects.call(getActiveChannelId);
|
|
15403
15447
|
case 118:
|
|
@@ -15410,7 +15454,7 @@ function watchForEvents() {
|
|
|
15410
15454
|
_objs6.push({
|
|
15411
15455
|
type: _vote4.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15412
15456
|
vote: _vote4,
|
|
15413
|
-
incrementVotesPerOptionCount: -
|
|
15457
|
+
incrementVotesPerOptionCount: -1
|
|
15414
15458
|
});
|
|
15415
15459
|
}
|
|
15416
15460
|
_i5 = 0, _objs7 = _objs6;
|
|
@@ -15420,7 +15464,7 @@ function watchForEvents() {
|
|
|
15420
15464
|
break;
|
|
15421
15465
|
}
|
|
15422
15466
|
_obj4 = _objs7[_i5];
|
|
15423
|
-
updateMessageOnMap(
|
|
15467
|
+
updateMessageOnMap(_channel12.id, {
|
|
15424
15468
|
messageId: _messageId3,
|
|
15425
15469
|
params: {}
|
|
15426
15470
|
}, _obj4);
|
|
@@ -15441,7 +15485,7 @@ function watchForEvents() {
|
|
|
15441
15485
|
_context.n = 120;
|
|
15442
15486
|
break;
|
|
15443
15487
|
case 122:
|
|
15444
|
-
if (!(
|
|
15488
|
+
if (!(_channel12.id === _activeChannelId10)) {
|
|
15445
15489
|
_context.n = 123;
|
|
15446
15490
|
break;
|
|
15447
15491
|
}
|
|
@@ -15455,7 +15499,7 @@ function watchForEvents() {
|
|
|
15455
15499
|
case 124:
|
|
15456
15500
|
return _context.a(3, 183);
|
|
15457
15501
|
case 125:
|
|
15458
|
-
|
|
15502
|
+
_channel13 = args.channel, _messageId4 = args.messageId;
|
|
15459
15503
|
_context.n = 126;
|
|
15460
15504
|
return effects.call(getActiveChannelId);
|
|
15461
15505
|
case 126:
|
|
@@ -15464,11 +15508,11 @@ function watchForEvents() {
|
|
|
15464
15508
|
type: 'close',
|
|
15465
15509
|
incrementVotesPerOptionCount: 0
|
|
15466
15510
|
};
|
|
15467
|
-
updateMessageOnMap(
|
|
15511
|
+
updateMessageOnMap(_channel13.id, {
|
|
15468
15512
|
messageId: _messageId4,
|
|
15469
15513
|
params: {}
|
|
15470
15514
|
}, _obj5);
|
|
15471
|
-
if (!(
|
|
15515
|
+
if (!(_channel13.id === _activeChannelId11)) {
|
|
15472
15516
|
_context.n = 128;
|
|
15473
15517
|
break;
|
|
15474
15518
|
}
|
|
@@ -15480,15 +15524,15 @@ function watchForEvents() {
|
|
|
15480
15524
|
case 128:
|
|
15481
15525
|
return _context.a(3, 183);
|
|
15482
15526
|
case 129:
|
|
15483
|
-
|
|
15484
|
-
log.info('channel REACTION_DELETED ... ',
|
|
15485
|
-
channelFromMap = getChannelFromMap(
|
|
15527
|
+
_channel14 = args.channel, _user = args.user, _message3 = args.message, _reaction = args.reaction;
|
|
15528
|
+
log.info('channel REACTION_DELETED ... ', _channel14);
|
|
15529
|
+
channelFromMap = getChannelFromMap(_channel14.id);
|
|
15486
15530
|
_isSelf = _user.id === SceytChatClient.user.id;
|
|
15487
15531
|
_context.n = 130;
|
|
15488
15532
|
return effects.call(getActiveChannelId);
|
|
15489
15533
|
case 130:
|
|
15490
15534
|
_activeChannelId12 = _context.v;
|
|
15491
|
-
if (!(
|
|
15535
|
+
if (!(_channel14.id === _activeChannelId12)) {
|
|
15492
15536
|
_context.n = 132;
|
|
15493
15537
|
break;
|
|
15494
15538
|
}
|
|
@@ -15497,54 +15541,54 @@ function watchForEvents() {
|
|
|
15497
15541
|
case 131:
|
|
15498
15542
|
removeReactionOnAllMessages(_message3, _reaction, true);
|
|
15499
15543
|
case 132:
|
|
15500
|
-
_channelUpdateParams = JSON.parse(JSON.stringify(
|
|
15544
|
+
_channelUpdateParams = JSON.parse(JSON.stringify(_channel14));
|
|
15501
15545
|
if (channelFromMap && channelFromMap.lastReactedMessage && channelFromMap.lastReactedMessage.id === _message3.id) {
|
|
15502
15546
|
_channelUpdateParams.lastReactedMessage = null;
|
|
15503
15547
|
}
|
|
15504
15548
|
_context.n = 133;
|
|
15505
|
-
return effects.put(updateChannelDataAC(
|
|
15549
|
+
return effects.put(updateChannelDataAC(_channel14.id, _channelUpdateParams));
|
|
15506
15550
|
case 133:
|
|
15507
|
-
updateChannelOnAllChannels(
|
|
15508
|
-
if (checkChannelExistsOnMessagesMap(
|
|
15509
|
-
removeReactionToMessageOnMap(
|
|
15551
|
+
updateChannelOnAllChannels(_channel14.id, _channelUpdateParams);
|
|
15552
|
+
if (checkChannelExistsOnMessagesMap(_channel14.id)) {
|
|
15553
|
+
removeReactionToMessageOnMap(_channel14.id, _message3, _reaction, true);
|
|
15510
15554
|
}
|
|
15511
15555
|
return _context.a(3, 183);
|
|
15512
15556
|
case 134:
|
|
15513
|
-
|
|
15514
|
-
if (!
|
|
15557
|
+
_channel15 = args.channel;
|
|
15558
|
+
if (!_channel15) {
|
|
15515
15559
|
_context.n = 136;
|
|
15516
15560
|
break;
|
|
15517
15561
|
}
|
|
15518
|
-
_updatedChannel = JSON.parse(JSON.stringify(
|
|
15562
|
+
_updatedChannel = JSON.parse(JSON.stringify(_channel15));
|
|
15519
15563
|
_context.n = 135;
|
|
15520
|
-
return effects.put(updateChannelDataAC(
|
|
15521
|
-
lastMessage:
|
|
15522
|
-
newMessageCount:
|
|
15523
|
-
newMentionCount:
|
|
15524
|
-
unread:
|
|
15525
|
-
newReactedMessageCount:
|
|
15526
|
-
newReactions:
|
|
15527
|
-
lastReactedMessage:
|
|
15528
|
-
lastReceivedMsgId:
|
|
15529
|
-
lastDisplayedMessageId:
|
|
15530
|
-
messageRetentionPeriod:
|
|
15564
|
+
return effects.put(updateChannelDataAC(_channel15.id, {
|
|
15565
|
+
lastMessage: _channel15.lastMessage,
|
|
15566
|
+
newMessageCount: _channel15.newMessageCount,
|
|
15567
|
+
newMentionCount: _channel15.newMentionCount,
|
|
15568
|
+
unread: _channel15.unread,
|
|
15569
|
+
newReactedMessageCount: _channel15.newReactedMessageCount,
|
|
15570
|
+
newReactions: _channel15.newReactions,
|
|
15571
|
+
lastReactedMessage: _channel15.lastReactedMessage,
|
|
15572
|
+
lastReceivedMsgId: _channel15.lastReceivedMsgId,
|
|
15573
|
+
lastDisplayedMessageId: _channel15.lastDisplayedMessageId,
|
|
15574
|
+
messageRetentionPeriod: _channel15.messageRetentionPeriod
|
|
15531
15575
|
}));
|
|
15532
15576
|
case 135:
|
|
15533
|
-
updateChannelOnAllChannels(
|
|
15577
|
+
updateChannelOnAllChannels(_channel15.id, _updatedChannel);
|
|
15534
15578
|
case 136:
|
|
15535
15579
|
return _context.a(3, 183);
|
|
15536
15580
|
case 137:
|
|
15537
|
-
|
|
15538
|
-
log.info('CLEAR_HISTORY: ',
|
|
15581
|
+
_channel16 = args.channel;
|
|
15582
|
+
log.info('CLEAR_HISTORY: ', _channel16);
|
|
15539
15583
|
_context.n = 138;
|
|
15540
15584
|
return effects.call(getActiveChannelId);
|
|
15541
15585
|
case 138:
|
|
15542
15586
|
_activeChannelId13 = _context.v;
|
|
15543
15587
|
_context.n = 139;
|
|
15544
|
-
return effects.call(checkChannelExists,
|
|
15588
|
+
return effects.call(checkChannelExists, _channel16.id);
|
|
15545
15589
|
case 139:
|
|
15546
15590
|
channelExist = _context.v;
|
|
15547
|
-
if (!(
|
|
15591
|
+
if (!(_channel16.id === _activeChannelId13)) {
|
|
15548
15592
|
_context.n = 141;
|
|
15549
15593
|
break;
|
|
15550
15594
|
}
|
|
@@ -15553,141 +15597,141 @@ function watchForEvents() {
|
|
|
15553
15597
|
case 140:
|
|
15554
15598
|
removeAllMessages();
|
|
15555
15599
|
case 141:
|
|
15556
|
-
removeMessagesFromMap(
|
|
15600
|
+
removeMessagesFromMap(_channel16.id);
|
|
15557
15601
|
if (!channelExist) {
|
|
15558
15602
|
_context.n = 142;
|
|
15559
15603
|
break;
|
|
15560
15604
|
}
|
|
15561
15605
|
_context.n = 142;
|
|
15562
|
-
return effects.put(updateChannelDataAC(
|
|
15606
|
+
return effects.put(updateChannelDataAC(_channel16.id, {
|
|
15563
15607
|
lastMessage: null,
|
|
15564
15608
|
newMessageCount: 0,
|
|
15565
15609
|
newMentionCount: 0,
|
|
15566
|
-
muted:
|
|
15567
|
-
mutedTill:
|
|
15610
|
+
muted: _channel16.muted,
|
|
15611
|
+
mutedTill: _channel16.mutedTill
|
|
15568
15612
|
}));
|
|
15569
15613
|
case 142:
|
|
15570
|
-
updateChannelOnAllChannels(
|
|
15614
|
+
updateChannelOnAllChannels(_channel16.id, {
|
|
15571
15615
|
lastMessage: null,
|
|
15572
15616
|
newMessageCount: 0,
|
|
15573
15617
|
newMentionCount: 0,
|
|
15574
|
-
muted:
|
|
15575
|
-
mutedTill:
|
|
15618
|
+
muted: _channel16.muted,
|
|
15619
|
+
mutedTill: _channel16.mutedTill
|
|
15576
15620
|
});
|
|
15577
15621
|
return _context.a(3, 183);
|
|
15578
15622
|
case 143:
|
|
15579
|
-
|
|
15623
|
+
_channel17 = args.channel;
|
|
15580
15624
|
log.info('channel MUTE ... ');
|
|
15581
15625
|
_context.n = 144;
|
|
15582
|
-
return effects.put(updateChannelDataAC(
|
|
15583
|
-
muted:
|
|
15584
|
-
mutedTill:
|
|
15626
|
+
return effects.put(updateChannelDataAC(_channel17.id, {
|
|
15627
|
+
muted: _channel17.muted,
|
|
15628
|
+
mutedTill: _channel17.mutedTill
|
|
15585
15629
|
}));
|
|
15586
15630
|
case 144:
|
|
15587
|
-
updateChannelOnAllChannels(
|
|
15588
|
-
muted:
|
|
15589
|
-
mutedTill:
|
|
15631
|
+
updateChannelOnAllChannels(_channel17.id, {
|
|
15632
|
+
muted: _channel17.muted,
|
|
15633
|
+
mutedTill: _channel17.mutedTill
|
|
15590
15634
|
});
|
|
15591
15635
|
return _context.a(3, 183);
|
|
15592
15636
|
case 145:
|
|
15593
|
-
|
|
15637
|
+
_channel18 = args.channel;
|
|
15594
15638
|
log.info('channel UNMUTE ... ');
|
|
15595
15639
|
_context.n = 146;
|
|
15596
|
-
return effects.put(updateChannelDataAC(
|
|
15597
|
-
muted:
|
|
15598
|
-
mutedTill:
|
|
15640
|
+
return effects.put(updateChannelDataAC(_channel18.id, {
|
|
15641
|
+
muted: _channel18.muted,
|
|
15642
|
+
mutedTill: _channel18.mutedTill
|
|
15599
15643
|
}));
|
|
15600
15644
|
case 146:
|
|
15601
|
-
updateChannelOnAllChannels(
|
|
15602
|
-
muted:
|
|
15603
|
-
mutedTill:
|
|
15645
|
+
updateChannelOnAllChannels(_channel18.id, {
|
|
15646
|
+
muted: _channel18.muted,
|
|
15647
|
+
mutedTill: _channel18.mutedTill
|
|
15604
15648
|
});
|
|
15605
15649
|
return _context.a(3, 183);
|
|
15606
15650
|
case 147:
|
|
15607
|
-
|
|
15651
|
+
_channel19 = args.channel;
|
|
15608
15652
|
log.info('channel PINED ... ');
|
|
15609
15653
|
_context.n = 148;
|
|
15610
|
-
return effects.put(updateChannelDataAC(
|
|
15611
|
-
pinnedAt:
|
|
15654
|
+
return effects.put(updateChannelDataAC(_channel19.id, {
|
|
15655
|
+
pinnedAt: _channel19.pinnedAt
|
|
15612
15656
|
}, true));
|
|
15613
15657
|
case 148:
|
|
15614
|
-
updateChannelOnAllChannels(
|
|
15615
|
-
pinnedAt:
|
|
15658
|
+
updateChannelOnAllChannels(_channel19.id, {
|
|
15659
|
+
pinnedAt: _channel19.pinnedAt
|
|
15616
15660
|
});
|
|
15617
15661
|
return _context.a(3, 183);
|
|
15618
15662
|
case 149:
|
|
15619
|
-
|
|
15663
|
+
_channel20 = args.channel;
|
|
15620
15664
|
log.info('channel UNPINED ... ');
|
|
15621
15665
|
_context.n = 150;
|
|
15622
|
-
return effects.put(updateChannelDataAC(
|
|
15623
|
-
pinnedAt:
|
|
15666
|
+
return effects.put(updateChannelDataAC(_channel20.id, {
|
|
15667
|
+
pinnedAt: _channel20.pinnedAt
|
|
15624
15668
|
}, false, true));
|
|
15625
15669
|
case 150:
|
|
15626
|
-
updateChannelOnAllChannels(
|
|
15627
|
-
pinnedAt:
|
|
15670
|
+
updateChannelOnAllChannels(_channel20.id, {
|
|
15671
|
+
pinnedAt: _channel20.pinnedAt
|
|
15628
15672
|
});
|
|
15629
15673
|
return _context.a(3, 183);
|
|
15630
15674
|
case 151:
|
|
15631
|
-
|
|
15675
|
+
_channel21 = args.channel;
|
|
15632
15676
|
log.info('channel HIDE ... ');
|
|
15633
15677
|
_context.n = 152;
|
|
15634
|
-
return effects.put(setChannelToHideAC(
|
|
15678
|
+
return effects.put(setChannelToHideAC(_channel21));
|
|
15635
15679
|
case 152:
|
|
15636
15680
|
return _context.a(3, 183);
|
|
15637
15681
|
case 153:
|
|
15638
|
-
|
|
15682
|
+
_channel22 = args.channel;
|
|
15639
15683
|
log.info('channel UNHIDE ... ');
|
|
15640
15684
|
_context.n = 154;
|
|
15641
|
-
return effects.put(setChannelToUnHideAC(
|
|
15685
|
+
return effects.put(setChannelToUnHideAC(_channel22));
|
|
15642
15686
|
case 154:
|
|
15643
15687
|
return _context.a(3, 183);
|
|
15644
15688
|
case 155:
|
|
15645
|
-
|
|
15689
|
+
_channel23 = args.channel;
|
|
15646
15690
|
_context.n = 156;
|
|
15647
|
-
return effects.put(updateChannelDataAC(
|
|
15648
|
-
unread:
|
|
15649
|
-
muted:
|
|
15650
|
-
mutedTill:
|
|
15691
|
+
return effects.put(updateChannelDataAC(_channel23.id, {
|
|
15692
|
+
unread: _channel23.unread,
|
|
15693
|
+
muted: _channel23.muted,
|
|
15694
|
+
mutedTill: _channel23.mutedTill
|
|
15651
15695
|
}));
|
|
15652
15696
|
case 156:
|
|
15653
|
-
_groupName5 = getChannelGroupName(
|
|
15697
|
+
_groupName5 = getChannelGroupName(_channel23);
|
|
15654
15698
|
_context.n = 157;
|
|
15655
|
-
return effects.put(updateSearchedChannelDataAC(
|
|
15656
|
-
unread:
|
|
15699
|
+
return effects.put(updateSearchedChannelDataAC(_channel23.id, {
|
|
15700
|
+
unread: _channel23.unread
|
|
15657
15701
|
}, _groupName5));
|
|
15658
15702
|
case 157:
|
|
15659
|
-
updateChannelOnAllChannels(
|
|
15660
|
-
unread:
|
|
15703
|
+
updateChannelOnAllChannels(_channel23.id, {
|
|
15704
|
+
unread: _channel23.unread
|
|
15661
15705
|
});
|
|
15662
15706
|
return _context.a(3, 183);
|
|
15663
15707
|
case 158:
|
|
15664
|
-
|
|
15708
|
+
_channel24 = args.channel;
|
|
15665
15709
|
_context.n = 159;
|
|
15666
|
-
return effects.put(updateChannelDataAC(
|
|
15667
|
-
unread:
|
|
15668
|
-
muted:
|
|
15669
|
-
mutedTill:
|
|
15710
|
+
return effects.put(updateChannelDataAC(_channel24.id, {
|
|
15711
|
+
unread: _channel24.unread,
|
|
15712
|
+
muted: _channel24.muted,
|
|
15713
|
+
mutedTill: _channel24.mutedTill
|
|
15670
15714
|
}));
|
|
15671
15715
|
case 159:
|
|
15672
|
-
_groupName6 = getChannelGroupName(
|
|
15716
|
+
_groupName6 = getChannelGroupName(_channel24);
|
|
15673
15717
|
_context.n = 160;
|
|
15674
|
-
return effects.put(updateSearchedChannelDataAC(
|
|
15675
|
-
unread:
|
|
15718
|
+
return effects.put(updateSearchedChannelDataAC(_channel24.id, {
|
|
15719
|
+
unread: _channel24.unread
|
|
15676
15720
|
}, _groupName6));
|
|
15677
15721
|
case 160:
|
|
15678
|
-
updateChannelOnAllChannels(
|
|
15679
|
-
unread:
|
|
15722
|
+
updateChannelOnAllChannels(_channel24.id, {
|
|
15723
|
+
unread: _channel24.unread
|
|
15680
15724
|
});
|
|
15681
15725
|
return _context.a(3, 183);
|
|
15682
15726
|
case 161:
|
|
15683
|
-
|
|
15684
|
-
log.info('channel CHANGE_ROLE channel ... ',
|
|
15727
|
+
_channel25 = args.channel, members = args.members;
|
|
15728
|
+
log.info('channel CHANGE_ROLE channel ... ', _channel25);
|
|
15685
15729
|
log.info('channel CHANGE_ROLE member ... ', members);
|
|
15686
15730
|
_context.n = 162;
|
|
15687
15731
|
return effects.call(getActiveChannelId);
|
|
15688
15732
|
case 162:
|
|
15689
15733
|
_activeChannelId14 = _context.v;
|
|
15690
|
-
if (!(
|
|
15734
|
+
if (!(_channel25.id === _activeChannelId14)) {
|
|
15691
15735
|
_context.n = 163;
|
|
15692
15736
|
break;
|
|
15693
15737
|
}
|
|
@@ -15705,16 +15749,16 @@ function watchForEvents() {
|
|
|
15705
15749
|
break;
|
|
15706
15750
|
}
|
|
15707
15751
|
_context.n = 165;
|
|
15708
|
-
return effects.put(updateChannelDataAC(
|
|
15752
|
+
return effects.put(updateChannelDataAC(_channel25.id, {
|
|
15709
15753
|
userRole: members[i].role,
|
|
15710
|
-
muted:
|
|
15711
|
-
mutedTill:
|
|
15754
|
+
muted: _channel25.muted,
|
|
15755
|
+
mutedTill: _channel25.mutedTill
|
|
15712
15756
|
}));
|
|
15713
15757
|
case 165:
|
|
15714
|
-
updateChannelOnAllChannels(
|
|
15758
|
+
updateChannelOnAllChannels(_channel25.id, {
|
|
15715
15759
|
userRole: members[i].role,
|
|
15716
|
-
muted:
|
|
15717
|
-
mutedTill:
|
|
15760
|
+
muted: _channel25.muted,
|
|
15761
|
+
mutedTill: _channel25.mutedTill
|
|
15718
15762
|
});
|
|
15719
15763
|
case 166:
|
|
15720
15764
|
i++;
|
|
@@ -15723,12 +15767,12 @@ function watchForEvents() {
|
|
|
15723
15767
|
case 167:
|
|
15724
15768
|
return _context.a(3, 183);
|
|
15725
15769
|
case 168:
|
|
15726
|
-
|
|
15727
|
-
log.info('channel frozen channel ... ',
|
|
15770
|
+
_channel26 = args.channel;
|
|
15771
|
+
log.info('channel frozen channel ... ', _channel26);
|
|
15728
15772
|
return _context.a(3, 183);
|
|
15729
15773
|
case 169:
|
|
15730
|
-
|
|
15731
|
-
log.info('channel unfrozen channel ... ',
|
|
15774
|
+
_channel27 = args.channel;
|
|
15775
|
+
log.info('channel unfrozen channel ... ', _channel27);
|
|
15732
15776
|
return _context.a(3, 183);
|
|
15733
15777
|
case 170:
|
|
15734
15778
|
_channelId2 = args.channelId, from = args.from, name = args.name;
|
|
@@ -16064,25 +16108,31 @@ function createChannel(action) {
|
|
|
16064
16108
|
}, _marked$2, null, [[0, 17]]);
|
|
16065
16109
|
}
|
|
16066
16110
|
function getChannels(action) {
|
|
16067
|
-
var _params$filter, _types, payload, params, SceytChatClient, channelQueryBuilder, channelTypesFilter, types, channelQuery, channelsData, channelList, channelId, activeChannel, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, channelMessageMap, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, i, allChannelsData, allChannelList, _t2, _t3, _t4;
|
|
16111
|
+
var _params$filter, _types, _activeChannel, _mappedChannels, _mappedChannels3, _mappedChannels4, payload, params, SceytChatClient, connectionStatus, channelQueryBuilder, channelTypesFilter, types, limit, channelQuery, channelsData, channelList, channelId, activeChannel, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys, _mappedChannels2, channelMessageMap, _activeChannel2, _activeChannel3, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, totalAllChannelsAdded, i, _connectionStatus, allChannelsData, allChannelList, _t2, _t3, _t4;
|
|
16068
16112
|
return _regenerator().w(function (_context2) {
|
|
16069
16113
|
while (1) switch (_context2.p = _context2.n) {
|
|
16070
16114
|
case 0:
|
|
16071
|
-
|
|
16115
|
+
log.info('[getChannels] start get channels');
|
|
16116
|
+
_context2.p = 1;
|
|
16072
16117
|
payload = action.payload;
|
|
16073
16118
|
params = payload.params;
|
|
16119
|
+
log.info('[getChannels] input params:', JSON.stringify(params));
|
|
16074
16120
|
SceytChatClient = getClient();
|
|
16075
|
-
|
|
16076
|
-
|
|
16121
|
+
connectionStatus = store.getState().UserReducer.connectionStatus;
|
|
16122
|
+
log.info('[getChannels] connection status:', connectionStatus);
|
|
16123
|
+
if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
|
|
16124
|
+
_context2.n = 2;
|
|
16077
16125
|
break;
|
|
16078
16126
|
}
|
|
16127
|
+
log.warn('[getChannels] connection not ready, aborting. Status:', connectionStatus);
|
|
16079
16128
|
return _context2.a(2);
|
|
16080
|
-
case 1:
|
|
16081
|
-
_context2.n = 2;
|
|
16082
|
-
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16083
16129
|
case 2:
|
|
16130
|
+
_context2.n = 3;
|
|
16131
|
+
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16132
|
+
case 3:
|
|
16084
16133
|
channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
|
|
16085
16134
|
channelTypesFilter = getChannelTypesFilter();
|
|
16135
|
+
log.info('[getChannels] channelTypesFilter:', JSON.stringify(channelTypesFilter));
|
|
16086
16136
|
types = [];
|
|
16087
16137
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
16088
16138
|
types = channelTypesFilter;
|
|
@@ -16090,59 +16140,77 @@ function getChannels(action) {
|
|
|
16090
16140
|
if (params !== null && params !== void 0 && (_params$filter = params.filter) !== null && _params$filter !== void 0 && _params$filter.channelType) {
|
|
16091
16141
|
types.push(params.filter.channelType);
|
|
16092
16142
|
}
|
|
16143
|
+
log.info('[getChannels] final types array:', JSON.stringify(types));
|
|
16093
16144
|
if ((_types = types) !== null && _types !== void 0 && _types.length) {
|
|
16094
16145
|
channelQueryBuilder.types(types);
|
|
16095
16146
|
}
|
|
16096
16147
|
if (params.memberCount) {
|
|
16148
|
+
log.info('[getChannels] setting memberCount filter:', params === null || params === void 0 ? void 0 : params.memberCount);
|
|
16097
16149
|
channelQueryBuilder.memberCount(params.memberCount);
|
|
16098
16150
|
}
|
|
16099
16151
|
channelQueryBuilder.order('lastMessage');
|
|
16100
|
-
|
|
16101
|
-
|
|
16152
|
+
limit = params.limit || 50;
|
|
16153
|
+
log.info('[getChannels] query limit:', limit);
|
|
16154
|
+
channelQueryBuilder.limit(limit);
|
|
16155
|
+
_context2.n = 4;
|
|
16102
16156
|
return effects.call(channelQueryBuilder.build);
|
|
16103
|
-
case
|
|
16157
|
+
case 4:
|
|
16104
16158
|
channelQuery = _context2.v;
|
|
16105
|
-
|
|
16159
|
+
log.info('[getChannels] query built successfully');
|
|
16160
|
+
_context2.n = 5;
|
|
16106
16161
|
return effects.call(channelQuery.loadNextPage);
|
|
16107
|
-
case
|
|
16162
|
+
case 5:
|
|
16108
16163
|
channelsData = _context2.v;
|
|
16109
16164
|
channelList = channelsData.channels;
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16165
|
+
log.info('[getChannels] channelsData received:', JSON.stringify({
|
|
16166
|
+
channelsCount: (channelList === null || channelList === void 0 ? void 0 : channelList.length) || 0,
|
|
16167
|
+
hasNext: channelsData.hasNext
|
|
16168
|
+
}));
|
|
16113
16169
|
_context2.n = 6;
|
|
16114
|
-
return effects.
|
|
16170
|
+
return effects.put(channelHasNextAC(channelsData.hasNext));
|
|
16115
16171
|
case 6:
|
|
16172
|
+
_context2.n = 7;
|
|
16173
|
+
return effects.call(getActiveChannelId);
|
|
16174
|
+
case 7:
|
|
16116
16175
|
channelId = _context2.v;
|
|
16176
|
+
log.info('[getChannels] active channelId:', channelId);
|
|
16117
16177
|
if (!channelId) {
|
|
16118
|
-
_context2.n =
|
|
16178
|
+
_context2.n = 9;
|
|
16119
16179
|
break;
|
|
16120
16180
|
}
|
|
16121
|
-
_context2.n =
|
|
16181
|
+
_context2.n = 8;
|
|
16122
16182
|
return effects.call(getChannelFromMap, channelId);
|
|
16123
|
-
case
|
|
16183
|
+
case 8:
|
|
16124
16184
|
_t2 = _context2.v;
|
|
16125
|
-
_context2.n =
|
|
16185
|
+
_context2.n = 10;
|
|
16126
16186
|
break;
|
|
16127
|
-
case 8:
|
|
16128
|
-
_t2 = null;
|
|
16129
16187
|
case 9:
|
|
16130
|
-
|
|
16131
|
-
_context2.n = 10;
|
|
16132
|
-
return effects.call(destroyChannelsMap);
|
|
16188
|
+
_t2 = null;
|
|
16133
16189
|
case 10:
|
|
16190
|
+
activeChannel = _t2;
|
|
16191
|
+
log.info('[getChannels] activeChannel from map:', activeChannel ? (_activeChannel = activeChannel) === null || _activeChannel === void 0 ? void 0 : _activeChannel.id : 'null');
|
|
16134
16192
|
_context2.n = 11;
|
|
16135
|
-
return effects.call(
|
|
16193
|
+
return effects.call(destroyChannelsMap);
|
|
16136
16194
|
case 11:
|
|
16195
|
+
log.info('[getChannels] channels map destroyed');
|
|
16196
|
+
_context2.n = 12;
|
|
16197
|
+
return effects.call(setChannelsInMap, channelList);
|
|
16198
|
+
case 12:
|
|
16137
16199
|
_yield$call = _context2.v;
|
|
16138
16200
|
mappedChannels = _yield$call.channels;
|
|
16139
16201
|
channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
|
|
16140
|
-
|
|
16141
|
-
|
|
16202
|
+
log.info('[getChannels] setChannelsInMap result:', JSON.stringify({
|
|
16203
|
+
mappedChannelsCount: ((_mappedChannels = mappedChannels) === null || _mappedChannels === void 0 ? void 0 : _mappedChannels.length) || 0,
|
|
16204
|
+
channelsForUpdateLastReactionMessageCount: (channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length) || 0
|
|
16205
|
+
}));
|
|
16206
|
+
log.info('channelsForUpdateLastReactionMessage', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16207
|
+
if (!(channelsForUpdateLastReactionMessage !== null && channelsForUpdateLastReactionMessage !== void 0 && channelsForUpdateLastReactionMessage.length)) {
|
|
16208
|
+
_context2.n = 14;
|
|
16142
16209
|
break;
|
|
16143
16210
|
}
|
|
16211
|
+
log.info('[getChannels] processing channels for reaction message update:', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16144
16212
|
channelMessageMap = {};
|
|
16145
|
-
_context2.n =
|
|
16213
|
+
_context2.n = 13;
|
|
16146
16214
|
return effects.call(function () {
|
|
16147
16215
|
try {
|
|
16148
16216
|
return Promise.resolve(Promise.all(channelsForUpdateLastReactionMessage.map(function (channel) {
|
|
@@ -16150,9 +16218,10 @@ function getChannels(action) {
|
|
|
16150
16218
|
return Promise.resolve(new Promise(function (resolve) {
|
|
16151
16219
|
channel.getMessagesById([channel.newReactions[0].messageId]).then(function (messages) {
|
|
16152
16220
|
channelMessageMap[channel.id] = messages[0];
|
|
16221
|
+
log.info('[getChannels] successfully fetched reaction message for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16153
16222
|
resolve(true);
|
|
16154
16223
|
})["catch"](function (e) {
|
|
16155
|
-
log.error(e, 'Error on getMessagesById');
|
|
16224
|
+
log.error(e, 'Error on getMessagesById for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16156
16225
|
resolve(true);
|
|
16157
16226
|
});
|
|
16158
16227
|
}));
|
|
@@ -16164,89 +16233,133 @@ function getChannels(action) {
|
|
|
16164
16233
|
return Promise.reject(e);
|
|
16165
16234
|
}
|
|
16166
16235
|
});
|
|
16167
|
-
case
|
|
16236
|
+
case 13:
|
|
16237
|
+
log.info('[getChannels] reaction messages fetched:', channelMessageMap ? (_Object$keys = Object.keys(channelMessageMap)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length : 0);
|
|
16168
16238
|
mappedChannels = mappedChannels.map(function (channel) {
|
|
16169
16239
|
if (channelMessageMap[channel.id]) {
|
|
16170
16240
|
channel.lastReactedMessage = channelMessageMap[channel.id];
|
|
16171
16241
|
}
|
|
16172
16242
|
return channel;
|
|
16173
16243
|
});
|
|
16174
|
-
|
|
16175
|
-
_context2.n = 14;
|
|
16176
|
-
return effects.put(setChannelsAC(mappedChannels));
|
|
16244
|
+
log.info('[getChannels] mappedChannels updated with reaction messages, final count:', ((_mappedChannels2 = mappedChannels) === null || _mappedChannels2 === void 0 ? void 0 : _mappedChannels2.length) || 0);
|
|
16177
16245
|
case 14:
|
|
16246
|
+
log.info('[getChannels] setting channels in state, count:', ((_mappedChannels3 = mappedChannels) === null || _mappedChannels3 === void 0 ? void 0 : _mappedChannels3.length) || 0);
|
|
16247
|
+
_context2.n = 15;
|
|
16248
|
+
return effects.put(setChannelsAC(mappedChannels));
|
|
16249
|
+
case 15:
|
|
16178
16250
|
if (!channelId) {
|
|
16179
16251
|
activeChannel = channelList[0];
|
|
16252
|
+
log.info('[getChannels] no active channelId, setting first channel as active:', (_activeChannel2 = activeChannel) === null || _activeChannel2 === void 0 ? void 0 : _activeChannel2.id);
|
|
16180
16253
|
}
|
|
16181
16254
|
query.channelQuery = channelQuery;
|
|
16182
16255
|
if (!(activeChannel && getAutoSelectFitsChannel())) {
|
|
16183
|
-
_context2.n =
|
|
16256
|
+
_context2.n = 16;
|
|
16184
16257
|
break;
|
|
16185
16258
|
}
|
|
16186
|
-
|
|
16187
|
-
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
16188
|
-
case 15:
|
|
16259
|
+
log.info('[getChannels] auto-selecting channel:', (_activeChannel3 = activeChannel) === null || _activeChannel3 === void 0 ? void 0 : _activeChannel3.id);
|
|
16189
16260
|
_context2.n = 16;
|
|
16190
|
-
return effects.put(
|
|
16261
|
+
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
16191
16262
|
case 16:
|
|
16263
|
+
_context2.n = 17;
|
|
16264
|
+
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
|
|
16265
|
+
case 17:
|
|
16192
16266
|
hiddenList = store.getState().ChannelReducer.hideChannelList;
|
|
16267
|
+
log.info('[getChannels] hiddenList state:', hiddenList);
|
|
16193
16268
|
if (hiddenList) {
|
|
16194
|
-
_context2.n =
|
|
16269
|
+
_context2.n = 28;
|
|
16195
16270
|
break;
|
|
16196
16271
|
}
|
|
16272
|
+
log.info('[getChannels] starting all channels query (hiddenList is false)');
|
|
16197
16273
|
allChannelsQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
|
|
16198
16274
|
allChannelsQueryBuilder.order('lastMessage');
|
|
16199
16275
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
16200
16276
|
allChannelsQueryBuilder.types(channelTypesFilter);
|
|
16277
|
+
log.info('[getChannels] allChannelsQuery types:', JSON.stringify(channelTypesFilter));
|
|
16201
16278
|
}
|
|
16202
16279
|
if (params !== null && params !== void 0 && params.memberCount) {
|
|
16203
16280
|
allChannelsQueryBuilder.memberCount(params.memberCount);
|
|
16281
|
+
log.info('[getChannels] allChannelsQuery memberCount:', params === null || params === void 0 ? void 0 : params.memberCount);
|
|
16204
16282
|
}
|
|
16205
16283
|
allChannelsQueryBuilder.limit(50);
|
|
16206
|
-
_context2.n =
|
|
16284
|
+
_context2.n = 18;
|
|
16207
16285
|
return effects.call(allChannelsQueryBuilder.build);
|
|
16208
|
-
case
|
|
16286
|
+
case 18:
|
|
16209
16287
|
allChannelsQuery = _context2.v;
|
|
16288
|
+
log.info('[getChannels] allChannelsQuery built');
|
|
16210
16289
|
hasNext = true;
|
|
16290
|
+
totalAllChannelsAdded = 0;
|
|
16211
16291
|
i = 0;
|
|
16212
|
-
case
|
|
16292
|
+
case 19:
|
|
16213
16293
|
if (!(i <= 4)) {
|
|
16214
|
-
_context2.n =
|
|
16294
|
+
_context2.n = 27;
|
|
16215
16295
|
break;
|
|
16216
16296
|
}
|
|
16217
16297
|
if (!hasNext) {
|
|
16218
|
-
_context2.n =
|
|
16298
|
+
_context2.n = 25;
|
|
16299
|
+
break;
|
|
16300
|
+
}
|
|
16301
|
+
_context2.p = 20;
|
|
16302
|
+
_connectionStatus = store.getState().UserReducer.connectionStatus;
|
|
16303
|
+
if (!(_connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
|
|
16304
|
+
_context2.n = 21;
|
|
16219
16305
|
break;
|
|
16220
16306
|
}
|
|
16221
|
-
|
|
16222
|
-
_context2.
|
|
16307
|
+
log.warn('[getChannels] connection not ready, aborting. Status:', _connectionStatus);
|
|
16308
|
+
return _context2.a(3, 27);
|
|
16309
|
+
case 21:
|
|
16310
|
+
log.info('[getChannels] loading all channels page:', i + 1);
|
|
16311
|
+
_context2.n = 22;
|
|
16223
16312
|
return effects.call(allChannelsQuery.loadNextPage);
|
|
16224
|
-
case
|
|
16313
|
+
case 22:
|
|
16225
16314
|
allChannelsData = _context2.v;
|
|
16226
16315
|
hasNext = allChannelsData.hasNext;
|
|
16227
16316
|
allChannelList = allChannelsData.channels;
|
|
16317
|
+
log.info('[getChannels] all channels page', i + 1, 'loaded:', JSON.stringify({
|
|
16318
|
+
channelsCount: (allChannelList === null || allChannelList === void 0 ? void 0 : allChannelList.length) || 0,
|
|
16319
|
+
hasNext: hasNext
|
|
16320
|
+
}));
|
|
16228
16321
|
addChannelsToAllChannels(allChannelList);
|
|
16229
|
-
|
|
16322
|
+
totalAllChannelsAdded += (allChannelList === null || allChannelList === void 0 ? void 0 : allChannelList.length) || 0;
|
|
16323
|
+
log.info('[getChannels] total all channels added so far:', totalAllChannelsAdded);
|
|
16324
|
+
_context2.n = 24;
|
|
16230
16325
|
break;
|
|
16231
|
-
case
|
|
16232
|
-
_context2.p =
|
|
16326
|
+
case 23:
|
|
16327
|
+
_context2.p = 23;
|
|
16233
16328
|
_t3 = _context2.v;
|
|
16234
|
-
log.error(_t3, 'Error on get all channels');
|
|
16235
|
-
|
|
16329
|
+
log.error(_t3, 'Error on get all channels page:', i + 1);
|
|
16330
|
+
return _context2.a(3, 27);
|
|
16331
|
+
case 24:
|
|
16332
|
+
_context2.n = 26;
|
|
16333
|
+
break;
|
|
16334
|
+
case 25:
|
|
16335
|
+
log.info('[getChannels] no more pages available, stopping at iteration:', i);
|
|
16336
|
+
case 26:
|
|
16236
16337
|
i++;
|
|
16237
|
-
_context2.n =
|
|
16338
|
+
_context2.n = 19;
|
|
16238
16339
|
break;
|
|
16239
|
-
case
|
|
16240
|
-
|
|
16340
|
+
case 27:
|
|
16341
|
+
log.info('[getChannels] all channels query completed, total channels added:', totalAllChannelsAdded);
|
|
16342
|
+
_context2.n = 29;
|
|
16241
16343
|
break;
|
|
16242
|
-
case
|
|
16243
|
-
|
|
16344
|
+
case 28:
|
|
16345
|
+
log.info('[getChannels] skipping all channels query (hiddenList is true)');
|
|
16346
|
+
case 29:
|
|
16347
|
+
log.info('[getChannels] completed successfully. Final mapped channels count:', ((_mappedChannels4 = mappedChannels) === null || _mappedChannels4 === void 0 ? void 0 : _mappedChannels4.length) || 0);
|
|
16348
|
+
_context2.n = 31;
|
|
16349
|
+
break;
|
|
16350
|
+
case 30:
|
|
16351
|
+
_context2.p = 30;
|
|
16244
16352
|
_t4 = _context2.v;
|
|
16245
|
-
log.error(JSON.stringify(_t4), 'Error on get channels');
|
|
16246
|
-
|
|
16353
|
+
log.error('[getChannels] error occurred:', JSON.stringify(_t4), 'Error on get channels');
|
|
16354
|
+
log.error('[getChannels] error details:', {
|
|
16355
|
+
message: _t4.message,
|
|
16356
|
+
code: _t4.code,
|
|
16357
|
+
stack: _t4.stack
|
|
16358
|
+
});
|
|
16359
|
+
case 31:
|
|
16247
16360
|
return _context2.a(2);
|
|
16248
16361
|
}
|
|
16249
|
-
}, _marked2$1, null, [[
|
|
16362
|
+
}, _marked2$1, null, [[20, 23], [1, 30]]);
|
|
16250
16363
|
}
|
|
16251
16364
|
function searchChannels(action) {
|
|
16252
16365
|
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;
|
|
@@ -16569,39 +16682,66 @@ function searchChannelsForForward(action) {
|
|
|
16569
16682
|
}, _marked5, null, [[0, 7]]);
|
|
16570
16683
|
}
|
|
16571
16684
|
function channelsLoadMore(action) {
|
|
16572
|
-
var payload, limit, channelQuery, channelsData, _yield$call3, mappedChannels, channelsForUpdateLastReactionMessage, channelMessageMap, _t8;
|
|
16685
|
+
var _mappedChannels5, _mappedChannels7, _mappedChannels8, payload, limit, channelQuery, channelsData, channelList, _yield$call3, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys2, _mappedChannels6, channelMessageMap, _t8;
|
|
16573
16686
|
return _regenerator().w(function (_context6) {
|
|
16574
16687
|
while (1) switch (_context6.p = _context6.n) {
|
|
16575
16688
|
case 0:
|
|
16576
|
-
|
|
16689
|
+
log.info('[channelsLoadMore] start load more channels');
|
|
16690
|
+
_context6.p = 1;
|
|
16577
16691
|
payload = action.payload;
|
|
16578
16692
|
limit = payload.limit;
|
|
16693
|
+
log.info('[channelsLoadMore] input payload:', JSON.stringify({
|
|
16694
|
+
limit: limit
|
|
16695
|
+
}));
|
|
16579
16696
|
channelQuery = query.channelQuery;
|
|
16697
|
+
log.info('[channelsLoadMore] channelQuery exists:', !!channelQuery);
|
|
16698
|
+
if (channelQuery) {
|
|
16699
|
+
_context6.n = 2;
|
|
16700
|
+
break;
|
|
16701
|
+
}
|
|
16702
|
+
log.error('[channelsLoadMore] channelQuery is null or undefined, cannot load more');
|
|
16703
|
+
return _context6.a(2);
|
|
16704
|
+
case 2:
|
|
16580
16705
|
if (limit) {
|
|
16706
|
+
log.info('[channelsLoadMore] setting query limit to:', limit);
|
|
16581
16707
|
channelQuery.limit = limit;
|
|
16708
|
+
} else {
|
|
16709
|
+
log.info('[channelsLoadMore] no limit provided, using existing query limit');
|
|
16582
16710
|
}
|
|
16583
|
-
_context6.n = 1;
|
|
16584
|
-
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16585
|
-
case 1:
|
|
16586
|
-
_context6.n = 2;
|
|
16587
|
-
return effects.call(channelQuery.loadNextPage);
|
|
16588
|
-
case 2:
|
|
16589
|
-
channelsData = _context6.v;
|
|
16590
16711
|
_context6.n = 3;
|
|
16591
|
-
return effects.put(
|
|
16712
|
+
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
16592
16713
|
case 3:
|
|
16714
|
+
log.info('[channelsLoadMore] loading next page...');
|
|
16593
16715
|
_context6.n = 4;
|
|
16594
|
-
return effects.call(
|
|
16716
|
+
return effects.call(channelQuery.loadNextPage);
|
|
16595
16717
|
case 4:
|
|
16718
|
+
channelsData = _context6.v;
|
|
16719
|
+
channelList = channelsData.channels;
|
|
16720
|
+
log.info('[channelsLoadMore] channelsData received:', JSON.stringify({
|
|
16721
|
+
channelsCount: (channelList === null || channelList === void 0 ? void 0 : channelList.length) || 0,
|
|
16722
|
+
hasNext: channelsData.hasNext
|
|
16723
|
+
}));
|
|
16724
|
+
_context6.n = 5;
|
|
16725
|
+
return effects.put(channelHasNextAC(channelsData.hasNext));
|
|
16726
|
+
case 5:
|
|
16727
|
+
log.info('[channelsLoadMore] hasNext set to:', channelsData.hasNext);
|
|
16728
|
+
_context6.n = 6;
|
|
16729
|
+
return effects.call(setChannelsInMap, channelsData.channels);
|
|
16730
|
+
case 6:
|
|
16596
16731
|
_yield$call3 = _context6.v;
|
|
16597
16732
|
mappedChannels = _yield$call3.channels;
|
|
16598
16733
|
channelsForUpdateLastReactionMessage = _yield$call3.channelsForUpdateLastReactionMessage;
|
|
16599
|
-
|
|
16600
|
-
|
|
16734
|
+
log.info('[channelsLoadMore] setChannelsInMap result:', JSON.stringify({
|
|
16735
|
+
mappedChannelsCount: ((_mappedChannels5 = mappedChannels) === null || _mappedChannels5 === void 0 ? void 0 : _mappedChannels5.length) || 0,
|
|
16736
|
+
channelsForUpdateLastReactionMessageCount: (channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length) || 0
|
|
16737
|
+
}));
|
|
16738
|
+
if (!(channelsForUpdateLastReactionMessage !== null && channelsForUpdateLastReactionMessage !== void 0 && channelsForUpdateLastReactionMessage.length)) {
|
|
16739
|
+
_context6.n = 8;
|
|
16601
16740
|
break;
|
|
16602
16741
|
}
|
|
16742
|
+
log.info('[channelsLoadMore] processing channels for reaction message update:', channelsForUpdateLastReactionMessage === null || channelsForUpdateLastReactionMessage === void 0 ? void 0 : channelsForUpdateLastReactionMessage.length);
|
|
16603
16743
|
channelMessageMap = {};
|
|
16604
|
-
_context6.n =
|
|
16744
|
+
_context6.n = 7;
|
|
16605
16745
|
return effects.call(function () {
|
|
16606
16746
|
try {
|
|
16607
16747
|
return Promise.resolve(Promise.all(channelsForUpdateLastReactionMessage.map(function (channel) {
|
|
@@ -16609,9 +16749,10 @@ function channelsLoadMore(action) {
|
|
|
16609
16749
|
return Promise.resolve(new Promise(function (resolve) {
|
|
16610
16750
|
channel.getMessagesById([channel.newReactions[0].messageId]).then(function (messages) {
|
|
16611
16751
|
channelMessageMap[channel.id] = messages[0];
|
|
16752
|
+
log.info('[channelsLoadMore] successfully fetched reaction message for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16612
16753
|
resolve(true);
|
|
16613
16754
|
})["catch"](function (e) {
|
|
16614
|
-
log.error(e, 'Error on getMessagesById');
|
|
16755
|
+
log.error(e, 'Error on getMessagesById for channel:', channel === null || channel === void 0 ? void 0 : channel.id);
|
|
16615
16756
|
resolve(true);
|
|
16616
16757
|
});
|
|
16617
16758
|
}));
|
|
@@ -16623,30 +16764,43 @@ function channelsLoadMore(action) {
|
|
|
16623
16764
|
return Promise.reject(e);
|
|
16624
16765
|
}
|
|
16625
16766
|
});
|
|
16626
|
-
case
|
|
16767
|
+
case 7:
|
|
16768
|
+
log.info('[channelsLoadMore] reaction messages fetched:', channelMessageMap ? (_Object$keys2 = Object.keys(channelMessageMap)) === null || _Object$keys2 === void 0 ? void 0 : _Object$keys2.length : 0);
|
|
16627
16769
|
mappedChannels = mappedChannels.map(function (channel) {
|
|
16628
16770
|
if (channelMessageMap[channel.id]) {
|
|
16629
16771
|
channel.lastReactedMessage = channelMessageMap[channel.id];
|
|
16630
16772
|
}
|
|
16631
16773
|
return channel;
|
|
16632
16774
|
});
|
|
16633
|
-
|
|
16634
|
-
_context6.n =
|
|
16635
|
-
|
|
16636
|
-
case 7:
|
|
16637
|
-
_context6.n = 8;
|
|
16638
|
-
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
|
|
16775
|
+
log.info('[channelsLoadMore] mappedChannels updated with reaction messages, final count:', ((_mappedChannels6 = mappedChannels) === null || _mappedChannels6 === void 0 ? void 0 : _mappedChannels6.length) || 0);
|
|
16776
|
+
_context6.n = 9;
|
|
16777
|
+
break;
|
|
16639
16778
|
case 8:
|
|
16779
|
+
log.info('[channelsLoadMore] no channels need reaction message update');
|
|
16780
|
+
case 9:
|
|
16781
|
+
log.info('[channelsLoadMore] adding channels to state, count:', ((_mappedChannels7 = mappedChannels) === null || _mappedChannels7 === void 0 ? void 0 : _mappedChannels7.length) || 0);
|
|
16640
16782
|
_context6.n = 10;
|
|
16783
|
+
return effects.put(addChannelsAC(mappedChannels));
|
|
16784
|
+
case 10:
|
|
16785
|
+
_context6.n = 11;
|
|
16786
|
+
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
|
|
16787
|
+
case 11:
|
|
16788
|
+
log.info('[channelsLoadMore] completed successfully. Total channels added:', ((_mappedChannels8 = mappedChannels) === null || _mappedChannels8 === void 0 ? void 0 : _mappedChannels8.length) || 0);
|
|
16789
|
+
_context6.n = 13;
|
|
16641
16790
|
break;
|
|
16642
|
-
case
|
|
16643
|
-
_context6.p =
|
|
16791
|
+
case 12:
|
|
16792
|
+
_context6.p = 12;
|
|
16644
16793
|
_t8 = _context6.v;
|
|
16645
|
-
log.error(
|
|
16646
|
-
|
|
16794
|
+
log.error('[channelsLoadMore] error occurred:', _t8);
|
|
16795
|
+
log.error('[channelsLoadMore] error details:', JSON.stringify({
|
|
16796
|
+
message: _t8 === null || _t8 === void 0 ? void 0 : _t8.message,
|
|
16797
|
+
code: _t8 === null || _t8 === void 0 ? void 0 : _t8.code,
|
|
16798
|
+
stack: _t8 === null || _t8 === void 0 ? void 0 : _t8.stack
|
|
16799
|
+
}));
|
|
16800
|
+
case 13:
|
|
16647
16801
|
return _context6.a(2);
|
|
16648
16802
|
}
|
|
16649
|
-
}, _marked6, null, [[
|
|
16803
|
+
}, _marked6, null, [[1, 12]]);
|
|
16650
16804
|
}
|
|
16651
16805
|
function getChannelMentions(action) {
|
|
16652
16806
|
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
|
|
@@ -17358,7 +17512,7 @@ function blockChannel(action) {
|
|
|
17358
17512
|
}, _marked20, null, [[0, 5]]);
|
|
17359
17513
|
}
|
|
17360
17514
|
function updateChannel(action) {
|
|
17361
|
-
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t22;
|
|
17515
|
+
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, onUpdateChannel, _channel3, _channel4, _channel5, fields, updatedChannel, _t22;
|
|
17362
17516
|
return _regenerator().w(function (_context21) {
|
|
17363
17517
|
while (1) switch (_context21.p = _context21.n) {
|
|
17364
17518
|
case 0:
|
|
@@ -17422,16 +17576,37 @@ function updateChannel(action) {
|
|
|
17422
17576
|
avatarUrl: avatarUrl,
|
|
17423
17577
|
metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
|
|
17424
17578
|
});
|
|
17425
|
-
|
|
17426
|
-
|
|
17579
|
+
onUpdateChannel = getOnUpdateChannel();
|
|
17580
|
+
if (!onUpdateChannel) {
|
|
17581
|
+
_context21.n = 7;
|
|
17582
|
+
break;
|
|
17583
|
+
}
|
|
17584
|
+
fields = [];
|
|
17585
|
+
if (((_channel3 = channel) === null || _channel3 === void 0 ? void 0 : _channel3.subject) !== subject) {
|
|
17586
|
+
fields.push('subject');
|
|
17587
|
+
}
|
|
17588
|
+
if (((_channel4 = channel) === null || _channel4 === void 0 ? void 0 : _channel4.avatarUrl) !== avatarUrl) {
|
|
17589
|
+
fields.push('avatarUrl');
|
|
17590
|
+
}
|
|
17591
|
+
if (JSON.stringify((_channel5 = channel) === null || _channel5 === void 0 ? void 0 : _channel5.metadata) !== metadata) {
|
|
17592
|
+
fields.push('metadata');
|
|
17593
|
+
}
|
|
17594
|
+
_context21.n = 6;
|
|
17595
|
+
return effects.call(getChannelFromMap, channelId);
|
|
17427
17596
|
case 6:
|
|
17428
|
-
|
|
17597
|
+
updatedChannel = _context21.v;
|
|
17598
|
+
onUpdateChannel(updatedChannel, fields);
|
|
17599
|
+
case 7:
|
|
17600
|
+
_context21.n = 9;
|
|
17601
|
+
break;
|
|
17602
|
+
case 8:
|
|
17603
|
+
_context21.p = 8;
|
|
17429
17604
|
_t22 = _context21.v;
|
|
17430
17605
|
log.error('ERROR in update channel', _t22.message);
|
|
17431
|
-
case
|
|
17606
|
+
case 9:
|
|
17432
17607
|
return _context21.a(2);
|
|
17433
17608
|
}
|
|
17434
|
-
}, _marked21, null, [[0,
|
|
17609
|
+
}, _marked21, null, [[0, 8]]);
|
|
17435
17610
|
}
|
|
17436
17611
|
function checkUsersStatus() {
|
|
17437
17612
|
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t23;
|
|
@@ -18672,7 +18847,9 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
18672
18847
|
addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
18673
18848
|
}
|
|
18674
18849
|
setPendingMessage(channel.id, messageToAdd);
|
|
18675
|
-
|
|
18850
|
+
if (!(messageToAdd !== null && messageToAdd !== void 0 && messageToAdd.forwardingDetails)) {
|
|
18851
|
+
store.dispatch(scrollToNewMessageAC(true));
|
|
18852
|
+
}
|
|
18676
18853
|
if (activeChannelId === channel.id) {
|
|
18677
18854
|
store.dispatch(addMessageAC(messageToAdd));
|
|
18678
18855
|
}
|
|
@@ -18681,23 +18858,14 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
18681
18858
|
return Promise.reject(e);
|
|
18682
18859
|
}
|
|
18683
18860
|
};
|
|
18684
|
-
var updatePendingMessage$1 = function updatePendingMessage(message, channel, updatedMessage) {
|
|
18685
|
-
var messageToUpdate = _extends({}, message, updatedMessage);
|
|
18686
|
-
updateMessageOnMap(channel.id, {
|
|
18687
|
-
messageId: message.tid,
|
|
18688
|
-
params: messageToUpdate
|
|
18689
|
-
});
|
|
18690
|
-
updateMessageOnAllMessages(message.tid, messageToUpdate);
|
|
18691
|
-
updatePendingMessageOnMap(channel.id, message.tid, messageToUpdate);
|
|
18692
|
-
store.dispatch(updateMessageAC(message.tid, messageToUpdate, false));
|
|
18693
|
-
};
|
|
18694
18861
|
function sendMessage(action) {
|
|
18695
|
-
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap, channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop, i, messageBuilder, messageToSend, messageCopy, _loop2, _i, _t2;
|
|
18862
|
+
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap, pendingMessages, channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop, i, messageBuilder, messageToSend, messageCopy, _loop2, _i, _t2;
|
|
18696
18863
|
return _regenerator().w(function (_context3) {
|
|
18697
18864
|
while (1) switch (_context3.p = _context3.n) {
|
|
18698
18865
|
case 0:
|
|
18699
18866
|
payload = action.payload;
|
|
18700
18867
|
message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId, sendAttachmentsAsSeparateMessage = payload.sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
|
|
18868
|
+
pendingMessages = [];
|
|
18701
18869
|
_context3.p = 1;
|
|
18702
18870
|
_context3.n = 2;
|
|
18703
18871
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
@@ -18741,7 +18909,7 @@ function sendMessage(action) {
|
|
|
18741
18909
|
}) : [];
|
|
18742
18910
|
customUploader = getCustomUploader();
|
|
18743
18911
|
if (!(message.attachments && message.attachments.length)) {
|
|
18744
|
-
_context3.n =
|
|
18912
|
+
_context3.n = 14;
|
|
18745
18913
|
break;
|
|
18746
18914
|
}
|
|
18747
18915
|
linkAttachment = null;
|
|
@@ -18754,11 +18922,11 @@ function sendMessage(action) {
|
|
|
18754
18922
|
return att.type !== attachmentTypes.link;
|
|
18755
18923
|
});
|
|
18756
18924
|
if (!(mediaAttachments && mediaAttachments.length)) {
|
|
18757
|
-
_context3.n =
|
|
18925
|
+
_context3.n = 11;
|
|
18758
18926
|
break;
|
|
18759
18927
|
}
|
|
18760
18928
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
18761
|
-
var attachment, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, messageForSend
|
|
18929
|
+
var attachment, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, messageForSend;
|
|
18762
18930
|
return _regenerator().w(function (_context) {
|
|
18763
18931
|
while (1) switch (_context.n) {
|
|
18764
18932
|
case 0:
|
|
@@ -18804,55 +18972,37 @@ function sendMessage(action) {
|
|
|
18804
18972
|
if (customUploader) {
|
|
18805
18973
|
messageAttachment.url = attachment.data;
|
|
18806
18974
|
}
|
|
18807
|
-
if (
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
_context.n = 2;
|
|
18831
|
-
break;
|
|
18975
|
+
if (sendAttachmentsAsSeparateMessage) {
|
|
18976
|
+
_messageBuilder = channel.createMessageBuilder();
|
|
18977
|
+
_messageBuilder.setBody(i === 0 ? message.body : '').setAttachments([]).setBodyAttributes(i === 0 ? message.bodyAttributes : {}).setMentionUserIds(i === 0 ? mentionedUserIds : []).setType(message.type).setDisplayCount(message.type === exports.MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === exports.MESSAGE_TYPE.SYSTEM).setMetadata(i === 0 ? JSON.stringify(message.metadata) : '');
|
|
18978
|
+
if (message.parentMessage) {
|
|
18979
|
+
_messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
|
|
18980
|
+
}
|
|
18981
|
+
if (message.repliedInThread) {
|
|
18982
|
+
_messageBuilder.setReplyInThread();
|
|
18983
|
+
}
|
|
18984
|
+
_messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : _messageBuilder.create();
|
|
18985
|
+
setPendingAttachment(messageAttachment.tid, _extends({}, messageAttachment.data, {
|
|
18986
|
+
messageTid: _messageToSend.tid,
|
|
18987
|
+
channelId: channel.id
|
|
18988
|
+
}));
|
|
18989
|
+
messageForSend = _extends({}, _messageToSend, {
|
|
18990
|
+
attachments: [messageAttachment]
|
|
18991
|
+
});
|
|
18992
|
+
messagesToSend.push(messageForSend);
|
|
18993
|
+
pendingMessages.push(_extends({}, messageForSend, {
|
|
18994
|
+
attachments: [attachment]
|
|
18995
|
+
}));
|
|
18996
|
+
} else {
|
|
18997
|
+
attachmentsToSend.push(messageAttachment);
|
|
18832
18998
|
}
|
|
18833
|
-
_context.n = 1;
|
|
18834
|
-
return effects.call(addPendingMessage, message, _extends({}, messageForSendCopy, {
|
|
18835
|
-
attachments: [attachment]
|
|
18836
|
-
}), channel);
|
|
18837
|
-
case 1:
|
|
18838
|
-
_context.n = 3;
|
|
18839
|
-
break;
|
|
18840
|
-
case 2:
|
|
18841
|
-
_context.n = 3;
|
|
18842
|
-
return effects.call(updatePendingMessage$1, message, channel, messageForSendCopy);
|
|
18843
|
-
case 3:
|
|
18844
|
-
_context.n = 5;
|
|
18845
|
-
break;
|
|
18846
|
-
case 4:
|
|
18847
|
-
attachmentsToSend.push(messageAttachment);
|
|
18848
|
-
case 5:
|
|
18849
18999
|
if (!(!messageAttachment.cachedUrl && customUploader)) {
|
|
18850
|
-
_context.n =
|
|
19000
|
+
_context.n = 1;
|
|
18851
19001
|
break;
|
|
18852
19002
|
}
|
|
18853
|
-
_context.n =
|
|
19003
|
+
_context.n = 1;
|
|
18854
19004
|
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, messageAttachment.tid));
|
|
18855
|
-
case
|
|
19005
|
+
case 1:
|
|
18856
19006
|
return _context.a(2);
|
|
18857
19007
|
}
|
|
18858
19008
|
}, _callee);
|
|
@@ -18869,68 +19019,28 @@ function sendMessage(action) {
|
|
|
18869
19019
|
_context3.n = 8;
|
|
18870
19020
|
break;
|
|
18871
19021
|
case 10:
|
|
18872
|
-
if (sendAttachmentsAsSeparateMessage) {
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
if (sendAttachmentsAsSeparateMessage) {
|
|
18891
|
-
_context3.n = 13;
|
|
18892
|
-
break;
|
|
18893
|
-
}
|
|
18894
|
-
if (!isAddToPendingMessagesMap) {
|
|
18895
|
-
_context3.n = 12;
|
|
18896
|
-
break;
|
|
19022
|
+
if (!sendAttachmentsAsSeparateMessage) {
|
|
19023
|
+
messageBuilder = channel.createMessageBuilder();
|
|
19024
|
+
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(message.attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === exports.MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === exports.MESSAGE_TYPE.SYSTEM).setMetadata(JSON.stringify(message.metadata));
|
|
19025
|
+
if (message.parentMessage) {
|
|
19026
|
+
messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
|
|
19027
|
+
}
|
|
19028
|
+
if (message.repliedInThread) {
|
|
19029
|
+
messageBuilder.setReplyInThread();
|
|
19030
|
+
}
|
|
19031
|
+
messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
|
|
19032
|
+
messageCopy = messageToSend;
|
|
19033
|
+
pendingMessages.push(_extends({}, messageCopy, {
|
|
19034
|
+
attachments: message.attachments
|
|
19035
|
+
}));
|
|
19036
|
+
messageToSend = _extends({}, messageToSend, {
|
|
19037
|
+
attachments: attachmentsToSend
|
|
19038
|
+
});
|
|
19039
|
+
messagesToSend.push(messageToSend);
|
|
18897
19040
|
}
|
|
18898
|
-
_context3.n = 11;
|
|
18899
|
-
return effects.call(addPendingMessage, message, _extends({}, messageCopy, {
|
|
18900
|
-
attachments: message.attachments
|
|
18901
|
-
}), channel);
|
|
18902
19041
|
case 11:
|
|
18903
|
-
_context3.n = 13;
|
|
18904
|
-
break;
|
|
18905
|
-
case 12:
|
|
18906
|
-
updatePendingMessage$1(message, channel, messageCopy);
|
|
18907
|
-
case 13:
|
|
18908
|
-
_context3.n = 17;
|
|
18909
|
-
break;
|
|
18910
|
-
case 14:
|
|
18911
|
-
if (!isAddToPendingMessagesMap) {
|
|
18912
|
-
_context3.n = 16;
|
|
18913
|
-
break;
|
|
18914
|
-
}
|
|
18915
|
-
_context3.n = 15;
|
|
18916
|
-
return effects.call(addPendingMessage, message, messageCopy, channel);
|
|
18917
|
-
case 15:
|
|
18918
|
-
_context3.n = 17;
|
|
18919
|
-
break;
|
|
18920
|
-
case 16:
|
|
18921
|
-
updatePendingMessage$1(message, channel, messageCopy);
|
|
18922
|
-
case 17:
|
|
18923
|
-
messageToSend.attachments = attachmentsToSend;
|
|
18924
|
-
messagesToSend.push(messageToSend);
|
|
18925
|
-
case 18:
|
|
18926
|
-
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
18927
|
-
_context3.n = 19;
|
|
18928
|
-
break;
|
|
18929
|
-
}
|
|
18930
|
-
throw new Error('Connection is required to send message');
|
|
18931
|
-
case 19:
|
|
18932
19042
|
_loop2 = /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
18933
|
-
var messageAttachment, messageToSend, _messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, _t;
|
|
19043
|
+
var messageAttachment, messageToSend, _messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, _t;
|
|
18934
19044
|
return _regenerator().w(function (_context2) {
|
|
18935
19045
|
while (1) switch (_context2.p = _context2.n) {
|
|
18936
19046
|
case 0:
|
|
@@ -18938,6 +19048,7 @@ function sendMessage(action) {
|
|
|
18938
19048
|
messageToSend = messagesToSend[_i];
|
|
18939
19049
|
_context2.p = 1;
|
|
18940
19050
|
_messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i]));
|
|
19051
|
+
store.dispatch(scrollToNewMessageAC(true));
|
|
18941
19052
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
18942
19053
|
_context2.n = 12;
|
|
18943
19054
|
break;
|
|
@@ -18996,12 +19107,7 @@ function sendMessage(action) {
|
|
|
18996
19107
|
_context2.n = 5;
|
|
18997
19108
|
break;
|
|
18998
19109
|
case 8:
|
|
18999
|
-
|
|
19000
|
-
message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
|
|
19001
|
-
message.id && store.dispatch(removePendingMessageAC(channel.id, message.id));
|
|
19002
|
-
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19003
|
-
messageToSend.id && store.dispatch(removePendingMessageAC(channel.id, messageToSend.id));
|
|
19004
|
-
}
|
|
19110
|
+
message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
|
|
19005
19111
|
attachmentsToUpdate = [];
|
|
19006
19112
|
if (messageResponse.attachments && messageResponse.attachments.length > 0) {
|
|
19007
19113
|
currentAttachmentsMap = {};
|
|
@@ -19064,19 +19170,33 @@ function sendMessage(action) {
|
|
|
19064
19170
|
case 12:
|
|
19065
19171
|
throw new Error('Connection required to send message');
|
|
19066
19172
|
case 13:
|
|
19067
|
-
_context2.n =
|
|
19173
|
+
_context2.n = 17;
|
|
19068
19174
|
break;
|
|
19069
19175
|
case 14:
|
|
19070
19176
|
_context2.p = 14;
|
|
19071
19177
|
_t = _context2.v;
|
|
19072
|
-
|
|
19073
|
-
|
|
19178
|
+
pendingMessage = pendingMessages === null || pendingMessages === void 0 ? void 0 : pendingMessages.find(function (pendingMessage) {
|
|
19179
|
+
return pendingMessage.tid === messageToSend.tid;
|
|
19180
|
+
});
|
|
19181
|
+
if (!(channel && pendingMessage && action.type !== RESEND_MESSAGE)) {
|
|
19182
|
+
_context2.n = 15;
|
|
19183
|
+
break;
|
|
19184
|
+
}
|
|
19185
|
+
if (!isAddToPendingMessagesMap) {
|
|
19074
19186
|
_context2.n = 15;
|
|
19075
19187
|
break;
|
|
19076
19188
|
}
|
|
19077
19189
|
_context2.n = 15;
|
|
19078
|
-
return effects.
|
|
19190
|
+
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19079
19191
|
case 15:
|
|
19192
|
+
log.error('Error on uploading attachment', messageToSend.tid, _t);
|
|
19193
|
+
if (!(messageToSend.attachments && messageToSend.attachments.length)) {
|
|
19194
|
+
_context2.n = 16;
|
|
19195
|
+
break;
|
|
19196
|
+
}
|
|
19197
|
+
_context2.n = 16;
|
|
19198
|
+
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, messageToSend.attachments[0].tid));
|
|
19199
|
+
case 16:
|
|
19080
19200
|
updateMessageOnMap(channel.id, {
|
|
19081
19201
|
messageId: messageToSend.tid,
|
|
19082
19202
|
params: {
|
|
@@ -19086,40 +19206,40 @@ function sendMessage(action) {
|
|
|
19086
19206
|
updateMessageOnAllMessages(messageToSend.tid, {
|
|
19087
19207
|
state: MESSAGE_STATUS.FAILED
|
|
19088
19208
|
});
|
|
19089
|
-
_context2.n =
|
|
19209
|
+
_context2.n = 17;
|
|
19090
19210
|
return effects.put(updateMessageAC(messageToSend.tid, {
|
|
19091
19211
|
state: MESSAGE_STATUS.FAILED
|
|
19092
19212
|
}));
|
|
19093
|
-
case
|
|
19213
|
+
case 17:
|
|
19094
19214
|
return _context2.a(2);
|
|
19095
19215
|
}
|
|
19096
19216
|
}, _callee2, null, [[1, 14]]);
|
|
19097
19217
|
});
|
|
19098
19218
|
_i = 0;
|
|
19099
|
-
case
|
|
19219
|
+
case 12:
|
|
19100
19220
|
if (!(_i < messagesToSend.length)) {
|
|
19101
|
-
_context3.n =
|
|
19221
|
+
_context3.n = 14;
|
|
19102
19222
|
break;
|
|
19103
19223
|
}
|
|
19104
|
-
return _context3.d(_regeneratorValues(_loop2()),
|
|
19105
|
-
case
|
|
19224
|
+
return _context3.d(_regeneratorValues(_loop2()), 13);
|
|
19225
|
+
case 13:
|
|
19106
19226
|
_i++;
|
|
19107
|
-
_context3.n =
|
|
19227
|
+
_context3.n = 12;
|
|
19108
19228
|
break;
|
|
19109
|
-
case
|
|
19110
|
-
_context3.n =
|
|
19229
|
+
case 14:
|
|
19230
|
+
_context3.n = 16;
|
|
19111
19231
|
break;
|
|
19112
|
-
case
|
|
19113
|
-
_context3.p =
|
|
19232
|
+
case 15:
|
|
19233
|
+
_context3.p = 15;
|
|
19114
19234
|
_t2 = _context3.v;
|
|
19115
19235
|
log.error('error on send message ... ', _t2);
|
|
19116
|
-
case
|
|
19236
|
+
case 16:
|
|
19117
19237
|
return _context3.a(2);
|
|
19118
19238
|
}
|
|
19119
|
-
}, _marked$3, null, [[1,
|
|
19239
|
+
}, _marked$3, null, [[1, 15]]);
|
|
19120
19240
|
}
|
|
19121
19241
|
function sendTextMessage(action) {
|
|
19122
|
-
var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend,
|
|
19242
|
+
var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
|
|
19123
19243
|
return _regenerator().w(function (_context4) {
|
|
19124
19244
|
while (1) switch (_context4.p = _context4.n) {
|
|
19125
19245
|
case 0:
|
|
@@ -19138,6 +19258,7 @@ function sendTextMessage(action) {
|
|
|
19138
19258
|
setChannelInMap(channel);
|
|
19139
19259
|
}
|
|
19140
19260
|
}
|
|
19261
|
+
pendingMessage = null;
|
|
19141
19262
|
activeChannelId = getActiveChannelId();
|
|
19142
19263
|
_context4.p = 3;
|
|
19143
19264
|
if (!channel.isMockChannel) {
|
|
@@ -19181,52 +19302,38 @@ function sendTextMessage(action) {
|
|
|
19181
19302
|
if (message.repliedInThread) {
|
|
19182
19303
|
messageBuilder.setReplyInThread();
|
|
19183
19304
|
}
|
|
19184
|
-
messageToSend = messageBuilder.create();
|
|
19305
|
+
messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
|
|
19185
19306
|
pendingMessage = JSON.parse(JSON.stringify(_extends({}, messageToSend, {
|
|
19307
|
+
attachments: message === null || message === void 0 ? void 0 : message.attachments,
|
|
19186
19308
|
createdAt: new Date(Date.now()),
|
|
19187
19309
|
mentionedUsers: message.mentionedUsers,
|
|
19188
19310
|
parentMessage: message.parentMessage
|
|
19189
19311
|
})));
|
|
19190
19312
|
sendMessageTid = messageToSend.tid;
|
|
19191
|
-
if (pendingMessage.metadata) {
|
|
19313
|
+
if (pendingMessage && pendingMessage.metadata) {
|
|
19192
19314
|
pendingMessage.metadata = JSON.parse(pendingMessage.metadata);
|
|
19193
19315
|
}
|
|
19194
|
-
|
|
19195
|
-
_context4.n = 10;
|
|
19196
|
-
break;
|
|
19197
|
-
}
|
|
19198
|
-
if (!isAddToPendingMessagesMap) {
|
|
19199
|
-
_context4.n = 9;
|
|
19200
|
-
break;
|
|
19201
|
-
}
|
|
19202
|
-
_context4.n = 8;
|
|
19203
|
-
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19204
|
-
case 8:
|
|
19205
|
-
_context4.n = 10;
|
|
19206
|
-
break;
|
|
19207
|
-
case 9:
|
|
19208
|
-
updatePendingMessage$1(message, channel, pendingMessage);
|
|
19209
|
-
case 10:
|
|
19316
|
+
store.dispatch(scrollToNewMessageAC(true));
|
|
19210
19317
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19211
|
-
_context4.n =
|
|
19318
|
+
_context4.n = 15;
|
|
19212
19319
|
break;
|
|
19213
19320
|
}
|
|
19214
19321
|
if (!sendMessageHandler) {
|
|
19215
|
-
_context4.n =
|
|
19322
|
+
_context4.n = 9;
|
|
19216
19323
|
break;
|
|
19217
19324
|
}
|
|
19218
|
-
_context4.n =
|
|
19325
|
+
_context4.n = 8;
|
|
19219
19326
|
return effects.call(sendMessageHandler, messageToSend, channel.id);
|
|
19220
|
-
case
|
|
19327
|
+
case 8:
|
|
19221
19328
|
messageResponse = _context4.v;
|
|
19222
|
-
_context4.n =
|
|
19329
|
+
_context4.n = 11;
|
|
19223
19330
|
break;
|
|
19224
|
-
case
|
|
19225
|
-
_context4.n =
|
|
19331
|
+
case 9:
|
|
19332
|
+
_context4.n = 10;
|
|
19226
19333
|
return effects.call(channel.sendMessage, messageToSend);
|
|
19227
|
-
case
|
|
19334
|
+
case 10:
|
|
19228
19335
|
messageResponse = _context4.v;
|
|
19229
|
-
case
|
|
19336
|
+
case 11:
|
|
19230
19337
|
messageUpdateData = {
|
|
19231
19338
|
id: messageResponse.id,
|
|
19232
19339
|
body: messageResponse.body,
|
|
@@ -19245,12 +19352,12 @@ function sendTextMessage(action) {
|
|
|
19245
19352
|
channelId: channel.id
|
|
19246
19353
|
};
|
|
19247
19354
|
if (!(activeChannelId === channel.id)) {
|
|
19248
|
-
_context4.n =
|
|
19355
|
+
_context4.n = 12;
|
|
19249
19356
|
break;
|
|
19250
19357
|
}
|
|
19251
|
-
_context4.n =
|
|
19358
|
+
_context4.n = 12;
|
|
19252
19359
|
return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData));
|
|
19253
|
-
case
|
|
19360
|
+
case 12:
|
|
19254
19361
|
updateMessageOnMap(channel.id, {
|
|
19255
19362
|
messageId: !isAddToPendingMessagesMap ? message.tid : messageToSend.tid,
|
|
19256
19363
|
params: messageUpdateData
|
|
@@ -19264,17 +19371,17 @@ function sendTextMessage(action) {
|
|
|
19264
19371
|
lastMessage: messageToUpdate,
|
|
19265
19372
|
lastReactedMessage: null
|
|
19266
19373
|
};
|
|
19267
|
-
_context4.n =
|
|
19374
|
+
_context4.n = 13;
|
|
19268
19375
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19269
|
-
case
|
|
19376
|
+
case 13:
|
|
19270
19377
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19271
19378
|
if (!channel.unread) {
|
|
19272
|
-
_context4.n =
|
|
19379
|
+
_context4.n = 14;
|
|
19273
19380
|
break;
|
|
19274
19381
|
}
|
|
19275
|
-
_context4.n =
|
|
19382
|
+
_context4.n = 14;
|
|
19276
19383
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19277
|
-
case
|
|
19384
|
+
case 14:
|
|
19278
19385
|
channel.lastMessage = messageToUpdate;
|
|
19279
19386
|
if (!isAddToPendingMessagesMap) {
|
|
19280
19387
|
message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
|
|
@@ -19282,19 +19389,30 @@ function sendTextMessage(action) {
|
|
|
19282
19389
|
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19283
19390
|
messageToSend.id && store.dispatch(removePendingMessageAC(channel.id, messageToSend.id));
|
|
19284
19391
|
}
|
|
19285
|
-
_context4.n =
|
|
19392
|
+
_context4.n = 16;
|
|
19286
19393
|
break;
|
|
19287
|
-
case
|
|
19394
|
+
case 15:
|
|
19288
19395
|
throw new Error('Connection required to send message');
|
|
19289
|
-
case
|
|
19290
|
-
_context4.n =
|
|
19396
|
+
case 16:
|
|
19397
|
+
_context4.n = 17;
|
|
19291
19398
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19292
|
-
case
|
|
19293
|
-
_context4.n =
|
|
19399
|
+
case 17:
|
|
19400
|
+
_context4.n = 21;
|
|
19294
19401
|
break;
|
|
19295
|
-
case
|
|
19296
|
-
_context4.p =
|
|
19402
|
+
case 18:
|
|
19403
|
+
_context4.p = 18;
|
|
19297
19404
|
_t3 = _context4.v;
|
|
19405
|
+
if (!(activeChannelId === channel.id && pendingMessage && action.type !== RESEND_MESSAGE)) {
|
|
19406
|
+
_context4.n = 19;
|
|
19407
|
+
break;
|
|
19408
|
+
}
|
|
19409
|
+
if (!isAddToPendingMessagesMap) {
|
|
19410
|
+
_context4.n = 19;
|
|
19411
|
+
break;
|
|
19412
|
+
}
|
|
19413
|
+
_context4.n = 19;
|
|
19414
|
+
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19415
|
+
case 19:
|
|
19298
19416
|
log.error('error on send text message ... ', _t3);
|
|
19299
19417
|
updateMessageOnMap(channel.id, {
|
|
19300
19418
|
messageId: sendMessageTid,
|
|
@@ -19303,61 +19421,68 @@ function sendTextMessage(action) {
|
|
|
19303
19421
|
}
|
|
19304
19422
|
});
|
|
19305
19423
|
if (!(activeChannelId === channel.id)) {
|
|
19306
|
-
_context4.n =
|
|
19424
|
+
_context4.n = 20;
|
|
19307
19425
|
break;
|
|
19308
19426
|
}
|
|
19309
19427
|
updateMessageOnAllMessages(sendMessageTid, {
|
|
19310
19428
|
state: MESSAGE_STATUS.FAILED
|
|
19311
19429
|
});
|
|
19312
|
-
_context4.n =
|
|
19430
|
+
_context4.n = 20;
|
|
19313
19431
|
return effects.put(updateMessageAC(sendMessageTid, {
|
|
19314
19432
|
state: MESSAGE_STATUS.FAILED
|
|
19315
19433
|
}));
|
|
19316
|
-
case
|
|
19317
|
-
_context4.n =
|
|
19434
|
+
case 20:
|
|
19435
|
+
_context4.n = 21;
|
|
19318
19436
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19319
|
-
case
|
|
19437
|
+
case 21:
|
|
19320
19438
|
return _context4.a(2);
|
|
19321
19439
|
}
|
|
19322
|
-
}, _marked2$2, null, [[3,
|
|
19440
|
+
}, _marked2$2, null, [[3, 18]]);
|
|
19323
19441
|
}
|
|
19324
19442
|
function forwardMessage(action) {
|
|
19325
|
-
var payload, message, channelId, connectionState, isForward, isAddToPendingMessagesMap, channel, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend,
|
|
19443
|
+
var payload, message, channelId, connectionState, isForward, isAddToPendingMessagesMap, pendingMessage, channel, activeChannelId, messageTid, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t4;
|
|
19326
19444
|
return _regenerator().w(function (_context5) {
|
|
19327
19445
|
while (1) switch (_context5.p = _context5.n) {
|
|
19328
19446
|
case 0:
|
|
19329
|
-
_context5.p = 0;
|
|
19330
19447
|
payload = action.payload;
|
|
19331
19448
|
message = payload.message, channelId = payload.channelId, connectionState = payload.connectionState, isForward = payload.isForward, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19449
|
+
pendingMessage = null;
|
|
19450
|
+
channel = null;
|
|
19451
|
+
activeChannelId = getActiveChannelId();
|
|
19452
|
+
messageTid = null;
|
|
19453
|
+
_context5.p = 1;
|
|
19335
19454
|
_context5.n = 2;
|
|
19336
|
-
return effects.
|
|
19455
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19337
19456
|
case 2:
|
|
19457
|
+
_context5.n = 3;
|
|
19458
|
+
return effects.call(getChannelFromMap, channelId);
|
|
19459
|
+
case 3:
|
|
19338
19460
|
channel = _context5.v;
|
|
19339
19461
|
if (channel) {
|
|
19340
|
-
_context5.n =
|
|
19462
|
+
_context5.n = 6;
|
|
19341
19463
|
break;
|
|
19342
19464
|
}
|
|
19343
|
-
channel = getChannelFromAllChannels(channelId);
|
|
19465
|
+
channel = getChannelFromAllChannels(channelId) || null;
|
|
19344
19466
|
if (channel) {
|
|
19345
|
-
_context5.n =
|
|
19467
|
+
_context5.n = 5;
|
|
19346
19468
|
break;
|
|
19347
19469
|
}
|
|
19348
19470
|
SceytChatClient = getClient();
|
|
19349
|
-
_context5.n =
|
|
19471
|
+
_context5.n = 4;
|
|
19350
19472
|
return effects.call(SceytChatClient.getChannel, channelId);
|
|
19351
|
-
case 3:
|
|
19352
|
-
channel = _context5.v;
|
|
19353
19473
|
case 4:
|
|
19474
|
+
channel = _context5.v;
|
|
19475
|
+
case 5:
|
|
19354
19476
|
if (channel) {
|
|
19355
19477
|
setChannelInMap(channel);
|
|
19356
19478
|
}
|
|
19357
|
-
case 5:
|
|
19358
|
-
_context5.n = 6;
|
|
19359
|
-
return effects.put(addChannelAC(JSON.parse(JSON.stringify(channel))));
|
|
19360
19479
|
case 6:
|
|
19480
|
+
if (channel) {
|
|
19481
|
+
_context5.n = 7;
|
|
19482
|
+
break;
|
|
19483
|
+
}
|
|
19484
|
+
throw new Error('Channel not found');
|
|
19485
|
+
case 7:
|
|
19361
19486
|
mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
|
|
19362
19487
|
return member.id;
|
|
19363
19488
|
}) : [];
|
|
@@ -19389,12 +19514,14 @@ function forwardMessage(action) {
|
|
|
19389
19514
|
allowVoteRetract: message.pollDetails.allowVoteRetract
|
|
19390
19515
|
};
|
|
19391
19516
|
}
|
|
19392
|
-
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisableMentionsCount(getDisableFrowardMentionsCount()).setMetadata(message.metadata ? JSON.stringify(message.metadata) : '').setForwardingMessageId(message.forwardingDetails ? message.forwardingDetails.messageId : message.id).setPollDetails(pollDetails);
|
|
19517
|
+
messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisableMentionsCount(getDisableFrowardMentionsCount()).setMetadata(message.metadata ? isJSON(message.metadata) ? message.metadata : JSON.stringify(message.metadata) : '').setForwardingMessageId(message.forwardingDetails ? message.forwardingDetails.messageId : message.id).setPollDetails(pollDetails);
|
|
19393
19518
|
messageToSend = messageBuilder.create();
|
|
19519
|
+
messageToSend.tid = action.type === RESEND_MESSAGE ? action.payload.message.tid : messageToSend.tid;
|
|
19520
|
+
messageTid = messageToSend.tid;
|
|
19394
19521
|
pendingMessage = _extends({}, messageToSend, {
|
|
19395
19522
|
createdAt: new Date(Date.now())
|
|
19396
19523
|
});
|
|
19397
|
-
if (isForward) {
|
|
19524
|
+
if (isForward && pendingMessage && action.type !== RESEND_MESSAGE) {
|
|
19398
19525
|
if (message.forwardingDetails) {
|
|
19399
19526
|
pendingMessage.forwardingDetails.user = message.forwardingDetails.user;
|
|
19400
19527
|
pendingMessage.forwardingDetails.channelId = message.forwardingDetails.channelId;
|
|
@@ -19404,43 +19531,29 @@ function forwardMessage(action) {
|
|
|
19404
19531
|
}
|
|
19405
19532
|
pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
|
|
19406
19533
|
}
|
|
19407
|
-
activeChannelId = getActiveChannelId();
|
|
19408
19534
|
if (!(channelId === activeChannelId)) {
|
|
19409
|
-
_context5.n =
|
|
19535
|
+
_context5.n = 8;
|
|
19410
19536
|
break;
|
|
19411
19537
|
}
|
|
19412
19538
|
hasNextMessages = store.getState().MessageReducer.messagesHasNext;
|
|
19413
19539
|
if (getHasNextCached()) {
|
|
19414
|
-
_context5.n =
|
|
19540
|
+
_context5.n = 8;
|
|
19415
19541
|
break;
|
|
19416
19542
|
}
|
|
19417
19543
|
if (!hasNextMessages) {
|
|
19418
|
-
_context5.n =
|
|
19419
|
-
break;
|
|
19420
|
-
}
|
|
19421
|
-
_context5.n = 7;
|
|
19422
|
-
return effects.put(getMessagesAC(channel));
|
|
19423
|
-
case 7:
|
|
19424
|
-
if (!isAddToPendingMessagesMap) {
|
|
19425
|
-
_context5.n = 9;
|
|
19544
|
+
_context5.n = 8;
|
|
19426
19545
|
break;
|
|
19427
19546
|
}
|
|
19428
19547
|
_context5.n = 8;
|
|
19429
|
-
return effects.
|
|
19548
|
+
return effects.put(getMessagesAC(channel));
|
|
19430
19549
|
case 8:
|
|
19431
|
-
_context5.n = 10;
|
|
19432
|
-
break;
|
|
19433
|
-
case 9:
|
|
19434
|
-
_context5.n = 10;
|
|
19435
|
-
return effects.call(updatePendingMessage$1, message, channel, pendingMessage);
|
|
19436
|
-
case 10:
|
|
19437
19550
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19438
|
-
_context5.n =
|
|
19551
|
+
_context5.n = 14;
|
|
19439
19552
|
break;
|
|
19440
19553
|
}
|
|
19441
|
-
_context5.n =
|
|
19554
|
+
_context5.n = 9;
|
|
19442
19555
|
return effects.call(channel.sendMessage, messageToSend);
|
|
19443
|
-
case
|
|
19556
|
+
case 9:
|
|
19444
19557
|
messageResponse = _context5.v;
|
|
19445
19558
|
messageUpdateData = {
|
|
19446
19559
|
id: messageResponse.id,
|
|
@@ -19457,18 +19570,15 @@ function forwardMessage(action) {
|
|
|
19457
19570
|
channelId: channel.id
|
|
19458
19571
|
};
|
|
19459
19572
|
if (!(channelId === activeChannelId)) {
|
|
19460
|
-
_context5.n =
|
|
19573
|
+
_context5.n = 11;
|
|
19461
19574
|
break;
|
|
19462
19575
|
}
|
|
19463
|
-
_context5.n =
|
|
19576
|
+
_context5.n = 10;
|
|
19464
19577
|
return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData))));
|
|
19465
|
-
case
|
|
19578
|
+
case 10:
|
|
19466
19579
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
19467
|
-
case
|
|
19580
|
+
case 11:
|
|
19468
19581
|
message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
|
|
19469
|
-
message.id && store.dispatch(removePendingMessageAC(channel.id, message.id));
|
|
19470
|
-
messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
19471
|
-
messageToSend.id && store.dispatch(removePendingMessageAC(channel.id, messageToSend.id));
|
|
19472
19582
|
updateMessageOnMap(channel.id, {
|
|
19473
19583
|
messageId: !isAddToPendingMessagesMap ? message.tid : messageToSend.tid,
|
|
19474
19584
|
params: messageUpdateData
|
|
@@ -19479,30 +19589,71 @@ function forwardMessage(action) {
|
|
|
19479
19589
|
lastMessage: messageToUpdate,
|
|
19480
19590
|
lastReactedMessage: null
|
|
19481
19591
|
};
|
|
19482
|
-
_context5.n =
|
|
19592
|
+
_context5.n = 12;
|
|
19483
19593
|
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
19484
|
-
case
|
|
19594
|
+
case 12:
|
|
19485
19595
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
19486
19596
|
if (!channel.unread) {
|
|
19487
|
-
_context5.n =
|
|
19597
|
+
_context5.n = 13;
|
|
19488
19598
|
break;
|
|
19489
19599
|
}
|
|
19490
|
-
_context5.n =
|
|
19600
|
+
_context5.n = 13;
|
|
19491
19601
|
return effects.put(markChannelAsReadAC(channel.id));
|
|
19602
|
+
case 13:
|
|
19603
|
+
_context5.n = 15;
|
|
19604
|
+
break;
|
|
19605
|
+
case 14:
|
|
19606
|
+
throw new Error('Connection required to forward message');
|
|
19492
19607
|
case 15:
|
|
19493
|
-
_context5.n =
|
|
19608
|
+
_context5.n = 20;
|
|
19494
19609
|
break;
|
|
19495
19610
|
case 16:
|
|
19496
19611
|
_context5.p = 16;
|
|
19497
19612
|
_t4 = _context5.v;
|
|
19498
|
-
|
|
19613
|
+
if (!(pendingMessage && channel && action.type !== RESEND_MESSAGE)) {
|
|
19614
|
+
_context5.n = 17;
|
|
19615
|
+
break;
|
|
19616
|
+
}
|
|
19617
|
+
if (!isAddToPendingMessagesMap) {
|
|
19618
|
+
_context5.n = 17;
|
|
19619
|
+
break;
|
|
19620
|
+
}
|
|
19621
|
+
_context5.n = 17;
|
|
19622
|
+
return effects.call(addPendingMessage, message, pendingMessage, channel);
|
|
19499
19623
|
case 17:
|
|
19624
|
+
if (!(channel && messageTid)) {
|
|
19625
|
+
_context5.n = 18;
|
|
19626
|
+
break;
|
|
19627
|
+
}
|
|
19628
|
+
updateMessageOnMap(channel.id, {
|
|
19629
|
+
messageId: messageTid,
|
|
19630
|
+
params: {
|
|
19631
|
+
state: MESSAGE_STATUS.FAILED
|
|
19632
|
+
}
|
|
19633
|
+
});
|
|
19634
|
+
if (!(activeChannelId === channel.id)) {
|
|
19635
|
+
_context5.n = 18;
|
|
19636
|
+
break;
|
|
19637
|
+
}
|
|
19638
|
+
updateMessageOnAllMessages(messageTid, {
|
|
19639
|
+
state: MESSAGE_STATUS.FAILED
|
|
19640
|
+
});
|
|
19500
19641
|
_context5.n = 18;
|
|
19501
|
-
return effects.put(
|
|
19642
|
+
return effects.put(updateMessageAC(messageTid, {
|
|
19643
|
+
state: MESSAGE_STATUS.FAILED
|
|
19644
|
+
}));
|
|
19502
19645
|
case 18:
|
|
19646
|
+
_context5.n = 19;
|
|
19647
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19648
|
+
case 19:
|
|
19649
|
+
log.error('error on forward message ... ', _t4);
|
|
19650
|
+
case 20:
|
|
19651
|
+
_context5.n = 21;
|
|
19652
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19653
|
+
case 21:
|
|
19503
19654
|
return _context5.a(2);
|
|
19504
19655
|
}
|
|
19505
|
-
}, _marked3$1, null, [[
|
|
19656
|
+
}, _marked3$1, null, [[1, 16]]);
|
|
19506
19657
|
}
|
|
19507
19658
|
function resendMessage(action) {
|
|
19508
19659
|
var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isVoiceMessage;
|
|
@@ -19648,19 +19799,18 @@ function editMessage(action) {
|
|
|
19648
19799
|
}, _marked6$1, null, [[0, 5]]);
|
|
19649
19800
|
}
|
|
19650
19801
|
function getMessagesQuery(action) {
|
|
19651
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, pendingMessagesMap, channelId, _iterator, _step, msg, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
19802
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
19652
19803
|
return _regenerator().w(function (_context9) {
|
|
19653
19804
|
while (1) switch (_context9.p = _context9.n) {
|
|
19654
19805
|
case 0:
|
|
19655
|
-
|
|
19656
|
-
_context9.
|
|
19657
|
-
_context9.n = 2;
|
|
19806
|
+
_context9.p = 0;
|
|
19807
|
+
_context9.n = 1;
|
|
19658
19808
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
19659
|
-
case
|
|
19809
|
+
case 1:
|
|
19660
19810
|
_action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight, behavior = _action$payload.behavior;
|
|
19661
19811
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
19662
19812
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
19663
|
-
_context9.n =
|
|
19813
|
+
_context9.n = 86;
|
|
19664
19814
|
break;
|
|
19665
19815
|
}
|
|
19666
19816
|
SceytChatClient = getClient();
|
|
@@ -19668,18 +19818,18 @@ function getMessagesQuery(action) {
|
|
|
19668
19818
|
messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
|
|
19669
19819
|
messageQueryBuilder.reverse(true);
|
|
19670
19820
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19671
|
-
_context9.n =
|
|
19821
|
+
_context9.n = 3;
|
|
19672
19822
|
break;
|
|
19673
19823
|
}
|
|
19674
|
-
_context9.n =
|
|
19824
|
+
_context9.n = 2;
|
|
19675
19825
|
return effects.call(messageQueryBuilder.build);
|
|
19676
|
-
case
|
|
19826
|
+
case 2:
|
|
19677
19827
|
_t7 = _context9.v;
|
|
19678
|
-
_context9.n =
|
|
19828
|
+
_context9.n = 4;
|
|
19679
19829
|
break;
|
|
19680
|
-
case
|
|
19830
|
+
case 3:
|
|
19681
19831
|
_t7 = null;
|
|
19682
|
-
case
|
|
19832
|
+
case 4:
|
|
19683
19833
|
messageQuery = _t7;
|
|
19684
19834
|
query.messageQuery = messageQuery;
|
|
19685
19835
|
cachedMessages = Object.values(getMessagesFromMap(channel.id) || {}).sort(function (a, b) {
|
|
@@ -19690,60 +19840,60 @@ function getMessagesQuery(action) {
|
|
|
19690
19840
|
hasNext: false
|
|
19691
19841
|
};
|
|
19692
19842
|
if (!loadWithLastMessage) {
|
|
19693
|
-
_context9.n =
|
|
19843
|
+
_context9.n = 19;
|
|
19694
19844
|
break;
|
|
19695
19845
|
}
|
|
19696
19846
|
allMessages = getAllMessages();
|
|
19697
19847
|
havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
|
|
19698
19848
|
if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
|
|
19699
|
-
_context9.n =
|
|
19849
|
+
_context9.n = 14;
|
|
19700
19850
|
break;
|
|
19701
19851
|
}
|
|
19702
19852
|
setHasPrevCached(false);
|
|
19703
19853
|
setMessagesToMap(channel.id, []);
|
|
19704
19854
|
setAllMessages([]);
|
|
19705
19855
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19706
|
-
_context9.n =
|
|
19856
|
+
_context9.n = 6;
|
|
19707
19857
|
break;
|
|
19708
19858
|
}
|
|
19709
|
-
_context9.n =
|
|
19859
|
+
_context9.n = 5;
|
|
19710
19860
|
return effects.call(messageQuery.loadPreviousMessageId, '0');
|
|
19711
|
-
case
|
|
19861
|
+
case 5:
|
|
19712
19862
|
_t8 = _context9.v;
|
|
19713
|
-
_context9.n =
|
|
19863
|
+
_context9.n = 7;
|
|
19714
19864
|
break;
|
|
19715
|
-
case
|
|
19865
|
+
case 6:
|
|
19716
19866
|
_t8 = {
|
|
19717
19867
|
messages: [],
|
|
19718
19868
|
hasNext: false
|
|
19719
19869
|
};
|
|
19720
|
-
case
|
|
19870
|
+
case 7:
|
|
19721
19871
|
result = _t8;
|
|
19722
19872
|
if (!(result.messages.length === 50)) {
|
|
19723
|
-
_context9.n =
|
|
19873
|
+
_context9.n = 11;
|
|
19724
19874
|
break;
|
|
19725
19875
|
}
|
|
19726
19876
|
messageQuery.limit = 30;
|
|
19727
19877
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19728
|
-
_context9.n =
|
|
19878
|
+
_context9.n = 9;
|
|
19729
19879
|
break;
|
|
19730
19880
|
}
|
|
19731
|
-
_context9.n =
|
|
19881
|
+
_context9.n = 8;
|
|
19732
19882
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
19733
|
-
case
|
|
19883
|
+
case 8:
|
|
19734
19884
|
_t9 = _context9.v;
|
|
19735
|
-
_context9.n =
|
|
19885
|
+
_context9.n = 10;
|
|
19736
19886
|
break;
|
|
19737
|
-
case
|
|
19887
|
+
case 9:
|
|
19738
19888
|
_t9 = {
|
|
19739
19889
|
messages: [],
|
|
19740
19890
|
hasNext: false
|
|
19741
19891
|
};
|
|
19742
|
-
case
|
|
19892
|
+
case 10:
|
|
19743
19893
|
secondResult = _t9;
|
|
19744
19894
|
result.messages = [].concat(secondResult.messages, result.messages);
|
|
19745
19895
|
result.hasNext = secondResult.hasNext;
|
|
19746
|
-
case
|
|
19896
|
+
case 11:
|
|
19747
19897
|
sentMessages = [];
|
|
19748
19898
|
if (withDeliveredMessages) {
|
|
19749
19899
|
sentMessages = getFromAllMessagesByMessageId('', '', true);
|
|
@@ -19756,40 +19906,40 @@ function getMessagesQuery(action) {
|
|
|
19756
19906
|
return !messagesMap[msg.tid || ''];
|
|
19757
19907
|
});
|
|
19758
19908
|
result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
|
|
19759
|
-
_context9.n =
|
|
19909
|
+
_context9.n = 12;
|
|
19760
19910
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19761
|
-
case
|
|
19911
|
+
case 12:
|
|
19762
19912
|
setMessagesToMap(channel.id, result.messages);
|
|
19763
19913
|
setAllMessages(result.messages);
|
|
19764
|
-
_context9.n =
|
|
19914
|
+
_context9.n = 13;
|
|
19765
19915
|
return effects.put(setMessagesHasPrevAC(true));
|
|
19766
|
-
case
|
|
19767
|
-
_context9.n =
|
|
19916
|
+
case 13:
|
|
19917
|
+
_context9.n = 16;
|
|
19768
19918
|
break;
|
|
19769
|
-
case
|
|
19919
|
+
case 14:
|
|
19770
19920
|
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
19771
|
-
_context9.n =
|
|
19921
|
+
_context9.n = 15;
|
|
19772
19922
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19923
|
+
case 15:
|
|
19924
|
+
_context9.n = 16;
|
|
19925
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
19773
19926
|
case 16:
|
|
19774
19927
|
_context9.n = 17;
|
|
19775
|
-
return effects.put(setMessagesHasPrevAC(true));
|
|
19776
|
-
case 17:
|
|
19777
|
-
_context9.n = 18;
|
|
19778
19928
|
return effects.put(setMessagesHasNextAC(false));
|
|
19779
|
-
case
|
|
19929
|
+
case 17:
|
|
19780
19930
|
setHasNextCached(false);
|
|
19781
19931
|
if (!messageId) {
|
|
19782
|
-
_context9.n =
|
|
19932
|
+
_context9.n = 18;
|
|
19783
19933
|
break;
|
|
19784
19934
|
}
|
|
19785
|
-
_context9.n =
|
|
19935
|
+
_context9.n = 18;
|
|
19786
19936
|
return effects.put(setScrollToMessagesAC(messageId, highlight, behavior));
|
|
19787
|
-
case
|
|
19788
|
-
_context9.n =
|
|
19937
|
+
case 18:
|
|
19938
|
+
_context9.n = 72;
|
|
19789
19939
|
break;
|
|
19790
|
-
case
|
|
19940
|
+
case 19:
|
|
19791
19941
|
if (!messageId) {
|
|
19792
|
-
_context9.n =
|
|
19942
|
+
_context9.n = 38;
|
|
19793
19943
|
break;
|
|
19794
19944
|
}
|
|
19795
19945
|
_allMessages = getAllMessages();
|
|
@@ -19798,299 +19948,299 @@ function getMessagesQuery(action) {
|
|
|
19798
19948
|
});
|
|
19799
19949
|
maxLengthPart = MESSAGES_MAX_LENGTH / 2;
|
|
19800
19950
|
if (!(messageIndex >= maxLengthPart)) {
|
|
19801
|
-
_context9.n =
|
|
19951
|
+
_context9.n = 22;
|
|
19802
19952
|
break;
|
|
19803
19953
|
}
|
|
19804
19954
|
result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
|
|
19805
|
-
_context9.n =
|
|
19955
|
+
_context9.n = 20;
|
|
19806
19956
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19807
|
-
case
|
|
19957
|
+
case 20:
|
|
19808
19958
|
setHasPrevCached(messageIndex > maxLengthPart);
|
|
19809
19959
|
setHasNextCached(_allMessages.length > maxLengthPart);
|
|
19810
|
-
_context9.n =
|
|
19960
|
+
_context9.n = 21;
|
|
19811
19961
|
return effects.put(setMessagesHasPrevAC(true));
|
|
19812
|
-
case
|
|
19813
|
-
_context9.n =
|
|
19962
|
+
case 21:
|
|
19963
|
+
_context9.n = 34;
|
|
19814
19964
|
break;
|
|
19815
|
-
case
|
|
19965
|
+
case 22:
|
|
19816
19966
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
19817
19967
|
log.info('load by message id from server ...............', messageId);
|
|
19818
19968
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19819
|
-
_context9.n =
|
|
19969
|
+
_context9.n = 24;
|
|
19820
19970
|
break;
|
|
19821
19971
|
}
|
|
19822
|
-
_context9.n =
|
|
19972
|
+
_context9.n = 23;
|
|
19823
19973
|
return effects.call(messageQuery.loadNearMessageId, messageId);
|
|
19824
|
-
case
|
|
19974
|
+
case 23:
|
|
19825
19975
|
_t0 = _context9.v;
|
|
19826
|
-
_context9.n =
|
|
19976
|
+
_context9.n = 25;
|
|
19827
19977
|
break;
|
|
19828
|
-
case
|
|
19978
|
+
case 24:
|
|
19829
19979
|
_t0 = {
|
|
19830
19980
|
messages: [],
|
|
19831
19981
|
hasNext: false
|
|
19832
19982
|
};
|
|
19833
|
-
case
|
|
19983
|
+
case 25:
|
|
19834
19984
|
result = _t0;
|
|
19835
19985
|
if (!(result.messages.length === 50)) {
|
|
19836
|
-
_context9.n =
|
|
19986
|
+
_context9.n = 32;
|
|
19837
19987
|
break;
|
|
19838
19988
|
}
|
|
19839
19989
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
19840
19990
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19841
|
-
_context9.n =
|
|
19991
|
+
_context9.n = 27;
|
|
19842
19992
|
break;
|
|
19843
19993
|
}
|
|
19844
|
-
_context9.n =
|
|
19994
|
+
_context9.n = 26;
|
|
19845
19995
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
19846
|
-
case
|
|
19996
|
+
case 26:
|
|
19847
19997
|
_t1 = _context9.v;
|
|
19848
|
-
_context9.n =
|
|
19998
|
+
_context9.n = 28;
|
|
19849
19999
|
break;
|
|
19850
|
-
case
|
|
20000
|
+
case 27:
|
|
19851
20001
|
_t1 = {
|
|
19852
20002
|
messages: [],
|
|
19853
20003
|
hasNext: false
|
|
19854
20004
|
};
|
|
19855
|
-
case
|
|
20005
|
+
case 28:
|
|
19856
20006
|
_secondResult = _t1;
|
|
19857
20007
|
messageQuery.reverse = false;
|
|
19858
20008
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19859
|
-
_context9.n =
|
|
20009
|
+
_context9.n = 30;
|
|
19860
20010
|
break;
|
|
19861
20011
|
}
|
|
19862
|
-
_context9.n =
|
|
20012
|
+
_context9.n = 29;
|
|
19863
20013
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
19864
|
-
case
|
|
20014
|
+
case 29:
|
|
19865
20015
|
_t10 = _context9.v;
|
|
19866
|
-
_context9.n =
|
|
20016
|
+
_context9.n = 31;
|
|
19867
20017
|
break;
|
|
19868
|
-
case
|
|
20018
|
+
case 30:
|
|
19869
20019
|
_t10 = {
|
|
19870
20020
|
messages: [],
|
|
19871
20021
|
hasNext: false
|
|
19872
20022
|
};
|
|
19873
|
-
case
|
|
20023
|
+
case 31:
|
|
19874
20024
|
thirdResult = _t10;
|
|
19875
20025
|
result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
|
|
19876
20026
|
result.hasNext = _secondResult.hasNext;
|
|
19877
20027
|
messageQuery.reverse = true;
|
|
19878
|
-
_context9.n =
|
|
20028
|
+
_context9.n = 32;
|
|
19879
20029
|
return effects.put(setMessagesHasPrevAC(_secondResult.hasNext));
|
|
19880
|
-
case
|
|
19881
|
-
_context9.n =
|
|
20030
|
+
case 32:
|
|
20031
|
+
_context9.n = 33;
|
|
19882
20032
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
19883
|
-
case
|
|
20033
|
+
case 33:
|
|
19884
20034
|
setMessagesToMap(channel.id, result.messages);
|
|
19885
20035
|
setAllMessages([].concat(result.messages));
|
|
19886
20036
|
setHasPrevCached(false);
|
|
19887
20037
|
setHasNextCached(false);
|
|
20038
|
+
case 34:
|
|
20039
|
+
_context9.n = 35;
|
|
20040
|
+
return effects.put(setMessagesHasNextAC(true));
|
|
19888
20041
|
case 35:
|
|
19889
20042
|
_context9.n = 36;
|
|
19890
|
-
return effects.put(
|
|
20043
|
+
return effects.put(setScrollToMessagesAC(messageId, true, behavior));
|
|
19891
20044
|
case 36:
|
|
19892
20045
|
_context9.n = 37;
|
|
19893
|
-
return effects.put(setScrollToMessagesAC(messageId, true, behavior));
|
|
19894
|
-
case 37:
|
|
19895
|
-
_context9.n = 38;
|
|
19896
20046
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
19897
|
-
case
|
|
19898
|
-
_context9.n =
|
|
20047
|
+
case 37:
|
|
20048
|
+
_context9.n = 72;
|
|
19899
20049
|
break;
|
|
19900
|
-
case
|
|
20050
|
+
case 38:
|
|
19901
20051
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
19902
|
-
_context9.n =
|
|
20052
|
+
_context9.n = 61;
|
|
19903
20053
|
break;
|
|
19904
20054
|
}
|
|
19905
20055
|
setMessagesToMap(channel.id, []);
|
|
19906
20056
|
setAllMessages([]);
|
|
19907
20057
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
19908
20058
|
if (!Number(channel.lastDisplayedMessageId)) {
|
|
19909
|
-
_context9.n =
|
|
20059
|
+
_context9.n = 50;
|
|
19910
20060
|
break;
|
|
19911
20061
|
}
|
|
19912
20062
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19913
|
-
_context9.n =
|
|
20063
|
+
_context9.n = 40;
|
|
19914
20064
|
break;
|
|
19915
20065
|
}
|
|
19916
|
-
_context9.n =
|
|
20066
|
+
_context9.n = 39;
|
|
19917
20067
|
return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
|
|
19918
|
-
case
|
|
20068
|
+
case 39:
|
|
19919
20069
|
_t11 = _context9.v;
|
|
19920
|
-
_context9.n =
|
|
20070
|
+
_context9.n = 41;
|
|
19921
20071
|
break;
|
|
19922
|
-
case
|
|
20072
|
+
case 40:
|
|
19923
20073
|
_t11 = {
|
|
19924
20074
|
messages: [],
|
|
19925
20075
|
hasNext: false
|
|
19926
20076
|
};
|
|
19927
|
-
case
|
|
20077
|
+
case 41:
|
|
19928
20078
|
result = _t11;
|
|
19929
20079
|
if (!(result.messages.length === 50)) {
|
|
19930
|
-
_context9.n =
|
|
20080
|
+
_context9.n = 49;
|
|
19931
20081
|
break;
|
|
19932
20082
|
}
|
|
19933
20083
|
messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
|
|
19934
20084
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19935
|
-
_context9.n =
|
|
20085
|
+
_context9.n = 43;
|
|
19936
20086
|
break;
|
|
19937
20087
|
}
|
|
19938
|
-
_context9.n =
|
|
20088
|
+
_context9.n = 42;
|
|
19939
20089
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
19940
|
-
case
|
|
20090
|
+
case 42:
|
|
19941
20091
|
_t12 = _context9.v;
|
|
19942
|
-
_context9.n =
|
|
20092
|
+
_context9.n = 44;
|
|
19943
20093
|
break;
|
|
19944
|
-
case
|
|
20094
|
+
case 43:
|
|
19945
20095
|
_t12 = {
|
|
19946
20096
|
messages: [],
|
|
19947
20097
|
hasNext: false
|
|
19948
20098
|
};
|
|
19949
|
-
case
|
|
20099
|
+
case 44:
|
|
19950
20100
|
_secondResult2 = _t12;
|
|
19951
20101
|
if (!(channel.newMessageCount > 25)) {
|
|
19952
|
-
_context9.n =
|
|
20102
|
+
_context9.n = 48;
|
|
19953
20103
|
break;
|
|
19954
20104
|
}
|
|
19955
20105
|
messageQuery.reverse = false;
|
|
19956
20106
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19957
|
-
_context9.n =
|
|
20107
|
+
_context9.n = 46;
|
|
19958
20108
|
break;
|
|
19959
20109
|
}
|
|
19960
|
-
_context9.n =
|
|
20110
|
+
_context9.n = 45;
|
|
19961
20111
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
19962
|
-
case
|
|
20112
|
+
case 45:
|
|
19963
20113
|
_t13 = _context9.v;
|
|
19964
|
-
_context9.n =
|
|
20114
|
+
_context9.n = 47;
|
|
19965
20115
|
break;
|
|
19966
|
-
case
|
|
20116
|
+
case 46:
|
|
19967
20117
|
_t13 = {
|
|
19968
20118
|
messages: [],
|
|
19969
20119
|
hasNext: false
|
|
19970
20120
|
};
|
|
19971
|
-
case
|
|
20121
|
+
case 47:
|
|
19972
20122
|
_thirdResult = _t13;
|
|
19973
20123
|
result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
|
|
19974
20124
|
messageQuery.reverse = true;
|
|
19975
|
-
_context9.n =
|
|
20125
|
+
_context9.n = 49;
|
|
19976
20126
|
break;
|
|
19977
|
-
case
|
|
20127
|
+
case 48:
|
|
19978
20128
|
result.messages = [].concat(_secondResult2.messages, result.messages);
|
|
19979
|
-
case
|
|
19980
|
-
_context9.n =
|
|
20129
|
+
case 49:
|
|
20130
|
+
_context9.n = 57;
|
|
19981
20131
|
break;
|
|
19982
|
-
case
|
|
20132
|
+
case 50:
|
|
19983
20133
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
19984
|
-
_context9.n =
|
|
20134
|
+
_context9.n = 52;
|
|
19985
20135
|
break;
|
|
19986
20136
|
}
|
|
19987
|
-
_context9.n =
|
|
20137
|
+
_context9.n = 51;
|
|
19988
20138
|
return effects.call(messageQuery.loadPrevious);
|
|
19989
|
-
case
|
|
20139
|
+
case 51:
|
|
19990
20140
|
_t14 = _context9.v;
|
|
19991
|
-
_context9.n =
|
|
20141
|
+
_context9.n = 53;
|
|
19992
20142
|
break;
|
|
19993
|
-
case
|
|
20143
|
+
case 52:
|
|
19994
20144
|
_t14 = {
|
|
19995
20145
|
messages: [],
|
|
19996
20146
|
hasNext: false
|
|
19997
20147
|
};
|
|
19998
|
-
case
|
|
20148
|
+
case 53:
|
|
19999
20149
|
result = _t14;
|
|
20000
20150
|
if (!(result.messages.length === 50)) {
|
|
20001
|
-
_context9.n =
|
|
20151
|
+
_context9.n = 57;
|
|
20002
20152
|
break;
|
|
20003
20153
|
}
|
|
20004
20154
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20005
20155
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20006
|
-
_context9.n =
|
|
20156
|
+
_context9.n = 55;
|
|
20007
20157
|
break;
|
|
20008
20158
|
}
|
|
20009
|
-
_context9.n =
|
|
20159
|
+
_context9.n = 54;
|
|
20010
20160
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20011
|
-
case
|
|
20161
|
+
case 54:
|
|
20012
20162
|
_t15 = _context9.v;
|
|
20013
|
-
_context9.n =
|
|
20163
|
+
_context9.n = 56;
|
|
20014
20164
|
break;
|
|
20015
|
-
case
|
|
20165
|
+
case 55:
|
|
20016
20166
|
_t15 = {
|
|
20017
20167
|
messages: [],
|
|
20018
20168
|
hasNext: false
|
|
20019
20169
|
};
|
|
20020
|
-
case
|
|
20170
|
+
case 56:
|
|
20021
20171
|
_secondResult3 = _t15;
|
|
20022
20172
|
result.messages = [].concat(_secondResult3.messages, result.messages);
|
|
20023
20173
|
result.hasNext = _secondResult3.hasNext;
|
|
20174
|
+
case 57:
|
|
20175
|
+
_context9.n = 58;
|
|
20176
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
20024
20177
|
case 58:
|
|
20025
20178
|
_context9.n = 59;
|
|
20026
|
-
return effects.put(setMessagesHasPrevAC(true));
|
|
20027
|
-
case 59:
|
|
20028
|
-
_context9.n = 60;
|
|
20029
20179
|
return effects.put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
|
|
20030
|
-
case
|
|
20180
|
+
case 59:
|
|
20031
20181
|
setMessagesToMap(channel.id, result.messages);
|
|
20032
20182
|
setAllMessages([].concat(result.messages));
|
|
20033
|
-
_context9.n =
|
|
20183
|
+
_context9.n = 60;
|
|
20034
20184
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
20035
|
-
case
|
|
20036
|
-
_context9.n =
|
|
20185
|
+
case 60:
|
|
20186
|
+
_context9.n = 72;
|
|
20037
20187
|
break;
|
|
20038
|
-
case
|
|
20188
|
+
case 61:
|
|
20039
20189
|
previousAllMessages = getAllMessages();
|
|
20040
20190
|
setMessagesToMap(channel.id, []);
|
|
20041
20191
|
setAllMessages([]);
|
|
20042
20192
|
if (!(cachedMessages && cachedMessages.length)) {
|
|
20043
|
-
_context9.n =
|
|
20193
|
+
_context9.n = 62;
|
|
20044
20194
|
break;
|
|
20045
20195
|
}
|
|
20046
20196
|
setMessagesToMap(channel.id, []);
|
|
20047
20197
|
setAllMessages([].concat(cachedMessages));
|
|
20048
|
-
_context9.n =
|
|
20198
|
+
_context9.n = 62;
|
|
20049
20199
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
|
|
20050
|
-
case
|
|
20200
|
+
case 62:
|
|
20051
20201
|
log.info('load message from server');
|
|
20052
20202
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20053
|
-
_context9.n =
|
|
20203
|
+
_context9.n = 64;
|
|
20054
20204
|
break;
|
|
20055
20205
|
}
|
|
20056
|
-
_context9.n =
|
|
20206
|
+
_context9.n = 63;
|
|
20057
20207
|
return effects.call(messageQuery.loadPrevious);
|
|
20058
|
-
case
|
|
20208
|
+
case 63:
|
|
20059
20209
|
_t16 = _context9.v;
|
|
20060
|
-
_context9.n =
|
|
20210
|
+
_context9.n = 65;
|
|
20061
20211
|
break;
|
|
20062
|
-
case
|
|
20212
|
+
case 64:
|
|
20063
20213
|
_t16 = {
|
|
20064
20214
|
messages: [],
|
|
20065
20215
|
hasNext: false
|
|
20066
20216
|
};
|
|
20067
|
-
case
|
|
20217
|
+
case 65:
|
|
20068
20218
|
result = _t16;
|
|
20069
20219
|
if (!(result.messages.length === 50)) {
|
|
20070
|
-
_context9.n =
|
|
20220
|
+
_context9.n = 69;
|
|
20071
20221
|
break;
|
|
20072
20222
|
}
|
|
20073
20223
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
20074
20224
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
20075
|
-
_context9.n =
|
|
20225
|
+
_context9.n = 67;
|
|
20076
20226
|
break;
|
|
20077
20227
|
}
|
|
20078
|
-
_context9.n =
|
|
20228
|
+
_context9.n = 66;
|
|
20079
20229
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
20080
|
-
case
|
|
20230
|
+
case 66:
|
|
20081
20231
|
_t17 = _context9.v;
|
|
20082
|
-
_context9.n =
|
|
20232
|
+
_context9.n = 68;
|
|
20083
20233
|
break;
|
|
20084
|
-
case
|
|
20234
|
+
case 67:
|
|
20085
20235
|
_t17 = {
|
|
20086
20236
|
messages: [],
|
|
20087
20237
|
hasNext: false
|
|
20088
20238
|
};
|
|
20089
|
-
case
|
|
20239
|
+
case 68:
|
|
20090
20240
|
_secondResult4 = _t17;
|
|
20091
20241
|
result.messages = [].concat(_secondResult4.messages, result.messages);
|
|
20092
20242
|
result.hasNext = _secondResult4.hasNext;
|
|
20093
|
-
case
|
|
20243
|
+
case 69:
|
|
20094
20244
|
updatedMessages = [];
|
|
20095
20245
|
result.messages.forEach(function (msg) {
|
|
20096
20246
|
var updatedMessage = updateMessageOnMap(channel.id, {
|
|
@@ -20119,18 +20269,18 @@ function getMessagesQuery(action) {
|
|
|
20119
20269
|
updatedMessages = [].concat(updatedMessages, allMessagesAfterLastMessage || []);
|
|
20120
20270
|
setMessagesToMap(channel.id, updatedMessages);
|
|
20121
20271
|
setAllMessages(updatedMessages);
|
|
20122
|
-
_context9.n =
|
|
20272
|
+
_context9.n = 70;
|
|
20123
20273
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
20274
|
+
case 70:
|
|
20275
|
+
_context9.n = 71;
|
|
20276
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
20124
20277
|
case 71:
|
|
20125
20278
|
_context9.n = 72;
|
|
20126
|
-
return effects.put(setMessagesHasPrevAC(true));
|
|
20127
|
-
case 72:
|
|
20128
|
-
_context9.n = 73;
|
|
20129
20279
|
return effects.put(setMessagesHasNextAC(false));
|
|
20130
|
-
case
|
|
20280
|
+
case 72:
|
|
20131
20281
|
pendingMessages = getPendingMessages(channel.id);
|
|
20132
20282
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
20133
|
-
_context9.n =
|
|
20283
|
+
_context9.n = 73;
|
|
20134
20284
|
break;
|
|
20135
20285
|
}
|
|
20136
20286
|
_messagesMap = {};
|
|
@@ -20140,71 +20290,122 @@ function getMessagesQuery(action) {
|
|
|
20140
20290
|
filteredPendingMessages = pendingMessages.filter(function (msg) {
|
|
20141
20291
|
return !_messagesMap[msg.tid || ''];
|
|
20142
20292
|
});
|
|
20143
|
-
_context9.n =
|
|
20293
|
+
_context9.n = 73;
|
|
20144
20294
|
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
20145
|
-
case
|
|
20146
|
-
|
|
20147
|
-
|
|
20295
|
+
case 73:
|
|
20296
|
+
waitToSendPendingMessages = store.getState().UserReducer.waitToSendPendingMessages;
|
|
20297
|
+
if (!(connectionState === CONNECTION_STATUS.CONNECTED && waitToSendPendingMessages)) {
|
|
20298
|
+
_context9.n = 84;
|
|
20148
20299
|
break;
|
|
20149
20300
|
}
|
|
20301
|
+
_context9.n = 74;
|
|
20302
|
+
return effects.put(setWaitToSendPendingMessagesAC(false));
|
|
20303
|
+
case 74:
|
|
20150
20304
|
pendingMessagesMap = getPendingMessagesMap();
|
|
20151
20305
|
_t18 = _regeneratorKeys(pendingMessagesMap);
|
|
20152
20306
|
case 75:
|
|
20153
20307
|
if ((_t19 = _t18()).done) {
|
|
20154
|
-
_context9.n =
|
|
20308
|
+
_context9.n = 83;
|
|
20155
20309
|
break;
|
|
20156
20310
|
}
|
|
20157
20311
|
channelId = _t19.value;
|
|
20158
20312
|
_iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
20159
20313
|
case 76:
|
|
20160
20314
|
if ((_step = _iterator()).done) {
|
|
20161
|
-
_context9.n =
|
|
20315
|
+
_context9.n = 82;
|
|
20162
20316
|
break;
|
|
20163
20317
|
}
|
|
20164
20318
|
msg = _step.value;
|
|
20319
|
+
attachments = (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
20320
|
+
return att.type !== attachmentTypes.link;
|
|
20321
|
+
});
|
|
20322
|
+
if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
|
|
20323
|
+
_context9.n = 78;
|
|
20324
|
+
break;
|
|
20325
|
+
}
|
|
20165
20326
|
_context9.n = 77;
|
|
20166
|
-
return effects.
|
|
20327
|
+
return effects.call(forwardMessage, {
|
|
20328
|
+
type: RESEND_MESSAGE,
|
|
20329
|
+
payload: {
|
|
20330
|
+
message: msg,
|
|
20331
|
+
connectionState: connectionState,
|
|
20332
|
+
channelId: channelId
|
|
20333
|
+
}
|
|
20334
|
+
});
|
|
20167
20335
|
case 77:
|
|
20168
|
-
_context9.n =
|
|
20336
|
+
_context9.n = 81;
|
|
20169
20337
|
break;
|
|
20170
20338
|
case 78:
|
|
20339
|
+
if (!(attachments && attachments.length > 0)) {
|
|
20340
|
+
_context9.n = 80;
|
|
20341
|
+
break;
|
|
20342
|
+
}
|
|
20343
|
+
_context9.n = 79;
|
|
20344
|
+
return effects.call(sendMessage, {
|
|
20345
|
+
type: RESEND_MESSAGE,
|
|
20346
|
+
payload: {
|
|
20347
|
+
message: msg,
|
|
20348
|
+
connectionState: connectionState,
|
|
20349
|
+
channelId: channelId
|
|
20350
|
+
}
|
|
20351
|
+
});
|
|
20352
|
+
case 79:
|
|
20353
|
+
_context9.n = 81;
|
|
20354
|
+
break;
|
|
20355
|
+
case 80:
|
|
20356
|
+
_context9.n = 81;
|
|
20357
|
+
return effects.call(sendTextMessage, {
|
|
20358
|
+
type: RESEND_MESSAGE,
|
|
20359
|
+
payload: {
|
|
20360
|
+
message: msg,
|
|
20361
|
+
connectionState: connectionState,
|
|
20362
|
+
channelId: channelId
|
|
20363
|
+
}
|
|
20364
|
+
});
|
|
20365
|
+
case 81:
|
|
20366
|
+
_context9.n = 76;
|
|
20367
|
+
break;
|
|
20368
|
+
case 82:
|
|
20171
20369
|
_context9.n = 75;
|
|
20172
20370
|
break;
|
|
20173
|
-
case
|
|
20371
|
+
case 83:
|
|
20174
20372
|
pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
|
|
20175
20373
|
if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
|
|
20176
|
-
_context9.n =
|
|
20374
|
+
_context9.n = 84;
|
|
20177
20375
|
break;
|
|
20178
20376
|
}
|
|
20179
|
-
_context9.n =
|
|
20377
|
+
_context9.n = 84;
|
|
20180
20378
|
return effects.put(resendPendingPollActionsAC(connectionState));
|
|
20181
|
-
case
|
|
20182
|
-
_context9.n =
|
|
20379
|
+
case 84:
|
|
20380
|
+
_context9.n = 85;
|
|
20381
|
+
return effects.put(setWaitToSendPendingMessagesAC(false));
|
|
20382
|
+
case 85:
|
|
20383
|
+
_context9.n = 87;
|
|
20183
20384
|
break;
|
|
20184
|
-
case
|
|
20385
|
+
case 86:
|
|
20185
20386
|
if (!channel.isMockChannel) {
|
|
20186
|
-
_context9.n =
|
|
20387
|
+
_context9.n = 87;
|
|
20187
20388
|
break;
|
|
20188
20389
|
}
|
|
20189
|
-
_context9.n =
|
|
20390
|
+
_context9.n = 87;
|
|
20190
20391
|
return effects.put(setMessagesAC([]));
|
|
20191
|
-
case
|
|
20192
|
-
_context9.n =
|
|
20392
|
+
case 87:
|
|
20393
|
+
_context9.n = 89;
|
|
20193
20394
|
break;
|
|
20194
|
-
case
|
|
20195
|
-
_context9.p =
|
|
20395
|
+
case 88:
|
|
20396
|
+
_context9.p = 88;
|
|
20196
20397
|
_t20 = _context9.v;
|
|
20197
20398
|
log.error('error in message query', _t20);
|
|
20198
|
-
case
|
|
20199
|
-
_context9.p =
|
|
20200
|
-
_context9.n =
|
|
20399
|
+
case 89:
|
|
20400
|
+
_context9.p = 89;
|
|
20401
|
+
_context9.n = 90;
|
|
20201
20402
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
20202
|
-
case
|
|
20203
|
-
return _context9.f(
|
|
20204
|
-
case
|
|
20403
|
+
case 90:
|
|
20404
|
+
return _context9.f(89);
|
|
20405
|
+
case 91:
|
|
20205
20406
|
return _context9.a(2);
|
|
20206
20407
|
}
|
|
20207
|
-
}, _marked7$1, null, [[
|
|
20408
|
+
}, _marked7$1, null, [[0, 88, 89, 91]]);
|
|
20208
20409
|
}
|
|
20209
20410
|
function getMessageQuery(action) {
|
|
20210
20411
|
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t21;
|
|
@@ -22108,28 +22309,34 @@ function getRoles(action) {
|
|
|
22108
22309
|
_action$payload = action.payload, timeout = _action$payload.timeout, attempts = _action$payload.attempts;
|
|
22109
22310
|
_context8.p = 1;
|
|
22110
22311
|
SceytChatClient = getClient();
|
|
22111
|
-
|
|
22112
|
-
|
|
22312
|
+
if (!(store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
|
|
22313
|
+
_context8.n = 2;
|
|
22314
|
+
break;
|
|
22315
|
+
}
|
|
22316
|
+
return _context8.a(2);
|
|
22113
22317
|
case 2:
|
|
22114
|
-
roles = _context8.v;
|
|
22115
22318
|
_context8.n = 3;
|
|
22116
|
-
return effects.
|
|
22319
|
+
return effects.call(SceytChatClient.getRoles);
|
|
22117
22320
|
case 3:
|
|
22321
|
+
roles = _context8.v;
|
|
22118
22322
|
_context8.n = 4;
|
|
22119
|
-
return effects.put(
|
|
22323
|
+
return effects.put(getRolesSuccessAC(roles));
|
|
22120
22324
|
case 4:
|
|
22121
|
-
_context8.n =
|
|
22122
|
-
|
|
22325
|
+
_context8.n = 5;
|
|
22326
|
+
return effects.put(getRolesFailAC());
|
|
22123
22327
|
case 5:
|
|
22124
|
-
_context8.
|
|
22328
|
+
_context8.n = 7;
|
|
22329
|
+
break;
|
|
22330
|
+
case 6:
|
|
22331
|
+
_context8.p = 6;
|
|
22125
22332
|
_t8 = _context8.v;
|
|
22126
22333
|
log.error('ERROR get roles', _t8);
|
|
22127
|
-
_context8.n =
|
|
22334
|
+
_context8.n = 7;
|
|
22128
22335
|
return effects.put(getRolesFailAC((timeout || 0) + 300, (attempts || 0) + 1));
|
|
22129
|
-
case
|
|
22336
|
+
case 7:
|
|
22130
22337
|
return _context8.a(2);
|
|
22131
22338
|
}
|
|
22132
|
-
}, _marked8$2, null, [[1,
|
|
22339
|
+
}, _marked8$2, null, [[1, 6]]);
|
|
22133
22340
|
}
|
|
22134
22341
|
function MembersSaga() {
|
|
22135
22342
|
return _regenerator().w(function (_context9) {
|
|
@@ -23225,7 +23432,8 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
23225
23432
|
disableFrowardMentionsCount = _ref$disableFrowardMe === void 0 ? false : _ref$disableFrowardMe,
|
|
23226
23433
|
chatMinWidth = _ref.chatMinWidth,
|
|
23227
23434
|
_ref$embeddedJoinGrou = _ref.embeddedJoinGroupPopup,
|
|
23228
|
-
embeddedJoinGroupPopup = _ref$embeddedJoinGrou === void 0 ? false : _ref$embeddedJoinGrou
|
|
23435
|
+
embeddedJoinGroupPopup = _ref$embeddedJoinGrou === void 0 ? false : _ref$embeddedJoinGrou,
|
|
23436
|
+
onUpdateChannel = _ref.onUpdateChannel;
|
|
23229
23437
|
var useInviteLink = getUseInviteLink();
|
|
23230
23438
|
var _useColor = useColors(),
|
|
23231
23439
|
backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
@@ -23294,7 +23502,6 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
23294
23502
|
setSceytChatClient(client);
|
|
23295
23503
|
dispatch(setUserAC(client.user));
|
|
23296
23504
|
dispatch(watchForEventsAC());
|
|
23297
|
-
dispatch(setConnectionStatusAC(client.connectionState));
|
|
23298
23505
|
} else {
|
|
23299
23506
|
clearMessagesMap();
|
|
23300
23507
|
removeAllMessages();
|
|
@@ -23309,6 +23516,9 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
23309
23516
|
setTabIsActive(true);
|
|
23310
23517
|
};
|
|
23311
23518
|
}, [client]);
|
|
23519
|
+
React.useEffect(function () {
|
|
23520
|
+
dispatch(setConnectionStatusAC(client.connectionState));
|
|
23521
|
+
}, [client === null || client === void 0 ? void 0 : client.connectionState]);
|
|
23312
23522
|
React.useEffect(function () {
|
|
23313
23523
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
23314
23524
|
if (showOnlyContactUsers) {
|
|
@@ -23468,6 +23678,11 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
23468
23678
|
onJoin: handleJoinChannel,
|
|
23469
23679
|
channel: joinableChannel
|
|
23470
23680
|
})) : null;
|
|
23681
|
+
React.useEffect(function () {
|
|
23682
|
+
if (onUpdateChannel) {
|
|
23683
|
+
setOnUpdateChannel(onUpdateChannel);
|
|
23684
|
+
}
|
|
23685
|
+
}, [onUpdateChannel]);
|
|
23471
23686
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, SceytChatClient ? (/*#__PURE__*/React__default.createElement(ChatContainer, {
|
|
23472
23687
|
onDrop: handleDropFile,
|
|
23473
23688
|
onDragOver: handleDragOver,
|
|
@@ -23530,7 +23745,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
23530
23745
|
ResetLinkConfirmModal: {}
|
|
23531
23746
|
} : _ref$inviteLinkOption,
|
|
23532
23747
|
_ref$embeddedJoinGrou = _ref.embeddedJoinGroupPopup,
|
|
23533
|
-
embeddedJoinGroupPopup = _ref$embeddedJoinGrou === void 0 ? false : _ref$embeddedJoinGrou
|
|
23748
|
+
embeddedJoinGroupPopup = _ref$embeddedJoinGrou === void 0 ? false : _ref$embeddedJoinGrou,
|
|
23749
|
+
onUpdateChannel = _ref.onUpdateChannel;
|
|
23534
23750
|
React.useEffect(function () {
|
|
23535
23751
|
log.setLevel(logLevel);
|
|
23536
23752
|
if (baseUrlForInviteMembers) {
|
|
@@ -23567,7 +23783,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
23567
23783
|
memberCount: memberCount,
|
|
23568
23784
|
disableFrowardMentionsCount: disableFrowardMentionsCount,
|
|
23569
23785
|
chatMinWidth: chatMinWidth,
|
|
23570
|
-
embeddedJoinGroupPopup: embeddedJoinGroupPopup
|
|
23786
|
+
embeddedJoinGroupPopup: embeddedJoinGroupPopup,
|
|
23787
|
+
onUpdateChannel: onUpdateChannel
|
|
23571
23788
|
}));
|
|
23572
23789
|
};
|
|
23573
23790
|
|
|
@@ -32465,7 +32682,7 @@ var AudioPlayer = function AudioPlayer(_ref) {
|
|
|
32465
32682
|
wavesurfer.current.seekTo(0);
|
|
32466
32683
|
var audioDuration = wavesurfer.current.getDuration();
|
|
32467
32684
|
setDuration(audioDuration);
|
|
32468
|
-
setCurrentTime(formatAudioVideoTime(
|
|
32685
|
+
setCurrentTime(formatAudioVideoTime(audioDuration));
|
|
32469
32686
|
setCurrentTimeSeconds(0);
|
|
32470
32687
|
if (playingAudioId === file.id) {
|
|
32471
32688
|
dispatch(setPlayingAudioIdAC(null));
|
|
@@ -34755,6 +34972,12 @@ var PollMessage = function PollMessage(_ref) {
|
|
|
34755
34972
|
var handleViewResults = function handleViewResults() {
|
|
34756
34973
|
return setShowResults(true);
|
|
34757
34974
|
};
|
|
34975
|
+
var handleResultsClick = function handleResultsClick(e) {
|
|
34976
|
+
e.stopPropagation();
|
|
34977
|
+
if (isHaveResults && !poll.anonymous) {
|
|
34978
|
+
handleViewResults();
|
|
34979
|
+
}
|
|
34980
|
+
};
|
|
34758
34981
|
return /*#__PURE__*/React__default.createElement(Container$i, null, /*#__PURE__*/React__default.createElement(Question$1, {
|
|
34759
34982
|
color: textPrimary
|
|
34760
34983
|
}, poll.name), /*#__PURE__*/React__default.createElement(SubTitle$1, {
|
|
@@ -34793,7 +35016,10 @@ var PollMessage = function PollMessage(_ref) {
|
|
|
34793
35016
|
border: borderSecondary
|
|
34794
35017
|
}))), /*#__PURE__*/React__default.createElement(Title$2, {
|
|
34795
35018
|
color: textPrimary
|
|
34796
|
-
}, opt.name), poll.anonymous ? null : (/*#__PURE__*/React__default.createElement(UsersContainer,
|
|
35019
|
+
}, opt.name), poll.anonymous ? null : (/*#__PURE__*/React__default.createElement(UsersContainer, {
|
|
35020
|
+
onClick: handleResultsClick,
|
|
35021
|
+
cursor: poll.anonymous ? 'default' : 'pointer'
|
|
35022
|
+
}, optionVotesUsers.map(function (vote) {
|
|
34797
35023
|
var _vote$user, _vote$user2, _vote$user2$profile, _vote$user3, _vote$user3$profile;
|
|
34798
35024
|
return /*#__PURE__*/React__default.createElement(Avatar, {
|
|
34799
35025
|
key: vote === null || vote === void 0 ? void 0 : (_vote$user = vote.user) === null || _vote$user === void 0 ? void 0 : _vote$user.id,
|
|
@@ -34806,7 +35032,9 @@ var PollMessage = function PollMessage(_ref) {
|
|
|
34806
35032
|
border: "2px solid " + (message.incoming ? incomingMessageBackground : outgoingMessageBackground)
|
|
34807
35033
|
});
|
|
34808
35034
|
}))), /*#__PURE__*/React__default.createElement(Votes, {
|
|
34809
|
-
color: textPrimary
|
|
35035
|
+
color: textPrimary,
|
|
35036
|
+
onClick: handleResultsClick,
|
|
35037
|
+
cursor: poll.anonymous ? 'default' : 'pointer'
|
|
34810
35038
|
}, votes)), /*#__PURE__*/React__default.createElement(Bar$1, {
|
|
34811
35039
|
track: borderSecondary,
|
|
34812
35040
|
closed: poll.closed
|
|
@@ -34822,7 +35050,7 @@ var PollMessage = function PollMessage(_ref) {
|
|
|
34822
35050
|
color: isHaveResults ? accent : textSecondary,
|
|
34823
35051
|
disabledOpacity: 0.8,
|
|
34824
35052
|
borderRadius: '14px',
|
|
34825
|
-
onClick:
|
|
35053
|
+
onClick: handleViewResults,
|
|
34826
35054
|
style: {
|
|
34827
35055
|
width: '100%',
|
|
34828
35056
|
marginTop: 10
|
|
@@ -34864,8 +35092,10 @@ var StyledCheck = styled__default(SvgFilledCheckbox)(_templateObject9$d || (_tem
|
|
|
34864
35092
|
var Title$2 = styled__default.div(_templateObject0$c || (_templateObject0$c = _taggedTemplateLiteralLoose(["\n flex: 1 1 auto;\n color: ", ";\n margin-right: auto;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.2px;\n max-width: calc(100% - 80px);\n word-break: break-word;\n"])), function (p) {
|
|
34865
35093
|
return p.color;
|
|
34866
35094
|
});
|
|
34867
|
-
var Votes = styled__default.span(_templateObject1$9 || (_templateObject1$9 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.2px;\n margin-left: 4px;\n"])), function (p) {
|
|
35095
|
+
var Votes = styled__default.span(_templateObject1$9 || (_templateObject1$9 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: -0.2px;\n margin-left: 4px;\n cursor: ", ";\n"])), function (p) {
|
|
34868
35096
|
return p.color;
|
|
35097
|
+
}, function (p) {
|
|
35098
|
+
return p.cursor;
|
|
34869
35099
|
});
|
|
34870
35100
|
var Bar$1 = styled__default.div(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: 6px;\n border-radius: 6px;\n background: ", ";\n overflow: hidden;\n margin-left: auto;\n"])), function (p) {
|
|
34871
35101
|
return p.closed ? '100%' : "calc(100% - 28px)";
|
|
@@ -34873,7 +35103,9 @@ var Bar$1 = styled__default.div(_templateObject10$6 || (_templateObject10$6 = _t
|
|
|
34873
35103
|
return p.track;
|
|
34874
35104
|
});
|
|
34875
35105
|
var Fill = styled__default.div(_templateObject11$4 || (_templateObject11$4 = _taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: 6px;\n transition: width 0.3s ease-in-out;\n"])));
|
|
34876
|
-
var UsersContainer = styled__default.div(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: auto;\n padding-left: 16px;\n height: max-content;\n"])))
|
|
35106
|
+
var UsersContainer = styled__default.div(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: auto;\n padding-left: 16px;\n height: max-content;\n cursor: ", ";\n"])), function (p) {
|
|
35107
|
+
return p.cursor;
|
|
35108
|
+
});
|
|
34877
35109
|
|
|
34878
35110
|
var _templateObject$G, _templateObject2$B, _templateObject3$v, _templateObject4$q, _templateObject5$l, _templateObject6$j, _templateObject7$i, _templateObject8$g, _templateObject9$e, _templateObject0$d, _templateObject1$a;
|
|
34879
35111
|
var validateUrl = function validateUrl(url) {
|
|
@@ -34885,11 +35117,12 @@ var validateUrl = function validateUrl(url) {
|
|
|
34885
35117
|
}
|
|
34886
35118
|
};
|
|
34887
35119
|
var isDescriptionOnlySymbol = function isDescriptionOnlySymbol(description) {
|
|
35120
|
+
if (!description) return true;
|
|
34888
35121
|
var trimmed = description === null || description === void 0 ? void 0 : description.trim();
|
|
34889
35122
|
return !!trimmed && !/[a-zA-Z0-9]/.test(trimmed);
|
|
34890
35123
|
};
|
|
34891
35124
|
var OGMetadata = function OGMetadata(_ref) {
|
|
34892
|
-
var _metadata$
|
|
35125
|
+
var _metadata$og5, _metadata$og6, _metadata$og9, _metadata$og14, _metadata$og14$image, _metadata$og14$image$, _metadata$og16, _metadata$og16$favico, _metadata$og20, _metadata$og21, _metadata$og22;
|
|
34893
35126
|
var attachments = _ref.attachments,
|
|
34894
35127
|
state = _ref.state,
|
|
34895
35128
|
incoming = _ref.incoming,
|
|
@@ -34943,12 +35176,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
34943
35176
|
});
|
|
34944
35177
|
}, [attachments]);
|
|
34945
35178
|
var metadata = React.useMemo(function () {
|
|
34946
|
-
|
|
34947
|
-
var metadata = (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) || null;
|
|
34948
|
-
if (metadata !== null && metadata !== void 0 && (_metadata$og = metadata.og) !== null && _metadata$og !== void 0 && _metadata$og.title && metadata !== null && metadata !== void 0 && (_metadata$og2 = metadata.og) !== null && _metadata$og2 !== void 0 && _metadata$og2.description) {
|
|
34949
|
-
return metadata;
|
|
34950
|
-
}
|
|
34951
|
-
return null;
|
|
35179
|
+
return (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) || null;
|
|
34952
35180
|
}, [oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
34953
35181
|
var _useState2 = React.useState(false),
|
|
34954
35182
|
imageLoadError = _useState2[0],
|
|
@@ -34973,9 +35201,9 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
34973
35201
|
var queryBuilder = new client.MessageLinkOGQueryBuilder(url);
|
|
34974
35202
|
return Promise.resolve(queryBuilder.build()).then(function (query) {
|
|
34975
35203
|
return Promise.resolve(query.loadOGData()).then(function (metadata) {
|
|
34976
|
-
var _metadata$
|
|
35204
|
+
var _metadata$og, _metadata$og$image, _metadata$og$image$;
|
|
34977
35205
|
var image = new Image();
|
|
34978
|
-
image.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35206
|
+
image.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$og = metadata.og) === null || _metadata$og === void 0 ? void 0 : (_metadata$og$image = _metadata$og.image) === null || _metadata$og$image === void 0 ? void 0 : (_metadata$og$image$ = _metadata$og$image[0]) === null || _metadata$og$image$ === void 0 ? void 0 : _metadata$og$image$.url;
|
|
34979
35207
|
var _temp = function () {
|
|
34980
35208
|
if (image.src) {
|
|
34981
35209
|
image.onload = function () {
|
|
@@ -34997,10 +35225,10 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
34997
35225
|
};
|
|
34998
35226
|
image.onerror = function () {
|
|
34999
35227
|
try {
|
|
35000
|
-
var _metadata$
|
|
35228
|
+
var _metadata$og2, _metadata$og2$favicon;
|
|
35001
35229
|
setImageLoadError(true);
|
|
35002
35230
|
var favicon = new Image();
|
|
35003
|
-
favicon.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35231
|
+
favicon.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$og2 = metadata.og) === null || _metadata$og2 === void 0 ? void 0 : (_metadata$og2$favicon = _metadata$og2.favicon) === null || _metadata$og2$favicon === void 0 ? void 0 : _metadata$og2$favicon.url;
|
|
35004
35232
|
if (favicon.src) {
|
|
35005
35233
|
favicon.onload = function () {
|
|
35006
35234
|
try {
|
|
@@ -35092,10 +35320,22 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
35092
35320
|
}
|
|
35093
35321
|
return url;
|
|
35094
35322
|
}, [attachment]);
|
|
35323
|
+
var shouldShowTitle = React.useMemo(function () {
|
|
35324
|
+
var _metadata$og3, _metadata$og4;
|
|
35325
|
+
return ogShowTitle && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og3 = metadata.og) === null || _metadata$og3 === void 0 ? void 0 : _metadata$og3.title) && !isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$og4 = metadata.og) === null || _metadata$og4 === void 0 ? void 0 : _metadata$og4.description);
|
|
35326
|
+
}, [ogShowTitle, metadata === null || metadata === void 0 ? void 0 : (_metadata$og5 = metadata.og) === null || _metadata$og5 === void 0 ? void 0 : _metadata$og5.title, metadata === null || metadata === void 0 ? void 0 : (_metadata$og6 = metadata.og) === null || _metadata$og6 === void 0 ? void 0 : _metadata$og6.description]);
|
|
35327
|
+
var shouldShowDescription = React.useMemo(function () {
|
|
35328
|
+
var _metadata$og7, _metadata$og8;
|
|
35329
|
+
return ogShowDescription && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og7 = metadata.og) === null || _metadata$og7 === void 0 ? void 0 : _metadata$og7.description) && !isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$og8 = metadata.og) === null || _metadata$og8 === void 0 ? void 0 : _metadata$og8.description);
|
|
35330
|
+
}, [ogShowDescription, metadata === null || metadata === void 0 ? void 0 : (_metadata$og9 = metadata.og) === null || _metadata$og9 === void 0 ? void 0 : _metadata$og9.description]);
|
|
35095
35331
|
var showOGMetadata = React.useMemo(function () {
|
|
35096
|
-
var _metadata$
|
|
35097
|
-
|
|
35098
|
-
|
|
35332
|
+
var _metadata$og0, _metadata$og1, _metadata$og10, _metadata$og11, _metadata$og11$image, _metadata$og11$image$, _metadata$og12, _metadata$og12$favico;
|
|
35333
|
+
var descriptionIsSymbol = isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$og0 = metadata.og) === null || _metadata$og0 === void 0 ? void 0 : _metadata$og0.description);
|
|
35334
|
+
if (descriptionIsSymbol) {
|
|
35335
|
+
return false;
|
|
35336
|
+
}
|
|
35337
|
+
return state !== 'deleted' && ((metadata === null || metadata === void 0 ? void 0 : (_metadata$og1 = metadata.og) === null || _metadata$og1 === void 0 ? void 0 : _metadata$og1.title) || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og10 = metadata.og) === null || _metadata$og10 === void 0 ? void 0 : _metadata$og10.description) || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og11 = metadata.og) === null || _metadata$og11 === void 0 ? void 0 : (_metadata$og11$image = _metadata$og11.image) === null || _metadata$og11$image === void 0 ? void 0 : (_metadata$og11$image$ = _metadata$og11$image[0]) === null || _metadata$og11$image$ === void 0 ? void 0 : _metadata$og11$image$.url) || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og12 = metadata.og) === null || _metadata$og12 === void 0 ? void 0 : (_metadata$og12$favico = _metadata$og12.favicon) === null || _metadata$og12$favico === void 0 ? void 0 : _metadata$og12$favico.url)) && metadata;
|
|
35338
|
+
}, [state, metadata, shouldShowTitle, shouldShowDescription]);
|
|
35099
35339
|
var calculatedImageHeight = React.useMemo(function () {
|
|
35100
35340
|
if (!(metadata !== null && metadata !== void 0 && metadata.imageWidth) || !(metadata !== null && metadata !== void 0 && metadata.imageHeight)) {
|
|
35101
35341
|
return 0;
|
|
@@ -35103,13 +35343,13 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
35103
35343
|
return (metadata === null || metadata === void 0 ? void 0 : metadata.imageHeight) / ((metadata === null || metadata === void 0 ? void 0 : metadata.imageWidth) / maxWidth);
|
|
35104
35344
|
}, [metadata === null || metadata === void 0 ? void 0 : metadata.imageWidth, metadata === null || metadata === void 0 ? void 0 : metadata.imageHeight, maxWidth]);
|
|
35105
35345
|
var hasImage = React.useMemo(function () {
|
|
35106
|
-
var _metadata$
|
|
35107
|
-
return (metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35108
|
-
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35346
|
+
var _metadata$og13, _metadata$og13$image, _metadata$og13$image$;
|
|
35347
|
+
return (metadata === null || metadata === void 0 ? void 0 : (_metadata$og13 = metadata.og) === null || _metadata$og13 === void 0 ? void 0 : (_metadata$og13$image = _metadata$og13.image) === null || _metadata$og13$image === void 0 ? void 0 : (_metadata$og13$image$ = _metadata$og13$image[0]) === null || _metadata$og13$image$ === void 0 ? void 0 : _metadata$og13$image$.url) && !imageLoadError;
|
|
35348
|
+
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$og14 = metadata.og) === null || _metadata$og14 === void 0 ? void 0 : (_metadata$og14$image = _metadata$og14.image) === null || _metadata$og14$image === void 0 ? void 0 : (_metadata$og14$image$ = _metadata$og14$image[0]) === null || _metadata$og14$image$ === void 0 ? void 0 : _metadata$og14$image$.url, imageLoadError]);
|
|
35109
35349
|
var faviconUrl = React.useMemo(function () {
|
|
35110
|
-
var _metadata$
|
|
35111
|
-
return ogShowFavicon && metadata !== null && metadata !== void 0 && metadata.faviconLoaded ? metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35112
|
-
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35350
|
+
var _metadata$og15, _metadata$og15$favico;
|
|
35351
|
+
return ogShowFavicon && metadata !== null && metadata !== void 0 && metadata.faviconLoaded ? metadata === null || metadata === void 0 ? void 0 : (_metadata$og15 = metadata.og) === null || _metadata$og15 === void 0 ? void 0 : (_metadata$og15$favico = _metadata$og15.favicon) === null || _metadata$og15$favico === void 0 ? void 0 : _metadata$og15$favico.url : '';
|
|
35352
|
+
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$og16 = metadata.og) === null || _metadata$og16 === void 0 ? void 0 : (_metadata$og16$favico = _metadata$og16.favicon) === null || _metadata$og16$favico === void 0 ? void 0 : _metadata$og16$favico.url, metadata === null || metadata === void 0 ? void 0 : metadata.faviconLoaded, ogShowFavicon]);
|
|
35113
35353
|
var resolvedOrder = React.useMemo(function () {
|
|
35114
35354
|
return order || {
|
|
35115
35355
|
image: 1,
|
|
@@ -35125,15 +35365,15 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
35125
35365
|
}, [hasImage, calculatedImageHeight]);
|
|
35126
35366
|
React.useEffect(function () {
|
|
35127
35367
|
if (metadataLoaded || oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) {
|
|
35128
|
-
if (oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url] && metadataGetSuccessCallback && metadata) {
|
|
35368
|
+
if (showOGMetadata && oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url] && metadataGetSuccessCallback && metadata) {
|
|
35129
35369
|
metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, true, showImage, metadata);
|
|
35130
35370
|
} else {
|
|
35131
35371
|
metadataGetSuccessCallback === null || metadataGetSuccessCallback === void 0 ? void 0 : metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, false, false, metadata);
|
|
35132
35372
|
}
|
|
35133
35373
|
}
|
|
35134
|
-
}, [metadataLoaded, oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, metadata]);
|
|
35374
|
+
}, [metadataLoaded, oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, metadata, showOGMetadata, showImage]);
|
|
35135
35375
|
var elements = React.useMemo(function () {
|
|
35136
|
-
var _resolvedOrder$image, _metadata$
|
|
35376
|
+
var _resolvedOrder$image, _metadata$og17, _metadata$og17$image, _metadata$og17$image$, _resolvedOrder$title, _metadata$og18, _metadata$og18$title, _resolvedOrder$descri, _metadata$og19, _metadata$og19$descri, _resolvedOrder$link;
|
|
35137
35377
|
return [showImage ? {
|
|
35138
35378
|
key: 'image',
|
|
35139
35379
|
order: (_resolvedOrder$image = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.image) != null ? _resolvedOrder$image : 1,
|
|
@@ -35145,28 +35385,28 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
35145
35385
|
maxWidth: maxWidth,
|
|
35146
35386
|
maxHeight: maxHeight || calculatedImageHeight
|
|
35147
35387
|
}, /*#__PURE__*/React__default.createElement(Img, {
|
|
35148
|
-
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35388
|
+
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$og17 = metadata.og) === null || _metadata$og17 === void 0 ? void 0 : (_metadata$og17$image = _metadata$og17.image) === null || _metadata$og17$image === void 0 ? void 0 : (_metadata$og17$image$ = _metadata$og17$image[0]) === null || _metadata$og17$image$ === void 0 ? void 0 : _metadata$og17$image$.url,
|
|
35149
35389
|
alt: 'OG image',
|
|
35150
35390
|
shouldAnimate: shouldAnimate
|
|
35151
35391
|
})))
|
|
35152
35392
|
} : null, {
|
|
35153
35393
|
key: 'title',
|
|
35154
35394
|
order: (_resolvedOrder$title = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.title) != null ? _resolvedOrder$title : 2,
|
|
35155
|
-
render:
|
|
35395
|
+
render: shouldShowTitle && (/*#__PURE__*/React__default.createElement(Title$3, {
|
|
35156
35396
|
maxWidth: maxWidth,
|
|
35157
35397
|
shouldAnimate: shouldAnimate,
|
|
35158
35398
|
padding: infoPadding,
|
|
35159
35399
|
color: textPrimary
|
|
35160
|
-
}, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35400
|
+
}, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og18 = metadata.og) === null || _metadata$og18 === void 0 ? void 0 : (_metadata$og18$title = _metadata$og18.title) === null || _metadata$og18$title === void 0 ? void 0 : _metadata$og18$title.trim())))
|
|
35161
35401
|
}, {
|
|
35162
35402
|
key: 'description',
|
|
35163
35403
|
order: (_resolvedOrder$descri = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.description) != null ? _resolvedOrder$descri : 3,
|
|
35164
|
-
render:
|
|
35404
|
+
render: shouldShowDescription && (/*#__PURE__*/React__default.createElement(Desc, {
|
|
35165
35405
|
maxWidth: maxWidth,
|
|
35166
35406
|
shouldAnimate: shouldAnimate,
|
|
35167
35407
|
color: textSecondary,
|
|
35168
35408
|
padding: infoPadding
|
|
35169
|
-
}, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35409
|
+
}, metadata === null || metadata === void 0 ? void 0 : (_metadata$og19 = metadata.og) === null || _metadata$og19 === void 0 ? void 0 : (_metadata$og19$descri = _metadata$og19.description) === null || _metadata$og19$descri === void 0 ? void 0 : _metadata$og19$descri.trim()))
|
|
35170
35410
|
}, {
|
|
35171
35411
|
key: 'link',
|
|
35172
35412
|
order: (_resolvedOrder$link = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.link) != null ? _resolvedOrder$link : 4,
|
|
@@ -35181,7 +35421,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
35181
35421
|
var _a$order, _b$order;
|
|
35182
35422
|
return ((_a$order = a.order) != null ? _a$order : 0) - ((_b$order = b.order) != null ? _b$order : 0);
|
|
35183
35423
|
});
|
|
35184
|
-
}, [hasImage, resolvedOrder, showOGMetadata, maxWidth, calculatedImageHeight, maxHeight, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
35424
|
+
}, [hasImage, resolvedOrder, showOGMetadata, maxWidth, calculatedImageHeight, maxHeight, metadata === null || metadata === void 0 ? void 0 : (_metadata$og20 = metadata.og) === null || _metadata$og20 === void 0 ? void 0 : _metadata$og20.image, shouldAnimate, shouldShowTitle, metadata === null || metadata === void 0 ? void 0 : (_metadata$og21 = metadata.og) === null || _metadata$og21 === void 0 ? void 0 : _metadata$og21.title, infoPadding, shouldShowDescription, metadata === null || metadata === void 0 ? void 0 : (_metadata$og22 = metadata.og) === null || _metadata$og22 === void 0 ? void 0 : _metadata$og22.description, textSecondary, ogShowUrl, ogUrl]);
|
|
35185
35425
|
var textContent = React.useMemo(function () {
|
|
35186
35426
|
return /*#__PURE__*/React__default.createElement(OGText, {
|
|
35187
35427
|
shouldAnimate: shouldAnimate,
|
|
@@ -35216,6 +35456,9 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
35216
35456
|
dispatch(getChannelByInviteKeyAC(key));
|
|
35217
35457
|
}
|
|
35218
35458
|
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
35459
|
+
if (!showOGMetadata) {
|
|
35460
|
+
return null;
|
|
35461
|
+
}
|
|
35219
35462
|
return /*#__PURE__*/React__default.createElement(OGMetadataContainer, Object.assign({
|
|
35220
35463
|
showOGMetadata: !!showOGMetadata,
|
|
35221
35464
|
bgColor: incoming ? incomingMessageBackgroundX : outgoingMessageBackgroundX,
|
|
@@ -35563,8 +35806,8 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
35563
35806
|
return (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[linkAttachment.url]) || null;
|
|
35564
35807
|
}, [oGMetadata, linkAttachment === null || linkAttachment === void 0 ? void 0 : linkAttachment.url]);
|
|
35565
35808
|
var ogMetadataContainerWidth = React.useMemo(function () {
|
|
35566
|
-
var _linkMetadata$og, _linkMetadata$og$imag, _linkMetadata$og$imag2, _linkMetadata$og2, _linkMetadata$og3, _linkMetadata$og3$fav;
|
|
35567
|
-
if (!linkMetadata || !linkAttachment) return
|
|
35809
|
+
var _linkMetadata$og, _linkMetadata$og$imag, _linkMetadata$og$imag2, _linkMetadata$og2, _linkMetadata$og3, _linkMetadata$og3$des, _linkMetadata$og4, _linkMetadata$og4$fav;
|
|
35810
|
+
if (!linkMetadata || !linkAttachment) return undefined;
|
|
35568
35811
|
if (hasLongLinkAttachmentUrl) {
|
|
35569
35812
|
return 400;
|
|
35570
35813
|
}
|
|
@@ -35573,8 +35816,11 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
35573
35816
|
var imageHeight = linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.imageHeight;
|
|
35574
35817
|
var calculatedImageHeight = imageWidth && imageHeight ? imageHeight / (imageWidth / ((ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth) || 400)) : 0;
|
|
35575
35818
|
var showImage = hasImage && calculatedImageHeight >= 180 && calculatedImageHeight <= 400;
|
|
35576
|
-
var hasDescription = linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og2 = linkMetadata.og) === null || _linkMetadata$og2 === void 0 ? void 0 : _linkMetadata$og2.description;
|
|
35577
|
-
var hasFavicon = (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogShowFavicon) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.faviconLoaded) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$
|
|
35819
|
+
var hasDescription = !isDescriptionOnlySymbol(linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og2 = linkMetadata.og) === null || _linkMetadata$og2 === void 0 ? void 0 : _linkMetadata$og2.description) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og3 = linkMetadata.og) === null || _linkMetadata$og3 === void 0 ? void 0 : (_linkMetadata$og3$des = _linkMetadata$og3.description) === null || _linkMetadata$og3$des === void 0 ? void 0 : _linkMetadata$og3$des.trim());
|
|
35820
|
+
var hasFavicon = (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogShowFavicon) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.faviconLoaded) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og4 = linkMetadata.og) === null || _linkMetadata$og4 === void 0 ? void 0 : (_linkMetadata$og4$fav = _linkMetadata$og4.favicon) === null || _linkMetadata$og4$fav === void 0 ? void 0 : _linkMetadata$og4$fav.url);
|
|
35821
|
+
if (!hasDescription) {
|
|
35822
|
+
return undefined;
|
|
35823
|
+
}
|
|
35578
35824
|
if (showImage) {
|
|
35579
35825
|
return 400;
|
|
35580
35826
|
}
|
|
@@ -39254,7 +39500,7 @@ function MentionsPlugin(_ref3) {
|
|
|
39254
39500
|
});
|
|
39255
39501
|
}
|
|
39256
39502
|
var MentionsContainerWrapper = styled__default.div(_templateObject$L || (_templateObject$L = _taggedTemplateLiteralLoose(["\n position: relative;\n animation: fadeIn 0.2s ease-in-out;\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n"])));
|
|
39257
|
-
var MentionsList = styled__default.ul(_templateObject2$G || (_templateObject2$G = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom:
|
|
39503
|
+
var MentionsList = styled__default.ul(_templateObject2$G || (_templateObject2$G = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 5px;\n width: 300px;\n transition: all 0.2s;\n overflow: auto;\n max-height: 240px;\n z-index: 200;\n padding: 2px 0 0;\n background: ", ";\n border: ", ";\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: 6px;\n visibility: ", ";\n"])), function (props) {
|
|
39258
39504
|
return props.backgroundColor;
|
|
39259
39505
|
}, function (props) {
|
|
39260
39506
|
return props.withBorder && "1px solid " + props.borderColor;
|