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.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 {
@@ -13063,29 +13072,30 @@ var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(createChannel),
13063
13072
  _marked4 = /*#__PURE__*/_regeneratorRuntime().mark(getChannelsForForward),
13064
13073
  _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(searchChannelsForForward),
13065
13074
  _marked6 = /*#__PURE__*/_regeneratorRuntime().mark(channelsLoadMore),
13066
- _marked7 = /*#__PURE__*/_regeneratorRuntime().mark(channelsForForwardLoadMore),
13067
- _marked8 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesRead),
13068
- _marked9 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesDelivered),
13069
- _marked0 = /*#__PURE__*/_regeneratorRuntime().mark(switchChannel),
13070
- _marked1 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOff),
13071
- _marked10 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOn),
13072
- _marked11 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsRead),
13073
- _marked12 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsUnRead),
13074
- _marked13 = /*#__PURE__*/_regeneratorRuntime().mark(pinChannel),
13075
- _marked14 = /*#__PURE__*/_regeneratorRuntime().mark(unpinChannel),
13076
- _marked15 = /*#__PURE__*/_regeneratorRuntime().mark(removeChannelCaches),
13077
- _marked16 = /*#__PURE__*/_regeneratorRuntime().mark(leaveChannel),
13078
- _marked17 = /*#__PURE__*/_regeneratorRuntime().mark(deleteChannel),
13079
- _marked18 = /*#__PURE__*/_regeneratorRuntime().mark(blockChannel),
13080
- _marked19 = /*#__PURE__*/_regeneratorRuntime().mark(updateChannel),
13081
- _marked20 = /*#__PURE__*/_regeneratorRuntime().mark(checkUsersStatus),
13082
- _marked21 = /*#__PURE__*/_regeneratorRuntime().mark(sendTyping),
13083
- _marked22 = /*#__PURE__*/_regeneratorRuntime().mark(sendRecording),
13084
- _marked23 = /*#__PURE__*/_regeneratorRuntime().mark(clearHistory),
13085
- _marked24 = /*#__PURE__*/_regeneratorRuntime().mark(deleteAllMessages),
13086
- _marked25 = /*#__PURE__*/_regeneratorRuntime().mark(joinChannel),
13087
- _marked26 = /*#__PURE__*/_regeneratorRuntime().mark(watchForChannelEvents),
13088
- _marked27 = /*#__PURE__*/_regeneratorRuntime().mark(ChannelsSaga);
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);
13089
13099
  function createChannel(action) {
13090
13100
  var payload, channelData, dontCreateIfNotExists, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, checkChannelExist, messageToSend, _allChannels, _memberId;
13091
13101
  return _regeneratorRuntime().wrap(function createChannel$(_context) {
@@ -13825,27 +13835,64 @@ function channelsLoadMore(action) {
13825
13835
  }
13826
13836
  }, _marked6, null, [[0, 28]]);
13827
13837
  }
13828
- function channelsForForwardLoadMore(action) {
13829
- var payload, limit, SceytChatClient, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels;
13830
- return _regeneratorRuntime().wrap(function channelsForForwardLoadMore$(_context7) {
13838
+ function getChannelMentions(action) {
13839
+ var payload, channelId, SceytChatClient, mentionsQueryBuilder, mentionsQuery, mentions;
13840
+ return _regeneratorRuntime().wrap(function getChannelMentions$(_context7) {
13831
13841
  while (1) switch (_context7.prev = _context7.next) {
13832
13842
  case 0:
13833
13843
  _context7.prev = 0;
13834
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;
13835
13882
  limit = payload.limit;
13836
13883
  SceytChatClient = getClient();
13837
13884
  channelQueryForward = query.channelQueryForward;
13838
13885
  if (limit) {
13839
13886
  channelQueryForward.limit = limit;
13840
13887
  }
13841
- _context7.next = 8;
13888
+ _context8.next = 8;
13842
13889
  return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
13843
13890
  case 8:
13844
- _context7.next = 10;
13891
+ _context8.next = 10;
13845
13892
  return effects.call(channelQueryForward.loadNextPage);
13846
13893
  case 10:
13847
- channelsData = _context7.sent;
13848
- _context7.next = 13;
13894
+ channelsData = _context8.sent;
13895
+ _context8.next = 13;
13849
13896
  return effects.put(channelHasNextAC(channelsData.hasNext, true));
13850
13897
  case 13:
13851
13898
  channelsToAdd = channelsData.channels.filter(function (channel) {
@@ -13853,41 +13900,41 @@ function channelsForForwardLoadMore(action) {
13853
13900
  return member.id && member.id !== SceytChatClient.user.id;
13854
13901
  }) : true;
13855
13902
  });
13856
- _context7.next = 16;
13903
+ _context8.next = 16;
13857
13904
  return effects.call(setChannelsInMap, channelsToAdd);
13858
13905
  case 16:
13859
- _yield$call4 = _context7.sent;
13906
+ _yield$call4 = _context8.sent;
13860
13907
  mappedChannels = _yield$call4.channels;
13861
- _context7.next = 20;
13908
+ _context8.next = 20;
13862
13909
  return effects.put(addChannelsForForwardAC(mappedChannels));
13863
13910
  case 20:
13864
- _context7.next = 22;
13911
+ _context8.next = 22;
13865
13912
  return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
13866
13913
  case 22:
13867
- _context7.next = 27;
13914
+ _context8.next = 27;
13868
13915
  break;
13869
13916
  case 24:
13870
- _context7.prev = 24;
13871
- _context7.t0 = _context7["catch"](0);
13872
- log.error(_context7.t0, 'Error in load more channels for forward');
13917
+ _context8.prev = 24;
13918
+ _context8.t0 = _context8["catch"](0);
13919
+ log.error(_context8.t0, 'Error in load more channels for forward');
13873
13920
  case 27:
13874
13921
  case "end":
13875
- return _context7.stop();
13922
+ return _context8.stop();
13876
13923
  }
13877
- }, _marked7, null, [[0, 24]]);
13924
+ }, _marked8, null, [[0, 24]]);
13878
13925
  }
