sceyt-chat-react-uikit 1.6.8-beta.7 → 1.6.8-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/index.d.ts +2 -1
- package/index.js +634 -406
- package/index.modern.js +634 -407
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
package/index.js
CHANGED
|
@@ -1053,6 +1053,7 @@ var UPDATE_USER_STATUS_ON_CHANNEL = 'UPDATE_USER_STATUS_ON_CHANNEL';
|
|
|
1053
1053
|
var SET_CHANNEL_LIST_WIDTH = 'SET_CHANNEL_LIST_WIDTH';
|
|
1054
1054
|
var CLEAR_HISTORY = 'CLEAR_HISTORY';
|
|
1055
1055
|
var DELETE_ALL_MESSAGES = 'DELETE_ALL_MESSAGES';
|
|
1056
|
+
var GET_CHANNEL_MENTIONS = 'GET_CHANNEL_MENTIONS';
|
|
1056
1057
|
var DESTROY_SESSION = 'DESTROY_SESSION';
|
|
1057
1058
|
var SET_TAB_IS_ACTIVE = 'SET_TAB_IS_ACTIVE';
|
|
1058
1059
|
var SET_HIDE_CHANNEL_LIST = 'SET_HIDE_CHANNEL_LIST';
|
|
@@ -9757,6 +9758,14 @@ function destroySession() {
|
|
|
9757
9758
|
type: DESTROY_SESSION
|
|
9758
9759
|
};
|
|
9759
9760
|
}
|
|
9761
|
+
function getChannelMentionsAC(channelId) {
|
|
9762
|
+
return {
|
|
9763
|
+
type: GET_CHANNEL_MENTIONS,
|
|
9764
|
+
payload: {
|
|
9765
|
+
channelId: channelId
|
|
9766
|
+
}
|
|
9767
|
+
};
|
|
9768
|
+
}
|
|
9760
9769
|
|
|
9761
9770
|
function sendMessageAC(message, channelId, connectionState, sendAttachmentsAsSeparateMessage, isResend) {
|
|
9762
9771
|
return {
|
|
@@ -12664,7 +12673,18 @@ function watchForEvents() {
|
|
|
12664
12673
|
}
|
|
12665
12674
|
_updatedChannel = JSON.parse(JSON.stringify(_channel10));
|
|
12666
12675
|
_context.next = 327;
|
|
12667
|
-
return effects.put(updateChannelDataAC(_channel10.id,
|
|
12676
|
+
return effects.put(updateChannelDataAC(_channel10.id, {
|
|
12677
|
+
lastMessage: _channel10.lastMessage,
|
|
12678
|
+
newMessageCount: _channel10.newMessageCount,
|
|
12679
|
+
newMentionCount: _channel10.newMentionCount,
|
|
12680
|
+
unread: _channel10.unread,
|
|
12681
|
+
newReactedMessageCount: _channel10.newReactedMessageCount,
|
|
12682
|
+
newReactions: _channel10.newReactions,
|
|
12683
|
+
lastReactedMessage: _channel10.lastReactedMessage,
|
|
12684
|
+
lastReceivedMsgId: _channel10.lastReceivedMsgId,
|
|
12685
|
+
lastDisplayedMessageId: _channel10.lastDisplayedMessageId,
|
|
12686
|
+
messageRetentionPeriod: _channel10.messageRetentionPeriod
|
|
12687
|
+
}));
|
|
12668
12688
|
case 327:
|
|
12669
12689
|
updateChannelOnAllChannels(_channel10.id, _updatedChannel);
|
|
12670
12690
|
case 328:
|
|
@@ -13052,29 +13072,30 @@ var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(createChannel),
|
|
|
13052
13072
|
_marked4 = /*#__PURE__*/_regeneratorRuntime().mark(getChannelsForForward),
|
|
13053
13073
|
_marked5 = /*#__PURE__*/_regeneratorRuntime().mark(searchChannelsForForward),
|
|
13054
13074
|
_marked6 = /*#__PURE__*/_regeneratorRuntime().mark(channelsLoadMore),
|
|
13055
|
-
_marked7 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13056
|
-
_marked8 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13057
|
-
_marked9 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13058
|
-
_marked0 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13059
|
-
_marked1 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13060
|
-
_marked10 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13061
|
-
_marked11 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13062
|
-
_marked12 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13063
|
-
_marked13 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13064
|
-
_marked14 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13065
|
-
_marked15 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13066
|
-
_marked16 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13067
|
-
_marked17 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13068
|
-
_marked18 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13069
|
-
_marked19 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13070
|
-
_marked20 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13071
|
-
_marked21 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13072
|
-
_marked22 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13073
|
-
_marked23 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13074
|
-
_marked24 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13075
|
-
_marked25 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13076
|
-
_marked26 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13077
|
-
_marked27 = /*#__PURE__*/_regeneratorRuntime().mark(
|
|
13075
|
+
_marked7 = /*#__PURE__*/_regeneratorRuntime().mark(getChannelMentions),
|
|
13076
|
+
_marked8 = /*#__PURE__*/_regeneratorRuntime().mark(channelsForForwardLoadMore),
|
|
13077
|
+
_marked9 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesRead),
|
|
13078
|
+
_marked0 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesDelivered),
|
|
13079
|
+
_marked1 = /*#__PURE__*/_regeneratorRuntime().mark(switchChannel),
|
|
13080
|
+
_marked10 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOff),
|
|
13081
|
+
_marked11 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOn),
|
|
13082
|
+
_marked12 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsRead),
|
|
13083
|
+
_marked13 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsUnRead),
|
|
13084
|
+
_marked14 = /*#__PURE__*/_regeneratorRuntime().mark(pinChannel),
|
|
13085
|
+
_marked15 = /*#__PURE__*/_regeneratorRuntime().mark(unpinChannel),
|
|
13086
|
+
_marked16 = /*#__PURE__*/_regeneratorRuntime().mark(removeChannelCaches),
|
|
13087
|
+
_marked17 = /*#__PURE__*/_regeneratorRuntime().mark(leaveChannel),
|
|
13088
|
+
_marked18 = /*#__PURE__*/_regeneratorRuntime().mark(deleteChannel),
|
|
13089
|
+
_marked19 = /*#__PURE__*/_regeneratorRuntime().mark(blockChannel),
|
|
13090
|
+
_marked20 = /*#__PURE__*/_regeneratorRuntime().mark(updateChannel),
|
|
13091
|
+
_marked21 = /*#__PURE__*/_regeneratorRuntime().mark(checkUsersStatus),
|
|
13092
|
+
_marked22 = /*#__PURE__*/_regeneratorRuntime().mark(sendTyping),
|
|
13093
|
+
_marked23 = /*#__PURE__*/_regeneratorRuntime().mark(sendRecording),
|
|
13094
|
+
_marked24 = /*#__PURE__*/_regeneratorRuntime().mark(clearHistory),
|
|
13095
|
+
_marked25 = /*#__PURE__*/_regeneratorRuntime().mark(deleteAllMessages),
|
|
13096
|
+
_marked26 = /*#__PURE__*/_regeneratorRuntime().mark(joinChannel),
|
|
13097
|
+
_marked27 = /*#__PURE__*/_regeneratorRuntime().mark(watchForChannelEvents),
|
|
13098
|
+
_marked28 = /*#__PURE__*/_regeneratorRuntime().mark(ChannelsSaga);
|
|
13078
13099
|
function createChannel(action) {
|
|
13079
13100
|
var payload, channelData, dontCreateIfNotExists, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, checkChannelExist, messageToSend, _allChannels, _memberId;
|
|
13080
13101
|
return _regeneratorRuntime().wrap(function createChannel$(_context) {
|
|
@@ -13814,27 +13835,64 @@ function channelsLoadMore(action) {
|
|
|
13814
13835
|
}
|
|
13815
13836
|
}, _marked6, null, [[0, 28]]);
|
|
13816
13837
|
}
|
|
13817
|
-
function
|
|
13818
|
-
var payload,
|
|
13819
|
-
return _regeneratorRuntime().wrap(function
|
|
13838
|
+
function getChannelMentions(action) {
|
|
13839
|
+
var payload, channelId, SceytChatClient, mentionsQueryBuilder, mentionsQuery, mentions;
|
|
13840
|
+
return _regeneratorRuntime().wrap(function getChannelMentions$(_context7) {
|
|
13820
13841
|
while (1) switch (_context7.prev = _context7.next) {
|
|
13821
13842
|
case 0:
|
|
13822
13843
|
_context7.prev = 0;
|
|
13823
13844
|
payload = action.payload;
|
|
13845
|
+
channelId = payload.channelId;
|
|
13846
|
+
SceytChatClient = getClient();
|
|
13847
|
+
mentionsQueryBuilder = new SceytChatClient.MentionsListQueryBuilder();
|
|
13848
|
+
mentionsQueryBuilder.setChannelId(channelId);
|
|
13849
|
+
mentionsQueryBuilder.limit(10);
|
|
13850
|
+
_context7.next = 9;
|
|
13851
|
+
return effects.call(mentionsQueryBuilder.build);
|
|
13852
|
+
case 9:
|
|
13853
|
+
mentionsQuery = _context7.sent;
|
|
13854
|
+
_context7.next = 12;
|
|
13855
|
+
return effects.call(mentionsQuery.loadNext);
|
|
13856
|
+
case 12:
|
|
13857
|
+
mentions = _context7.sent;
|
|
13858
|
+
_context7.next = 15;
|
|
13859
|
+
return effects.put(updateChannelDataAC(channelId, {
|
|
13860
|
+
mentionsIds: mentions.mentions
|
|
13861
|
+
}));
|
|
13862
|
+
case 15:
|
|
13863
|
+
_context7.next = 20;
|
|
13864
|
+
break;
|
|
13865
|
+
case 17:
|
|
13866
|
+
_context7.prev = 17;
|
|
13867
|
+
_context7.t0 = _context7["catch"](0);
|
|
13868
|
+
log.error(_context7.t0, 'Error in get channel mentions');
|
|
13869
|
+
case 20:
|
|
13870
|
+
case "end":
|
|
13871
|
+
return _context7.stop();
|
|
13872
|
+
}
|
|
13873
|
+
}, _marked7, null, [[0, 17]]);
|
|
13874
|
+
}
|
|
13875
|
+
function channelsForForwardLoadMore(action) {
|
|
13876
|
+
var payload, limit, SceytChatClient, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels;
|
|
13877
|
+
return _regeneratorRuntime().wrap(function channelsForForwardLoadMore$(_context8) {
|
|
13878
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
13879
|
+
case 0:
|
|
13880
|
+
_context8.prev = 0;
|
|
13881
|
+
payload = action.payload;
|
|
13824
13882
|
limit = payload.limit;
|
|
13825
13883
|
SceytChatClient = getClient();
|
|
13826
13884
|
channelQueryForward = query.channelQueryForward;
|
|
13827
13885
|
if (limit) {
|
|
13828
13886
|
channelQueryForward.limit = limit;
|
|
13829
13887
|
}
|
|
13830
|
-
|
|
13888
|
+
_context8.next = 8;
|
|
13831
13889
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
|
|
13832
13890
|
case 8:
|
|
13833
|
-
|
|
13891
|
+
_context8.next = 10;
|
|
13834
13892
|
return effects.call(channelQueryForward.loadNextPage);
|
|
13835
13893
|
case 10:
|
|
13836
|
-
channelsData =
|
|
13837
|
-
|
|
13894
|
+
channelsData = _context8.sent;
|
|
13895
|
+
_context8.next = 13;
|
|
13838
13896
|
return effects.put(channelHasNextAC(channelsData.hasNext, true));
|
|
13839
13897
|
case 13:
|
|
13840
13898
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
@@ -13842,41 +13900,41 @@ function channelsForForwardLoadMore(action) {
|
|
|
13842
13900
|
return member.id && member.id !== SceytChatClient.user.id;
|
|
13843
13901
|
}) : true;
|
|
13844
13902
|
});
|
|
13845
|
-
|
|
13903
|
+
_context8.next = 16;
|
|
13846
13904
|
return effects.call(setChannelsInMap, channelsToAdd);
|
|
13847
13905
|
case 16:
|
|
13848
|
-
_yield$call4 =
|
|
13906
|
+
_yield$call4 = _context8.sent;
|
|
13849
13907
|
mappedChannels = _yield$call4.channels;
|
|
13850
|
-
|
|
13908
|
+
_context8.next = 20;
|
|
13851
13909
|
return effects.put(addChannelsForForwardAC(mappedChannels));
|
|
13852
13910
|
case 20:
|
|
13853
|
-
|
|
13911
|
+
_context8.next = 22;
|
|
13854
13912
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
|
|
13855
13913
|
case 22:
|
|
13856
|
-
|
|
13914
|
+
_context8.next = 27;
|
|
13857
13915
|
break;
|
|
13858
13916
|
case 24:
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
log.error(
|
|
13917
|
+
_context8.prev = 24;
|
|
13918
|
+
_context8.t0 = _context8["catch"](0);
|
|
13919
|
+
log.error(_context8.t0, 'Error in load more channels for forward');
|
|
13862
13920
|
case 27:
|
|
13863
13921
|
case "end":
|
|
13864
|
-
return
|
|
13922
|
+
return _context8.stop();
|
|
13865
13923
|
}
|
|
13866
|
-
},
|
|
13924
|
+
}, _marked8, null, [[0, 24]]);
|
|
13867
13925
|
}
|
|
13868
13926
|
function markMessagesRead(action) {
|
|
13869
13927
|
var payload, channelId, messageIds, channel, messageListMarker, _iterator, _step, messageId, updateParams;
|
|
13870
|
-
return _regeneratorRuntime().wrap(function markMessagesRead$(
|
|
13871
|
-
while (1) switch (
|
|
13928
|
+
return _regeneratorRuntime().wrap(function markMessagesRead$(_context9) {
|
|
13929
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
13872
13930
|
case 0:
|
|
13873
13931
|
payload = action.payload;
|
|
13874
13932
|
channelId = payload.channelId, messageIds = payload.messageIds;
|
|
13875
|
-
|
|
13933
|
+
_context9.next = 4;
|
|
13876
13934
|
return effects.call(getChannelFromMap, channelId);
|
|
13877
13935
|
case 4:
|
|
13878
|
-
channel =
|
|
13879
|
-
|
|
13936
|
+
channel = _context9.sent;
|
|
13937
|
+
_context9.prev = 5;
|
|
13880
13938
|
if (!channel) {
|
|
13881
13939
|
channel = getChannelFromAllChannels(channelId);
|
|
13882
13940
|
if (channel) {
|
|
@@ -13884,14 +13942,14 @@ function markMessagesRead(action) {
|
|
|
13884
13942
|
}
|
|
13885
13943
|
}
|
|
13886
13944
|
if (!channel) {
|
|
13887
|
-
|
|
13945
|
+
_context9.next = 24;
|
|
13888
13946
|
break;
|
|
13889
13947
|
}
|
|
13890
|
-
|
|
13948
|
+
_context9.next = 10;
|
|
13891
13949
|
return effects.call(channel.markMessagesAsDisplayed, messageIds);
|
|
13892
13950
|
case 10:
|
|
13893
|
-
messageListMarker =
|
|
13894
|
-
|
|
13951
|
+
messageListMarker = _context9.sent;
|
|
13952
|
+
_context9.next = 13;
|
|
13895
13953
|
return effects.put(updateChannelDataAC(channel.id, {
|
|
13896
13954
|
lastReadMessageId: channel.lastDisplayedMessageId
|
|
13897
13955
|
}));
|
|
@@ -13902,7 +13960,7 @@ function markMessagesRead(action) {
|
|
|
13902
13960
|
_iterator = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
|
|
13903
13961
|
case 15:
|
|
13904
13962
|
if ((_step = _iterator()).done) {
|
|
13905
|
-
|
|
13963
|
+
_context9.next = 24;
|
|
13906
13964
|
break;
|
|
13907
13965
|
}
|
|
13908
13966
|
messageId = _step.value;
|
|
@@ -13915,7 +13973,7 @@ function markMessagesRead(action) {
|
|
|
13915
13973
|
name: MESSAGE_DELIVERY_STATUS.READ
|
|
13916
13974
|
}]
|
|
13917
13975
|
};
|
|
13918
|
-
|
|
13976
|
+
_context9.next = 20;
|
|
13919
13977
|
return effects.put(updateMessageAC(messageId, updateParams));
|
|
13920
13978
|
case 20:
|
|
13921
13979
|
updateMessageOnMap(channel.id, {
|
|
@@ -13924,33 +13982,33 @@ function markMessagesRead(action) {
|
|
|
13924
13982
|
});
|
|
13925
13983
|
updateMessageOnAllMessages(messageId, updateParams);
|
|
13926
13984
|
case 22:
|
|
13927
|
-
|
|
13985
|
+
_context9.next = 15;
|
|
13928
13986
|
break;
|
|
13929
13987
|
case 24:
|
|
13930
|
-
|
|
13988
|
+
_context9.next = 29;
|
|
13931
13989
|
break;
|
|
13932
13990
|
case 26:
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
log.error(
|
|
13991
|
+
_context9.prev = 26;
|
|
13992
|
+
_context9.t0 = _context9["catch"](5);
|
|
13993
|
+
log.error(_context9.t0, 'Error on mark messages read');
|
|
13936
13994
|
case 29:
|
|
13937
13995
|
case "end":
|
|
13938
|
-
return
|
|
13996
|
+
return _context9.stop();
|
|
13939
13997
|
}
|
|
13940
|
-
},
|
|
13998
|
+
}, _marked9, null, [[5, 26]]);
|
|
13941
13999
|
}
|
|
13942
14000
|
function markMessagesDelivered(action) {
|
|
13943
14001
|
var payload, channelId, messageIds, channel;
|
|
13944
|
-
return _regeneratorRuntime().wrap(function markMessagesDelivered$(
|
|
13945
|
-
while (1) switch (
|
|
14002
|
+
return _regeneratorRuntime().wrap(function markMessagesDelivered$(_context0) {
|
|
14003
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
13946
14004
|
case 0:
|
|
13947
14005
|
payload = action.payload;
|
|
13948
14006
|
channelId = payload.channelId, messageIds = payload.messageIds;
|
|
13949
|
-
|
|
13950
|
-
|
|
14007
|
+
_context0.prev = 2;
|
|
14008
|
+
_context0.next = 5;
|
|
13951
14009
|
return effects.call(getChannelFromMap, channelId);
|
|
13952
14010
|
case 5:
|
|
13953
|
-
channel =
|
|
14011
|
+
channel = _context0.sent;
|
|
13954
14012
|
if (!channel) {
|
|
13955
14013
|
channel = getChannelFromAllChannels(channelId);
|
|
13956
14014
|
if (channel) {
|
|
@@ -13958,203 +14016,203 @@ function markMessagesDelivered(action) {
|
|
|
13958
14016
|
}
|
|
13959
14017
|
}
|
|
13960
14018
|
if (!channel) {
|
|
13961
|
-
|
|
14019
|
+
_context0.next = 11;
|
|
13962
14020
|
break;
|
|
13963
14021
|
}
|
|
13964
14022
|
log.info('send delivered marker ', messageIds);
|
|
13965
|
-
|
|
14023
|
+
_context0.next = 11;
|
|
13966
14024
|
return effects.call(channel.markMessagesAsReceived, messageIds);
|
|
13967
14025
|
case 11:
|
|
13968
|
-
|
|
14026
|
+
_context0.next = 16;
|
|
13969
14027
|
break;
|
|
13970
14028
|
case 13:
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
log.error(
|
|
14029
|
+
_context0.prev = 13;
|
|
14030
|
+
_context0.t0 = _context0["catch"](2);
|
|
14031
|
+
log.error(_context0.t0, 'Error on mark messages delivered');
|
|
13974
14032
|
case 16:
|
|
13975
14033
|
case "end":
|
|
13976
|
-
return
|
|
14034
|
+
return _context0.stop();
|
|
13977
14035
|
}
|
|
13978
|
-
},
|
|
14036
|
+
}, _marked0, null, [[2, 13]]);
|
|
13979
14037
|
}
|
|
13980
14038
|
function switchChannel(action) {
|
|
13981
14039
|
var payload, channel, channelToSwitch, existingChannel, addChannel, SceytChatClient, fetchedChannel, channelFromMap, currentActiveChannel;
|
|
13982
|
-
return _regeneratorRuntime().wrap(function switchChannel$(
|
|
13983
|
-
while (1) switch (
|
|
14040
|
+
return _regeneratorRuntime().wrap(function switchChannel$(_context1) {
|
|
14041
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
13984
14042
|
case 0:
|
|
13985
|
-
|
|
14043
|
+
_context1.prev = 0;
|
|
13986
14044
|
payload = action.payload;
|
|
13987
14045
|
channel = payload.channel;
|
|
13988
14046
|
channelToSwitch = channel;
|
|
13989
14047
|
if (channel !== null && channel !== void 0 && channel.id) {
|
|
13990
|
-
|
|
14048
|
+
_context1.next = 10;
|
|
13991
14049
|
break;
|
|
13992
14050
|
}
|
|
13993
|
-
|
|
14051
|
+
_context1.next = 7;
|
|
13994
14052
|
return effects.call(setActiveChannelId, '');
|
|
13995
14053
|
case 7:
|
|
13996
|
-
|
|
14054
|
+
_context1.next = 9;
|
|
13997
14055
|
return effects.put(setActiveChannelAC({}));
|
|
13998
14056
|
case 9:
|
|
13999
|
-
return
|
|
14057
|
+
return _context1.abrupt("return");
|
|
14000
14058
|
case 10:
|
|
14001
14059
|
existingChannel = checkChannelExists(channel.id);
|
|
14002
14060
|
if (existingChannel) {
|
|
14003
|
-
|
|
14061
|
+
_context1.next = 31;
|
|
14004
14062
|
break;
|
|
14005
14063
|
}
|
|
14006
14064
|
addChannel = getChannelFromAllChannels(channel.id);
|
|
14007
14065
|
if (!addChannel) {
|
|
14008
|
-
|
|
14066
|
+
_context1.next = 20;
|
|
14009
14067
|
break;
|
|
14010
14068
|
}
|
|
14011
14069
|
setChannelInMap(addChannel);
|
|
14012
|
-
|
|
14070
|
+
_context1.next = 17;
|
|
14013
14071
|
return effects.put(addChannelAC(JSON.parse(JSON.stringify(addChannel))));
|
|
14014
14072
|
case 17:
|
|
14015
14073
|
channelToSwitch = _extends({}, channelToSwitch, addChannel);
|
|
14016
|
-
|
|
14074
|
+
_context1.next = 29;
|
|
14017
14075
|
break;
|
|
14018
14076
|
case 20:
|
|
14019
14077
|
SceytChatClient = getClient();
|
|
14020
|
-
|
|
14078
|
+
_context1.next = 23;
|
|
14021
14079
|
return effects.call(SceytChatClient.getChannel, channel.id);
|
|
14022
14080
|
case 23:
|
|
14023
|
-
fetchedChannel =
|
|
14081
|
+
fetchedChannel = _context1.sent;
|
|
14024
14082
|
addChannelToAllChannels(fetchedChannel);
|
|
14025
14083
|
setChannelInMap(fetchedChannel);
|
|
14026
|
-
|
|
14084
|
+
_context1.next = 28;
|
|
14027
14085
|
return effects.put(addChannelAC(JSON.parse(JSON.stringify(fetchedChannel))));
|
|
14028
14086
|
case 28:
|
|
14029
14087
|
channelToSwitch = _extends({}, channelToSwitch, fetchedChannel);
|
|
14030
14088
|
case 29:
|
|
14031
|
-
|
|
14089
|
+
_context1.next = 33;
|
|
14032
14090
|
break;
|
|
14033
14091
|
case 31:
|
|
14034
14092
|
channelFromMap = getChannelFromMap(channel.id);
|
|
14035
14093
|
channelToSwitch = _extends({}, channelToSwitch, channelFromMap);
|
|
14036
14094
|
case 33:
|
|
14037
14095
|
currentActiveChannel = getChannelFromMap(getActiveChannelId());
|
|
14038
|
-
|
|
14096
|
+
_context1.next = 36;
|
|
14039
14097
|
return effects.call(setUnreadScrollTo, true);
|
|
14040
14098
|
case 36:
|
|
14041
|
-
|
|
14099
|
+
_context1.next = 38;
|
|
14042
14100
|
return effects.call(setActiveChannelId, channel && channel.id);
|
|
14043
14101
|
case 38:
|
|
14044
14102
|
if (channel.isLinkedChannel) {
|
|
14045
14103
|
channelToSwitch.linkedFrom = currentActiveChannel;
|
|
14046
14104
|
}
|
|
14047
|
-
|
|
14105
|
+
_context1.next = 41;
|
|
14048
14106
|
return effects.put(setActiveChannelAC(_extends({}, channelToSwitch)));
|
|
14049
14107
|
case 41:
|
|
14050
|
-
|
|
14108
|
+
_context1.next = 47;
|
|
14051
14109
|
break;
|
|
14052
14110
|
case 44:
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
log.error('error in switch channel',
|
|
14111
|
+
_context1.prev = 44;
|
|
14112
|
+
_context1.t0 = _context1["catch"](0);
|
|
14113
|
+
log.error('error in switch channel', _context1.t0);
|
|
14056
14114
|
case 47:
|
|
14057
14115
|
case "end":
|
|
14058
|
-
return
|
|
14116
|
+
return _context1.stop();
|
|
14059
14117
|
}
|
|
14060
|
-
},
|
|
14118
|
+
}, _marked1, null, [[0, 44]]);
|
|
14061
14119
|
}
|
|
14062
14120
|
function notificationsTurnOff(action) {
|
|
14063
14121
|
var expireTime, activeChannelId, channel, updatedChannel;
|
|
14064
|
-
return _regeneratorRuntime().wrap(function notificationsTurnOff$(
|
|
14065
|
-
while (1) switch (
|
|
14122
|
+
return _regeneratorRuntime().wrap(function notificationsTurnOff$(_context10) {
|
|
14123
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
14066
14124
|
case 0:
|
|
14067
14125
|
expireTime = action.payload.expireTime;
|
|
14068
|
-
|
|
14126
|
+
_context10.next = 3;
|
|
14069
14127
|
return effects.call(getActiveChannelId);
|
|
14070
14128
|
case 3:
|
|
14071
|
-
activeChannelId =
|
|
14072
|
-
|
|
14129
|
+
activeChannelId = _context10.sent;
|
|
14130
|
+
_context10.next = 6;
|
|
14073
14131
|
return effects.call(getChannelFromMap, activeChannelId);
|
|
14074
14132
|
case 6:
|
|
14075
|
-
channel =
|
|
14076
|
-
|
|
14077
|
-
|
|
14133
|
+
channel = _context10.sent;
|
|
14134
|
+
_context10.prev = 7;
|
|
14135
|
+
_context10.next = 10;
|
|
14078
14136
|
return effects.call(channel.mute, expireTime);
|
|
14079
14137
|
case 10:
|
|
14080
|
-
updatedChannel =
|
|
14138
|
+
updatedChannel = _context10.sent;
|
|
14081
14139
|
updateChannelOnAllChannels(channel.id, {
|
|
14082
14140
|
muted: updatedChannel.muted,
|
|
14083
14141
|
mutedTill: updatedChannel.mutedTill
|
|
14084
14142
|
});
|
|
14085
|
-
|
|
14143
|
+
_context10.next = 14;
|
|
14086
14144
|
return effects.put(updateChannelDataAC(updatedChannel.id, {
|
|
14087
14145
|
muted: updatedChannel.muted,
|
|
14088
14146
|
mutedTill: updatedChannel.mutedTill
|
|
14089
14147
|
}));
|
|
14090
14148
|
case 14:
|
|
14091
|
-
|
|
14149
|
+
_context10.next = 19;
|
|
14092
14150
|
break;
|
|
14093
14151
|
case 16:
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
log.error('ERROR turn off notifications',
|
|
14152
|
+
_context10.prev = 16;
|
|
14153
|
+
_context10.t0 = _context10["catch"](7);
|
|
14154
|
+
log.error('ERROR turn off notifications', _context10.t0.message);
|
|
14097
14155
|
case 19:
|
|
14098
14156
|
case "end":
|
|
14099
|
-
return
|
|
14157
|
+
return _context10.stop();
|
|
14100
14158
|
}
|
|
14101
|
-
},
|
|
14159
|
+
}, _marked10, null, [[7, 16]]);
|
|
14102
14160
|
}
|
|
14103
14161
|
function notificationsTurnOn() {
|
|
14104
14162
|
var activeChannelId, channel, updatedChannel;
|
|
14105
|
-
return _regeneratorRuntime().wrap(function notificationsTurnOn$(
|
|
14106
|
-
while (1) switch (
|
|
14163
|
+
return _regeneratorRuntime().wrap(function notificationsTurnOn$(_context11) {
|
|
14164
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
14107
14165
|
case 0:
|
|
14108
|
-
|
|
14166
|
+
_context11.next = 2;
|
|
14109
14167
|
return effects.call(getActiveChannelId);
|
|
14110
14168
|
case 2:
|
|
14111
|
-
activeChannelId =
|
|
14112
|
-
|
|
14169
|
+
activeChannelId = _context11.sent;
|
|
14170
|
+
_context11.next = 5;
|
|
14113
14171
|
return effects.call(getChannelFromMap, activeChannelId);
|
|
14114
14172
|
case 5:
|
|
14115
|
-
channel =
|
|
14116
|
-
|
|
14117
|
-
|
|
14173
|
+
channel = _context11.sent;
|
|
14174
|
+
_context11.prev = 6;
|
|
14175
|
+
_context11.next = 9;
|
|
14118
14176
|
return effects.call(channel.unmute);
|
|
14119
14177
|
case 9:
|
|
14120
|
-
updatedChannel =
|
|
14178
|
+
updatedChannel = _context11.sent;
|
|
14121
14179
|
updateChannelOnAllChannels(channel.id, {
|
|
14122
14180
|
muted: updatedChannel.muted,
|
|
14123
14181
|
mutedTill: updatedChannel.mutedTill
|
|
14124
14182
|
});
|
|
14125
|
-
|
|
14183
|
+
_context11.next = 13;
|
|
14126
14184
|
return effects.put(updateChannelDataAC(updatedChannel.id, {
|
|
14127
14185
|
muted: updatedChannel.muted,
|
|
14128
14186
|
mutedTill: updatedChannel.mutedTill
|
|
14129
14187
|
}));
|
|
14130
14188
|
case 13:
|
|
14131
|
-
|
|
14189
|
+
_context11.next = 18;
|
|
14132
14190
|
break;
|
|
14133
14191
|
case 15:
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
log.error('ERROR turn on notifications: ',
|
|
14192
|
+
_context11.prev = 15;
|
|
14193
|
+
_context11.t0 = _context11["catch"](6);
|
|
14194
|
+
log.error('ERROR turn on notifications: ', _context11.t0.message);
|
|
14137
14195
|
case 18:
|
|
14138
14196
|
case "end":
|
|
14139
|
-
return
|
|
14197
|
+
return _context11.stop();
|
|
14140
14198
|
}
|
|
14141
|
-
},
|
|
14199
|
+
}, _marked11, null, [[6, 15]]);
|
|
14142
14200
|
}
|
|
14143
14201
|
function markChannelAsRead(action) {
|
|
14144
14202
|
var channelId, channel, updateData;
|
|
14145
|
-
return _regeneratorRuntime().wrap(function markChannelAsRead$(
|
|
14146
|
-
while (1) switch (
|
|
14203
|
+
return _regeneratorRuntime().wrap(function markChannelAsRead$(_context12) {
|
|
14204
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
14147
14205
|
case 0:
|
|
14148
|
-
|
|
14206
|
+
_context12.prev = 0;
|
|
14149
14207
|
channelId = action.payload.channelId;
|
|
14150
|
-
|
|
14208
|
+
_context12.next = 4;
|
|
14151
14209
|
return effects.call(getChannelFromMap, channelId);
|
|
14152
14210
|
case 4:
|
|
14153
|
-
channel =
|
|
14211
|
+
channel = _context12.sent;
|
|
14154
14212
|
if (!channel) {
|
|
14155
14213
|
channel = getChannelFromAllChannels(channelId);
|
|
14156
14214
|
}
|
|
14157
|
-
|
|
14215
|
+
_context12.next = 8;
|
|
14158
14216
|
return effects.call(channel.markAsRead);
|
|
14159
14217
|
case 8:
|
|
14160
14218
|
updateData = {
|
|
@@ -14163,316 +14221,316 @@ function markChannelAsRead(action) {
|
|
|
14163
14221
|
newMentionCount: 0
|
|
14164
14222
|
};
|
|
14165
14223
|
updateChannelOnAllChannels(channel.id, updateData);
|
|
14166
|
-
|
|
14224
|
+
_context12.next = 12;
|
|
14167
14225
|
return effects.put(updateChannelDataAC(channel.id, updateData));
|
|
14168
14226
|
case 12:
|
|
14169
|
-
|
|
14227
|
+
_context12.next = 17;
|
|
14170
14228
|
break;
|
|
14171
14229
|
case 14:
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
log.error(
|
|
14230
|
+
_context12.prev = 14;
|
|
14231
|
+
_context12.t0 = _context12["catch"](0);
|
|
14232
|
+
log.error(_context12.t0, 'Error in set channel unread');
|
|
14175
14233
|
case 17:
|
|
14176
14234
|
case "end":
|
|
14177
|
-
return
|
|
14235
|
+
return _context12.stop();
|
|
14178
14236
|
}
|
|
14179
|
-
},
|
|
14237
|
+
}, _marked12, null, [[0, 14]]);
|
|
14180
14238
|
}
|
|
14181
14239
|
function markChannelAsUnRead(action) {
|
|
14182
14240
|
var channelId, channel;
|
|
14183
|
-
return _regeneratorRuntime().wrap(function markChannelAsUnRead$(
|
|
14184
|
-
while (1) switch (
|
|
14241
|
+
return _regeneratorRuntime().wrap(function markChannelAsUnRead$(_context13) {
|
|
14242
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
14185
14243
|
case 0:
|
|
14186
|
-
|
|
14244
|
+
_context13.prev = 0;
|
|
14187
14245
|
channelId = action.payload.channelId;
|
|
14188
|
-
|
|
14246
|
+
_context13.next = 4;
|
|
14189
14247
|
return effects.call(getChannelFromMap, channelId);
|
|
14190
14248
|
case 4:
|
|
14191
|
-
channel =
|
|
14249
|
+
channel = _context13.sent;
|
|
14192
14250
|
if (!channel) {
|
|
14193
14251
|
channel = getChannelFromAllChannels(channelId);
|
|
14194
14252
|
}
|
|
14195
|
-
|
|
14253
|
+
_context13.next = 8;
|
|
14196
14254
|
return effects.call(channel.markAsUnRead);
|
|
14197
14255
|
case 8:
|
|
14198
14256
|
updateChannelOnAllChannels(channel.id, {
|
|
14199
14257
|
unread: true
|
|
14200
14258
|
});
|
|
14201
|
-
|
|
14259
|
+
_context13.next = 11;
|
|
14202
14260
|
return effects.put(updateChannelDataAC(channel.id, {
|
|
14203
14261
|
unread: true
|
|
14204
14262
|
}));
|
|
14205
14263
|
case 11:
|
|
14206
|
-
|
|
14264
|
+
_context13.next = 16;
|
|
14207
14265
|
break;
|
|
14208
14266
|
case 13:
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
log.error(
|
|
14267
|
+
_context13.prev = 13;
|
|
14268
|
+
_context13.t0 = _context13["catch"](0);
|
|
14269
|
+
log.error(_context13.t0, 'Error in set channel unread');
|
|
14212
14270
|
case 16:
|
|
14213
14271
|
case "end":
|
|
14214
|
-
return
|
|
14272
|
+
return _context13.stop();
|
|
14215
14273
|
}
|
|
14216
|
-
},
|
|
14274
|
+
}, _marked13, null, [[0, 13]]);
|
|
14217
14275
|
}
|
|
14218
14276
|
function pinChannel(action) {
|
|
14219
14277
|
var channelId, channel, updatedChannel;
|
|
14220
|
-
return _regeneratorRuntime().wrap(function pinChannel$(
|
|
14221
|
-
while (1) switch (
|
|
14278
|
+
return _regeneratorRuntime().wrap(function pinChannel$(_context14) {
|
|
14279
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
14222
14280
|
case 0:
|
|
14223
|
-
|
|
14281
|
+
_context14.prev = 0;
|
|
14224
14282
|
channelId = action.payload.channelId;
|
|
14225
|
-
|
|
14283
|
+
_context14.next = 4;
|
|
14226
14284
|
return effects.call(getChannelFromMap, channelId);
|
|
14227
14285
|
case 4:
|
|
14228
|
-
channel =
|
|
14286
|
+
channel = _context14.sent;
|
|
14229
14287
|
if (!channel) {
|
|
14230
14288
|
channel = getChannelFromAllChannels(channelId);
|
|
14231
14289
|
}
|
|
14232
|
-
|
|
14290
|
+
_context14.next = 8;
|
|
14233
14291
|
return effects.call(channel.pin);
|
|
14234
14292
|
case 8:
|
|
14235
|
-
updatedChannel =
|
|
14293
|
+
updatedChannel = _context14.sent;
|
|
14236
14294
|
updateChannelOnAllChannels(channel.id, {
|
|
14237
14295
|
pinnedAt: updatedChannel.pinnedAt
|
|
14238
14296
|
});
|
|
14239
|
-
|
|
14297
|
+
_context14.next = 12;
|
|
14240
14298
|
return effects.put(updateChannelDataAC(updatedChannel.id, {
|
|
14241
14299
|
pinnedAt: updatedChannel.pinnedAt
|
|
14242
14300
|
}, true));
|
|
14243
14301
|
case 12:
|
|
14244
|
-
|
|
14302
|
+
_context14.next = 17;
|
|
14245
14303
|
break;
|
|
14246
14304
|
case 14:
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
log.error(
|
|
14305
|
+
_context14.prev = 14;
|
|
14306
|
+
_context14.t0 = _context14["catch"](0);
|
|
14307
|
+
log.error(_context14.t0, 'Error in pinChannel');
|
|
14250
14308
|
case 17:
|
|
14251
14309
|
case "end":
|
|
14252
|
-
return
|
|
14310
|
+
return _context14.stop();
|
|
14253
14311
|
}
|
|
14254
|
-
},
|
|
14312
|
+
}, _marked14, null, [[0, 14]]);
|
|
14255
14313
|
}
|
|
14256
14314
|
function unpinChannel(action) {
|
|
14257
14315
|
var channelId, channel, updatedChannel;
|
|
14258
|
-
return _regeneratorRuntime().wrap(function unpinChannel$(
|
|
14259
|
-
while (1) switch (
|
|
14316
|
+
return _regeneratorRuntime().wrap(function unpinChannel$(_context15) {
|
|
14317
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
14260
14318
|
case 0:
|
|
14261
|
-
|
|
14319
|
+
_context15.prev = 0;
|
|
14262
14320
|
channelId = action.payload.channelId;
|
|
14263
|
-
|
|
14321
|
+
_context15.next = 4;
|
|
14264
14322
|
return effects.call(getChannelFromMap, channelId);
|
|
14265
14323
|
case 4:
|
|
14266
|
-
channel =
|
|
14324
|
+
channel = _context15.sent;
|
|
14267
14325
|
if (!channel) {
|
|
14268
14326
|
channel = getChannelFromAllChannels(channelId);
|
|
14269
14327
|
}
|
|
14270
|
-
|
|
14328
|
+
_context15.next = 8;
|
|
14271
14329
|
return effects.call(channel.unpin);
|
|
14272
14330
|
case 8:
|
|
14273
|
-
updatedChannel =
|
|
14331
|
+
updatedChannel = _context15.sent;
|
|
14274
14332
|
updateChannelOnAllChannels(channel.id, {
|
|
14275
14333
|
pinnedAt: updatedChannel.pinnedAt
|
|
14276
14334
|
});
|
|
14277
|
-
|
|
14335
|
+
_context15.next = 12;
|
|
14278
14336
|
return effects.put(updateChannelDataAC(updatedChannel.id, {
|
|
14279
14337
|
pinnedAt: updatedChannel.pinnedAt
|
|
14280
14338
|
}, false, true));
|
|
14281
14339
|
case 12:
|
|
14282
|
-
|
|
14340
|
+
_context15.next = 17;
|
|
14283
14341
|
break;
|
|
14284
14342
|
case 14:
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
log.error(
|
|
14343
|
+
_context15.prev = 14;
|
|
14344
|
+
_context15.t0 = _context15["catch"](0);
|
|
14345
|
+
log.error(_context15.t0, 'Error in unpinChannel');
|
|
14288
14346
|
case 17:
|
|
14289
14347
|
case "end":
|
|
14290
|
-
return
|
|
14348
|
+
return _context15.stop();
|
|
14291
14349
|
}
|
|
14292
|
-
},
|
|
14350
|
+
}, _marked15, null, [[0, 14]]);
|
|
14293
14351
|
}
|
|
14294
14352
|
function removeChannelCaches(action) {
|
|
14295
14353
|
var payload, channelId, activeChannelId, activeChannel;
|
|
14296
|
-
return _regeneratorRuntime().wrap(function removeChannelCaches$(
|
|
14297
|
-
while (1) switch (
|
|
14354
|
+
return _regeneratorRuntime().wrap(function removeChannelCaches$(_context16) {
|
|
14355
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
14298
14356
|
case 0:
|
|
14299
14357
|
payload = action.payload;
|
|
14300
14358
|
channelId = payload.channelId;
|
|
14301
|
-
|
|
14359
|
+
_context16.next = 4;
|
|
14302
14360
|
return effects.call(getActiveChannelId);
|
|
14303
14361
|
case 4:
|
|
14304
|
-
activeChannelId =
|
|
14362
|
+
activeChannelId = _context16.sent;
|
|
14305
14363
|
removeChannelFromMap(channelId);
|
|
14306
14364
|
removeMessagesFromMap(channelId);
|
|
14307
14365
|
if (!(activeChannelId === channelId)) {
|
|
14308
|
-
|
|
14366
|
+
_context16.next = 14;
|
|
14309
14367
|
break;
|
|
14310
14368
|
}
|
|
14311
|
-
|
|
14369
|
+
_context16.next = 10;
|
|
14312
14370
|
return effects.call(getLastChannelFromMap);
|
|
14313
14371
|
case 10:
|
|
14314
|
-
activeChannel =
|
|
14372
|
+
activeChannel = _context16.sent;
|
|
14315
14373
|
if (!activeChannel) {
|
|
14316
|
-
|
|
14374
|
+
_context16.next = 14;
|
|
14317
14375
|
break;
|
|
14318
14376
|
}
|
|
14319
|
-
|
|
14377
|
+
_context16.next = 14;
|
|
14320
14378
|
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
|
|
14321
14379
|
case 14:
|
|
14322
14380
|
case "end":
|
|
14323
|
-
return
|
|
14381
|
+
return _context16.stop();
|
|
14324
14382
|
}
|
|
14325
|
-
},
|
|
14383
|
+
}, _marked16);
|
|
14326
14384
|
}
|
|
14327
14385
|
function leaveChannel(action) {
|
|
14328
14386
|
var payload, channelId, channel, messageBuilder, messageToSend;
|
|
14329
|
-
return _regeneratorRuntime().wrap(function leaveChannel$(
|
|
14330
|
-
while (1) switch (
|
|
14387
|
+
return _regeneratorRuntime().wrap(function leaveChannel$(_context17) {
|
|
14388
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
14331
14389
|
case 0:
|
|
14332
|
-
|
|
14390
|
+
_context17.prev = 0;
|
|
14333
14391
|
payload = action.payload;
|
|
14334
14392
|
channelId = payload.channelId;
|
|
14335
|
-
|
|
14393
|
+
_context17.next = 5;
|
|
14336
14394
|
return effects.call(getChannelFromMap, channelId);
|
|
14337
14395
|
case 5:
|
|
14338
|
-
channel =
|
|
14396
|
+
channel = _context17.sent;
|
|
14339
14397
|
if (!channel) {
|
|
14340
14398
|
channel = getChannelFromAllChannels(channelId);
|
|
14341
14399
|
}
|
|
14342
14400
|
if (!channel) {
|
|
14343
|
-
|
|
14401
|
+
_context17.next = 24;
|
|
14344
14402
|
break;
|
|
14345
14403
|
}
|
|
14346
14404
|
if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
|
|
14347
|
-
|
|
14405
|
+
_context17.next = 16;
|
|
14348
14406
|
break;
|
|
14349
14407
|
}
|
|
14350
14408
|
messageBuilder = channel.createMessageBuilder();
|
|
14351
14409
|
messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
|
|
14352
14410
|
messageToSend = messageBuilder.create();
|
|
14353
14411
|
log.info('send message for left');
|
|
14354
|
-
|
|
14412
|
+
_context17.next = 16;
|
|
14355
14413
|
return effects.call(channel.sendMessage, messageToSend);
|
|
14356
14414
|
case 16:
|
|
14357
14415
|
log.info('leave');
|
|
14358
|
-
|
|
14416
|
+
_context17.next = 19;
|
|
14359
14417
|
return effects.call(channel.leave);
|
|
14360
14418
|
case 19:
|
|
14361
|
-
|
|
14419
|
+
_context17.next = 21;
|
|
14362
14420
|
return effects.put(removeChannelAC(channelId));
|
|
14363
14421
|
case 21:
|
|
14364
14422
|
deleteChannelFromAllChannels(channelId);
|
|
14365
|
-
|
|
14423
|
+
_context17.next = 24;
|
|
14366
14424
|
return effects.put(removeChannelCachesAC(channelId));
|
|
14367
14425
|
case 24:
|
|
14368
|
-
|
|
14426
|
+
_context17.next = 29;
|
|
14369
14427
|
break;
|
|
14370
14428
|
case 26:
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
log.error('ERROR in leave channel - ',
|
|
14429
|
+
_context17.prev = 26;
|
|
14430
|
+
_context17.t0 = _context17["catch"](0);
|
|
14431
|
+
log.error('ERROR in leave channel - ', _context17.t0.message);
|
|
14374
14432
|
case 29:
|
|
14375
14433
|
case "end":
|
|
14376
|
-
return
|
|
14434
|
+
return _context17.stop();
|
|
14377
14435
|
}
|
|
14378
|
-
},
|
|
14436
|
+
}, _marked17, null, [[0, 26]]);
|
|
14379
14437
|
}
|
|
14380
14438
|
function deleteChannel(action) {
|
|
14381
14439
|
var payload, channelId, channel;
|
|
14382
|
-
return _regeneratorRuntime().wrap(function deleteChannel$(
|
|
14383
|
-
while (1) switch (
|
|
14440
|
+
return _regeneratorRuntime().wrap(function deleteChannel$(_context18) {
|
|
14441
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
14384
14442
|
case 0:
|
|
14385
|
-
|
|
14443
|
+
_context18.prev = 0;
|
|
14386
14444
|
payload = action.payload;
|
|
14387
14445
|
channelId = payload.channelId;
|
|
14388
|
-
|
|
14446
|
+
_context18.next = 5;
|
|
14389
14447
|
return effects.call(getChannelFromMap, channelId);
|
|
14390
14448
|
case 5:
|
|
14391
|
-
channel =
|
|
14449
|
+
channel = _context18.sent;
|
|
14392
14450
|
if (!channel) {
|
|
14393
14451
|
channel = getChannelFromAllChannels(channelId);
|
|
14394
14452
|
}
|
|
14395
14453
|
if (!channel) {
|
|
14396
|
-
|
|
14454
|
+
_context18.next = 16;
|
|
14397
14455
|
break;
|
|
14398
14456
|
}
|
|
14399
|
-
|
|
14457
|
+
_context18.next = 10;
|
|
14400
14458
|
return effects.call(channel["delete"]);
|
|
14401
14459
|
case 10:
|
|
14402
|
-
|
|
14460
|
+
_context18.next = 12;
|
|
14403
14461
|
return effects.put(setChannelToRemoveAC(channel));
|
|
14404
14462
|
case 12:
|
|
14405
|
-
|
|
14463
|
+
_context18.next = 14;
|
|
14406
14464
|
return effects.put(removeChannelAC(channelId));
|
|
14407
14465
|
case 14:
|
|
14408
|
-
|
|
14466
|
+
_context18.next = 16;
|
|
14409
14467
|
return effects.put(removeChannelCachesAC(channelId));
|
|
14410
14468
|
case 16:
|
|
14411
|
-
|
|
14469
|
+
_context18.next = 21;
|
|
14412
14470
|
break;
|
|
14413
14471
|
case 18:
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
log.error('ERROR in delete channel',
|
|
14472
|
+
_context18.prev = 18;
|
|
14473
|
+
_context18.t0 = _context18["catch"](0);
|
|
14474
|
+
log.error('ERROR in delete channel', _context18.t0);
|
|
14417
14475
|
case 21:
|
|
14418
14476
|
case "end":
|
|
14419
|
-
return
|
|
14477
|
+
return _context18.stop();
|
|
14420
14478
|
}
|
|
14421
|
-
},
|
|
14479
|
+
}, _marked18, null, [[0, 18]]);
|
|
14422
14480
|
}
|
|
14423
14481
|
function blockChannel(action) {
|
|
14424
14482
|
var payload, channelId, channel;
|
|
14425
|
-
return _regeneratorRuntime().wrap(function blockChannel$(
|
|
14426
|
-
while (1) switch (
|
|
14483
|
+
return _regeneratorRuntime().wrap(function blockChannel$(_context19) {
|
|
14484
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
14427
14485
|
case 0:
|
|
14428
|
-
|
|
14486
|
+
_context19.prev = 0;
|
|
14429
14487
|
payload = action.payload;
|
|
14430
14488
|
channelId = payload.channelId;
|
|
14431
|
-
|
|
14489
|
+
_context19.next = 5;
|
|
14432
14490
|
return effects.call(getChannelFromMap, channelId);
|
|
14433
14491
|
case 5:
|
|
14434
|
-
channel =
|
|
14492
|
+
channel = _context19.sent;
|
|
14435
14493
|
if (!channel) {
|
|
14436
14494
|
channel = getChannelFromAllChannels(channelId);
|
|
14437
14495
|
}
|
|
14438
14496
|
if (!channel) {
|
|
14439
|
-
|
|
14497
|
+
_context19.next = 14;
|
|
14440
14498
|
break;
|
|
14441
14499
|
}
|
|
14442
|
-
|
|
14500
|
+
_context19.next = 10;
|
|
14443
14501
|
return effects.call(channel.block);
|
|
14444
14502
|
case 10:
|
|
14445
|
-
|
|
14503
|
+
_context19.next = 12;
|
|
14446
14504
|
return effects.put(removeChannelAC(channelId));
|
|
14447
14505
|
case 12:
|
|
14448
|
-
|
|
14506
|
+
_context19.next = 14;
|
|
14449
14507
|
return effects.put(removeChannelCachesAC(channelId));
|
|
14450
14508
|
case 14:
|
|
14451
|
-
|
|
14509
|
+
_context19.next = 19;
|
|
14452
14510
|
break;
|
|
14453
14511
|
case 16:
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
log.error('ERROR in block channel - ',
|
|
14512
|
+
_context19.prev = 16;
|
|
14513
|
+
_context19.t0 = _context19["catch"](0);
|
|
14514
|
+
log.error('ERROR in block channel - ', _context19.t0.message);
|
|
14457
14515
|
case 19:
|
|
14458
14516
|
case "end":
|
|
14459
|
-
return
|
|
14517
|
+
return _context19.stop();
|
|
14460
14518
|
}
|
|
14461
|
-
},
|
|
14519
|
+
}, _marked19, null, [[0, 16]]);
|
|
14462
14520
|
}
|
|
14463
14521
|
function updateChannel(action) {
|
|
14464
14522
|
var payload, channelId, config, SceytChatClient, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata;
|
|
14465
|
-
return _regeneratorRuntime().wrap(function updateChannel$(
|
|
14466
|
-
while (1) switch (
|
|
14523
|
+
return _regeneratorRuntime().wrap(function updateChannel$(_context20) {
|
|
14524
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
14467
14525
|
case 0:
|
|
14468
|
-
|
|
14526
|
+
_context20.prev = 0;
|
|
14469
14527
|
payload = action.payload;
|
|
14470
14528
|
channelId = payload.channelId, config = payload.config;
|
|
14471
14529
|
SceytChatClient = getClient();
|
|
14472
|
-
|
|
14530
|
+
_context20.next = 6;
|
|
14473
14531
|
return effects.call(getChannelFromMap, channelId);
|
|
14474
14532
|
case 6:
|
|
14475
|
-
channel =
|
|
14533
|
+
channel = _context20.sent;
|
|
14476
14534
|
if (!channel) {
|
|
14477
14535
|
channel = getChannelFromAllChannels(channelId);
|
|
14478
14536
|
}
|
|
@@ -14483,7 +14541,7 @@ function updateChannel(action) {
|
|
|
14483
14541
|
avatarUrl: channel.avatarUrl
|
|
14484
14542
|
};
|
|
14485
14543
|
if (!config.avatar) {
|
|
14486
|
-
|
|
14544
|
+
_context20.next = 14;
|
|
14487
14545
|
break;
|
|
14488
14546
|
}
|
|
14489
14547
|
fileToUpload = {
|
|
@@ -14492,10 +14550,10 @@ function updateChannel(action) {
|
|
|
14492
14550
|
log.info('upload percent - ', progressPercent);
|
|
14493
14551
|
}
|
|
14494
14552
|
};
|
|
14495
|
-
|
|
14553
|
+
_context20.next = 13;
|
|
14496
14554
|
return effects.call(SceytChatClient.uploadFile, fileToUpload);
|
|
14497
14555
|
case 13:
|
|
14498
|
-
paramsToUpdate.avatarUrl =
|
|
14556
|
+
paramsToUpdate.avatarUrl = _context20.sent;
|
|
14499
14557
|
case 14:
|
|
14500
14558
|
if (config.subject) {
|
|
14501
14559
|
paramsToUpdate.subject = config.subject;
|
|
@@ -14506,14 +14564,14 @@ function updateChannel(action) {
|
|
|
14506
14564
|
if (config.avatarUrl === '') {
|
|
14507
14565
|
paramsToUpdate.avatarUrl = '';
|
|
14508
14566
|
}
|
|
14509
|
-
|
|
14567
|
+
_context20.next = 19;
|
|
14510
14568
|
return effects.call(channel.update, paramsToUpdate);
|
|
14511
14569
|
case 19:
|
|
14512
|
-
_yield$call5 =
|
|
14570
|
+
_yield$call5 = _context20.sent;
|
|
14513
14571
|
subject = _yield$call5.subject;
|
|
14514
14572
|
avatarUrl = _yield$call5.avatarUrl;
|
|
14515
14573
|
metadata = _yield$call5.metadata;
|
|
14516
|
-
|
|
14574
|
+
_context20.next = 25;
|
|
14517
14575
|
return effects.put(updateChannelDataAC(channelId, {
|
|
14518
14576
|
subject: subject,
|
|
14519
14577
|
avatarUrl: avatarUrl,
|
|
@@ -14525,30 +14583,30 @@ function updateChannel(action) {
|
|
|
14525
14583
|
avatarUrl: avatarUrl,
|
|
14526
14584
|
metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
|
|
14527
14585
|
});
|
|
14528
|
-
|
|
14586
|
+
_context20.next = 31;
|
|
14529
14587
|
break;
|
|
14530
14588
|
case 28:
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
log.error('ERROR in update channel',
|
|
14589
|
+
_context20.prev = 28;
|
|
14590
|
+
_context20.t0 = _context20["catch"](0);
|
|
14591
|
+
log.error('ERROR in update channel', _context20.t0.message);
|
|
14534
14592
|
case 31:
|
|
14535
14593
|
case "end":
|
|
14536
|
-
return
|
|
14594
|
+
return _context20.stop();
|
|
14537
14595
|
}
|
|
14538
|
-
},
|
|
14596
|
+
}, _marked20, null, [[0, 28]]);
|
|
14539
14597
|
}
|
|
14540
14598
|
function checkUsersStatus() {
|
|
14541
14599
|
var SceytChatClient, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData;
|
|
14542
|
-
return _regeneratorRuntime().wrap(function checkUsersStatus$(
|
|
14543
|
-
while (1) switch (
|
|
14600
|
+
return _regeneratorRuntime().wrap(function checkUsersStatus$(_context21) {
|
|
14601
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
14544
14602
|
case 0:
|
|
14545
|
-
|
|
14603
|
+
_context21.prev = 0;
|
|
14546
14604
|
SceytChatClient = getClient();
|
|
14547
14605
|
usersForUpdate = Object.keys(usersMap);
|
|
14548
|
-
|
|
14606
|
+
_context21.next = 5;
|
|
14549
14607
|
return effects.call(SceytChatClient.getUsers, usersForUpdate);
|
|
14550
14608
|
case 5:
|
|
14551
|
-
updatedUsers =
|
|
14609
|
+
updatedUsers = _context21.sent;
|
|
14552
14610
|
usersToUpdateMap = {};
|
|
14553
14611
|
update = false;
|
|
14554
14612
|
updatedUsers.forEach(function (updatedUser) {
|
|
@@ -14560,156 +14618,156 @@ function checkUsersStatus() {
|
|
|
14560
14618
|
}
|
|
14561
14619
|
});
|
|
14562
14620
|
if (!update) {
|
|
14563
|
-
|
|
14621
|
+
_context21.next = 17;
|
|
14564
14622
|
break;
|
|
14565
14623
|
}
|
|
14566
14624
|
updateData = JSON.parse(JSON.stringify(usersToUpdateMap));
|
|
14567
|
-
|
|
14625
|
+
_context21.next = 13;
|
|
14568
14626
|
return effects.put(updateMembersPresenceAC(updateData));
|
|
14569
14627
|
case 13:
|
|
14570
|
-
|
|
14628
|
+
_context21.next = 15;
|
|
14571
14629
|
return effects.put(updateUserStatusOnMapAC(updateData));
|
|
14572
14630
|
case 15:
|
|
14573
|
-
|
|
14631
|
+
_context21.next = 17;
|
|
14574
14632
|
return effects.put(updateUserStatusOnChannelAC(updateData));
|
|
14575
14633
|
case 17:
|
|
14576
|
-
|
|
14634
|
+
_context21.next = 22;
|
|
14577
14635
|
break;
|
|
14578
14636
|
case 19:
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
log.error('ERROR in check user status : ',
|
|
14637
|
+
_context21.prev = 19;
|
|
14638
|
+
_context21.t0 = _context21["catch"](0);
|
|
14639
|
+
log.error('ERROR in check user status : ', _context21.t0.message);
|
|
14582
14640
|
case 22:
|
|
14583
14641
|
case "end":
|
|
14584
|
-
return
|
|
14642
|
+
return _context21.stop();
|
|
14585
14643
|
}
|
|
14586
|
-
},
|
|
14644
|
+
}, _marked21, null, [[0, 19]]);
|
|
14587
14645
|
}
|
|
14588
14646
|
function sendTyping(action) {
|
|
14589
14647
|
var state, activeChannelId, channel;
|
|
14590
|
-
return _regeneratorRuntime().wrap(function sendTyping$(
|
|
14591
|
-
while (1) switch (
|
|
14648
|
+
return _regeneratorRuntime().wrap(function sendTyping$(_context22) {
|
|
14649
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
14592
14650
|
case 0:
|
|
14593
14651
|
state = action.payload.state;
|
|
14594
|
-
|
|
14652
|
+
_context22.next = 3;
|
|
14595
14653
|
return effects.call(getActiveChannelId);
|
|
14596
14654
|
case 3:
|
|
14597
|
-
activeChannelId =
|
|
14598
|
-
|
|
14655
|
+
activeChannelId = _context22.sent;
|
|
14656
|
+
_context22.next = 6;
|
|
14599
14657
|
return effects.call(getChannelFromMap, activeChannelId);
|
|
14600
14658
|
case 6:
|
|
14601
|
-
channel =
|
|
14602
|
-
|
|
14659
|
+
channel = _context22.sent;
|
|
14660
|
+
_context22.prev = 7;
|
|
14603
14661
|
if (!channel) {
|
|
14604
|
-
|
|
14662
|
+
_context22.next = 16;
|
|
14605
14663
|
break;
|
|
14606
14664
|
}
|
|
14607
14665
|
if (!state) {
|
|
14608
|
-
|
|
14666
|
+
_context22.next = 14;
|
|
14609
14667
|
break;
|
|
14610
14668
|
}
|
|
14611
|
-
|
|
14669
|
+
_context22.next = 12;
|
|
14612
14670
|
return effects.call(channel.startTyping);
|
|
14613
14671
|
case 12:
|
|
14614
|
-
|
|
14672
|
+
_context22.next = 16;
|
|
14615
14673
|
break;
|
|
14616
14674
|
case 14:
|
|
14617
|
-
|
|
14675
|
+
_context22.next = 16;
|
|
14618
14676
|
return effects.call(channel.stopTyping);
|
|
14619
14677
|
case 16:
|
|
14620
|
-
|
|
14678
|
+
_context22.next = 21;
|
|
14621
14679
|
break;
|
|
14622
14680
|
case 18:
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
log.error('ERROR in send typing',
|
|
14681
|
+
_context22.prev = 18;
|
|
14682
|
+
_context22.t0 = _context22["catch"](7);
|
|
14683
|
+
log.error('ERROR in send typing', _context22.t0);
|
|
14626
14684
|
case 21:
|
|
14627
14685
|
case "end":
|
|
14628
|
-
return
|
|
14686
|
+
return _context22.stop();
|
|
14629
14687
|
}
|
|
14630
|
-
},
|
|
14688
|
+
}, _marked22, null, [[7, 18]]);
|
|
14631
14689
|
}
|
|
14632
14690
|
function sendRecording(action) {
|
|
14633
14691
|
var state, activeChannelId, channel;
|
|
14634
|
-
return _regeneratorRuntime().wrap(function sendRecording$(
|
|
14635
|
-
while (1) switch (
|
|
14692
|
+
return _regeneratorRuntime().wrap(function sendRecording$(_context23) {
|
|
14693
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
14636
14694
|
case 0:
|
|
14637
14695
|
state = action.payload.state;
|
|
14638
|
-
|
|
14696
|
+
_context23.next = 3;
|
|
14639
14697
|
return effects.call(getActiveChannelId);
|
|
14640
14698
|
case 3:
|
|
14641
|
-
activeChannelId =
|
|
14642
|
-
|
|
14699
|
+
activeChannelId = _context23.sent;
|
|
14700
|
+
_context23.next = 6;
|
|
14643
14701
|
return effects.call(getChannelFromMap, activeChannelId);
|
|
14644
14702
|
case 6:
|
|
14645
|
-
channel =
|
|
14646
|
-
|
|
14703
|
+
channel = _context23.sent;
|
|
14704
|
+
_context23.prev = 7;
|
|
14647
14705
|
if (!channel) {
|
|
14648
|
-
|
|
14706
|
+
_context23.next = 16;
|
|
14649
14707
|
break;
|
|
14650
14708
|
}
|
|
14651
14709
|
if (!state) {
|
|
14652
|
-
|
|
14710
|
+
_context23.next = 14;
|
|
14653
14711
|
break;
|
|
14654
14712
|
}
|
|
14655
|
-
|
|
14713
|
+
_context23.next = 12;
|
|
14656
14714
|
return effects.call(channel.startRecording);
|
|
14657
14715
|
case 12:
|
|
14658
|
-
|
|
14716
|
+
_context23.next = 16;
|
|
14659
14717
|
break;
|
|
14660
14718
|
case 14:
|
|
14661
|
-
|
|
14719
|
+
_context23.next = 16;
|
|
14662
14720
|
return effects.call(channel.stopRecording);
|
|
14663
14721
|
case 16:
|
|
14664
|
-
|
|
14722
|
+
_context23.next = 21;
|
|
14665
14723
|
break;
|
|
14666
14724
|
case 18:
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
log.error('ERROR in send recording',
|
|
14725
|
+
_context23.prev = 18;
|
|
14726
|
+
_context23.t0 = _context23["catch"](7);
|
|
14727
|
+
log.error('ERROR in send recording', _context23.t0);
|
|
14670
14728
|
case 21:
|
|
14671
14729
|
case "end":
|
|
14672
|
-
return
|
|
14730
|
+
return _context23.stop();
|
|
14673
14731
|
}
|
|
14674
|
-
},
|
|
14732
|
+
}, _marked23, null, [[7, 18]]);
|
|
14675
14733
|
}
|
|
14676
14734
|
function clearHistory(action) {
|
|
14677
14735
|
var payload, channelId, channel, activeChannelId, groupName;
|
|
14678
|
-
return _regeneratorRuntime().wrap(function clearHistory$(
|
|
14679
|
-
while (1) switch (
|
|
14736
|
+
return _regeneratorRuntime().wrap(function clearHistory$(_context24) {
|
|
14737
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
14680
14738
|
case 0:
|
|
14681
|
-
|
|
14739
|
+
_context24.prev = 0;
|
|
14682
14740
|
payload = action.payload;
|
|
14683
14741
|
channelId = payload.channelId;
|
|
14684
|
-
|
|
14742
|
+
_context24.next = 5;
|
|
14685
14743
|
return effects.call(getChannelFromMap, channelId);
|
|
14686
14744
|
case 5:
|
|
14687
|
-
channel =
|
|
14745
|
+
channel = _context24.sent;
|
|
14688
14746
|
if (!channel) {
|
|
14689
14747
|
channel = getChannelFromAllChannels(channelId);
|
|
14690
14748
|
}
|
|
14691
|
-
|
|
14749
|
+
_context24.next = 9;
|
|
14692
14750
|
return effects.call(getActiveChannelId);
|
|
14693
14751
|
case 9:
|
|
14694
|
-
activeChannelId =
|
|
14752
|
+
activeChannelId = _context24.sent;
|
|
14695
14753
|
if (!channel) {
|
|
14696
|
-
|
|
14754
|
+
_context24.next = 25;
|
|
14697
14755
|
break;
|
|
14698
14756
|
}
|
|
14699
|
-
|
|
14757
|
+
_context24.next = 13;
|
|
14700
14758
|
return effects.call(channel.deleteAllMessages);
|
|
14701
14759
|
case 13:
|
|
14702
|
-
|
|
14760
|
+
_context24.next = 15;
|
|
14703
14761
|
return effects.put(clearMessagesAC());
|
|
14704
14762
|
case 15:
|
|
14705
14763
|
removeMessagesFromMap(channelId);
|
|
14706
14764
|
if (channelId === activeChannelId) {
|
|
14707
14765
|
removeAllMessages();
|
|
14708
14766
|
}
|
|
14709
|
-
|
|
14767
|
+
_context24.next = 19;
|
|
14710
14768
|
return effects.put(clearSelectedMessagesAC());
|
|
14711
14769
|
case 19:
|
|
14712
|
-
|
|
14770
|
+
_context24.next = 21;
|
|
14713
14771
|
return effects.put(updateChannelDataAC(channel.id, {
|
|
14714
14772
|
lastMessage: null,
|
|
14715
14773
|
newMessageCount: 0,
|
|
@@ -14722,65 +14780,65 @@ function clearHistory(action) {
|
|
|
14722
14780
|
newMentionCount: 0
|
|
14723
14781
|
});
|
|
14724
14782
|
groupName = getChannelGroupName(channel);
|
|
14725
|
-
|
|
14783
|
+
_context24.next = 25;
|
|
14726
14784
|
return effects.put(updateSearchedChannelDataAC(channel.id, {
|
|
14727
14785
|
lastMessage: null,
|
|
14728
14786
|
newMessageCount: 0,
|
|
14729
14787
|
newMentionCount: 0
|
|
14730
14788
|
}, groupName));
|
|
14731
14789
|
case 25:
|
|
14732
|
-
|
|
14790
|
+
_context24.next = 30;
|
|
14733
14791
|
break;
|
|
14734
14792
|
case 27:
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
log.error('ERROR in clear history',
|
|
14793
|
+
_context24.prev = 27;
|
|
14794
|
+
_context24.t0 = _context24["catch"](0);
|
|
14795
|
+
log.error('ERROR in clear history', _context24.t0);
|
|
14738
14796
|
case 30:
|
|
14739
14797
|
case "end":
|
|
14740
|
-
return
|
|
14798
|
+
return _context24.stop();
|
|
14741
14799
|
}
|
|
14742
|
-
},
|
|
14800
|
+
}, _marked24, null, [[0, 27]]);
|
|
14743
14801
|
}
|
|
14744
14802
|
function deleteAllMessages(action) {
|
|
14745
14803
|
var payload, channelId, channel, activeChannelId, groupName;
|
|
14746
|
-
return _regeneratorRuntime().wrap(function deleteAllMessages$(
|
|
14747
|
-
while (1) switch (
|
|
14804
|
+
return _regeneratorRuntime().wrap(function deleteAllMessages$(_context25) {
|
|
14805
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
14748
14806
|
case 0:
|
|
14749
|
-
|
|
14807
|
+
_context25.prev = 0;
|
|
14750
14808
|
payload = action.payload;
|
|
14751
14809
|
channelId = payload.channelId;
|
|
14752
|
-
|
|
14810
|
+
_context25.next = 5;
|
|
14753
14811
|
return effects.call(getChannelFromMap, channelId);
|
|
14754
14812
|
case 5:
|
|
14755
|
-
channel =
|
|
14813
|
+
channel = _context25.sent;
|
|
14756
14814
|
if (!channel) {
|
|
14757
14815
|
channel = getChannelFromAllChannels(channelId);
|
|
14758
14816
|
}
|
|
14759
|
-
|
|
14817
|
+
_context25.next = 9;
|
|
14760
14818
|
return effects.call(getActiveChannelId);
|
|
14761
14819
|
case 9:
|
|
14762
|
-
activeChannelId =
|
|
14820
|
+
activeChannelId = _context25.sent;
|
|
14763
14821
|
if (!channel) {
|
|
14764
|
-
|
|
14822
|
+
_context25.next = 26;
|
|
14765
14823
|
break;
|
|
14766
14824
|
}
|
|
14767
|
-
|
|
14825
|
+
_context25.next = 13;
|
|
14768
14826
|
return effects.call(channel.deleteAllMessages, true);
|
|
14769
14827
|
case 13:
|
|
14770
14828
|
removeMessagesFromMap(channelId);
|
|
14771
14829
|
if (!(channelId === activeChannelId)) {
|
|
14772
|
-
|
|
14830
|
+
_context25.next = 18;
|
|
14773
14831
|
break;
|
|
14774
14832
|
}
|
|
14775
|
-
|
|
14833
|
+
_context25.next = 17;
|
|
14776
14834
|
return effects.put(clearMessagesAC());
|
|
14777
14835
|
case 17:
|
|
14778
14836
|
removeAllMessages();
|
|
14779
14837
|
case 18:
|
|
14780
|
-
|
|
14838
|
+
_context25.next = 20;
|
|
14781
14839
|
return effects.put(clearSelectedMessagesAC());
|
|
14782
14840
|
case 20:
|
|
14783
|
-
|
|
14841
|
+
_context25.next = 22;
|
|
14784
14842
|
return effects.put(updateChannelDataAC(channel.id, {
|
|
14785
14843
|
lastMessage: null,
|
|
14786
14844
|
newMessageCount: 0,
|
|
@@ -14793,183 +14851,186 @@ function deleteAllMessages(action) {
|
|
|
14793
14851
|
newMentionCount: 0
|
|
14794
14852
|
});
|
|
14795
14853
|
groupName = getChannelGroupName(channel);
|
|
14796
|
-
|
|
14854
|
+
_context25.next = 26;
|
|
14797
14855
|
return effects.put(updateSearchedChannelDataAC(channel.id, {
|
|
14798
14856
|
lastMessage: null,
|
|
14799
14857
|
newMessageCount: 0,
|
|
14800
14858
|
newMentionCount: 0
|
|
14801
14859
|
}, groupName));
|
|
14802
14860
|
case 26:
|
|
14803
|
-
|
|
14861
|
+
_context25.next = 31;
|
|
14804
14862
|
break;
|
|
14805
14863
|
case 28:
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
log.error('ERROR in clear history',
|
|
14864
|
+
_context25.prev = 28;
|
|
14865
|
+
_context25.t0 = _context25["catch"](0);
|
|
14866
|
+
log.error('ERROR in clear history', _context25.t0);
|
|
14809
14867
|
case 31:
|
|
14810
14868
|
case "end":
|
|
14811
|
-
return
|
|
14869
|
+
return _context25.stop();
|
|
14812
14870
|
}
|
|
14813
|
-
},
|
|
14871
|
+
}, _marked25, null, [[0, 28]]);
|
|
14814
14872
|
}
|
|
14815
14873
|
function joinChannel(action) {
|
|
14816
14874
|
var payload, channelId, SceytChatClient, channel, joinedChannel;
|
|
14817
|
-
return _regeneratorRuntime().wrap(function joinChannel$(
|
|
14818
|
-
while (1) switch (
|
|
14875
|
+
return _regeneratorRuntime().wrap(function joinChannel$(_context26) {
|
|
14876
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
14819
14877
|
case 0:
|
|
14820
|
-
|
|
14878
|
+
_context26.prev = 0;
|
|
14821
14879
|
payload = action.payload;
|
|
14822
14880
|
channelId = payload.channelId;
|
|
14823
14881
|
SceytChatClient = getClient();
|
|
14824
|
-
|
|
14882
|
+
_context26.next = 6;
|
|
14825
14883
|
return effects.call(getChannelFromMap, channelId);
|
|
14826
14884
|
case 6:
|
|
14827
|
-
channel =
|
|
14885
|
+
channel = _context26.sent;
|
|
14828
14886
|
if (!channel) {
|
|
14829
14887
|
channel = getChannelFromAllChannels(channelId);
|
|
14830
14888
|
}
|
|
14831
14889
|
if (channel) {
|
|
14832
|
-
|
|
14890
|
+
_context26.next = 12;
|
|
14833
14891
|
break;
|
|
14834
14892
|
}
|
|
14835
|
-
|
|
14893
|
+
_context26.next = 11;
|
|
14836
14894
|
return effects.call(SceytChatClient.getChannel, channelId);
|
|
14837
14895
|
case 11:
|
|
14838
|
-
channel =
|
|
14896
|
+
channel = _context26.sent;
|
|
14839
14897
|
case 12:
|
|
14840
|
-
|
|
14898
|
+
_context26.next = 14;
|
|
14841
14899
|
return effects.call(channel.join);
|
|
14842
14900
|
case 14:
|
|
14843
|
-
joinedChannel =
|
|
14844
|
-
|
|
14901
|
+
joinedChannel = _context26.sent;
|
|
14902
|
+
_context26.next = 17;
|
|
14845
14903
|
return effects.put(setCloseSearchChannelsAC(true));
|
|
14846
14904
|
case 17:
|
|
14847
|
-
|
|
14905
|
+
_context26.next = 19;
|
|
14848
14906
|
return effects.put(setChannelToAddAC(JSON.parse(JSON.stringify(joinedChannel))));
|
|
14849
14907
|
case 19:
|
|
14850
|
-
|
|
14908
|
+
_context26.next = 21;
|
|
14851
14909
|
return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(joinedChannel))));
|
|
14852
14910
|
case 21:
|
|
14853
14911
|
addChannelToAllChannels(joinedChannel);
|
|
14854
|
-
|
|
14912
|
+
_context26.next = 24;
|
|
14855
14913
|
return effects.call(setActiveChannelId, joinedChannel.id);
|
|
14856
14914
|
case 24:
|
|
14857
|
-
|
|
14915
|
+
_context26.next = 29;
|
|
14858
14916
|
break;
|
|
14859
14917
|
case 26:
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
log.error(
|
|
14918
|
+
_context26.prev = 26;
|
|
14919
|
+
_context26.t0 = _context26["catch"](0);
|
|
14920
|
+
log.error(_context26.t0, 'Error in join to channel');
|
|
14863
14921
|
case 29:
|
|
14864
14922
|
case "end":
|
|
14865
|
-
return
|
|
14923
|
+
return _context26.stop();
|
|
14866
14924
|
}
|
|
14867
|
-
},
|
|
14925
|
+
}, _marked26, null, [[0, 26]]);
|
|
14868
14926
|
}
|
|
14869
14927
|
function watchForChannelEvents() {
|
|
14870
|
-
return _regeneratorRuntime().wrap(function watchForChannelEvents$(
|
|
14871
|
-
while (1) switch (
|
|
14928
|
+
return _regeneratorRuntime().wrap(function watchForChannelEvents$(_context27) {
|
|
14929
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
14872
14930
|
case 0:
|
|
14873
|
-
|
|
14931
|
+
_context27.next = 2;
|
|
14874
14932
|
return effects.call(watchForEvents);
|
|
14875
14933
|
case 2:
|
|
14876
14934
|
case "end":
|
|
14877
|
-
return
|
|
14935
|
+
return _context27.stop();
|
|
14878
14936
|
}
|
|
14879
|
-
},
|
|
14937
|
+
}, _marked27);
|
|
14880
14938
|
}
|
|
14881
14939
|
function ChannelsSaga() {
|
|
14882
|
-
return _regeneratorRuntime().wrap(function ChannelsSaga$(
|
|
14883
|
-
while (1) switch (
|
|
14940
|
+
return _regeneratorRuntime().wrap(function ChannelsSaga$(_context28) {
|
|
14941
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
14884
14942
|
case 0:
|
|
14885
|
-
|
|
14943
|
+
_context28.next = 2;
|
|
14886
14944
|
return effects.takeLatest(CREATE_CHANNEL, createChannel);
|
|
14887
14945
|
case 2:
|
|
14888
|
-
|
|
14946
|
+
_context28.next = 4;
|
|
14889
14947
|
return effects.takeLatest(GET_CHANNELS, getChannels);
|
|
14890
14948
|
case 4:
|
|
14891
|
-
|
|
14949
|
+
_context28.next = 6;
|
|
14892
14950
|
return effects.takeLatest(SEARCH_CHANNELS, searchChannels);
|
|
14893
14951
|
case 6:
|
|
14894
|
-
|
|
14952
|
+
_context28.next = 8;
|
|
14895
14953
|
return effects.takeLatest(GET_CHANNELS_FOR_FORWARD, getChannelsForForward);
|
|
14896
14954
|
case 8:
|
|
14897
|
-
|
|
14955
|
+
_context28.next = 10;
|
|
14898
14956
|
return effects.takeLatest(SEARCH_CHANNELS_FOR_FORWARD, searchChannelsForForward);
|
|
14899
14957
|
case 10:
|
|
14900
|
-
|
|
14958
|
+
_context28.next = 12;
|
|
14901
14959
|
return effects.takeLatest(LOAD_MORE_CHANNEL, channelsLoadMore);
|
|
14902
14960
|
case 12:
|
|
14903
|
-
|
|
14961
|
+
_context28.next = 14;
|
|
14904
14962
|
return effects.takeLatest(LOAD_MORE_CHANNELS_FOR_FORWARD, channelsForForwardLoadMore);
|
|
14905
14963
|
case 14:
|
|
14906
|
-
|
|
14964
|
+
_context28.next = 16;
|
|
14907
14965
|
return effects.takeEvery(SWITCH_CHANNEL, switchChannel);
|
|
14908
14966
|
case 16:
|
|
14909
|
-
|
|
14967
|
+
_context28.next = 18;
|
|
14910
14968
|
return effects.takeLatest(LEAVE_CHANNEL, leaveChannel);
|
|
14911
14969
|
case 18:
|
|
14912
|
-
|
|
14970
|
+
_context28.next = 20;
|
|
14913
14971
|
return effects.takeLatest(DELETE_CHANNEL, deleteChannel);
|
|
14914
14972
|
case 20:
|
|
14915
|
-
|
|
14973
|
+
_context28.next = 22;
|
|
14916
14974
|
return effects.takeLatest(BLOCK_CHANNEL, blockChannel);
|
|
14917
14975
|
case 22:
|
|
14918
|
-
|
|
14976
|
+
_context28.next = 24;
|
|
14919
14977
|
return effects.takeLatest(UPDATE_CHANNEL, updateChannel);
|
|
14920
14978
|
case 24:
|
|
14921
|
-
|
|
14979
|
+
_context28.next = 26;
|
|
14922
14980
|
return effects.takeEvery(MARK_MESSAGES_AS_READ, markMessagesRead);
|
|
14923
14981
|
case 26:
|
|
14924
|
-
|
|
14982
|
+
_context28.next = 28;
|
|
14925
14983
|
return effects.takeLatest(MARK_MESSAGES_AS_DELIVERED, markMessagesDelivered);
|
|
14926
14984
|
case 28:
|
|
14927
|
-
|
|
14985
|
+
_context28.next = 30;
|
|
14928
14986
|
return effects.takeLatest(WATCH_FOR_EVENTS, watchForChannelEvents);
|
|
14929
14987
|
case 30:
|
|
14930
|
-
|
|
14988
|
+
_context28.next = 32;
|
|
14931
14989
|
return effects.takeLatest(TURN_OFF_NOTIFICATION, notificationsTurnOff);
|
|
14932
14990
|
case 32:
|
|
14933
|
-
|
|
14991
|
+
_context28.next = 34;
|
|
14934
14992
|
return effects.takeLatest(TURN_ON_NOTIFICATION, notificationsTurnOn);
|
|
14935
14993
|
case 34:
|
|
14936
|
-
|
|
14994
|
+
_context28.next = 36;
|
|
14937
14995
|
return effects.takeLatest(MARK_CHANNEL_AS_READ, markChannelAsRead);
|
|
14938
14996
|
case 36:
|
|
14939
|
-
|
|
14997
|
+
_context28.next = 38;
|
|
14940
14998
|
return effects.takeLatest(MARK_CHANNEL_AS_UNREAD, markChannelAsUnRead);
|
|
14941
14999
|
case 38:
|
|
14942
|
-
|
|
15000
|
+
_context28.next = 40;
|
|
14943
15001
|
return effects.takeLatest(CHECK_USER_STATUS, checkUsersStatus);
|
|
14944
15002
|
case 40:
|
|
14945
|
-
|
|
15003
|
+
_context28.next = 42;
|
|
14946
15004
|
return effects.takeLatest(SEND_TYPING, sendTyping);
|
|
14947
15005
|
case 42:
|
|
14948
|
-
|
|
15006
|
+
_context28.next = 44;
|
|
14949
15007
|
return effects.takeLatest(SEND_RECORDING, sendRecording);
|
|
14950
15008
|
case 44:
|
|
14951
|
-
|
|
15009
|
+
_context28.next = 46;
|
|
14952
15010
|
return effects.takeLatest(PIN_CHANNEL, pinChannel);
|
|
14953
15011
|
case 46:
|
|
14954
|
-
|
|
15012
|
+
_context28.next = 48;
|
|
14955
15013
|
return effects.takeLatest(UNPIN_CHANNEL, unpinChannel);
|
|
14956
15014
|
case 48:
|
|
14957
|
-
|
|
15015
|
+
_context28.next = 50;
|
|
14958
15016
|
return effects.takeLatest(CLEAR_HISTORY, clearHistory);
|
|
14959
15017
|
case 50:
|
|
14960
|
-
|
|
15018
|
+
_context28.next = 52;
|
|
14961
15019
|
return effects.takeLatest(JOIN_TO_CHANNEL, joinChannel);
|
|
14962
15020
|
case 52:
|
|
14963
|
-
|
|
15021
|
+
_context28.next = 54;
|
|
14964
15022
|
return effects.takeLatest(DELETE_ALL_MESSAGES, deleteAllMessages);
|
|
14965
15023
|
case 54:
|
|
14966
|
-
|
|
15024
|
+
_context28.next = 56;
|
|
14967
15025
|
return effects.takeLatest(REMOVE_CHANNEL_CACHES, removeChannelCaches);
|
|
14968
15026
|
case 56:
|
|
15027
|
+
_context28.next = 58;
|
|
15028
|
+
return effects.takeLatest(GET_CHANNEL_MENTIONS, getChannelMentions);
|
|
15029
|
+
case 58:
|
|
14969
15030
|
case "end":
|
|
14970
|
-
return
|
|
15031
|
+
return _context28.stop();
|
|
14971
15032
|
}
|
|
14972
|
-
},
|
|
15033
|
+
}, _marked28);
|
|
14973
15034
|
}
|
|
14974
15035
|
|
|
14975
15036
|
function rgbaToThumbHash(w, h, rgba) {
|
|
@@ -21850,6 +21911,7 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
21850
21911
|
}, [searchValue]);
|
|
21851
21912
|
useDidUpdate(function () {
|
|
21852
21913
|
if (getSelectedChannel) {
|
|
21914
|
+
dispatch(getChannelMentionsAC(activeChannel.id));
|
|
21853
21915
|
getSelectedChannel(activeChannel);
|
|
21854
21916
|
}
|
|
21855
21917
|
}, [activeChannel && activeChannel.members && activeChannel.members.length]);
|
|
@@ -38660,8 +38722,34 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
38660
38722
|
var theme = reactRedux.useSelector(themeSelector);
|
|
38661
38723
|
var sendMessageInputHeight = reactRedux.useSelector(sendMessageInputHeightSelector);
|
|
38662
38724
|
var showScrollToNewMessageButton = reactRedux.useSelector(showScrollToNewMessageButtonSelector);
|
|
38725
|
+
var messages = reactRedux.useSelector(activeChannelMessagesSelector) || [];
|
|
38663
38726
|
var handleScrollToBottom = function handleScrollToBottom() {
|
|
38664
|
-
dispatch(
|
|
38727
|
+
dispatch(markMessagesAsReadAC(channel.id, [channel.lastMessage.id]));
|
|
38728
|
+
handleScrollToRepliedMessage(channel.lastMessage.id);
|
|
38729
|
+
};
|
|
38730
|
+
var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
|
|
38731
|
+
try {
|
|
38732
|
+
if (messages.findIndex(function (msg) {
|
|
38733
|
+
return msg.id === messageId;
|
|
38734
|
+
}) >= 10) {
|
|
38735
|
+
var repliedMessage = document.getElementById(messageId);
|
|
38736
|
+
if (repliedMessage) {
|
|
38737
|
+
var scrollRef = document.getElementById('scrollableDiv');
|
|
38738
|
+
if (scrollRef) {
|
|
38739
|
+
scrollRef.scrollTop = repliedMessage.offsetTop - scrollRef.offsetHeight / 2;
|
|
38740
|
+
}
|
|
38741
|
+
repliedMessage.classList.add('highlight');
|
|
38742
|
+
setTimeout(function () {
|
|
38743
|
+
repliedMessage.classList.remove('highlight');
|
|
38744
|
+
}, 1000);
|
|
38745
|
+
}
|
|
38746
|
+
} else {
|
|
38747
|
+
dispatch(getMessagesAC(channel, undefined, messageId));
|
|
38748
|
+
}
|
|
38749
|
+
return Promise.resolve();
|
|
38750
|
+
} catch (e) {
|
|
38751
|
+
return Promise.reject(e);
|
|
38752
|
+
}
|
|
38665
38753
|
};
|
|
38666
38754
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showScrollToNewMessageButton && (/*#__PURE__*/React__default.createElement(BottomButton, {
|
|
38667
38755
|
theme: theme,
|
|
@@ -38704,6 +38792,145 @@ var UnreadCount$1 = styled__default.span(_templateObject2$O || (_templateObject2
|
|
|
38704
38792
|
return props.textColor || '#fff';
|
|
38705
38793
|
});
|
|
38706
38794
|
|
|
38795
|
+
var _path$1t, _path2$9;
|
|
38796
|
+
function _extends$1x() {
|
|
38797
|
+
return _extends$1x = Object.assign ? Object.assign.bind() : function (n) {
|
|
38798
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
38799
|
+
var t = arguments[e];
|
|
38800
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
38801
|
+
}
|
|
38802
|
+
return n;
|
|
38803
|
+
}, _extends$1x.apply(null, arguments);
|
|
38804
|
+
}
|
|
38805
|
+
function SvgMention(props) {
|
|
38806
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1x({
|
|
38807
|
+
width: 24,
|
|
38808
|
+
height: 24,
|
|
38809
|
+
fill: "none",
|
|
38810
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
38811
|
+
}, props), _path$1t || (_path$1t = /*#__PURE__*/React.createElement("path", {
|
|
38812
|
+
d: "M12 15.6a3.6 3.6 0 100-7.2 3.6 3.6 0 000 7.2z",
|
|
38813
|
+
stroke: "currentColor",
|
|
38814
|
+
strokeWidth: 1.8,
|
|
38815
|
+
strokeLinecap: "round",
|
|
38816
|
+
strokeLinejoin: "round"
|
|
38817
|
+
})), _path2$9 || (_path2$9 = /*#__PURE__*/React.createElement("path", {
|
|
38818
|
+
d: "M15.6 8.4v4.5a2.7 2.7 0 005.4 0V12a9 9 0 10-3.528 7.145",
|
|
38819
|
+
stroke: "currentColor",
|
|
38820
|
+
strokeWidth: 1.8,
|
|
38821
|
+
strokeLinecap: "round",
|
|
38822
|
+
strokeLinejoin: "round"
|
|
38823
|
+
})));
|
|
38824
|
+
}
|
|
38825
|
+
|
|
38826
|
+
var _templateObject$X, _templateObject2$P;
|
|
38827
|
+
var MessagesScrollToUnreadMentionsButton = function MessagesScrollToUnreadMentionsButton(_ref) {
|
|
38828
|
+
var buttonIcon = _ref.buttonIcon,
|
|
38829
|
+
buttonWidth = _ref.buttonWidth,
|
|
38830
|
+
buttonHeight = _ref.buttonHeight,
|
|
38831
|
+
bottomPosition = _ref.bottomPosition,
|
|
38832
|
+
rightPosition = _ref.rightPosition,
|
|
38833
|
+
buttonBorder = _ref.buttonBorder,
|
|
38834
|
+
buttonBackgroundColor = _ref.buttonBackgroundColor,
|
|
38835
|
+
buttonHoverBackgroundColor = _ref.buttonHoverBackgroundColor,
|
|
38836
|
+
buttonBorderRadius = _ref.buttonBorderRadius,
|
|
38837
|
+
buttonShadow = _ref.buttonShadow,
|
|
38838
|
+
unreadCountWidth = _ref.unreadCountWidth,
|
|
38839
|
+
unreadCountHeight = _ref.unreadCountHeight,
|
|
38840
|
+
unreadCountFontSize = _ref.unreadCountFontSize,
|
|
38841
|
+
unreadCountTextColor = _ref.unreadCountTextColor;
|
|
38842
|
+
var _useColor = useColors(),
|
|
38843
|
+
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
38844
|
+
backgroundSections = _useColor[THEME_COLORS.BACKGROUND_SECTIONS];
|
|
38845
|
+
var dispatch = reactRedux.useDispatch();
|
|
38846
|
+
var channel = reactRedux.useSelector(activeChannelSelector);
|
|
38847
|
+
var theme = reactRedux.useSelector(themeSelector);
|
|
38848
|
+
var sendMessageInputHeight = reactRedux.useSelector(sendMessageInputHeightSelector);
|
|
38849
|
+
var showScrollToNewMessageButton = reactRedux.useSelector(showScrollToNewMessageButtonSelector);
|
|
38850
|
+
var messages = reactRedux.useSelector(activeChannelMessagesSelector) || [];
|
|
38851
|
+
var handleScrollToBottom = function handleScrollToBottom() {
|
|
38852
|
+
if (channel.newMentionCount >= 3 && (!channel.mentionsIds || channel.mentionsIds.length < 3)) {
|
|
38853
|
+
dispatch(getChannelMentionsAC(channel.id));
|
|
38854
|
+
}
|
|
38855
|
+
if (channel.mentionsIds && channel.mentionsIds.length) {
|
|
38856
|
+
handleScrollToRepliedMessage(channel.mentionsIds[0]);
|
|
38857
|
+
dispatch(markMessagesAsReadAC(channel.id, [channel.mentionsIds[0]]));
|
|
38858
|
+
dispatch(updateChannelDataAC(channel.id, {
|
|
38859
|
+
mentionsIds: channel.mentionsIds.slice(1)
|
|
38860
|
+
}));
|
|
38861
|
+
}
|
|
38862
|
+
};
|
|
38863
|
+
var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
|
|
38864
|
+
try {
|
|
38865
|
+
if (messages.findIndex(function (msg) {
|
|
38866
|
+
return msg.id === messageId;
|
|
38867
|
+
}) >= 10) {
|
|
38868
|
+
var repliedMessage = document.getElementById(messageId);
|
|
38869
|
+
if (repliedMessage) {
|
|
38870
|
+
var scrollRef = document.getElementById('scrollableDiv');
|
|
38871
|
+
if (scrollRef) {
|
|
38872
|
+
scrollRef.scrollTop = repliedMessage.offsetTop - scrollRef.offsetHeight / 2;
|
|
38873
|
+
}
|
|
38874
|
+
repliedMessage.classList.add('highlight');
|
|
38875
|
+
setTimeout(function () {
|
|
38876
|
+
repliedMessage.classList.remove('highlight');
|
|
38877
|
+
}, 1000);
|
|
38878
|
+
}
|
|
38879
|
+
} else {
|
|
38880
|
+
dispatch(getMessagesAC(channel, undefined, messageId));
|
|
38881
|
+
}
|
|
38882
|
+
return Promise.resolve();
|
|
38883
|
+
} catch (e) {
|
|
38884
|
+
return Promise.reject(e);
|
|
38885
|
+
}
|
|
38886
|
+
};
|
|
38887
|
+
React.useEffect(function () {
|
|
38888
|
+
if (channel.newMentionCount && (!channel.mentionsIds || channel.mentionsIds.length < 3)) {
|
|
38889
|
+
dispatch(getChannelMentionsAC(channel.id));
|
|
38890
|
+
}
|
|
38891
|
+
}, [channel.newMentionCount]);
|
|
38892
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, channel.newMentionCount ? (/*#__PURE__*/React__default.createElement(BottomButton$1, {
|
|
38893
|
+
theme: theme,
|
|
38894
|
+
width: buttonWidth,
|
|
38895
|
+
height: buttonHeight,
|
|
38896
|
+
border: buttonBorder,
|
|
38897
|
+
borderRadius: buttonBorderRadius,
|
|
38898
|
+
backgroundColor: buttonBackgroundColor || backgroundSections,
|
|
38899
|
+
hoverBackgroundColor: buttonHoverBackgroundColor,
|
|
38900
|
+
shadow: buttonShadow,
|
|
38901
|
+
onClick: handleScrollToBottom,
|
|
38902
|
+
bottomOffset: sendMessageInputHeight,
|
|
38903
|
+
bottomPosition: bottomPosition,
|
|
38904
|
+
showsUnreadMentionsButton: !!showScrollToNewMessageButton,
|
|
38905
|
+
rightPosition: rightPosition
|
|
38906
|
+
}, !!(channel.newMentionCount && channel.newMentionCount > 0) && (/*#__PURE__*/React__default.createElement(UnreadCount$2, {
|
|
38907
|
+
width: unreadCountWidth,
|
|
38908
|
+
height: unreadCountHeight,
|
|
38909
|
+
textColor: unreadCountTextColor,
|
|
38910
|
+
fontSize: unreadCountFontSize,
|
|
38911
|
+
backgroundColor: accentColor,
|
|
38912
|
+
isMuted: channel.muted
|
|
38913
|
+
}, channel.newMentionCount ? channel.newMentionCount > 99 ? '99+' : channel.newMentionCount : '')), buttonIcon || /*#__PURE__*/React__default.createElement(SvgMention, null))) : null);
|
|
38914
|
+
};
|
|
38915
|
+
var BottomButton$1 = styled__default.div(_templateObject$X || (_templateObject$X = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: ", ";\n right: ", ";\n margin-right: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 50px;\n width: 48px;\n height: 48px;\n cursor: pointer;\n z-index: 14;\n\n & > svg {\n color: rgba(129, 140, 153, 1);\n }\n\n & > span {\n bottom: 32px;\n right: 0;\n }\n"])), function (props) {
|
|
38916
|
+
return props.bottomOffset + (props.bottomPosition === undefined ? 45 : props.bottomPosition) + (props.showsUnreadMentionsButton ? 60 : 0) + "px";
|
|
38917
|
+
}, function (props) {
|
|
38918
|
+
return (props.rightPosition === undefined ? 16 : props.rightPosition) + "px";
|
|
38919
|
+
}, function (props) {
|
|
38920
|
+
return props.backgroundColor;
|
|
38921
|
+
});
|
|
38922
|
+
var UnreadCount$2 = styled__default.span(_templateObject2$P || (_templateObject2$P = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 11px;\n right: 16px;\n flex: 0 0 auto;\n margin-left: auto;\n background-color: ", ";\n padding: 0 4px;\n font-size: ", ";\n line-height: 20px;\n min-width: ", ";\n height: ", ";\n text-align: center;\n font-weight: 500;\n color: ", ";\n border-radius: 10px;\n box-sizing: border-box;\n"])), function (props) {
|
|
38923
|
+
return props.backgroundColor;
|
|
38924
|
+
}, function (props) {
|
|
38925
|
+
return props.fontSize || '13px';
|
|
38926
|
+
}, function (props) {
|
|
38927
|
+
return props.width || '20px';
|
|
38928
|
+
}, function (props) {
|
|
38929
|
+
return props.height || '20px';
|
|
38930
|
+
}, function (props) {
|
|
38931
|
+
return props.textColor || '#fff';
|
|
38932
|
+
});
|
|
38933
|
+
|
|
38707
38934
|
exports.Attachment = Attachment$1;
|
|
38708
38935
|
exports.Avatar = Avatar;
|
|
38709
38936
|
exports.Channel = Channel;
|
|
@@ -38720,6 +38947,7 @@ exports.MessageList = MessagesContainer;
|
|
|
38720
38947
|
exports.MessageStatusIcon = MessageStatusIcon;
|
|
38721
38948
|
exports.MessageTextFormat = MessageTextFormat;
|
|
38722
38949
|
exports.MessagesScrollToBottomButton = MessagesScrollToBottomButton;
|
|
38950
|
+
exports.MessagesScrollToUnreadMentionsButton = MessagesScrollToUnreadMentionsButton;
|
|
38723
38951
|
exports.SceytChat = SceytChatContainer;
|
|
38724
38952
|
exports.SendMessage = SendMessageInput;
|
|
38725
38953
|
exports.THEME_COLORS = THEME_COLORS;
|