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