13879
13926
  function markMessagesRead(action) {
13880
13927
  var payload, channelId, messageIds, channel, messageListMarker, _iterator, _step, messageId, updateParams;
13881
- return _regeneratorRuntime().wrap(function markMessagesRead$(_context8) {
13882
- while (1) switch (_context8.prev = _context8.next) {
13928
+ return _regeneratorRuntime().wrap(function markMessagesRead$(_context9) {
13929
+ while (1) switch (_context9.prev = _context9.next) {
13883
13930
  case 0:
13884
13931
  payload = action.payload;
13885
13932
  channelId = payload.channelId, messageIds = payload.messageIds;
13886
- _context8.next = 4;
13933
+ _context9.next = 4;
13887
13934
  return effects.call(getChannelFromMap, channelId);
13888
13935
  case 4:
13889
- channel = _context8.sent;
13890
- _context8.prev = 5;
13936
+ channel = _context9.sent;
13937
+ _context9.prev = 5;
13891
13938
  if (!channel) {
13892
13939
  channel = getChannelFromAllChannels(channelId);
13893
13940
  if (channel) {
@@ -13895,14 +13942,14 @@ function markMessagesRead(action) {
13895
13942
  }
13896
13943
  }
13897
13944
  if (!channel) {
13898
- _context8.next = 24;
13945
+ _context9.next = 24;
13899
13946
  break;
13900
13947
  }
13901
- _context8.next = 10;
13948
+ _context9.next = 10;
13902
13949
  return effects.call(channel.markMessagesAsDisplayed, messageIds);
13903
13950
  case 10:
13904
- messageListMarker = _context8.sent;
13905
- _context8.next = 13;
13951
+ messageListMarker = _context9.sent;
13952
+ _context9.next = 13;
13906
13953
  return effects.put(updateChannelDataAC(channel.id, {
13907
13954
  lastReadMessageId: channel.lastDisplayedMessageId
13908
13955
  }));
@@ -13913,7 +13960,7 @@ function markMessagesRead(action) {
13913
13960
  _iterator = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
13914
13961
  case 15:
13915
13962
  if ((_step = _iterator()).done) {
13916
- _context8.next = 24;
13963
+ _context9.next = 24;
13917
13964
  break;
13918
13965
  }
13919
13966
  messageId = _step.value;
@@ -13926,7 +13973,7 @@ function markMessagesRead(action) {
13926
13973
  name: MESSAGE_DELIVERY_STATUS.READ
13927
13974
  }]
13928
13975
  };
13929
- _context8.next = 20;
13976
+ _context9.next = 20;
13930
13977
  return effects.put(updateMessageAC(messageId, updateParams));
13931
13978
  case 20:
13932
13979
  updateMessageOnMap(channel.id, {
@@ -13935,33 +13982,33 @@ function markMessagesRead(action) {
13935
13982
  });
13936
13983
  updateMessageOnAllMessages(messageId, updateParams);
13937
13984
  case 22:
13938
- _context8.next = 15;
13985
+ _context9.next = 15;
13939
13986
  break;
13940
13987
  case 24:
13941
- _context8.next = 29;
13988
+ _context9.next = 29;
13942
13989
  break;
13943
13990
  case 26:
13944
- _context8.prev = 26;
13945
- _context8.t0 = _context8["catch"](5);
13946
- log.error(_context8.t0, 'Error on mark messages read');
13991
+ _context9.prev = 26;
13992
+ _context9.t0 = _context9["catch"](5);
13993
+ log.error(_context9.t0, 'Error on mark messages read');
13947
13994
  case 29:
13948
13995
  case "end":
13949
- return _context8.stop();
13996
+ return _context9.stop();
13950
13997
  }
13951
- }, _marked8, null, [[5, 26]]);
13998
+ }, _marked9, null, [[5, 26]]);
13952
13999
  }
13953
14000
  function markMessagesDelivered(action) {
13954
14001
  var payload, channelId, messageIds, channel;
13955
- return _regeneratorRuntime().wrap(function markMessagesDelivered$(_context9) {
13956
- while (1) switch (_context9.prev = _context9.next) {
14002
+ return _regeneratorRuntime().wrap(function markMessagesDelivered$(_context0) {
14003
+ while (1) switch (_context0.prev = _context0.next) {
13957
14004
  case 0:
13958
14005
  payload = action.payload;
13959
14006
  channelId = payload.channelId, messageIds = payload.messageIds;
13960
- _context9.prev = 2;
13961
- _context9.next = 5;
14007
+ _context0.prev = 2;
14008
+ _context0.next = 5;
13962
14009
  return effects.call(getChannelFromMap, channelId);
13963
14010
  case 5:
13964
- channel = _context9.sent;
14011
+ channel = _context0.sent;
13965
14012
  if (!channel) {
13966
14013
  channel = getChannelFromAllChannels(channelId);
13967
14014
  if (channel) {
@@ -13969,203 +14016,203 @@ function markMessagesDelivered(action) {
13969
14016
  }
13970
14017
  }
13971
14018
  if (!channel) {
13972
- _context9.next = 11;
14019
+ _context0.next = 11;
13973
14020
  break;
13974
14021
  }
13975
14022
  log.info('send delivered marker ', messageIds);
13976
- _context9.next = 11;
14023
+ _context0.next = 11;
13977
14024
  return effects.call(channel.markMessagesAsReceived, messageIds);
13978
14025
  case 11:
13979
- _context9.next = 16;
14026
+ _context0.next = 16;
13980
14027
  break;
13981
14028
  case 13:
13982
- _context9.prev = 13;
13983
- _context9.t0 = _context9["catch"](2);
13984
- log.error(_context9.t0, 'Error on mark messages delivered');
14029
+ _context0.prev = 13;
14030
+ _context0.t0 = _context0["catch"](2);
14031
+ log.error(_context0.t0, 'Error on mark messages delivered');
13985
14032
  case 16:
13986
14033
  case "end":
13987
- return _context9.stop();
14034
+ return _context0.stop();
13988
14035
  }
13989
- }, _marked9, null, [[2, 13]]);
14036
+ }, _marked0, null, [[2, 13]]);
13990
14037
  }
13991
14038
  function switchChannel(action) {
13992
14039
  var payload, channel, channelToSwitch, existingChannel, addChannel, SceytChatClient, fetchedChannel, channelFromMap, currentActiveChannel;
13993
- return _regeneratorRuntime().wrap(function switchChannel$(_context0) {
13994
- while (1) switch (_context0.prev = _context0.next) {
14040
+ return _regeneratorRuntime().wrap(function switchChannel$(_context1) {
14041
+ while (1) switch (_context1.prev = _context1.next) {
13995
14042
  case 0:
13996
- _context0.prev = 0;
14043
+ _context1.prev = 0;
13997
14044
  payload = action.payload;
13998
14045
  channel = payload.channel;
13999
14046
  channelToSwitch = channel;
14000
14047
  if (channel !== null && channel !== void 0 && channel.id) {
14001
- _context0.next = 10;
14048
+ _context1.next = 10;
14002
14049
  break;
14003
14050
  }
14004
- _context0.next = 7;
14051
+ _context1.next = 7;
14005
14052
  return effects.call(setActiveChannelId, '');
14006
14053
  case 7:
14007
- _context0.next = 9;
14054
+ _context1.next = 9;
14008
14055
  return effects.put(setActiveChannelAC({}));
14009
14056
  case 9:
14010
- return _context0.abrupt("return");
14057
+ return _context1.abrupt("return");
14011
14058
  case 10:
14012
14059
  existingChannel = checkChannelExists(channel.id);
14013
14060
  if (existingChannel) {
14014
- _context0.next = 31;
14061
+ _context1.next = 31;
14015
14062
  break;
14016
14063
  }
14017
14064
  addChannel = getChannelFromAllChannels(channel.id);
14018
14065
  if (!addChannel) {
14019
- _context0.next = 20;
14066
+ _context1.next = 20;
14020
14067
  break;
14021
14068
  }
14022
14069
  setChannelInMap(addChannel);
14023
- _context0.next = 17;
14070
+ _context1.next = 17;
14024
14071
  return effects.put(addChannelAC(JSON.parse(JSON.stringify(addChannel))));
14025
14072
  case 17:
14026
14073
  channelToSwitch = _extends({}, channelToSwitch, addChannel);
14027
- _context0.next = 29;
14074
+ _context1.next = 29;
14028
14075
  break;
14029
14076
  case 20:
14030
14077
  SceytChatClient = getClient();
14031
- _context0.next = 23;
14078
+ _context1.next = 23;
14032
14079
  return effects.call(SceytChatClient.getChannel, channel.id);
14033
14080
  case 23:
14034
- fetchedChannel = _context0.sent;
14081
+ fetchedChannel = _context1.sent;
14035
14082
  addChannelToAllChannels(fetchedChannel);
14036
14083
  setChannelInMap(fetchedChannel);
14037
- _context0.next = 28;
14084
+ _context1.next = 28;
14038
14085
  return effects.put(addChannelAC(JSON.parse(JSON.stringify(fetchedChannel))));
14039
14086
  case 28:
14040
14087
  channelToSwitch = _extends({}, channelToSwitch, fetchedChannel);
14041
14088
  case 29:
14042
- _context0.next = 33;
14089
+ _context1.next = 33;
14043
14090
  break;
14044
14091
  case 31:
14045
14092
  channelFromMap = getChannelFromMap(channel.id);
14046
14093
  channelToSwitch = _extends({}, channelToSwitch, channelFromMap);
14047
14094
  case 33:
14048
14095
  currentActiveChannel = getChannelFromMap(getActiveChannelId());
14049
- _context0.next = 36;
14096
+ _context1.next = 36;
14050
14097
  return effects.call(setUnreadScrollTo, true);
14051
14098
  case 36:
14052
- _context0.next = 38;
14099
+ _context1.next = 38;
14053
14100
  return effects.call(setActiveChannelId, channel && channel.id);
14054
14101
  case 38:
14055
14102
  if (channel.isLinkedChannel) {
14056
14103
  channelToSwitch.linkedFrom = currentActiveChannel;
14057
14104
  }
14058
- _context0.next = 41;
14105
+ _context1.next = 41;
14059
14106
  return effects.put(setActiveChannelAC(_extends({}, channelToSwitch)));
14060
14107
  case 41:
14061
- _context0.next = 47;
14108
+ _context1.next = 47;
14062
14109
  break;
14063
14110
  case 44:
14064
- _context0.prev = 44;
14065
- _context0.t0 = _context0["catch"](0);
14066
- log.error('error in switch channel', _context0.t0);
14111
+ _context1.prev = 44;
14112
+ _context1.t0 = _context1["catch"](0);
14113
+ log.error('error in switch channel', _context1.t0);
14067
14114
  case 47:
14068
14115
  case "end":
14069
- return _context0.stop();
14116
+ return _context1.stop();
14070
14117
  }
14071
- }, _marked0, null, [[0, 44]]);
14118
+ }, _marked1, null, [[0, 44]]);
14072
14119
  }
14073
14120
  function notificationsTurnOff(action) {
14074
14121
  var expireTime, activeChannelId, channel, updatedChannel;
14075
- return _regeneratorRuntime().wrap(function notificationsTurnOff$(_context1) {
14076
- while (1) switch (_context1.prev = _context1.next) {
14122
+ return _regeneratorRuntime().wrap(function notificationsTurnOff$(_context10) {
14123
+ while (1) switch (_context10.prev = _context10.next) {
14077
14124
  case 0:
14078
14125
  expireTime = action.payload.expireTime;
14079
- _context1.next = 3;
14126
+ _context10.next = 3;
14080
14127
  return effects.call(getActiveChannelId);
14081
14128
  case 3:
14082
- activeChannelId = _context1.sent;
14083
- _context1.next = 6;
14129
+ activeChannelId = _context10.sent;
14130
+ _context10.next = 6;
14084
14131
  return effects.call(getChannelFromMap, activeChannelId);
14085
14132
  case 6:
14086
- channel = _context1.sent;
14087
- _context1.prev = 7;
14088
- _context1.next = 10;
14133
+ channel = _context10.sent;
14134
+ _context10.prev = 7;
14135
+ _context10.next = 10;
14089
14136
  return effects.call(channel.mute, expireTime);
14090
14137
  case 10:
14091
- updatedChannel = _context1.sent;
14138
+ updatedChannel = _context10.sent;
14092
14139
  updateChannelOnAllChannels(channel.id, {
14093
14140
  muted: updatedChannel.muted,
14094
14141
  mutedTill: updatedChannel.mutedTill
14095
14142
  });
14096
- _context1.next = 14;
14143
+ _context10.next = 14;
14097
14144
  return effects.put(updateChannelDataAC(updatedChannel.id, {
14098
14145
  muted: updatedChannel.muted,
14099
14146
  mutedTill: updatedChannel.mutedTill
14100
14147
  }));
14101
14148
  case 14:
14102
- _context1.next = 19;
14149
+ _context10.next = 19;
14103
14150
  break;
14104
14151
  case 16:
14105
- _context1.prev = 16;
14106
- _context1.t0 = _context1["catch"](7);
14107
- log.error('ERROR turn off notifications', _context1.t0.message);
14152
+ _context10.prev = 16;
14153
+ _context10.t0 = _context10["catch"](7);
14154
+ log.error('ERROR turn off notifications', _context10.t0.message);
14108
14155
  case 19:
14109
14156
  case "end":
14110
- return _context1.stop();
14157
+ return _context10.stop();
14111
14158
  }
14112
- }, _marked1, null, [[7, 16]]);
14159
+ }, _marked10, null, [[7, 16]]);
14113
14160
  }
14114
14161
  function notificationsTurnOn() {
14115
14162
  var activeChannelId, channel, updatedChannel;
14116
- return _regeneratorRuntime().wrap(function notificationsTurnOn$(_context10) {
14117
- while (1) switch (_context10.prev = _context10.next) {
14163
+ return _regeneratorRuntime().wrap(function notificationsTurnOn$(_context11) {
14164
+ while (1) switch (_context11.prev = _context11.next) {
14118
14165
  case 0:
14119
- _context10.next = 2;
14166
+ _context11.next = 2;
14120
14167
  return effects.call(getActiveChannelId);
14121
14168
  case 2:
14122
- activeChannelId = _context10.sent;
14123
- _context10.next = 5;
14169
+ activeChannelId = _context11.sent;
14170
+ _context11.next = 5;
14124
14171
  return effects.call(getChannelFromMap, activeChannelId);
14125
14172
  case 5:
14126
- channel = _context10.sent;
14127
- _context10.prev = 6;
14128
- _context10.next = 9;
14173
+ channel = _context11.sent;
14174
+ _context11.prev = 6;
14175
+ _context11.next = 9;
14129
14176
  return effects.call(channel.unmute);
14130
14177
  case 9:
14131
- updatedChannel = _context10.sent;
14178
+ updatedChannel = _context11.sent;
14132
14179
  updateChannelOnAllChannels(channel.id, {
14133
14180
  muted: updatedChannel.muted,
14134
14181
  mutedTill: updatedChannel.mutedTill
14135
14182
  });
14136
- _context10.next = 13;
14183
+ _context11.next = 13;
14137
14184
  return effects.put(updateChannelDataAC(updatedChannel.id, {
14138
14185
  muted: updatedChannel.muted,
14139
14186
  mutedTill: updatedChannel.mutedTill
14140
14187
  }));
14141
14188
  case 13:
14142
- _context10.next = 18;
14189
+ _context11.next = 18;
14143
14190
  break;
14144
14191
  case 15:
14145
- _context10.prev = 15;
14146
- _context10.t0 = _context10["catch"](6);
14147
- log.error('ERROR turn on notifications: ', _context10.t0.message);
14192
+ _context11.prev = 15;
14193
+ _context11.t0 = _context11["catch"](6);
14194
+ log.error('ERROR turn on notifications: ', _context11.t0.message);
14148
14195
  case 18:
14149
14196
  case "end":
14150
- return _context10.stop();
14197
+ return _context11.stop();
14151
14198
  }
14152
- }, _marked10, null, [[6, 15]]);
14199
+ }, _marked11, null, [[6, 15]]);
14153
14200
  }
14154
14201
  function markChannelAsRead(action) {
14155
14202
  var channelId, channel, updateData;
14156
- return _regeneratorRuntime().wrap(function markChannelAsRead$(_context11) {
14157
- while (1) switch (_context11.prev = _context11.next) {
14203
+ return _regeneratorRuntime().wrap(function markChannelAsRead$(_context12) {
14204
+ while (1) switch (_context12.prev = _context12.next) {
14158
14205
  case 0:
14159
- _context11.prev = 0;
14206
+ _context12.prev = 0;
14160
14207
  channelId = action.payload.channelId;
14161
- _context11.next = 4;
14208
+ _context12.next = 4;
14162
14209
  return effects.call(getChannelFromMap, channelId);
14163
14210
  case 4:
14164
- channel = _context11.sent;
14211
+ channel = _context12.sent;
14165
14212
  if (!channel) {
14166
14213
  channel = getChannelFromAllChannels(channelId);
14167
14214
  }
14168
- _context11.next = 8;
14215
+ _context12.next = 8;
14169
14216
  return effects.call(channel.markAsRead);
14170
14217
  case 8:
14171
14218
  updateData = {
@@ -14174,316 +14221,316 @@ function markChannelAsRead(action) {
14174
14221
  newMentionCount: 0
14175
14222
  };
14176
14223
  updateChannelOnAllChannels(channel.id, updateData);
14177
- _context11.next = 12;
14224
+ _context12.next = 12;
14178
14225
  return effects.put(updateChannelDataAC(channel.id, updateData));
14179
14226
  case 12:
14180
- _context11.next = 17;
14227
+ _context12.next = 17;
14181
14228
  break;
14182
14229
  case 14:
14183
- _context11.prev = 14;
14184
- _context11.t0 = _context11["catch"](0);
14185
- log.error(_context11.t0, 'Error in set channel unread');
14230
+ _context12.prev = 14;
14231
+ _context12.t0 = _context12["catch"](0);
14232
+ log.error(_context12.t0, 'Error in set channel unread');
14186
14233
  case 17:
14187
14234
  case "end":
14188
- return _context11.stop();
14235
+ return _context12.stop();
14189
14236
  }
14190
- }, _marked11, null, [[0, 14]]);
14237
+ }, _marked12, null, [[0, 14]]);
14191
14238
  }
14192
14239
  function markChannelAsUnRead(action) {
14193
14240
  var channelId, channel;
14194
- return _regeneratorRuntime().wrap(function markChannelAsUnRead$(_context12) {
14195
- while (1) switch (_context12.prev = _context12.next) {
14241
+ return _regeneratorRuntime().wrap(function markChannelAsUnRead$(_context13) {
14242
+ while (1) switch (_context13.prev = _context13.next) {
14196
14243
  case 0:
14197
- _context12.prev = 0;
14244
+ _context13.prev = 0;
14198
14245
  channelId = action.payload.channelId;
14199
- _context12.next = 4;
14246
+ _context13.next = 4;
14200
14247
  return effects.call(getChannelFromMap, channelId);
14201
14248
  case 4:
14202
- channel = _context12.sent;
14249
+ channel = _context13.sent;
14203
14250
  if (!channel) {
14204
14251
  channel = getChannelFromAllChannels(channelId);
14205
14252
  }
14206
- _context12.next = 8;
14253
+ _context13.next = 8;
14207
14254
  return effects.call(channel.markAsUnRead);
14208
14255
  case 8:
14209
14256
  updateChannelOnAllChannels(channel.id, {
14210
14257
  unread: true
14211
14258
  });
14212
- _context12.next = 11;
14259
+ _context13.next = 11;
14213
14260
  return effects.put(updateChannelDataAC(channel.id, {
14214
14261
  unread: true
14215
14262
  }));
14216
14263
  case 11:
14217
- _context12.next = 16;
14264
+ _context13.next = 16;
14218
14265
  break;
14219
14266
  case 13:
14220
- _context12.prev = 13;
14221
- _context12.t0 = _context12["catch"](0);
14222
- log.error(_context12.t0, 'Error in set channel unread');
14267
+ _context13.prev = 13;
14268
+ _context13.t0 = _context13["catch"](0);
14269
+ log.error(_context13.t0, 'Error in set channel unread');
14223
14270
  case 16:
14224
14271
  case "end":
14225
- return _context12.stop();
14272
+ return _context13.stop();
14226
14273
  }
14227
- }, _marked12, null, [[0, 13]]);
14274
+ }, _marked13, null, [[0, 13]]);
14228
14275
  }
14229
14276
  function pinChannel(action) {
14230
14277
  var channelId, channel, updatedChannel;
14231
- return _regeneratorRuntime().wrap(function pinChannel$(_context13) {
14232
- while (1) switch (_context13.prev = _context13.next) {
14278
+ return _regeneratorRuntime().wrap(function pinChannel$(_context14) {
14279
+ while (1) switch (_context14.prev = _context14.next) {
14233
14280
  case 0:
14234
- _context13.prev = 0;
14281
+ _context14.prev = 0;
14235
14282
  channelId = action.payload.channelId;
14236
- _context13.next = 4;
14283
+ _context14.next = 4;
14237
14284
  return effects.call(getChannelFromMap, channelId);
14238
14285
  case 4:
14239
- channel = _context13.sent;
14286
+ channel = _context14.sent;
14240
14287
  if (!channel) {
14241
14288
  channel = getChannelFromAllChannels(channelId);
14242
14289
  }
14243
- _context13.next = 8;
14290
+ _context14.next = 8;
14244
14291
  return effects.call(channel.pin);
14245
14292
  case 8:
14246
- updatedChannel = _context13.sent;
14293
+ updatedChannel = _context14.sent;
14247
14294
  updateChannelOnAllChannels(channel.id, {
14248
14295
  pinnedAt: updatedChannel.pinnedAt
14249
14296
  });
14250
- _context13.next = 12;
14297
+ _context14.next = 12;
14251
14298
  return effects.put(updateChannelDataAC(updatedChannel.id, {
14252
14299
  pinnedAt: updatedChannel.pinnedAt
14253
14300
  }, true));
14254
14301
  case 12:
14255
- _context13.next = 17;
14302
+ _context14.next = 17;
14256
14303
  break;
14257
14304
  case 14:
14258
- _context13.prev = 14;
14259
- _context13.t0 = _context13["catch"](0);
14260
- log.error(_context13.t0, 'Error in pinChannel');
14305
+ _context14.prev = 14;
14306
+ _context14.t0 = _context14["catch"](0);
14307
+ log.error(_context14.t0, 'Error in pinChannel');
14261
14308
  case 17:
14262
14309
  case "end":
14263
- return _context13.stop();
14310
+ return _context14.stop();
14264
14311
  }
14265
- }, _marked13, null, [[0, 14]]);
14312
+ }, _marked14, null, [[0, 14]]);
14266
14313
  }
14267
14314
  function unpinChannel(action) {
14268
14315
  var channelId, channel, updatedChannel;
14269
- return _regeneratorRuntime().wrap(function unpinChannel$(_context14) {
14270
- while (1) switch (_context14.prev = _context14.next) {
14316
+ return _regeneratorRuntime().wrap(function unpinChannel$(_context15) {
14317
+ while (1) switch (_context15.prev = _context15.next) {
14271
14318
  case 0:
14272
- _context14.prev = 0;
14319
+ _context15.prev = 0;
14273
14320
  channelId = action.payload.channelId;
14274
- _context14.next = 4;
14321
+ _context15.next = 4;
14275
14322
  return effects.call(getChannelFromMap, channelId);
14276
14323
  case 4:
14277
- channel = _context14.sent;
14324
+ channel = _context15.sent;
14278
14325
  if (!channel) {
14279
14326
  channel = getChannelFromAllChannels(channelId);
14280
14327
  }
14281
- _context14.next = 8;
14328
+ _context15.next = 8;
14282
14329
  return effects.call(channel.unpin);
14283
14330
  case 8:
14284
- updatedChannel = _context14.sent;
14331
+ updatedChannel = _context15.sent;
14285
14332
  updateChannelOnAllChannels(channel.id, {
14286
14333
  pinnedAt: updatedChannel.pinnedAt
14287
14334
  });
14288
- _context14.next = 12;
14335
+ _context15.next = 12;
14289
14336
  return effects.put(updateChannelDataAC(updatedChannel.id, {
14290
14337
  pinnedAt: updatedChannel.pinnedAt
14291
14338
  }, false, true));
14292
14339
  case 12:
14293
- _context14.next = 17;
14340
+ _context15.next = 17;
14294
14341
  break;
14295
14342
  case 14:
14296
- _context14.prev = 14;
14297
- _context14.t0 = _context14["catch"](0);
14298
- log.error(_context14.t0, 'Error in unpinChannel');
14343
+ _context15.prev = 14;
14344
+ _context15.t0 = _context15["catch"](0);
14345
+ log.error(_context15.t0, 'Error in unpinChannel');
14299
14346
  case 17:
14300
14347
  case "end":
14301
- return _context14.stop();
14348
+ return _context15.stop();
14302
14349
  }
14303
- }, _marked14, null, [[0, 14]]);
14350
+ }, _marked15, null, [[0, 14]]);
14304
14351
  }
14305
14352
  function removeChannelCaches(action) {
14306
14353
  var payload, channelId, activeChannelId, activeChannel;
14307
- return _regeneratorRuntime().wrap(function removeChannelCaches$(_context15) {
14308
- while (1) switch (_context15.prev = _context15.next) {
14354
+ return _regeneratorRuntime().wrap(function removeChannelCaches$(_context16) {
14355
+ while (1) switch (_context16.prev = _context16.next) {
14309
14356
  case 0:
14310
14357
  payload = action.payload;
14311
14358
  channelId = payload.channelId;
14312
- _context15.next = 4;
14359
+ _context16.next = 4;
14313
14360
  return effects.call(getActiveChannelId);
14314
14361
  case 4:
14315
- activeChannelId = _context15.sent;
14362
+ activeChannelId = _context16.sent;
14316
14363
  removeChannelFromMap(channelId);
14317
14364
  removeMessagesFromMap(channelId);
14318
14365
  if (!(activeChannelId === channelId)) {
14319
- _context15.next = 14;
14366
+ _context16.next = 14;
14320
14367
  break;
14321
14368
  }
14322
- _context15.next = 10;
14369
+ _context16.next = 10;
14323
14370
  return effects.call(getLastChannelFromMap);
14324
14371
  case 10:
14325
- activeChannel = _context15.sent;
14372
+ activeChannel = _context16.sent;
14326
14373
  if (!activeChannel) {
14327
- _context15.next = 14;
14374
+ _context16.next = 14;
14328
14375
  break;
14329
14376
  }
14330
- _context15.next = 14;
14377
+ _context16.next = 14;
14331
14378
  return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
14332
14379
  case 14:
14333
14380
  case "end":
14334
- return _context15.stop();
14381
+ return _context16.stop();
14335
14382
  }
14336
- }, _marked15);
14383
+ }, _marked16);
14337
14384
  }
14338
14385
  function leaveChannel(action) {
14339
14386
  var payload, channelId, channel, messageBuilder, messageToSend;
14340
- return _regeneratorRuntime().wrap(function leaveChannel$(_context16) {
14341
- while (1) switch (_context16.prev = _context16.next) {
14387
+ return _regeneratorRuntime().wrap(function leaveChannel$(_context17) {
14388
+ while (1) switch (_context17.prev = _context17.next) {
14342
14389
  case 0:
14343
- _context16.prev = 0;
14390
+ _context17.prev = 0;
14344
14391
  payload = action.payload;
14345
14392
  channelId = payload.channelId;
14346
- _context16.next = 5;
14393
+ _context17.next = 5;
14347
14394
  return effects.call(getChannelFromMap, channelId);
14348
14395
  case 5:
14349
- channel = _context16.sent;
14396
+ channel = _context17.sent;
14350
14397
  if (!channel) {
14351
14398
  channel = getChannelFromAllChannels(channelId);
14352
14399
  }
14353
14400
  if (!channel) {
14354
- _context16.next = 24;
14401
+ _context17.next = 24;
14355
14402
  break;
14356
14403
  }
14357
14404
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
14358
- _context16.next = 16;
14405
+ _context17.next = 16;
14359
14406
  break;
14360
14407
  }
14361
14408
  messageBuilder = channel.createMessageBuilder();
14362
14409
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
14363
14410
  messageToSend = messageBuilder.create();
14364
14411
  log.info('send message for left');
14365
- _context16.next = 16;
14412
+ _context17.next = 16;
14366
14413
  return effects.call(channel.sendMessage, messageToSend);
14367
14414
  case 16:
14368
14415
  log.info('leave');
14369
- _context16.next = 19;
14416
+ _context17.next = 19;
14370
14417
  return effects.call(channel.leave);
14371
14418
  case 19:
14372
- _context16.next = 21;
14419
+ _context17.next = 21;
14373
14420
  return effects.put(removeChannelAC(channelId));
14374
14421
  case 21:
14375
14422
  deleteChannelFromAllChannels(channelId);
14376
- _context16.next = 24;
14423
+ _context17.next = 24;
14377
14424
  return effects.put(removeChannelCachesAC(channelId));
14378
14425
  case 24:
14379
- _context16.next = 29;
14426
+ _context17.next = 29;
14380
14427
  break;
14381
14428
  case 26:
14382
- _context16.prev = 26;
14383
- _context16.t0 = _context16["catch"](0);
14384
- log.error('ERROR in leave channel - ', _context16.t0.message);
14429
+ _context17.prev = 26;
14430
+ _context17.t0 = _context17["catch"](0);
14431
+ log.error('ERROR in leave channel - ', _context17.t0.message);
14385
14432
  case 29:
14386
14433
  case "end":
14387
- return _context16.stop();
14434
+ return _context17.stop();
14388
14435
  }
14389
- }, _marked16, null, [[0, 26]]);
14436
+ }, _marked17, null, [[0, 26]]);
14390
14437
  }
14391
14438
  function deleteChannel(action) {
14392
14439
  var payload, channelId, channel;
14393
- return _regeneratorRuntime().wrap(function deleteChannel$(_context17) {
14394
- while (1) switch (_context17.prev = _context17.next) {
14440
+ return _regeneratorRuntime().wrap(function deleteChannel$(_context18) {
14441
+ while (1) switch (_context18.prev = _context18.next) {
14395
14442
  case 0:
14396
- _context17.prev = 0;
14443
+ _context18.prev = 0;
14397
14444
  payload = action.payload;
14398
14445
  channelId = payload.channelId;
14399
- _context17.next = 5;
14446
+ _context18.next = 5;
14400
14447
  return effects.call(getChannelFromMap, channelId);
14401
14448
  case 5:
14402
- channel = _context17.sent;
14449
+ channel = _context18.sent;
14403
14450
  if (!channel) {
14404
14451
  channel = getChannelFromAllChannels(channelId);
14405
14452
  }
14406
14453
  if (!channel) {
14407
- _context17.next = 16;
14454
+ _context18.next = 16;
14408
14455
  break;
14409
14456
  }
14410
- _context17.next = 10;
14457
+ _context18.next = 10;
14411
14458
  return effects.call(channel["delete"]);
14412
14459
  case 10:
14413
- _context17.next = 12;
14460
+ _context18.next = 12;
14414
14461
  return effects.put(setChannelToRemoveAC(channel));
14415
14462
  case 12:
14416
- _context17.next = 14;
14463
+ _context18.next = 14;
14417
14464
  return effects.put(removeChannelAC(channelId));
14418
14465
  case 14:
14419
- _context17.next = 16;
14466
+ _context18.next = 16;
14420
14467
  return effects.put(removeChannelCachesAC(channelId));
14421
14468
  case 16:
14422
- _context17.next = 21;
14469
+ _context18.next = 21;
14423
14470
  break;
14424
14471
  case 18:
14425
- _context17.prev = 18;
14426
- _context17.t0 = _context17["catch"](0);
14427
- log.error('ERROR in delete channel', _context17.t0);
14472
+ _context18.prev = 18;
14473
+ _context18.t0 = _context18["catch"](0);
14474
+ log.error('ERROR in delete channel', _context18.t0);
14428
14475
  case 21:
14429
14476
  case "end":
14430
- return _context17.stop();
14477
+ return _context18.stop();
14431
14478
  }
14432
- }, _marked17, null, [[0, 18]]);
14479
+ }, _marked18, null, [[0, 18]]);
14433
14480
  }
14434
14481
  function blockChannel(action) {
14435
14482
  var payload, channelId, channel;
14436
- return _regeneratorRuntime().wrap(function blockChannel$(_context18) {
14437
- while (1) switch (_context18.prev = _context18.next) {
14483
+ return _regeneratorRuntime().wrap(function blockChannel$(_context19) {
14484
+ while (1) switch (_context19.prev = _context19.next) {
14438
14485
  case 0:
14439
- _context18.prev = 0;
14486
+ _context19.prev = 0;
14440
14487
  payload = action.payload;
14441
14488
  channelId = payload.channelId;
14442
- _context18.next = 5;
14489
+ _context19.next = 5;
14443
14490
  return effects.call(getChannelFromMap, channelId);
14444
14491
  case 5:
14445
- channel = _context18.sent;
14492
+ channel = _context19.sent;
14446
14493
  if (!channel) {
14447
14494
  channel = getChannelFromAllChannels(channelId);
14448
14495
  }
14449
14496
  if (!channel) {
14450
- _context18.next = 14;
14497
+ _context19.next = 14;
14451
14498
  break;
14452
14499
  }
14453
- _context18.next = 10;
14500
+ _context19.next = 10;
14454
14501
  return effects.call(channel.block);
14455
14502
  case 10:
14456
- _context18.next = 12;
14503
+ _context19.next = 12;
14457
14504
  return effects.put(removeChannelAC(channelId));
14458
14505
  case 12:
14459
- _context18.next = 14;
14506
+ _context19.next = 14;
14460
14507
  return effects.put(removeChannelCachesAC(channelId));
14461
14508
  case 14:
14462
- _context18.next = 19;
14509
+ _context19.next = 19;
14463
14510
  break;
14464
14511
  case 16:
14465
- _context18.prev = 16;
14466
- _context18.t0 = _context18["catch"](0);
14467
- log.error('ERROR in block channel - ', _context18.t0.message);
14512
+ _context19.prev = 16;
14513
+ _context19.t0 = _context19["catch"](0);
14514
+ log.error('ERROR in block channel - ', _context19.t0.message);
14468
14515
  case 19:
14469
14516
  case "end":
14470
- return _context18.stop();
14517
+ return _context19.stop();
14471
14518
  }
14472
- }, _marked18, null, [[0, 16]]);
14519
+ }, _marked19, null, [[0, 16]]);
14473
14520
  }
14474
14521
  function updateChannel(action) {
14475
14522
  var payload, channelId, config, SceytChatClient, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata;
14476
- return _regeneratorRuntime().wrap(function updateChannel$(_context19) {
14477
- while (1) switch (_context19.prev = _context19.next) {
14523
+ return _regeneratorRuntime().wrap(function updateChannel$(_context20) {
14524
+ while (1) switch (_context20.prev = _context20.next) {
14478
14525
  case 0:
14479
- _context19.prev = 0;
14526
+ _context20.prev = 0;
14480
14527
  payload = action.payload;
14481
14528
  channelId = payload.channelId, config = payload.config;
14482
14529
  SceytChatClient = getClient();
14483
- _context19.next = 6;
14530
+ _context20.next = 6;
14484
14531
  return effects.call(getChannelFromMap, channelId);
14485
14532
  case 6:
14486
- channel = _context19.sent;
14533
+ channel = _context20.sent;
14487
14534
  if (!channel) {
14488
14535
  channel = getChannelFromAllChannels(channelId);
14489
14536
  }
@@ -14494,7 +14541,7 @@ function updateChannel(action) {
14494
14541
  avatarUrl: channel.avatarUrl
14495
14542
  };
14496
14543
  if (!config.avatar) {
14497
- _context19.next = 14;
14544
+ _context20.next = 14;
14498
14545
  break;
14499
14546
  }
14500
14547
  fileToUpload = {
@@ -14503,10 +14550,10 @@ function updateChannel(action) {
14503
14550
  log.info('upload percent - ', progressPercent);
14504
14551
  }
14505
14552
  };
14506
- _context19.next = 13;
14553
+ _context20.next = 13;
14507
14554
  return effects.call(SceytChatClient.uploadFile, fileToUpload);
14508
14555
  case 13:
14509
- paramsToUpdate.avatarUrl = _context19.sent;
14556
+ paramsToUpdate.avatarUrl = _context20.sent;
14510
14557
  case 14:
14511
14558
  if (config.subject) {
14512
14559
  paramsToUpdate.subject = config.subject;
@@ -14517,14 +14564,14 @@ function updateChannel(action) {
14517
14564
  if (config.avatarUrl === '') {
14518
14565
  paramsToUpdate.avatarUrl = '';
14519
14566
  }
14520
- _context19.next = 19;
14567
+ _context20.next = 19;
14521
14568
  return effects.call(channel.update, paramsToUpdate);
14522
14569
  case 19:
14523
- _yield$call5 = _context19.sent;
14570
+ _yield$call5 = _context20.sent;
14524
14571
  subject = _yield$call5.subject;
14525
14572
  avatarUrl = _yield$call5.avatarUrl;
14526
14573
  metadata = _yield$call5.metadata;
14527
- _context19.next = 25;
14574
+ _context20.next = 25;
14528
14575
  return effects.put(updateChannelDataAC(channelId, {
14529
14576
  subject: subject,
14530
14577
  avatarUrl: avatarUrl,
@@ -14536,30 +14583,30 @@ function updateChannel(action) {
14536
14583
  avatarUrl: avatarUrl,
14537
14584
  metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
14538
14585
  });
14539
- _context19.next = 31;
14586
+ _context20.next = 31;
14540
14587
  break;
14541
14588
  case 28:
14542
- _context19.prev = 28;
14543
- _context19.t0 = _context19["catch"](0);
14544
- log.error('ERROR in update channel', _context19.t0.message);
14589
+ _context20.prev = 28;
14590
+ _context20.t0 = _context20["catch"](0);
14591
+ log.error('ERROR in update channel', _context20.t0.message);
14545
14592
  case 31:
14546
14593
  case "end":
14547
- return _context19.stop();
14594
+ return _context20.stop();
14548
14595
  }
14549
- }, _marked19, null, [[0, 28]]);
14596
+ }, _marked20, null, [[0, 28]]);
14550
14597
  }
14551
14598
  function checkUsersStatus() {
14552
14599
  var SceytChatClient, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData;
14553
- return _regeneratorRuntime().wrap(function checkUsersStatus$(_context20) {
14554
- while (1) switch (_context20.prev = _context20.next) {
14600
+ return _regeneratorRuntime().wrap(function checkUsersStatus$(_context21) {
14601
+ while (1) switch (_context21.prev = _context21.next) {
14555
14602
  case 0:
14556
- _context20.prev = 0;
14603
+ _context21.prev = 0;
14557
14604
  SceytChatClient = getClient();
14558
14605
  usersForUpdate = Object.keys(usersMap);
14559
- _context20.next = 5;
14606
+ _context21.next = 5;
14560
14607
  return effects.call(SceytChatClient.getUsers, usersForUpdate);
14561
14608
  case 5:
14562
- updatedUsers = _context20.sent;
14609
+ updatedUsers = _context21.sent;
14563
14610
  usersToUpdateMap = {};
14564
14611
  update = false;
14565
14612
  updatedUsers.forEach(function (updatedUser) {
@@ -14571,156 +14618,156 @@ function checkUsersStatus() {
14571
14618
  }
14572
14619
  });
14573
14620
  if (!update) {
14574
- _context20.next = 17;
14621
+ _context21.next = 17;
14575
14622
  break;
14576
14623
  }
14577
14624
  updateData = JSON.parse(JSON.stringify(usersToUpdateMap));
14578
- _context20.next = 13;
14625
+ _context21.next = 13;
14579
14626
  return effects.put(updateMembersPresenceAC(updateData));
14580
14627
  case 13:
14581
- _context20.next = 15;
14628
+ _context21.next = 15;
14582
14629
  return effects.put(updateUserStatusOnMapAC(updateData));
14583
14630
  case 15:
14584
- _context20.next = 17;
14631
+ _context21.next = 17;
14585
14632
  return effects.put(updateUserStatusOnChannelAC(updateData));
14586
14633
  case 17:
14587
- _context20.next = 22;
14634
+ _context21.next = 22;
14588
14635
  break;
14589
14636
  case 19:
14590
- _context20.prev = 19;
14591
- _context20.t0 = _context20["catch"](0);
14592
- log.error('ERROR in check user status : ', _context20.t0.message);
14637
+ _context21.prev = 19;
14638
+ _context21.t0 = _context21["catch"](0);
14639
+ log.error('ERROR in check user status : ', _context21.t0.message);
14593
14640
  case 22:
14594
14641
  case "end":
14595
- return _context20.stop();
14642
+ return _context21.stop();
14596
14643
  }
14597
- }, _marked20, null, [[0, 19]]);
14644
+ }, _marked21, null, [[0, 19]]);
14598
14645
  }
14599
14646
  function sendTyping(action) {
14600
14647
  var state, activeChannelId, channel;
14601
- return _regeneratorRuntime().wrap(function sendTyping$(_context21) {
14602
- while (1) switch (_context21.prev = _context21.next) {
14648
+ return _regeneratorRuntime().wrap(function sendTyping$(_context22) {
14649
+ while (1) switch (_context22.prev = _context22.next) {
14603
14650
  case 0:
14604
14651
  state = action.payload.state;
14605
- _context21.next = 3;
14652
+ _context22.next = 3;
14606
14653
  return effects.call(getActiveChannelId);
14607
14654
  case 3:
14608
- activeChannelId = _context21.sent;
14609
- _context21.next = 6;
14655
+ activeChannelId = _context22.sent;
14656
+ _context22.next = 6;
14610
14657
  return effects.call(getChannelFromMap, activeChannelId);
14611
14658
  case 6:
14612
- channel = _context21.sent;
14613
- _context21.prev = 7;
14659
+ channel = _context22.sent;
14660
+ _context22.prev = 7;
14614
14661
  if (!channel) {
14615
- _context21.next = 16;
14662
+ _context22.next = 16;
14616
14663
  break;
14617
14664
  }
14618
14665
  if (!state) {
14619
- _context21.next = 14;
14666
+ _context22.next = 14;
14620
14667
  break;
14621
14668
  }
14622
- _context21.next = 12;
14669
+ _context22.next = 12;
14623
14670
  return effects.call(channel.startTyping);
14624
14671
  case 12:
14625
- _context21.next = 16;
14672
+ _context22.next = 16;
14626
14673
  break;
14627
14674
  case 14:
14628
- _context21.next = 16;
14675
+ _context22.next = 16;
14629
14676
  return effects.call(channel.stopTyping);
14630
14677
  case 16:
14631
- _context21.next = 21;
14678
+ _context22.next = 21;
14632
14679
  break;
14633
14680
  case 18:
14634
- _context21.prev = 18;
14635
- _context21.t0 = _context21["catch"](7);
14636
- log.error('ERROR in send typing', _context21.t0);
14681
+ _context22.prev = 18;
14682
+ _context22.t0 = _context22["catch"](7);
14683
+ log.error('ERROR in send typing', _context22.t0);
14637
14684
  case 21:
14638
14685
  case "end":
14639
- return _context21.stop();
14686
+ return _context22.stop();
14640
14687
  }
14641
- }, _marked21, null, [[7, 18]]);
14688
+ }, _marked22, null, [[7, 18]]);
14642
14689
  }
14643
14690
  function sendRecording(action) {
14644
14691
  var state, activeChannelId, channel;
14645
- return _regeneratorRuntime().wrap(function sendRecording$(_context22) {
14646
- while (1) switch (_context22.prev = _context22.next) {
14692
+ return _regeneratorRuntime().wrap(function sendRecording$(_context23) {
14693
+ while (1) switch (_context23.prev = _context23.next) {
14647
14694
  case 0:
14648
14695
  state = action.payload.state;
14649
- _context22.next = 3;
14696
+ _context23.next = 3;
14650
14697
  return effects.call(getActiveChannelId);
14651
14698
  case 3:
14652
- activeChannelId = _context22.sent;
14653
- _context22.next = 6;
14699
+ activeChannelId = _context23.sent;
14700
+ _context23.next = 6;
14654
14701
  return effects.call(getChannelFromMap, activeChannelId);
14655
14702
  case 6:
14656
- channel = _context22.sent;
14657
- _context22.prev = 7;
14703
+ channel = _context23.sent;
14704
+ _context23.prev = 7;
14658
14705
  if (!channel) {
14659
- _context22.next = 16;
14706
+ _context23.next = 16;
14660
14707
  break;
14661
14708
  }
14662
14709
  if (!state) {
14663
- _context22.next = 14;
14710
+ _context23.next = 14;
14664
14711
  break;
14665
14712
  }
14666
- _context22.next = 12;
14713
+ _context23.next = 12;
14667
14714
  return effects.call(channel.startRecording);
14668
14715
  case 12:
14669
- _context22.next = 16;
14716
+ _context23.next = 16;
14670
14717
  break;
14671
14718
  case 14:
14672
- _context22.next = 16;
14719
+ _context23.next = 16;
14673
14720
  return effects.call(channel.stopRecording);
14674
14721
  case 16:
14675
- _context22.next = 21;
14722
+ _context23.next = 21;
14676
14723
  break;
14677
14724
  case 18:
14678
- _context22.prev = 18;
14679
- _context22.t0 = _context22["catch"](7);
14680
- log.error('ERROR in send recording', _context22.t0);
14725
+ _context23.prev = 18;
14726
+ _context23.t0 = _context23["catch"](7);
14727
+ log.error('ERROR in send recording', _context23.t0);
14681
14728
  case 21:
14682
14729
  case "end":
14683
- return _context22.stop();
14730
+ return _context23.stop();
14684
14731
  }
14685
- }, _marked22, null, [[7, 18]]);
14732
+ }, _marked23, null, [[7, 18]]);
14686
14733
  }
14687
14734
  function clearHistory(action) {
14688
14735
  var payload, channelId, channel, activeChannelId, groupName;
14689
- return _regeneratorRuntime().wrap(function clearHistory$(_context23) {
14690
- while (1) switch (_context23.prev = _context23.next) {
14736
+ return _regeneratorRuntime().wrap(function clearHistory$(_context24) {
14737
+ while (1) switch (_context24.prev = _context24.next) {
14691
14738
  case 0:
14692
- _context23.prev = 0;
14739
+ _context24.prev = 0;
14693
14740
  payload = action.payload;
14694
14741
  channelId = payload.channelId;
14695
- _context23.next = 5;
14742
+ _context24.next = 5;
14696
14743
  return effects.call(getChannelFromMap, channelId);
14697
14744
  case 5:
14698
- channel = _context23.sent;
14745
+ channel = _context24.sent;
14699
14746
  if (!channel) {
14700
14747
  channel = getChannelFromAllChannels(channelId);
14701
14748
  }
14702
- _context23.next = 9;
14749
+ _context24.next = 9;
14703
14750
  return effects.call(getActiveChannelId);
14704
14751
  case 9:
14705
- activeChannelId = _context23.sent;
14752
+ activeChannelId = _context24.sent;
14706
14753
  if (!channel) {
14707
- _context23.next = 25;
14754
+ _context24.next = 25;
14708
14755
  break;
14709
14756
  }
14710
- _context23.next = 13;
14757
+ _context24.next = 13;
14711
14758
  return effects.call(channel.deleteAllMessages);
14712
14759
  case 13:
14713
- _context23.next = 15;
14760
+ _context24.next = 15;
14714
14761
  return effects.put(clearMessagesAC());
14715
14762
  case 15:
14716
14763
  removeMessagesFromMap(channelId);
14717
14764
  if (channelId === activeChannelId) {
14718
14765
  removeAllMessages();
14719
14766
  }
14720
- _context23.next = 19;
14767
+ _context24.next = 19;
14721
14768
  return effects.put(clearSelectedMessagesAC());
14722
14769
  case 19:
14723
- _context23.next = 21;
14770
+ _context24.next = 21;
14724
14771
  return effects.put(updateChannelDataAC(channel.id, {
14725
14772
  lastMessage: null,
14726
14773
  newMessageCount: 0,
@@ -14733,65 +14780,65 @@ function clearHistory(action) {
14733
14780
  newMentionCount: 0
14734
14781
  });
14735
14782
  groupName = getChannelGroupName(channel);
14736
- _context23.next = 25;
14783
+ _context24.next = 25;
14737
14784
  return effects.put(updateSearchedChannelDataAC(channel.id, {
14738
14785
  lastMessage: null,
14739
14786
  newMessageCount: 0,
14740
14787
  newMentionCount: 0
14741
14788
  }, groupName));
14742
14789
  case 25:
14743
- _context23.next = 30;
14790
+ _context24.next = 30;
14744
14791
  break;
14745
14792
  case 27:
14746
- _context23.prev = 27;
14747
- _context23.t0 = _context23["catch"](0);
14748
- log.error('ERROR in clear history', _context23.t0);
14793
+ _context24.prev = 27;
14794
+ _context24.t0 = _context24["catch"](0);
14795
+ log.error('ERROR in clear history', _context24.t0);
14749
14796
  case 30:
14750
14797
  case "end":
14751
- return _context23.stop();
14798
+ return _context24.stop();
14752
14799
  }
14753
- }, _marked23, null, [[0, 27]]);
14800
+ }, _marked24, null, [[0, 27]]);
14754
14801
  }
14755
14802
  function deleteAllMessages(action) {
14756
14803
  var payload, channelId, channel, activeChannelId, groupName;
14757
- return _regeneratorRuntime().wrap(function deleteAllMessages$(_context24) {
14758
- while (1) switch (_context24.prev = _context24.next) {
14804
+ return _regeneratorRuntime().wrap(function deleteAllMessages$(_context25) {
14805
+ while (1) switch (_context25.prev = _context25.next) {
14759
14806
  case 0:
14760
- _context24.prev = 0;
14807
+ _context25.prev = 0;
14761
14808
  payload = action.payload;
14762
14809
  channelId = payload.channelId;
14763
- _context24.next = 5;
14810
+ _context25.next = 5;
14764
14811
  return effects.call(getChannelFromMap, channelId);
14765
14812
  case 5:
14766
- channel = _context24.sent;
14813
+ channel = _context25.sent;
14767
14814
  if (!channel) {
14768
14815
  channel = getChannelFromAllChannels(channelId);
14769
14816
  }
14770
- _context24.next = 9;
14817
+ _context25.next = 9;
14771
14818
  return effects.call(getActiveChannelId);
14772
14819
  case 9:
14773
- activeChannelId = _context24.sent;
14820
+ activeChannelId = _context25.sent;
14774
14821
  if (!channel) {
14775
- _context24.next = 26;
14822
+ _context25.next = 26;
14776
14823
  break;
14777
14824
  }
14778
- _context24.next = 13;
14825
+ _context25.next = 13;
14779
14826
  return effects.call(channel.deleteAllMessages, true);
14780
14827
  case 13:
14781
14828
  removeMessagesFromMap(channelId);
14782
14829
  if (!(channelId === activeChannelId)) {
14783
- _context24.next = 18;
14830
+ _context25.next = 18;
14784
14831
  break;
14785
14832
  }
14786
- _context24.next = 17;
14833
+ _context25.next = 17;
14787
14834
  return effects.put(clearMessagesAC());
14788
14835
  case 17:
14789
14836
  removeAllMessages();
14790
14837
  case 18:
14791
- _context24.next = 20;
14838
+ _context25.next = 20;
14792
14839
  return effects.put(clearSelectedMessagesAC());
14793
14840
  case 20:
14794
- _context24.next = 22;
14841
+ _context25.next = 22;
14795
14842
  return effects.put(updateChannelDataAC(channel.id, {
14796
14843
  lastMessage: null,
14797
14844
  newMessageCount: 0,
@@ -14804,183 +14851,186 @@ function deleteAllMessages(action) {
14804
14851
  newMentionCount: 0
14805
14852
  });
14806
14853
  groupName = getChannelGroupName(channel);
14807
- _context24.next = 26;
14854
+ _context25.next = 26;
14808
14855
  return effects.put(updateSearchedChannelDataAC(channel.id, {
14809
14856
  lastMessage: null,
14810
14857
  newMessageCount: 0,
14811
14858
  newMentionCount: 0
14812
14859
  }, groupName));
14813
14860
  case 26:
14814
- _context24.next = 31;
14861
+ _context25.next = 31;
14815
14862
  break;
14816
14863
  case 28:
14817
- _context24.prev = 28;
14818
- _context24.t0 = _context24["catch"](0);
14819
- log.error('ERROR in clear history', _context24.t0);
14864
+ _context25.prev = 28;
14865
+ _context25.t0 = _context25["catch"](0);
14866
+ log.error('ERROR in clear history', _context25.t0);
14820
14867
  case 31:
14821
14868
  case "end":
14822
- return _context24.stop();
14869
+ return _context25.stop();
14823
14870
  }
14824
- }, _marked24, null, [[0, 28]]);
14871
+ }, _marked25, null, [[0, 28]]);
14825
14872
  }
14826
14873
  function joinChannel(action) {
14827
14874
  var payload, channelId, SceytChatClient, channel, joinedChannel;
14828
- return _regeneratorRuntime().wrap(function joinChannel$(_context25) {
14829
- while (1) switch (_context25.prev = _context25.next) {
14875
+ return _regeneratorRuntime().wrap(function joinChannel$(_context26) {
14876
+ while (1) switch (_context26.prev = _context26.next) {
14830
14877
  case 0:
14831
- _context25.prev = 0;
14878
+ _context26.prev = 0;
14832
14879
  payload = action.payload;
14833
14880
  channelId = payload.channelId;
14834
14881
  SceytChatClient = getClient();
14835
- _context25.next = 6;
14882
+ _context26.next = 6;
14836
14883
  return effects.call(getChannelFromMap, channelId);
14837
14884
  case 6:
14838
- channel = _context25.sent;
14885
+ channel = _context26.sent;
14839
14886
  if (!channel) {
14840
14887
  channel = getChannelFromAllChannels(channelId);
14841
14888
  }
14842
14889
  if (channel) {
14843
- _context25.next = 12;
14890
+ _context26.next = 12;
14844
14891
  break;
14845
14892
  }
14846
- _context25.next = 11;
14893
+ _context26.next = 11;
14847
14894
  return effects.call(SceytChatClient.getChannel, channelId);
14848
14895
  case 11:
14849
- channel = _context25.sent;
14896
+ channel = _context26.sent;
14850
14897
  case 12:
14851
- _context25.next = 14;
14898
+ _context26.next = 14;
14852
14899
  return effects.call(channel.join);
14853
14900
  case 14:
14854
- joinedChannel = _context25.sent;
14855
- _context25.next = 17;
14901
+ joinedChannel = _context26.sent;
14902
+ _context26.next = 17;
14856
14903
  return effects.put(setCloseSearchChannelsAC(true));
14857
14904
  case 17:
14858
- _context25.next = 19;
14905
+ _context26.next = 19;
14859
14906
  return effects.put(setChannelToAddAC(JSON.parse(JSON.stringify(joinedChannel))));
14860
14907
  case 19:
14861
- _context25.next = 21;
14908
+ _context26.next = 21;
14862
14909
  return effects.put(switchChannelActionAC(JSON.parse(JSON.stringify(joinedChannel))));
14863
14910
  case 21:
14864
14911
  addChannelToAllChannels(joinedChannel);
14865
- _context25.next = 24;
14912
+ _context26.next = 24;
14866
14913
  return effects.call(setActiveChannelId, joinedChannel.id);
14867
14914
  case 24:
14868
- _context25.next = 29;
14915
+ _context26.next = 29;
14869
14916
  break;
14870
14917
  case 26:
14871
- _context25.prev = 26;
14872
- _context25.t0 = _context25["catch"](0);
14873
- log.error(_context25.t0, 'Error in join to channel');
14918
+ _context26.prev = 26;
14919
+ _context26.t0 = _context26["catch"](0);
14920
+ log.error(_context26.t0, 'Error in join to channel');
14874
14921
  case 29:
14875
14922
  case "end":
14876
- return _context25.stop();
14923
+ return _context26.stop();
14877
14924
  }
14878
- }, _marked25, null, [[0, 26]]);
14925
+ }, _marked26, null, [[0, 26]]);
14879
14926
  }
14880
14927
  function watchForChannelEvents() {
14881
- return _regeneratorRuntime().wrap(function watchForChannelEvents$(_context26) {
14882
- while (1) switch (_context26.prev = _context26.next) {
14928
+ return _regeneratorRuntime().wrap(function watchForChannelEvents$(_context27) {
14929
+ while (1) switch (_context27.prev = _context27.next) {
14883
14930
  case 0:
14884
- _context26.next = 2;
14931
+ _context27.next = 2;
14885
14932
  return effects.call(watchForEvents);
14886
14933
  case 2:
14887
14934
  case "end":
14888
- return _context26.stop();
14935
+ return _context27.stop();
14889
14936
  }
14890
- }, _marked26);
14937
+ }, _marked27);
14891
14938
  }
14892
14939
  function ChannelsSaga() {
14893
- return _regeneratorRuntime().wrap(function ChannelsSaga$(_context27) {
14894
- while (1) switch (_context27.prev = _context27.next) {
14940
+ return _regeneratorRuntime().wrap(function ChannelsSaga$(_context28) {
14941
+ while (1) switch (_context28.prev = _context28.next) {
14895
14942
  case 0:
14896
- _context27.next = 2;
14943
+ _context28.next = 2;
14897
14944
  return effects.takeLatest(CREATE_CHANNEL, createChannel);
14898
14945
  case 2:
14899
- _context27.next = 4;
14946
+ _context28.next = 4;
14900
14947
  return effects.takeLatest(GET_CHANNELS, getChannels);
14901
14948
  case 4:
14902
- _context27.next = 6;
14949
+ _context28.next = 6;
14903
14950
  return effects.takeLatest(SEARCH_CHANNELS, searchChannels);
14904
14951
  case 6:
14905
- _context27.next = 8;
14952
+ _context28.next = 8;
14906
14953
  return effects.takeLatest(GET_CHANNELS_FOR_FORWARD, getChannelsForForward);
14907
14954
  case 8:
14908
- _context27.next = 10;
14955
+ _context28.next = 10;
14909
14956
  return effects.takeLatest(SEARCH_CHANNELS_FOR_FORWARD, searchChannelsForForward);
14910
14957
  case 10:
14911
- _context27.next = 12;
14958
+ _context28.next = 12;
14912
14959
  return effects.takeLatest(LOAD_MORE_CHANNEL, channelsLoadMore);
14913
14960
  case 12:
14914
- _context27.next = 14;
14961
+ _context28.next = 14;
14915
14962
  return effects.takeLatest(LOAD_MORE_CHANNELS_FOR_FORWARD, channelsForForwardLoadMore);
14916
14963
  case 14:
14917
- _context27.next = 16;
14964
+ _context28.next = 16;
14918
14965
  return effects.takeEvery(SWITCH_CHANNEL, switchChannel);
14919
14966
  case 16:
14920
- _context27.next = 18;
14967
+ _context28.next = 18;
14921
14968
  return effects.takeLatest(LEAVE_CHANNEL, leaveChannel);
14922
14969
  case 18:
14923
- _context27.next = 20;
14970
+ _context28.next = 20;
14924
14971
  return effects.takeLatest(DELETE_CHANNEL, deleteChannel);
14925
14972
  case 20:
14926
- _context27.next = 22;
14973
+ _context28.next = 22;
14927
14974
  return effects.takeLatest(BLOCK_CHANNEL, blockChannel);
14928
14975
  case 22:
14929
- _context27.next = 24;
14976
+ _context28.next = 24;
14930
14977
  return effects.takeLatest(UPDATE_CHANNEL, updateChannel);
14931
14978
  case 24:
14932
- _context27.next = 26;
14979
+ _context28.next = 26;
14933
14980
  return effects.takeEvery(MARK_MESSAGES_AS_READ, markMessagesRead);
14934
14981
  case 26:
14935
- _context27.next = 28;
14982
+ _context28.next = 28;
14936
14983
  return effects.takeLatest(MARK_MESSAGES_AS_DELIVERED, markMessagesDelivered);
14937
14984
  case 28:
14938
- _context27.next = 30;
14985
+ _context28.next = 30;
14939
14986
  return effects.takeLatest(WATCH_FOR_EVENTS, watchForChannelEvents);
14940
14987
  case 30:
14941
- _context27.next = 32;
14988
+ _context28.next = 32;
14942
14989
  return effects.takeLatest(TURN_OFF_NOTIFICATION, notificationsTurnOff);
14943
14990
  case 32:
14944
- _context27.next = 34;
14991
+ _context28.next = 34;
14945
14992
  return effects.takeLatest(TURN_ON_NOTIFICATION, notificationsTurnOn);
14946
14993
  case 34:
14947
- _context27.next = 36;
14994
+ _context28.next = 36;
14948
14995
  return effects.takeLatest(MARK_CHANNEL_AS_READ, markChannelAsRead);
14949
14996
  case 36:
14950
- _context27.next = 38;
14997
+ _context28.next = 38;
14951
14998
  return effects.takeLatest(MARK_CHANNEL_AS_UNREAD, markChannelAsUnRead);
14952
14999
  case 38:
14953
- _context27.next = 40;
15000
+ _context28.next = 40;
14954
15001
  return effects.takeLatest(CHECK_USER_STATUS, checkUsersStatus);
14955
15002
  case 40:
14956
- _context27.next = 42;
15003
+ _context28.next = 42;
14957
15004
  return effects.takeLatest(SEND_TYPING, sendTyping);
14958
15005
  case 42:
14959
- _context27.next = 44;
15006
+ _context28.next = 44;
14960
15007
  return effects.takeLatest(SEND_RECORDING, sendRecording);
14961
15008
  case 44:
14962
- _context27.next = 46;
15009
+ _context28.next = 46;
14963
15010
  return effects.takeLatest(PIN_CHANNEL, pinChannel);
14964
15011
  case 46:
14965
- _context27.next = 48;
15012
+ _context28.next = 48;
14966
15013
  return effects.takeLatest(UNPIN_CHANNEL, unpinChannel);
14967
15014
  case 48:
14968
- _context27.next = 50;
15015
+ _context28.next = 50;
14969
15016
  return effects.takeLatest(CLEAR_HISTORY, clearHistory);
14970
15017
  case 50:
14971
- _context27.next = 52;
15018
+ _context28.next = 52;
14972
15019
  return effects.takeLatest(JOIN_TO_CHANNEL, joinChannel);
14973
15020
  case 52:
14974
- _context27.next = 54;
15021
+ _context28.next = 54;
14975
15022
  return effects.takeLatest(DELETE_ALL_MESSAGES, deleteAllMessages);
14976
15023
  case 54:
14977
- _context27.next = 56;
15024
+ _context28.next = 56;
14978
15025
  return effects.takeLatest(REMOVE_CHANNEL_CACHES, removeChannelCaches);
14979
15026
  case 56:
15027
+ _context28.next = 58;
15028
+ return effects.takeLatest(GET_CHANNEL_MENTIONS, getChannelMentions);
15029
+ case 58:
14980
15030
  case "end":
14981
- return _context27.stop();
15031
+ return _context28.stop();
14982
15032
  }
14983
- }, _marked27);
15033
+ }, _marked28);
14984
15034
  }
14985
15035
 
14986
15036
  function rgbaToThumbHash(w, h, rgba) {
@@ -21861,6 +21911,7 @@ var ChannelList = function ChannelList(_ref) {
21861
21911
  }, [searchValue]);
21862
21912
  useDidUpdate(function () {
21863
21913
  if (getSelectedChannel) {
21914
+ dispatch(getChannelMentionsAC(activeChannel.id));
21864
21915
  getSelectedChannel(activeChannel);
21865
21916
  }
21866
21917
  }, [activeChannel && activeChannel.members && activeChannel.members.length]);
@@ -38671,8 +38722,34 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
38671
38722
  var theme = reactRedux.useSelector(themeSelector);
38672
38723
  var sendMessageInputHeight = reactRedux.useSelector(sendMessageInputHeightSelector);
38673
38724
  var showScrollToNewMessageButton = reactRedux.useSelector(showScrollToNewMessageButtonSelector);
38725
+ var messages = reactRedux.useSelector(activeChannelMessagesSelector) || [];
38674
38726
  var handleScrollToBottom = function handleScrollToBottom() {
38675
- dispatch(scrollToNewMessageAC(true, true));
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
+ }
38676
38753
  };
38677
38754
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showScrollToNewMessageButton && (/*#__PURE__*/React__default.createElement(BottomButton, {
38678
38755
  theme: theme,
@@ -38715,6 +38792,145 @@ var UnreadCount$1 = styled__default.span(_templateObject2$O || (_templateObject2
38715
38792
  return props.textColor || '#fff';
38716
38793
  });
38717
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
+
38718
38934
  exports.Attachment = Attachment$1;
38719
38935
  exports.Avatar = Avatar;
38720
38936
  exports.Channel = Channel;
@@ -38731,6 +38947,7 @@ exports.MessageList = MessagesContainer;
38731
38947
  exports.MessageStatusIcon = MessageStatusIcon;
38732
38948
  exports.MessageTextFormat = MessageTextFormat;
38733
38949
  exports.MessagesScrollToBottomButton = MessagesScrollToBottomButton;
38950
+ exports.MessagesScrollToUnreadMentionsButton = MessagesScrollToUnreadMentionsButton;
38734
38951
  exports.SceytChat = SceytChatContainer;
38735
38952
  exports.SendMessage = SendMessageInput;
38736
38953
  exports.THEME_COLORS = THEME_COLORS;