sceyt-chat-react-uikit 1.8.4-beta.5 → 1.8.4-beta.6
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 +902 -721
- package/index.modern.js +902 -721
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10722,9 +10722,10 @@ function addMessagesAC(messages, direction) {
|
|
|
10722
10722
|
direction: direction
|
|
10723
10723
|
});
|
|
10724
10724
|
}
|
|
10725
|
-
function setMessagesAC(messages) {
|
|
10725
|
+
function setMessagesAC(messages, channelId) {
|
|
10726
10726
|
return setMessages({
|
|
10727
|
-
messages: messages
|
|
10727
|
+
messages: messages,
|
|
10728
|
+
channelId: channelId
|
|
10728
10729
|
});
|
|
10729
10730
|
}
|
|
10730
10731
|
function addReactionAC(channelId, messageId, key, score, reason, enforceUnique) {
|
|
@@ -11294,13 +11295,18 @@ var setAllMessages = function setAllMessages(messages) {
|
|
|
11294
11295
|
activeChannelAllMessages = messages;
|
|
11295
11296
|
};
|
|
11296
11297
|
var addAllMessages = function addAllMessages(messages, direction) {
|
|
11298
|
+
var toAdd = messages.filter(function (m) {
|
|
11299
|
+
return !activeChannelAllMessages.some(function (e) {
|
|
11300
|
+
return e.tid === m.tid || m.id && e.id === m.id;
|
|
11301
|
+
});
|
|
11302
|
+
});
|
|
11297
11303
|
if (direction === MESSAGE_LOAD_DIRECTION.PREV) {
|
|
11298
|
-
activeChannelAllMessages = [].concat(
|
|
11304
|
+
activeChannelAllMessages = [].concat(toAdd, activeChannelAllMessages);
|
|
11299
11305
|
if (activeChannelAllMessages.length > MESSAGES_MAX_PAGE_COUNT) {
|
|
11300
11306
|
setHasNextCached(true);
|
|
11301
11307
|
}
|
|
11302
11308
|
} else {
|
|
11303
|
-
activeChannelAllMessages = [].concat(activeChannelAllMessages,
|
|
11309
|
+
activeChannelAllMessages = [].concat(activeChannelAllMessages, toAdd);
|
|
11304
11310
|
if (activeChannelAllMessages.length > MESSAGES_MAX_PAGE_COUNT) {
|
|
11305
11311
|
setHasPrevCached(true);
|
|
11306
11312
|
}
|
|
@@ -11868,12 +11874,32 @@ var messageSlice = createSlice({
|
|
|
11868
11874
|
state.unreadScrollTo = action.payload.state;
|
|
11869
11875
|
},
|
|
11870
11876
|
setMessages: function setMessages(state, action) {
|
|
11871
|
-
state.activeChannelMessages = action.payload.messages;
|
|
11872
|
-
},
|
|
11873
|
-
addMessages: function addMessages(state, action) {
|
|
11874
11877
|
var _action$payload = action.payload,
|
|
11875
11878
|
messages = _action$payload.messages,
|
|
11876
|
-
|
|
11879
|
+
channelId = _action$payload.channelId;
|
|
11880
|
+
var pendingForChannel = channelId ? state.pendingMessagesMap[channelId] : undefined;
|
|
11881
|
+
if (pendingForChannel !== null && pendingForChannel !== void 0 && pendingForChannel.length) {
|
|
11882
|
+
var merged = [].concat(messages);
|
|
11883
|
+
var _loop = function _loop() {
|
|
11884
|
+
var pending = _step.value;
|
|
11885
|
+
if (!merged.some(function (m) {
|
|
11886
|
+
return m.tid === pending.tid || pending.id && m.id === pending.id;
|
|
11887
|
+
})) {
|
|
11888
|
+
merged.push(pending);
|
|
11889
|
+
}
|
|
11890
|
+
};
|
|
11891
|
+
for (var _iterator = _createForOfIteratorHelperLoose(pendingForChannel), _step; !(_step = _iterator()).done;) {
|
|
11892
|
+
_loop();
|
|
11893
|
+
}
|
|
11894
|
+
state.activeChannelMessages = merged;
|
|
11895
|
+
} else {
|
|
11896
|
+
state.activeChannelMessages = messages;
|
|
11897
|
+
}
|
|
11898
|
+
},
|
|
11899
|
+
addMessages: function addMessages(state, action) {
|
|
11900
|
+
var _action$payload2 = action.payload,
|
|
11901
|
+
messages = _action$payload2.messages,
|
|
11902
|
+
direction = _action$payload2.direction;
|
|
11877
11903
|
var newMessagesLength = messages.length;
|
|
11878
11904
|
var currentMessagesLength = state.activeChannelMessages.length;
|
|
11879
11905
|
var messagesIsNotIncludeInActiveChannelMessages = messages.filter(function (message) {
|
|
@@ -11916,10 +11942,10 @@ var messageSlice = createSlice({
|
|
|
11916
11942
|
}
|
|
11917
11943
|
},
|
|
11918
11944
|
updateMessagesStatus: function updateMessagesStatus(state, action) {
|
|
11919
|
-
var _action$
|
|
11920
|
-
name = _action$
|
|
11921
|
-
markersMap = _action$
|
|
11922
|
-
isOwnMarker = _action$
|
|
11945
|
+
var _action$payload3 = action.payload,
|
|
11946
|
+
name = _action$payload3.name,
|
|
11947
|
+
markersMap = _action$payload3.markersMap,
|
|
11948
|
+
isOwnMarker = _action$payload3.isOwnMarker;
|
|
11923
11949
|
var markerName = name;
|
|
11924
11950
|
for (var index = 0; index < state.activeChannelMessages.length; index++) {
|
|
11925
11951
|
if (!markersMap[state.activeChannelMessages[index].id]) {
|
|
@@ -11932,15 +11958,17 @@ var messageSlice = createSlice({
|
|
|
11932
11958
|
}
|
|
11933
11959
|
}
|
|
11934
11960
|
state.activeChannelMessages.sort(function (a, b) {
|
|
11935
|
-
|
|
11961
|
+
if (!(a !== null && a !== void 0 && a.id)) return 1;
|
|
11962
|
+
if (!(b !== null && b !== void 0 && b.id)) return -1;
|
|
11963
|
+
return BigInt(a.id) < BigInt(b.id) ? -1 : 1;
|
|
11936
11964
|
});
|
|
11937
11965
|
},
|
|
11938
11966
|
updateMessage: function updateMessage(state, action) {
|
|
11939
|
-
var _action$
|
|
11940
|
-
messageId = _action$
|
|
11941
|
-
params = _action$
|
|
11942
|
-
addIfNotExists = _action$
|
|
11943
|
-
voteDetails = _action$
|
|
11967
|
+
var _action$payload4 = action.payload,
|
|
11968
|
+
messageId = _action$payload4.messageId,
|
|
11969
|
+
params = _action$payload4.params,
|
|
11970
|
+
addIfNotExists = _action$payload4.addIfNotExists,
|
|
11971
|
+
voteDetails = _action$payload4.voteDetails;
|
|
11944
11972
|
var messageFound = false;
|
|
11945
11973
|
state.activeChannelMessages = state.activeChannelMessages.map(function (message) {
|
|
11946
11974
|
if (message.tid === messageId || message.id === messageId) {
|
|
@@ -11982,20 +12010,22 @@ var messageSlice = createSlice({
|
|
|
11982
12010
|
state.activeChannelMessages.push(params);
|
|
11983
12011
|
}
|
|
11984
12012
|
state.activeChannelMessages.sort(function (a, b) {
|
|
11985
|
-
|
|
12013
|
+
if (!(a !== null && a !== void 0 && a.id)) return 1;
|
|
12014
|
+
if (!(b !== null && b !== void 0 && b.id)) return -1;
|
|
12015
|
+
return BigInt(a.id) < BigInt(b.id) ? -1 : 1;
|
|
11986
12016
|
});
|
|
11987
12017
|
},
|
|
11988
12018
|
updateMessageAttachment: function updateMessageAttachment(state, action) {
|
|
11989
|
-
var _action$
|
|
11990
|
-
url = _action$
|
|
11991
|
-
attachmentUrl = _action$
|
|
12019
|
+
var _action$payload5 = action.payload,
|
|
12020
|
+
url = _action$payload5.url,
|
|
12021
|
+
attachmentUrl = _action$payload5.attachmentUrl;
|
|
11992
12022
|
state.attachmentUpdatedMap[url] = attachmentUrl;
|
|
11993
12023
|
},
|
|
11994
12024
|
addReactionToMessage: function addReactionToMessage(state, action) {
|
|
11995
|
-
var _action$
|
|
11996
|
-
message = _action$
|
|
11997
|
-
reaction = _action$
|
|
11998
|
-
isSelf = _action$
|
|
12025
|
+
var _action$payload6 = action.payload,
|
|
12026
|
+
message = _action$payload6.message,
|
|
12027
|
+
reaction = _action$payload6.reaction,
|
|
12028
|
+
isSelf = _action$payload6.isSelf;
|
|
11999
12029
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
12000
12030
|
if (msg.id === message.id) {
|
|
12001
12031
|
var slfReactions = [].concat(msg.userReactions);
|
|
@@ -12015,10 +12045,10 @@ var messageSlice = createSlice({
|
|
|
12015
12045
|
});
|
|
12016
12046
|
},
|
|
12017
12047
|
deleteReactionFromMessage: function deleteReactionFromMessage(state, action) {
|
|
12018
|
-
var _action$
|
|
12019
|
-
reaction = _action$
|
|
12020
|
-
message = _action$
|
|
12021
|
-
isSelf = _action$
|
|
12048
|
+
var _action$payload7 = action.payload,
|
|
12049
|
+
reaction = _action$payload7.reaction,
|
|
12050
|
+
message = _action$payload7.message,
|
|
12051
|
+
isSelf = _action$payload7.isSelf;
|
|
12022
12052
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
12023
12053
|
if (msg.id === message.id) {
|
|
12024
12054
|
var userReactions = msg.userReactions;
|
|
@@ -12067,9 +12097,9 @@ var messageSlice = createSlice({
|
|
|
12067
12097
|
(_state$activeTabAttac = state.activeTabAttachments).push.apply(_state$activeTabAttac, action.payload.attachments);
|
|
12068
12098
|
},
|
|
12069
12099
|
addAttachmentsForPopup: function addAttachmentsForPopup(state, action) {
|
|
12070
|
-
var _action$
|
|
12071
|
-
attachments = _action$
|
|
12072
|
-
direction = _action$
|
|
12100
|
+
var _action$payload8 = action.payload,
|
|
12101
|
+
attachments = _action$payload8.attachments,
|
|
12102
|
+
direction = _action$payload8.direction;
|
|
12073
12103
|
if (direction === 'prev') {
|
|
12074
12104
|
var _state$attachmentsFor;
|
|
12075
12105
|
(_state$attachmentsFor = state.attachmentsForPopup).unshift.apply(_state$attachmentsFor, attachments);
|
|
@@ -12090,10 +12120,10 @@ var messageSlice = createSlice({
|
|
|
12090
12120
|
}
|
|
12091
12121
|
},
|
|
12092
12122
|
updateUploadProgress: function updateUploadProgress(state, action) {
|
|
12093
|
-
var _action$
|
|
12094
|
-
uploaded = _action$
|
|
12095
|
-
total = _action$
|
|
12096
|
-
attachmentId = _action$
|
|
12123
|
+
var _action$payload9 = action.payload,
|
|
12124
|
+
uploaded = _action$payload9.uploaded,
|
|
12125
|
+
total = _action$payload9.total,
|
|
12126
|
+
attachmentId = _action$payload9.attachmentId;
|
|
12097
12127
|
var progress = uploaded / total;
|
|
12098
12128
|
var updateData = {
|
|
12099
12129
|
uploaded: uploaded,
|
|
@@ -12125,23 +12155,23 @@ var messageSlice = createSlice({
|
|
|
12125
12155
|
state.messageForReply = action.payload.message;
|
|
12126
12156
|
},
|
|
12127
12157
|
uploadAttachmentCompilation: function uploadAttachmentCompilation(state, action) {
|
|
12128
|
-
var _action$
|
|
12129
|
-
attachmentUploadingState = _action$
|
|
12130
|
-
attachmentId = _action$
|
|
12158
|
+
var _action$payload0 = action.payload,
|
|
12159
|
+
attachmentUploadingState = _action$payload0.attachmentUploadingState,
|
|
12160
|
+
attachmentId = _action$payload0.attachmentId;
|
|
12131
12161
|
state.attachmentsUploadingState[attachmentId] = attachmentUploadingState;
|
|
12132
12162
|
},
|
|
12133
12163
|
setReactionsList: function setReactionsList(state, action) {
|
|
12134
|
-
var _action$
|
|
12135
|
-
reactions = _action$
|
|
12136
|
-
hasNext = _action$
|
|
12164
|
+
var _action$payload1 = action.payload,
|
|
12165
|
+
reactions = _action$payload1.reactions,
|
|
12166
|
+
hasNext = _action$payload1.hasNext;
|
|
12137
12167
|
state.reactionsHasNext = hasNext;
|
|
12138
12168
|
state.reactionsList = [].concat(reactions);
|
|
12139
12169
|
},
|
|
12140
12170
|
addReactionsToList: function addReactionsToList(state, action) {
|
|
12141
12171
|
var _state$reactionsList;
|
|
12142
|
-
var _action$
|
|
12143
|
-
reactions = _action$
|
|
12144
|
-
hasNext = _action$
|
|
12172
|
+
var _action$payload10 = action.payload,
|
|
12173
|
+
reactions = _action$payload10.reactions,
|
|
12174
|
+
hasNext = _action$payload10.hasNext;
|
|
12145
12175
|
state.reactionsHasNext = hasNext;
|
|
12146
12176
|
(_state$reactionsList = state.reactionsList).push.apply(_state$reactionsList, reactions);
|
|
12147
12177
|
},
|
|
@@ -12185,18 +12215,18 @@ var messageSlice = createSlice({
|
|
|
12185
12215
|
state.selectedMessagesMap = null;
|
|
12186
12216
|
},
|
|
12187
12217
|
setOGMetadata: function setOGMetadata(state, action) {
|
|
12188
|
-
var _action$
|
|
12189
|
-
url = _action$
|
|
12190
|
-
metadata = _action$
|
|
12218
|
+
var _action$payload11 = action.payload,
|
|
12219
|
+
url = _action$payload11.url,
|
|
12220
|
+
metadata = _action$payload11.metadata;
|
|
12191
12221
|
if (!state.oGMetadata) {
|
|
12192
12222
|
state.oGMetadata = {};
|
|
12193
12223
|
}
|
|
12194
12224
|
state.oGMetadata[url] = metadata;
|
|
12195
12225
|
},
|
|
12196
12226
|
updateOGMetadata: function updateOGMetadata(state, action) {
|
|
12197
|
-
var _action$
|
|
12198
|
-
url = _action$
|
|
12199
|
-
metadata = _action$
|
|
12227
|
+
var _action$payload12 = action.payload,
|
|
12228
|
+
url = _action$payload12.url,
|
|
12229
|
+
metadata = _action$payload12.metadata;
|
|
12200
12230
|
if (metadata) {
|
|
12201
12231
|
if (!state.oGMetadata) {
|
|
12202
12232
|
state.oGMetadata = {};
|
|
@@ -12206,19 +12236,19 @@ var messageSlice = createSlice({
|
|
|
12206
12236
|
}
|
|
12207
12237
|
},
|
|
12208
12238
|
setMessageMarkers: function setMessageMarkers(state, action) {
|
|
12209
|
-
var _action$
|
|
12210
|
-
channelId = _action$
|
|
12211
|
-
messageId = _action$
|
|
12212
|
-
messageMarkers = _action$
|
|
12213
|
-
deliveryStatuses = _action$
|
|
12239
|
+
var _action$payload13 = action.payload,
|
|
12240
|
+
channelId = _action$payload13.channelId,
|
|
12241
|
+
messageId = _action$payload13.messageId,
|
|
12242
|
+
messageMarkers = _action$payload13.messageMarkers,
|
|
12243
|
+
deliveryStatuses = _action$payload13.deliveryStatuses;
|
|
12214
12244
|
if (!state.messageMarkers[channelId]) {
|
|
12215
12245
|
state.messageMarkers[channelId] = {};
|
|
12216
12246
|
}
|
|
12217
12247
|
if (!state.messageMarkers[channelId][messageId]) {
|
|
12218
12248
|
state.messageMarkers[channelId][messageId] = {};
|
|
12219
12249
|
}
|
|
12220
|
-
for (var
|
|
12221
|
-
var deliveryStatus =
|
|
12250
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(deliveryStatuses), _step2; !(_step2 = _iterator2()).done;) {
|
|
12251
|
+
var deliveryStatus = _step2.value;
|
|
12222
12252
|
if (!state.messageMarkers[channelId][messageId][deliveryStatus]) {
|
|
12223
12253
|
state.messageMarkers[channelId][messageId][deliveryStatus] = [];
|
|
12224
12254
|
}
|
|
@@ -12227,14 +12257,14 @@ var messageSlice = createSlice({
|
|
|
12227
12257
|
},
|
|
12228
12258
|
updateMessagesMarkers: function updateMessagesMarkers(state, action) {
|
|
12229
12259
|
var _marker$user;
|
|
12230
|
-
var _action$
|
|
12231
|
-
channelId = _action$
|
|
12232
|
-
deliveryStatus = _action$
|
|
12233
|
-
marker = _action$
|
|
12260
|
+
var _action$payload14 = action.payload,
|
|
12261
|
+
channelId = _action$payload14.channelId,
|
|
12262
|
+
deliveryStatus = _action$payload14.deliveryStatus,
|
|
12263
|
+
marker = _action$payload14.marker;
|
|
12234
12264
|
var userId = (_marker$user = marker.user) === null || _marker$user === void 0 ? void 0 : _marker$user.id;
|
|
12235
12265
|
var messageIds = marker.messageIds;
|
|
12236
|
-
for (var
|
|
12237
|
-
var messageId =
|
|
12266
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(messageIds), _step3; !(_step3 = _iterator3()).done;) {
|
|
12267
|
+
var messageId = _step3.value;
|
|
12238
12268
|
if (!state.messageMarkers[channelId]) {
|
|
12239
12269
|
state.messageMarkers[channelId] = {};
|
|
12240
12270
|
}
|
|
@@ -12269,11 +12299,11 @@ var messageSlice = createSlice({
|
|
|
12269
12299
|
state.messagesMarkersLoadingState = action.payload.state;
|
|
12270
12300
|
},
|
|
12271
12301
|
setPollVotesList: function setPollVotesList(state, action) {
|
|
12272
|
-
var _action$
|
|
12273
|
-
pollId = _action$
|
|
12274
|
-
optionId = _action$
|
|
12275
|
-
votes = _action$
|
|
12276
|
-
hasNext = _action$
|
|
12302
|
+
var _action$payload15 = action.payload,
|
|
12303
|
+
pollId = _action$payload15.pollId,
|
|
12304
|
+
optionId = _action$payload15.optionId,
|
|
12305
|
+
votes = _action$payload15.votes,
|
|
12306
|
+
hasNext = _action$payload15.hasNext;
|
|
12277
12307
|
var key = pollId + "_" + optionId;
|
|
12278
12308
|
state.pollVotesHasMore[key] = hasNext;
|
|
12279
12309
|
var sortedVotes = [].concat(votes).sort(function (a, b) {
|
|
@@ -12282,12 +12312,12 @@ var messageSlice = createSlice({
|
|
|
12282
12312
|
state.pollVotesList[key] = sortedVotes;
|
|
12283
12313
|
},
|
|
12284
12314
|
addPollVotesToList: function addPollVotesToList(state, action) {
|
|
12285
|
-
var _action$
|
|
12286
|
-
pollId = _action$
|
|
12287
|
-
optionId = _action$
|
|
12288
|
-
votes = _action$
|
|
12289
|
-
hasNext = _action$
|
|
12290
|
-
previousVotes = _action$
|
|
12315
|
+
var _action$payload16 = action.payload,
|
|
12316
|
+
pollId = _action$payload16.pollId,
|
|
12317
|
+
optionId = _action$payload16.optionId,
|
|
12318
|
+
votes = _action$payload16.votes,
|
|
12319
|
+
hasNext = _action$payload16.hasNext,
|
|
12320
|
+
previousVotes = _action$payload16.previousVotes;
|
|
12291
12321
|
var key = pollId + "_" + optionId;
|
|
12292
12322
|
state.pollVotesHasMore[key] = hasNext;
|
|
12293
12323
|
var existing = state.pollVotesList[key];
|
|
@@ -12308,11 +12338,11 @@ var messageSlice = createSlice({
|
|
|
12308
12338
|
},
|
|
12309
12339
|
deletePollVotesFromList: function deletePollVotesFromList(state, action) {
|
|
12310
12340
|
var _state$pollVotesList$;
|
|
12311
|
-
var _action$
|
|
12312
|
-
pollId = _action$
|
|
12313
|
-
optionId = _action$
|
|
12314
|
-
votes = _action$
|
|
12315
|
-
messageId = _action$
|
|
12341
|
+
var _action$payload17 = action.payload,
|
|
12342
|
+
pollId = _action$payload17.pollId,
|
|
12343
|
+
optionId = _action$payload17.optionId,
|
|
12344
|
+
votes = _action$payload17.votes,
|
|
12345
|
+
messageId = _action$payload17.messageId;
|
|
12316
12346
|
var key = pollId + "_" + optionId;
|
|
12317
12347
|
var existing = state.pollVotesList[key];
|
|
12318
12348
|
if (!existing || !(existing !== null && existing !== void 0 && existing.length)) {
|
|
@@ -12328,10 +12358,10 @@ var messageSlice = createSlice({
|
|
|
12328
12358
|
}
|
|
12329
12359
|
},
|
|
12330
12360
|
setPollVotesLoadingState: function setPollVotesLoadingState(state, action) {
|
|
12331
|
-
var _action$
|
|
12332
|
-
pollId = _action$
|
|
12333
|
-
optionId = _action$
|
|
12334
|
-
loadingState = _action$
|
|
12361
|
+
var _action$payload18 = action.payload,
|
|
12362
|
+
pollId = _action$payload18.pollId,
|
|
12363
|
+
optionId = _action$payload18.optionId,
|
|
12364
|
+
loadingState = _action$payload18.loadingState;
|
|
12335
12365
|
var key = pollId + "_" + optionId;
|
|
12336
12366
|
state.pollVotesLoadingState[key] = loadingState;
|
|
12337
12367
|
},
|
|
@@ -12339,10 +12369,10 @@ var messageSlice = createSlice({
|
|
|
12339
12369
|
state.pollVotesInitialCount = action.payload.initialCount;
|
|
12340
12370
|
},
|
|
12341
12371
|
removePendingPollAction: function removePendingPollAction(state, action) {
|
|
12342
|
-
var _action$
|
|
12343
|
-
messageId = _action$
|
|
12344
|
-
actionType = _action$
|
|
12345
|
-
optionId = _action$
|
|
12372
|
+
var _action$payload19 = action.payload,
|
|
12373
|
+
messageId = _action$payload19.messageId,
|
|
12374
|
+
actionType = _action$payload19.actionType,
|
|
12375
|
+
optionId = _action$payload19.optionId;
|
|
12346
12376
|
if (!state.pendingPollActions[messageId]) {
|
|
12347
12377
|
return;
|
|
12348
12378
|
}
|
|
@@ -12354,18 +12384,18 @@ var messageSlice = createSlice({
|
|
|
12354
12384
|
}
|
|
12355
12385
|
},
|
|
12356
12386
|
setPendingPollActionsMap: function setPendingPollActionsMap(state, action) {
|
|
12357
|
-
var _action$
|
|
12358
|
-
messageId = _action$
|
|
12359
|
-
event = _action$
|
|
12387
|
+
var _action$payload20 = action.payload,
|
|
12388
|
+
messageId = _action$payload20.messageId,
|
|
12389
|
+
event = _action$payload20.event;
|
|
12360
12390
|
if (!state.pendingPollActions[messageId]) {
|
|
12361
12391
|
state.pendingPollActions[messageId] = [];
|
|
12362
12392
|
}
|
|
12363
12393
|
state.pendingPollActions[messageId] = [].concat(state.pendingPollActions[messageId], [event]);
|
|
12364
12394
|
},
|
|
12365
12395
|
updatePendingPollAction: function updatePendingPollAction(state, action) {
|
|
12366
|
-
var _action$
|
|
12367
|
-
messageId = _action$
|
|
12368
|
-
message = _action$
|
|
12396
|
+
var _action$payload21 = action.payload,
|
|
12397
|
+
messageId = _action$payload21.messageId,
|
|
12398
|
+
message = _action$payload21.message;
|
|
12369
12399
|
if (!state.pendingPollActions[messageId]) {
|
|
12370
12400
|
return;
|
|
12371
12401
|
}
|
|
@@ -12377,9 +12407,9 @@ var messageSlice = createSlice({
|
|
|
12377
12407
|
});
|
|
12378
12408
|
},
|
|
12379
12409
|
setPendingMessage: function setPendingMessage(state, action) {
|
|
12380
|
-
var _action$
|
|
12381
|
-
channelId = _action$
|
|
12382
|
-
message = _action$
|
|
12410
|
+
var _action$payload22 = action.payload,
|
|
12411
|
+
channelId = _action$payload22.channelId,
|
|
12412
|
+
message = _action$payload22.message;
|
|
12383
12413
|
if (!state.pendingMessagesMap[channelId]) {
|
|
12384
12414
|
state.pendingMessagesMap[channelId] = [];
|
|
12385
12415
|
}
|
|
@@ -12391,9 +12421,9 @@ var messageSlice = createSlice({
|
|
|
12391
12421
|
}
|
|
12392
12422
|
},
|
|
12393
12423
|
removePendingMessage: function removePendingMessage(state, action) {
|
|
12394
|
-
var _action$
|
|
12395
|
-
channelId = _action$
|
|
12396
|
-
messageId = _action$
|
|
12424
|
+
var _action$payload23 = action.payload,
|
|
12425
|
+
channelId = _action$payload23.channelId,
|
|
12426
|
+
messageId = _action$payload23.messageId;
|
|
12397
12427
|
if (state.pendingMessagesMap[channelId]) {
|
|
12398
12428
|
state.pendingMessagesMap[channelId] = state.pendingMessagesMap[channelId].filter(function (msg) {
|
|
12399
12429
|
return !(msg.id === messageId || msg.tid === messageId);
|
|
@@ -12404,10 +12434,10 @@ var messageSlice = createSlice({
|
|
|
12404
12434
|
}
|
|
12405
12435
|
},
|
|
12406
12436
|
updatePendingMessage: function updatePendingMessage(state, action) {
|
|
12407
|
-
var _action$
|
|
12408
|
-
channelId = _action$
|
|
12409
|
-
messageId = _action$
|
|
12410
|
-
updatedMessage = _action$
|
|
12437
|
+
var _action$payload24 = action.payload,
|
|
12438
|
+
channelId = _action$payload24.channelId,
|
|
12439
|
+
messageId = _action$payload24.messageId,
|
|
12440
|
+
updatedMessage = _action$payload24.updatedMessage;
|
|
12411
12441
|
if (state.pendingMessagesMap[channelId]) {
|
|
12412
12442
|
state.pendingMessagesMap[channelId] = state.pendingMessagesMap[channelId].map(function (msg) {
|
|
12413
12443
|
if (msg.id === messageId || msg.tid === messageId) {
|
|
@@ -20672,13 +20702,7 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
20672
20702
|
return {};
|
|
20673
20703
|
}
|
|
20674
20704
|
}();
|
|
20675
|
-
var attachmentMeta = attachment.cachedUrl ? attachment.metadata : JSON.stringify(_extends({}, parsedAttachmentMeta
|
|
20676
|
-
tmb: thumbnailMetas.thumbnail,
|
|
20677
|
-
szw: thumbnailMetas.imageWidth,
|
|
20678
|
-
szh: thumbnailMetas.imageHeight
|
|
20679
|
-
}, thumbnailMetas.duration ? {
|
|
20680
|
-
dur: thumbnailMetas.duration
|
|
20681
|
-
} : {})));
|
|
20705
|
+
var attachmentMeta = attachment.cachedUrl ? attachment.metadata : JSON.stringify(_extends({}, parsedAttachmentMeta));
|
|
20682
20706
|
var attachmentBuilder = channel.createAttachmentBuilder(uriLocal, attachment.type);
|
|
20683
20707
|
var attachmentToSend = attachmentBuilder.setName(attachment.name).setMetadata(attachmentMeta).setFileSize(fileSize || attachment.size).setUpload(false).create();
|
|
20684
20708
|
if (attachment.tid) {
|
|
@@ -20686,113 +20710,101 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
20686
20710
|
}
|
|
20687
20711
|
return attachmentToSend;
|
|
20688
20712
|
}
|
|
20689
|
-
var thumbnailMetas;
|
|
20690
20713
|
var _temp9 = function () {
|
|
20691
20714
|
if (!attachment.cachedUrl && attachment.url.type.split('/')[0] === 'image') {
|
|
20692
|
-
return
|
|
20693
|
-
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
|
|
20705
|
-
|
|
20706
|
-
|
|
20707
|
-
|
|
20715
|
+
return _catch(function () {
|
|
20716
|
+
var _temp2 = function () {
|
|
20717
|
+
if (blobLocal && blobLocal.type.startsWith('image/')) {
|
|
20718
|
+
var file = attachment.url instanceof File ? attachment.url : new File([attachment.url], attachment.name || 'image', {
|
|
20719
|
+
type: attachment.url.type || blobLocal.type
|
|
20720
|
+
});
|
|
20721
|
+
var _calculateRenderedIma = calculateRenderedImageWidth((attachment === null || attachment === void 0 ? void 0 : attachment.metadata.szw) || 1280, (attachment === null || attachment === void 0 ? void 0 : attachment.metadata.szh) || 1080),
|
|
20722
|
+
newWidth = _calculateRenderedIma[0],
|
|
20723
|
+
newHeight = _calculateRenderedIma[1];
|
|
20724
|
+
return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref) {
|
|
20725
|
+
var resizedBlob = _ref.blob;
|
|
20726
|
+
var _temp = function () {
|
|
20727
|
+
if (resizedBlob) {
|
|
20728
|
+
var resizedResponse = new Response(resizedBlob, {
|
|
20729
|
+
headers: {
|
|
20730
|
+
'Content-Type': resizedBlob.type || blobLocal.type
|
|
20731
|
+
}
|
|
20732
|
+
});
|
|
20733
|
+
return Promise.resolve(setAttachmentToCache(uriLocal, resizedResponse)).then(function () {
|
|
20734
|
+
filePath = URL.createObjectURL(resizedBlob);
|
|
20735
|
+
store.dispatch(setUpdateMessageAttachmentAC(uriLocal, filePath));
|
|
20736
|
+
message.attachments[0] = _extends({}, message.attachments[0], {
|
|
20737
|
+
attachmentUrl: filePath
|
|
20738
|
+
});
|
|
20739
|
+
setAttachmentToCache(uriLocal + "_original_image_url", new Response(blobLocal, {
|
|
20708
20740
|
headers: {
|
|
20709
|
-
'Content-Type':
|
|
20741
|
+
'Content-Type': blobLocal.type
|
|
20710
20742
|
}
|
|
20711
|
-
});
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
|
|
20715
|
-
|
|
20716
|
-
|
|
20717
|
-
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_image_url", originalImageUrl));
|
|
20725
|
-
});
|
|
20726
|
-
}
|
|
20727
|
-
}();
|
|
20728
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
|
20729
|
-
});
|
|
20730
|
-
}
|
|
20731
|
-
}();
|
|
20732
|
-
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
20733
|
-
}, function (error) {
|
|
20734
|
-
log.error('Error resizing and caching image during upload:', error);
|
|
20735
|
-
});
|
|
20743
|
+
}));
|
|
20744
|
+
var originalImageUrl = URL.createObjectURL(blobLocal);
|
|
20745
|
+
store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_image_url", originalImageUrl));
|
|
20746
|
+
});
|
|
20747
|
+
}
|
|
20748
|
+
}();
|
|
20749
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
20750
|
+
});
|
|
20751
|
+
}
|
|
20752
|
+
}();
|
|
20753
|
+
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
20754
|
+
}, function (error) {
|
|
20755
|
+
log.error('Error resizing and caching image during upload:', error);
|
|
20736
20756
|
});
|
|
20737
20757
|
} else {
|
|
20738
20758
|
var _temp11 = function () {
|
|
20739
20759
|
if (!attachment.cachedUrl && attachment.url.type.split('/')[0] === 'video') {
|
|
20740
|
-
|
|
20741
|
-
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
var _temp5 = function () {
|
|
20758
|
-
if (frameBlobUrl && blob) {
|
|
20759
|
-
var _temp4 = function _temp4() {
|
|
20760
|
-
return Promise.resolve(setAttachmentToCache(uriLocal, response)).then(function () {
|
|
20761
|
-
store.dispatch(setUpdateMessageAttachmentAC(uriLocal, frameBlobUrl));
|
|
20762
|
-
message.attachments[0] = _extends({}, message.attachments[0], {
|
|
20763
|
-
attachmentUrl: frameBlobUrl
|
|
20764
|
-
});
|
|
20760
|
+
var _temp7 = function () {
|
|
20761
|
+
if (blobLocal) {
|
|
20762
|
+
var _calculateRenderedIma2 = calculateRenderedImageWidth((attachment === null || attachment === void 0 ? void 0 : attachment.metadata.szw) || 1280, (attachment === null || attachment === void 0 ? void 0 : attachment.metadata.szh) || 1080),
|
|
20763
|
+
newWidth = _calculateRenderedIma2[0],
|
|
20764
|
+
newHeight = _calculateRenderedIma2[1];
|
|
20765
|
+
return Promise.resolve(getVideoFirstFrame(blobLocal, newWidth, newHeight, 0.8)).then(function (result) {
|
|
20766
|
+
var _temp6 = function () {
|
|
20767
|
+
if (result) {
|
|
20768
|
+
var frameBlobUrl = result.frameBlobUrl,
|
|
20769
|
+
blob = result.blob;
|
|
20770
|
+
var _temp5 = function () {
|
|
20771
|
+
if (frameBlobUrl && blob) {
|
|
20772
|
+
var _temp4 = function _temp4() {
|
|
20773
|
+
return Promise.resolve(setAttachmentToCache(uriLocal, response)).then(function () {
|
|
20774
|
+
store.dispatch(setUpdateMessageAttachmentAC(uriLocal, frameBlobUrl));
|
|
20775
|
+
message.attachments[0] = _extends({}, message.attachments[0], {
|
|
20776
|
+
attachmentUrl: frameBlobUrl
|
|
20765
20777
|
});
|
|
20766
|
-
};
|
|
20767
|
-
var response = new Response(blob, {
|
|
20768
|
-
headers: {
|
|
20769
|
-
'Content-Type': blob.type
|
|
20770
|
-
}
|
|
20771
20778
|
});
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20779
|
+
};
|
|
20780
|
+
var response = new Response(blob, {
|
|
20781
|
+
headers: {
|
|
20782
|
+
'Content-Type': blob.type
|
|
20783
|
+
}
|
|
20784
|
+
});
|
|
20785
|
+
var _temp3 = function () {
|
|
20786
|
+
if (blobLocal) {
|
|
20787
|
+
return Promise.resolve(setAttachmentToCache(uriLocal + "_original_video_url", new Response(blobLocal, {
|
|
20788
|
+
headers: {
|
|
20789
|
+
'Content-Type': blobLocal.type
|
|
20790
|
+
}
|
|
20791
|
+
}))).then(function () {
|
|
20792
|
+
var originalVideoUrl = URL.createObjectURL(blobLocal);
|
|
20793
|
+
store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_video_url", originalVideoUrl));
|
|
20794
|
+
});
|
|
20795
|
+
}
|
|
20796
|
+
}();
|
|
20797
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
20798
|
+
}
|
|
20799
|
+
}();
|
|
20800
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
20801
|
+
}
|
|
20802
|
+
}();
|
|
20803
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
20804
|
+
});
|
|
20805
|
+
}
|
|
20806
|
+
}();
|
|
20807
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
20796
20808
|
}
|
|
20797
20809
|
}();
|
|
20798
20810
|
if (_temp11 && _temp11.then) return _temp11.then(function () {});
|
|
@@ -20866,13 +20878,13 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
20866
20878
|
isNotShowOwnMessageForward = false;
|
|
20867
20879
|
}
|
|
20868
20880
|
return /*#__PURE__*/_regenerator().m(function _callee() {
|
|
20869
|
-
var activeChannelId, channel, messages,
|
|
20881
|
+
var activeChannelId, channel, messages, lastMsgIdx, _channel$lastMessage2;
|
|
20870
20882
|
return _regenerator().w(function (_context) {
|
|
20871
20883
|
while (1) switch (_context.n) {
|
|
20872
20884
|
case 0:
|
|
20873
20885
|
activeChannelId = getActiveChannelId();
|
|
20874
20886
|
if (!(actionType !== RESEND_MESSAGE)) {
|
|
20875
|
-
_context.n =
|
|
20887
|
+
_context.n = 6;
|
|
20876
20888
|
break;
|
|
20877
20889
|
}
|
|
20878
20890
|
if (activeChannelId === channelId) {
|
|
@@ -20893,7 +20905,7 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
20893
20905
|
return effects.call(addPendingMessage, message, pending, channelId);
|
|
20894
20906
|
case 2:
|
|
20895
20907
|
if (!scrollToNewMessage) {
|
|
20896
|
-
_context.n =
|
|
20908
|
+
_context.n = 6;
|
|
20897
20909
|
break;
|
|
20898
20910
|
}
|
|
20899
20911
|
_context.n = 3;
|
|
@@ -20901,39 +20913,27 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
20901
20913
|
case 3:
|
|
20902
20914
|
channel = _context.v;
|
|
20903
20915
|
messages = store.getState().MessageReducer.activeChannelMessages;
|
|
20904
|
-
|
|
20916
|
+
lastMsgIdx = messages.findIndex(function (msg) {
|
|
20905
20917
|
var _channel$lastMessage;
|
|
20906
20918
|
return msg.id === (channel === null || channel === void 0 ? void 0 : (_channel$lastMessage = channel.lastMessage) === null || _channel$lastMessage === void 0 ? void 0 : _channel$lastMessage.id);
|
|
20907
|
-
})
|
|
20908
|
-
|
|
20919
|
+
});
|
|
20920
|
+
if (!(lastMsgIdx >= 0)) {
|
|
20921
|
+
_context.n = 5;
|
|
20909
20922
|
break;
|
|
20910
20923
|
}
|
|
20911
20924
|
_context.n = 4;
|
|
20912
20925
|
return effects.put(scrollToNewMessageAC(true, false, false));
|
|
20913
20926
|
case 4:
|
|
20914
|
-
_context.n =
|
|
20915
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
20916
|
-
case 5:
|
|
20917
|
-
repliedMessage = document.getElementById(channel === null || channel === void 0 ? void 0 : (_channel$lastMessage2 = channel.lastMessage) === null || _channel$lastMessage2 === void 0 ? void 0 : _channel$lastMessage2.id);
|
|
20918
|
-
if (repliedMessage) {
|
|
20919
|
-
scrollRef = document.getElementById('scrollableDiv');
|
|
20920
|
-
if (scrollRef) {
|
|
20921
|
-
scrollRef.scrollTo({
|
|
20922
|
-
top: 1000,
|
|
20923
|
-
behavior: 'smooth'
|
|
20924
|
-
});
|
|
20925
|
-
}
|
|
20926
|
-
}
|
|
20927
|
-
_context.n = 7;
|
|
20927
|
+
_context.n = 6;
|
|
20928
20928
|
break;
|
|
20929
|
-
case
|
|
20929
|
+
case 5:
|
|
20930
20930
|
if (!(channel !== null && channel !== void 0 && channel.id)) {
|
|
20931
|
-
_context.n =
|
|
20931
|
+
_context.n = 6;
|
|
20932
20932
|
break;
|
|
20933
20933
|
}
|
|
20934
|
-
_context.n =
|
|
20935
|
-
return effects.put(getMessagesAC(channel, true, channel === null || channel === void 0 ? void 0 : (_channel$
|
|
20936
|
-
case
|
|
20934
|
+
_context.n = 6;
|
|
20935
|
+
return effects.put(getMessagesAC(channel, true, channel === null || channel === void 0 ? void 0 : (_channel$lastMessage2 = channel.lastMessage) === null || _channel$lastMessage2 === void 0 ? void 0 : _channel$lastMessage2.id, undefined, false, 'smooth', true));
|
|
20936
|
+
case 6:
|
|
20937
20937
|
return _context.a(2);
|
|
20938
20938
|
}
|
|
20939
20939
|
}, _callee);
|
|
@@ -22586,7 +22586,7 @@ function loadOGMetadataForLinkSaga(action) {
|
|
|
22586
22586
|
}, _marked9$1);
|
|
22587
22587
|
}
|
|
22588
22588
|
function getMessagesQuery(action) {
|
|
22589
|
-
var _action$payload3, channel, loadWithLastMessage, messageId, limit, highlight, behavior, scrollToMessage, networkChanged, channelNewMessageCount, connectionState, messages, SceytChatClient, _updatedChannel, messageQueryBuilder, messageQuery, cachedMessages,
|
|
22589
|
+
var _action$payload3, channel, loadWithLastMessage, messageId, limit, highlight, behavior, scrollToMessage, networkChanged, channelNewMessageCount, connectionState, messages, SceytChatClient, _updatedChannel, messageQueryBuilder, messageQuery, cachedMessages, result, _result$messages$, _result$messages, _result$messages$2, _result$messages2, _result$messages$3, _result$messages3, loadNextMessageId, loadPreviousMessageId, nextLoadLimit, previousLoadLimit, centerMessageIndex, firstResult, secondResult, _result$messages$4, _result$messages4, _channel$lastMessage3, _channel$lastMessage4, _channel$lastMessage5, _result$messages5, _messages, _filteredPendingMessages, updatedMessages, messageIdForLoad, _updatedMessages$, filteredPendingMessages, waitToSendPendingMessages, updatedChannel, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21, _t22, _t23;
|
|
22590
22590
|
return _regenerator().w(function (_context14) {
|
|
22591
22591
|
while (1) switch (_context14.p = _context14.n) {
|
|
22592
22592
|
case 0:
|
|
@@ -22599,7 +22599,7 @@ function getMessagesQuery(action) {
|
|
|
22599
22599
|
connectionState = store.getState().UserReducer.connectionStatus;
|
|
22600
22600
|
messages = store.getState().MessageReducer.activeChannelMessages;
|
|
22601
22601
|
if (!(channel !== null && channel !== void 0 && channel.id && !(channel !== null && channel !== void 0 && channel.isMockChannel))) {
|
|
22602
|
-
_context14.n =
|
|
22602
|
+
_context14.n = 87;
|
|
22603
22603
|
break;
|
|
22604
22604
|
}
|
|
22605
22605
|
SceytChatClient = getClient();
|
|
@@ -22663,12 +22663,12 @@ function getMessagesQuery(action) {
|
|
|
22663
22663
|
cachedMessages = Object.values(getMessagesFromMap(channel.id) || {}).sort(function (a, b) {
|
|
22664
22664
|
return Number(a.id) - Number(b.id);
|
|
22665
22665
|
});
|
|
22666
|
-
|
|
22666
|
+
result = {
|
|
22667
22667
|
messages: [],
|
|
22668
22668
|
hasNext: false
|
|
22669
22669
|
};
|
|
22670
22670
|
if (!loadWithLastMessage) {
|
|
22671
|
-
_context14.n =
|
|
22671
|
+
_context14.n = 34;
|
|
22672
22672
|
break;
|
|
22673
22673
|
}
|
|
22674
22674
|
if (!(channelNewMessageCount && channelNewMessageCount > 0)) {
|
|
@@ -22698,7 +22698,7 @@ function getMessagesQuery(action) {
|
|
|
22698
22698
|
hasNext: false
|
|
22699
22699
|
};
|
|
22700
22700
|
case 14:
|
|
22701
|
-
|
|
22701
|
+
result = _t15;
|
|
22702
22702
|
_context14.n = 19;
|
|
22703
22703
|
break;
|
|
22704
22704
|
case 15:
|
|
@@ -22718,58 +22718,75 @@ function getMessagesQuery(action) {
|
|
|
22718
22718
|
hasNext: false
|
|
22719
22719
|
};
|
|
22720
22720
|
case 18:
|
|
22721
|
-
|
|
22721
|
+
result = _t16;
|
|
22722
22722
|
case 19:
|
|
22723
22723
|
_context14.n = 20;
|
|
22724
|
-
return effects.call(loadOGMetadataForLinkMessages,
|
|
22724
|
+
return effects.call(loadOGMetadataForLinkMessages, result.messages);
|
|
22725
22725
|
case 20:
|
|
22726
22726
|
_context14.n = 21;
|
|
22727
|
-
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(
|
|
22727
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages)), channel.id));
|
|
22728
22728
|
case 21:
|
|
22729
|
-
setMessagesToMap(channel.id,
|
|
22730
|
-
setAllMessages(
|
|
22729
|
+
setMessagesToMap(channel.id, result.messages, (_result$messages$ = result.messages[0]) === null || _result$messages$ === void 0 ? void 0 : _result$messages$.id, (_result$messages = result.messages[result.messages.length - 1]) === null || _result$messages === void 0 ? void 0 : _result$messages.id);
|
|
22730
|
+
setAllMessages(result.messages);
|
|
22731
22731
|
_context14.n = 22;
|
|
22732
22732
|
return effects.put(setMessagesHasPrevAC(true));
|
|
22733
22733
|
case 22:
|
|
22734
|
-
_context14.n =
|
|
22734
|
+
_context14.n = 29;
|
|
22735
22735
|
break;
|
|
22736
22736
|
case 23:
|
|
22737
|
-
|
|
22737
|
+
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22738
|
+
_context14.n = 25;
|
|
22739
|
+
break;
|
|
22740
|
+
}
|
|
22741
|
+
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
22738
22742
|
_context14.n = 24;
|
|
22739
|
-
return effects.call(
|
|
22743
|
+
return effects.call(messageQuery.loadPrevious);
|
|
22740
22744
|
case 24:
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22745
|
+
result = _context14.v;
|
|
22746
|
+
if (result.messages.length) {
|
|
22747
|
+
setMessagesToMap(channel.id, result.messages, (_result$messages$2 = result.messages[0]) === null || _result$messages$2 === void 0 ? void 0 : _result$messages$2.id, (_result$messages2 = result.messages[result.messages.length - 1]) === null || _result$messages2 === void 0 ? void 0 : _result$messages2.id);
|
|
22748
|
+
setAllMessages(result.messages);
|
|
22749
|
+
}
|
|
22744
22750
|
_context14.n = 26;
|
|
22745
|
-
|
|
22751
|
+
break;
|
|
22752
|
+
case 25:
|
|
22753
|
+
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
22746
22754
|
case 26:
|
|
22747
22755
|
_context14.n = 27;
|
|
22748
|
-
return effects.
|
|
22756
|
+
return effects.call(loadOGMetadataForLinkMessages, result.messages);
|
|
22749
22757
|
case 27:
|
|
22758
|
+
_context14.n = 28;
|
|
22759
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages)), channel.id));
|
|
22760
|
+
case 28:
|
|
22761
|
+
_context14.n = 29;
|
|
22762
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
22763
|
+
case 29:
|
|
22764
|
+
_context14.n = 30;
|
|
22765
|
+
return effects.put(setMessagesHasNextAC(false));
|
|
22766
|
+
case 30:
|
|
22750
22767
|
setHasNextCached(false);
|
|
22751
22768
|
if (!(messageId && scrollToMessage)) {
|
|
22752
|
-
_context14.n =
|
|
22769
|
+
_context14.n = 33;
|
|
22753
22770
|
break;
|
|
22754
22771
|
}
|
|
22755
22772
|
if (!(channelNewMessageCount && channelNewMessageCount > 0)) {
|
|
22756
|
-
_context14.n =
|
|
22773
|
+
_context14.n = 32;
|
|
22757
22774
|
break;
|
|
22758
22775
|
}
|
|
22759
|
-
_context14.n =
|
|
22776
|
+
_context14.n = 31;
|
|
22760
22777
|
return effects.put(setScrollToMessagesAC(channel.lastDisplayedMessageId, highlight, behavior));
|
|
22761
|
-
case
|
|
22762
|
-
_context14.n =
|
|
22778
|
+
case 31:
|
|
22779
|
+
_context14.n = 33;
|
|
22763
22780
|
break;
|
|
22764
|
-
case
|
|
22765
|
-
_context14.n =
|
|
22781
|
+
case 32:
|
|
22782
|
+
_context14.n = 33;
|
|
22766
22783
|
return effects.put(scrollToNewMessageAC(true));
|
|
22767
|
-
case
|
|
22768
|
-
_context14.n =
|
|
22784
|
+
case 33:
|
|
22785
|
+
_context14.n = 79;
|
|
22769
22786
|
break;
|
|
22770
|
-
case
|
|
22787
|
+
case 34:
|
|
22771
22788
|
if (!(messageId && messages !== null && messages !== void 0 && messages.length)) {
|
|
22772
|
-
_context14.n =
|
|
22789
|
+
_context14.n = 46;
|
|
22773
22790
|
break;
|
|
22774
22791
|
}
|
|
22775
22792
|
loadNextMessageId = '';
|
|
@@ -22786,23 +22803,22 @@ function getMessagesQuery(action) {
|
|
|
22786
22803
|
loadPreviousMessageId = messageId;
|
|
22787
22804
|
}
|
|
22788
22805
|
messageQuery.limit = previousLoadLimit;
|
|
22789
|
-
log.info('load by message id from server ...............', messageId);
|
|
22790
22806
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22791
|
-
_context14.n =
|
|
22807
|
+
_context14.n = 36;
|
|
22792
22808
|
break;
|
|
22793
22809
|
}
|
|
22794
|
-
_context14.n =
|
|
22810
|
+
_context14.n = 35;
|
|
22795
22811
|
return effects.call(messageQuery.loadPreviousMessageId, loadPreviousMessageId);
|
|
22796
|
-
case
|
|
22812
|
+
case 35:
|
|
22797
22813
|
_t17 = _context14.v;
|
|
22798
|
-
_context14.n =
|
|
22814
|
+
_context14.n = 37;
|
|
22799
22815
|
break;
|
|
22800
|
-
case
|
|
22816
|
+
case 36:
|
|
22801
22817
|
_t17 = {
|
|
22802
22818
|
messages: [],
|
|
22803
22819
|
hasNext: false
|
|
22804
22820
|
};
|
|
22805
|
-
case
|
|
22821
|
+
case 37:
|
|
22806
22822
|
firstResult = _t17;
|
|
22807
22823
|
if (!networkChanged && firstResult.messages.length > 0) {
|
|
22808
22824
|
loadNextMessageId = firstResult.messages[firstResult.messages.length - 1].id;
|
|
@@ -22812,190 +22828,189 @@ function getMessagesQuery(action) {
|
|
|
22812
22828
|
messageQuery.reverse = false;
|
|
22813
22829
|
messageQuery.limit = nextLoadLimit;
|
|
22814
22830
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22815
|
-
_context14.n =
|
|
22831
|
+
_context14.n = 39;
|
|
22816
22832
|
break;
|
|
22817
22833
|
}
|
|
22818
|
-
_context14.n =
|
|
22834
|
+
_context14.n = 38;
|
|
22819
22835
|
return effects.call(messageQuery.loadNextMessageId, loadNextMessageId);
|
|
22820
|
-
case
|
|
22836
|
+
case 38:
|
|
22821
22837
|
_t18 = _context14.v;
|
|
22822
|
-
_context14.n =
|
|
22838
|
+
_context14.n = 40;
|
|
22823
22839
|
break;
|
|
22824
|
-
case
|
|
22840
|
+
case 39:
|
|
22825
22841
|
_t18 = {
|
|
22826
22842
|
messages: [],
|
|
22827
22843
|
hasNext: false
|
|
22828
22844
|
};
|
|
22829
|
-
case
|
|
22845
|
+
case 40:
|
|
22830
22846
|
secondResult = _t18;
|
|
22831
|
-
|
|
22832
|
-
_context14.n =
|
|
22833
|
-
return effects.call(loadOGMetadataForLinkMessages,
|
|
22834
|
-
case
|
|
22835
|
-
_context14.n =
|
|
22836
|
-
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(
|
|
22837
|
-
case
|
|
22838
|
-
setMessagesToMap(channel.id,
|
|
22839
|
-
setAllMessages([].concat(
|
|
22847
|
+
result.messages = [].concat(firstResult.messages, secondResult.messages);
|
|
22848
|
+
_context14.n = 41;
|
|
22849
|
+
return effects.call(loadOGMetadataForLinkMessages, result.messages);
|
|
22850
|
+
case 41:
|
|
22851
|
+
_context14.n = 42;
|
|
22852
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages)), channel.id));
|
|
22853
|
+
case 42:
|
|
22854
|
+
setMessagesToMap(channel.id, result.messages, (_result$messages$3 = result.messages[0]) === null || _result$messages$3 === void 0 ? void 0 : _result$messages$3.id, (_result$messages3 = result.messages[result.messages.length - 1]) === null || _result$messages3 === void 0 ? void 0 : _result$messages3.id);
|
|
22855
|
+
setAllMessages([].concat(result.messages));
|
|
22840
22856
|
setHasPrevCached(false);
|
|
22841
22857
|
setHasNextCached(false);
|
|
22842
|
-
_context14.n =
|
|
22858
|
+
_context14.n = 43;
|
|
22843
22859
|
return effects.put(setMessagesHasNextAC(true));
|
|
22844
|
-
case
|
|
22860
|
+
case 43:
|
|
22845
22861
|
if (!(scrollToMessage && !networkChanged)) {
|
|
22846
|
-
_context14.n =
|
|
22862
|
+
_context14.n = 44;
|
|
22847
22863
|
break;
|
|
22848
22864
|
}
|
|
22849
|
-
_context14.n =
|
|
22865
|
+
_context14.n = 44;
|
|
22850
22866
|
return effects.put(setScrollToMessagesAC(messageId, highlight, behavior));
|
|
22851
|
-
case
|
|
22852
|
-
_context14.n =
|
|
22867
|
+
case 44:
|
|
22868
|
+
_context14.n = 45;
|
|
22853
22869
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
22854
|
-
case
|
|
22855
|
-
_context14.n =
|
|
22870
|
+
case 45:
|
|
22871
|
+
_context14.n = 79;
|
|
22856
22872
|
break;
|
|
22857
|
-
case
|
|
22873
|
+
case 46:
|
|
22858
22874
|
if (!(channelNewMessageCount && channel.lastDisplayedMessageId)) {
|
|
22859
|
-
_context14.n =
|
|
22875
|
+
_context14.n = 61;
|
|
22860
22876
|
break;
|
|
22861
22877
|
}
|
|
22862
22878
|
setAllMessages([]);
|
|
22863
22879
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
22864
22880
|
if (!Number(channel.lastDisplayedMessageId)) {
|
|
22865
|
-
_context14.n =
|
|
22881
|
+
_context14.n = 50;
|
|
22866
22882
|
break;
|
|
22867
22883
|
}
|
|
22868
22884
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22869
|
-
_context14.n =
|
|
22885
|
+
_context14.n = 48;
|
|
22870
22886
|
break;
|
|
22871
22887
|
}
|
|
22872
|
-
_context14.n =
|
|
22888
|
+
_context14.n = 47;
|
|
22873
22889
|
return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
|
|
22874
|
-
case
|
|
22890
|
+
case 47:
|
|
22875
22891
|
_t19 = _context14.v;
|
|
22876
|
-
_context14.n =
|
|
22892
|
+
_context14.n = 49;
|
|
22877
22893
|
break;
|
|
22878
|
-
case
|
|
22894
|
+
case 48:
|
|
22879
22895
|
_t19 = {
|
|
22880
22896
|
messages: [],
|
|
22881
22897
|
hasNext: false
|
|
22882
22898
|
};
|
|
22883
|
-
case
|
|
22884
|
-
|
|
22885
|
-
_context14.n =
|
|
22899
|
+
case 49:
|
|
22900
|
+
result = _t19;
|
|
22901
|
+
_context14.n = 54;
|
|
22886
22902
|
break;
|
|
22887
|
-
case
|
|
22903
|
+
case 50:
|
|
22888
22904
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22889
|
-
_context14.n =
|
|
22905
|
+
_context14.n = 52;
|
|
22890
22906
|
break;
|
|
22891
22907
|
}
|
|
22892
|
-
_context14.n =
|
|
22908
|
+
_context14.n = 51;
|
|
22893
22909
|
return effects.call(messageQuery.loadPrevious);
|
|
22894
|
-
case
|
|
22910
|
+
case 51:
|
|
22895
22911
|
_t20 = _context14.v;
|
|
22896
|
-
_context14.n =
|
|
22912
|
+
_context14.n = 53;
|
|
22897
22913
|
break;
|
|
22898
|
-
case
|
|
22914
|
+
case 52:
|
|
22899
22915
|
_t20 = {
|
|
22900
22916
|
messages: [],
|
|
22901
22917
|
hasNext: false
|
|
22902
22918
|
};
|
|
22903
|
-
case 50:
|
|
22904
|
-
_result = _t20;
|
|
22905
|
-
case 51:
|
|
22906
|
-
_context14.n = 52;
|
|
22907
|
-
return effects.put(setMessagesHasPrevAC(true));
|
|
22908
|
-
case 52:
|
|
22909
|
-
_context14.n = 53;
|
|
22910
|
-
return effects.put(setMessagesHasNextAC(channel.lastMessage && _result.messages.length > 0 && channel.lastMessage.id !== _result.messages[_result.messages.length - 1].id));
|
|
22911
22919
|
case 53:
|
|
22912
|
-
|
|
22913
|
-
setAllMessages([].concat(_result.messages));
|
|
22914
|
-
_context14.n = 54;
|
|
22915
|
-
return effects.call(loadOGMetadataForLinkMessages, _result.messages);
|
|
22920
|
+
result = _t20;
|
|
22916
22921
|
case 54:
|
|
22917
22922
|
_context14.n = 55;
|
|
22918
|
-
return effects.put(
|
|
22923
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
22919
22924
|
case 55:
|
|
22920
22925
|
_context14.n = 56;
|
|
22921
|
-
return effects.put(
|
|
22926
|
+
return effects.put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
|
|
22922
22927
|
case 56:
|
|
22928
|
+
setMessagesToMap(channel.id, result.messages, (_result$messages$4 = result.messages[0]) === null || _result$messages$4 === void 0 ? void 0 : _result$messages$4.id, (_result$messages4 = result.messages[result.messages.length - 1]) === null || _result$messages4 === void 0 ? void 0 : _result$messages4.id);
|
|
22929
|
+
setAllMessages([].concat(result.messages));
|
|
22923
22930
|
_context14.n = 57;
|
|
22924
|
-
return effects.
|
|
22931
|
+
return effects.call(loadOGMetadataForLinkMessages, result.messages);
|
|
22925
22932
|
case 57:
|
|
22926
|
-
_context14.n =
|
|
22927
|
-
|
|
22933
|
+
_context14.n = 58;
|
|
22934
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages)), channel.id));
|
|
22928
22935
|
case 58:
|
|
22929
|
-
if (!(cachedMessages && cachedMessages.length)) {
|
|
22930
|
-
_context14.n = 63;
|
|
22931
|
-
break;
|
|
22932
|
-
}
|
|
22933
|
-
_messages = getFromAllMessagesByMessageId('', '', true, cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length ? cachedMessages : undefined);
|
|
22934
22936
|
_context14.n = 59;
|
|
22935
|
-
return effects.
|
|
22937
|
+
return effects.put(scrollToNewMessageAC(false));
|
|
22936
22938
|
case 59:
|
|
22937
22939
|
_context14.n = 60;
|
|
22938
|
-
return effects.put(
|
|
22940
|
+
return effects.put(setUnreadScrollToAC(true));
|
|
22939
22941
|
case 60:
|
|
22940
|
-
_context14.n =
|
|
22941
|
-
|
|
22942
|
+
_context14.n = 79;
|
|
22943
|
+
break;
|
|
22942
22944
|
case 61:
|
|
22943
|
-
|
|
22945
|
+
if (!(cachedMessages && cachedMessages.length)) {
|
|
22946
|
+
_context14.n = 66;
|
|
22947
|
+
break;
|
|
22948
|
+
}
|
|
22949
|
+
_messages = getFromAllMessagesByMessageId('', '', true, cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length ? cachedMessages : undefined);
|
|
22944
22950
|
_context14.n = 62;
|
|
22945
|
-
return effects.
|
|
22951
|
+
return effects.call(loadOGMetadataForLinkMessages, _messages);
|
|
22946
22952
|
case 62:
|
|
22947
22953
|
_context14.n = 63;
|
|
22948
|
-
return effects.
|
|
22954
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(_messages)), channel.id));
|
|
22949
22955
|
case 63:
|
|
22950
|
-
|
|
22951
|
-
|
|
22956
|
+
_context14.n = 64;
|
|
22957
|
+
return effects.delay(0);
|
|
22958
|
+
case 64:
|
|
22959
|
+
_filteredPendingMessages = getFilteredPendingMessages(_messages);
|
|
22960
|
+
_context14.n = 65;
|
|
22961
|
+
return effects.put(addMessagesAC(_filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
22962
|
+
case 65:
|
|
22963
|
+
_context14.n = 66;
|
|
22964
|
+
return effects.call(loadOGMetadataForLinkMessages, _filteredPendingMessages);
|
|
22965
|
+
case 66:
|
|
22966
|
+
result = {
|
|
22952
22967
|
messages: [],
|
|
22953
22968
|
hasNext: false
|
|
22954
22969
|
};
|
|
22955
|
-
if (!((channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId) > (channel === null || channel === void 0 ? void 0 : (_channel$
|
|
22956
|
-
_context14.n =
|
|
22970
|
+
if (!((channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId) > (channel === null || channel === void 0 ? void 0 : (_channel$lastMessage3 = channel.lastMessage) === null || _channel$lastMessage3 === void 0 ? void 0 : _channel$lastMessage3.id))) {
|
|
22971
|
+
_context14.n = 70;
|
|
22957
22972
|
break;
|
|
22958
22973
|
}
|
|
22959
22974
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22960
|
-
_context14.n =
|
|
22975
|
+
_context14.n = 68;
|
|
22961
22976
|
break;
|
|
22962
22977
|
}
|
|
22963
|
-
_context14.n =
|
|
22978
|
+
_context14.n = 67;
|
|
22964
22979
|
return effects.call(messageQuery.loadPreviousMessageId, channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId);
|
|
22965
|
-
case
|
|
22980
|
+
case 67:
|
|
22966
22981
|
_t21 = _context14.v;
|
|
22967
|
-
_context14.n =
|
|
22982
|
+
_context14.n = 69;
|
|
22968
22983
|
break;
|
|
22969
|
-
case
|
|
22984
|
+
case 68:
|
|
22970
22985
|
_t21 = {
|
|
22971
22986
|
messages: [],
|
|
22972
22987
|
hasNext: false
|
|
22973
22988
|
};
|
|
22974
|
-
case
|
|
22975
|
-
|
|
22976
|
-
_context14.n =
|
|
22989
|
+
case 69:
|
|
22990
|
+
result = _t21;
|
|
22991
|
+
_context14.n = 74;
|
|
22977
22992
|
break;
|
|
22978
|
-
case
|
|
22993
|
+
case 70:
|
|
22979
22994
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
22980
|
-
_context14.n =
|
|
22995
|
+
_context14.n = 72;
|
|
22981
22996
|
break;
|
|
22982
22997
|
}
|
|
22983
|
-
_context14.n =
|
|
22998
|
+
_context14.n = 71;
|
|
22984
22999
|
return effects.call(messageQuery.loadPrevious);
|
|
22985
|
-
case
|
|
23000
|
+
case 71:
|
|
22986
23001
|
_t22 = _context14.v;
|
|
22987
|
-
_context14.n =
|
|
23002
|
+
_context14.n = 73;
|
|
22988
23003
|
break;
|
|
22989
|
-
case
|
|
23004
|
+
case 72:
|
|
22990
23005
|
_t22 = {
|
|
22991
23006
|
messages: [],
|
|
22992
23007
|
hasNext: false
|
|
22993
23008
|
};
|
|
22994
|
-
case
|
|
22995
|
-
|
|
22996
|
-
case
|
|
23009
|
+
case 73:
|
|
23010
|
+
result = _t22;
|
|
23011
|
+
case 74:
|
|
22997
23012
|
updatedMessages = [];
|
|
22998
|
-
|
|
23013
|
+
result.messages.forEach(function (msg) {
|
|
22999
23014
|
var updatedMessage = updateMessageOnMap(channel.id, {
|
|
23000
23015
|
messageId: msg.id,
|
|
23001
23016
|
params: msg
|
|
@@ -23003,87 +23018,89 @@ function getMessagesQuery(action) {
|
|
|
23003
23018
|
updateMessageOnAllMessages(msg.id, updatedMessage || msg);
|
|
23004
23019
|
updatedMessages.push(updatedMessage || msg);
|
|
23005
23020
|
});
|
|
23006
|
-
messageIdForLoad = (channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId) > (channel === null || channel === void 0 ? void 0 : (_channel$
|
|
23021
|
+
messageIdForLoad = (channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId) > (channel === null || channel === void 0 ? void 0 : (_channel$lastMessage4 = channel.lastMessage) === null || _channel$lastMessage4 === void 0 ? void 0 : _channel$lastMessage4.id) ? (channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId) || '0' : (channel === null || channel === void 0 ? void 0 : (_channel$lastMessage5 = channel.lastMessage) === null || _channel$lastMessage5 === void 0 ? void 0 : _channel$lastMessage5.id) || '0';
|
|
23007
23022
|
if (!updatedMessages.length) {
|
|
23008
|
-
_context14.n =
|
|
23023
|
+
_context14.n = 78;
|
|
23009
23024
|
break;
|
|
23010
23025
|
}
|
|
23011
|
-
_context14.n =
|
|
23026
|
+
_context14.n = 75;
|
|
23012
23027
|
return effects.call(updateMessages, channel, updatedMessages, (_updatedMessages$ = updatedMessages[0]) === null || _updatedMessages$ === void 0 ? void 0 : _updatedMessages$.id, messageIdForLoad);
|
|
23013
|
-
case 72:
|
|
23014
|
-
_context14.n = 73;
|
|
23015
|
-
return effects.put(setMessagesHasPrevAC(true));
|
|
23016
|
-
case 73:
|
|
23017
|
-
_context14.n = 74;
|
|
23018
|
-
return effects.put(setMessagesHasNextAC(false));
|
|
23019
|
-
case 74:
|
|
23020
|
-
_context14.n = 76;
|
|
23021
|
-
break;
|
|
23022
23028
|
case 75:
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
break;
|
|
23026
|
-
}
|
|
23029
|
+
setHasPrevCached(false);
|
|
23030
|
+
setHasNextCached(false);
|
|
23027
23031
|
_context14.n = 76;
|
|
23028
|
-
return effects.put(
|
|
23032
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
23029
23033
|
case 76:
|
|
23030
|
-
filteredPendingMessages = getFilteredPendingMessages(_result.messages);
|
|
23031
23034
|
_context14.n = 77;
|
|
23032
|
-
return effects.put(
|
|
23035
|
+
return effects.put(setMessagesHasNextAC(false));
|
|
23033
23036
|
case 77:
|
|
23034
|
-
_context14.n =
|
|
23035
|
-
|
|
23037
|
+
_context14.n = 79;
|
|
23038
|
+
break;
|
|
23036
23039
|
case 78:
|
|
23037
|
-
|
|
23038
|
-
|
|
23039
|
-
_context14.n = 80;
|
|
23040
|
+
if (!(!(cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length) && !((_result$messages5 = result.messages) !== null && _result$messages5 !== void 0 && _result$messages5.length))) {
|
|
23041
|
+
_context14.n = 79;
|
|
23040
23042
|
break;
|
|
23041
23043
|
}
|
|
23042
23044
|
_context14.n = 79;
|
|
23043
|
-
return effects.put(
|
|
23045
|
+
return effects.put(setMessagesAC([]));
|
|
23044
23046
|
case 79:
|
|
23047
|
+
filteredPendingMessages = getFilteredPendingMessages(result.messages);
|
|
23045
23048
|
_context14.n = 80;
|
|
23046
|
-
return effects.
|
|
23049
|
+
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
23047
23050
|
case 80:
|
|
23048
23051
|
_context14.n = 81;
|
|
23049
|
-
return effects.call(
|
|
23052
|
+
return effects.call(loadOGMetadataForLinkMessages, filteredPendingMessages);
|
|
23050
23053
|
case 81:
|
|
23051
|
-
|
|
23052
|
-
if (!(
|
|
23054
|
+
waitToSendPendingMessages = store.getState().UserReducer.waitToSendPendingMessages;
|
|
23055
|
+
if (!(connectionState === CONNECTION_STATUS.CONNECTED && waitToSendPendingMessages)) {
|
|
23053
23056
|
_context14.n = 83;
|
|
23054
23057
|
break;
|
|
23055
23058
|
}
|
|
23056
23059
|
_context14.n = 82;
|
|
23057
|
-
return effects.put(
|
|
23060
|
+
return effects.put(setWaitToSendPendingMessagesAC(false));
|
|
23058
23061
|
case 82:
|
|
23059
|
-
|
|
23062
|
+
_context14.n = 83;
|
|
23063
|
+
return effects.spawn(sendPendingMessages, connectionState);
|
|
23060
23064
|
case 83:
|
|
23061
|
-
_context14.n =
|
|
23062
|
-
|
|
23065
|
+
_context14.n = 84;
|
|
23066
|
+
return effects.call(SceytChatClient.getChannel, channel.id, true);
|
|
23063
23067
|
case 84:
|
|
23064
|
-
|
|
23065
|
-
|
|
23068
|
+
updatedChannel = _context14.v;
|
|
23069
|
+
if (!(updatedChannel && updatedChannel !== null && updatedChannel !== void 0 && updatedChannel.lastMessage)) {
|
|
23070
|
+
_context14.n = 86;
|
|
23066
23071
|
break;
|
|
23067
23072
|
}
|
|
23068
23073
|
_context14.n = 85;
|
|
23069
|
-
return effects.put(
|
|
23074
|
+
return effects.put(updateChannelLastMessageAC(updatedChannel.lastMessage, updatedChannel));
|
|
23070
23075
|
case 85:
|
|
23071
|
-
|
|
23072
|
-
break;
|
|
23076
|
+
updateChannelLastMessageOnAllChannels(channel.id, updatedChannel.lastMessage);
|
|
23073
23077
|
case 86:
|
|
23074
|
-
_context14.
|
|
23075
|
-
|
|
23076
|
-
log.error('error in message query', _t23);
|
|
23078
|
+
_context14.n = 88;
|
|
23079
|
+
break;
|
|
23077
23080
|
case 87:
|
|
23078
|
-
|
|
23081
|
+
if (!(channel !== null && channel !== void 0 && channel.isMockChannel)) {
|
|
23082
|
+
_context14.n = 88;
|
|
23083
|
+
break;
|
|
23084
|
+
}
|
|
23079
23085
|
_context14.n = 88;
|
|
23080
|
-
return effects.put(
|
|
23086
|
+
return effects.put(setMessagesAC([]));
|
|
23081
23087
|
case 88:
|
|
23082
|
-
|
|
23088
|
+
_context14.n = 90;
|
|
23089
|
+
break;
|
|
23083
23090
|
case 89:
|
|
23091
|
+
_context14.p = 89;
|
|
23092
|
+
_t23 = _context14.v;
|
|
23093
|
+
log.error('error in message query', _t23);
|
|
23094
|
+
case 90:
|
|
23095
|
+
_context14.p = 90;
|
|
23096
|
+
_context14.n = 91;
|
|
23097
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
23098
|
+
case 91:
|
|
23099
|
+
return _context14.f(90);
|
|
23100
|
+
case 92:
|
|
23084
23101
|
return _context14.a(2);
|
|
23085
23102
|
}
|
|
23086
|
-
}, _marked0$1, null, [[2, 7], [0,
|
|
23103
|
+
}, _marked0$1, null, [[2, 7], [0, 89, 90, 92]]);
|
|
23087
23104
|
}
|
|
23088
23105
|
function getMessageQuery(action) {
|
|
23089
23106
|
var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t24;
|
|
@@ -23144,7 +23161,7 @@ function getMessageQuery(action) {
|
|
|
23144
23161
|
}, _marked1$1, null, [[0, 7]]);
|
|
23145
23162
|
}
|
|
23146
23163
|
function loadMoreMessages(action) {
|
|
23147
|
-
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery,
|
|
23164
|
+
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _result$messages$5, _result$messages6, _result$messages$6, _result$messages7, _t25;
|
|
23148
23165
|
return _regenerator().w(function (_context16) {
|
|
23149
23166
|
while (1) switch (_context16.p = _context16.n) {
|
|
23150
23167
|
case 0:
|
|
@@ -23159,11 +23176,10 @@ function loadMoreMessages(action) {
|
|
|
23159
23176
|
case 1:
|
|
23160
23177
|
messageQuery = _context16.v;
|
|
23161
23178
|
messageQuery.limit = limit || 5;
|
|
23162
|
-
now = Date.now();
|
|
23163
23179
|
_context16.n = 2;
|
|
23164
23180
|
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
23165
23181
|
case 2:
|
|
23166
|
-
|
|
23182
|
+
result = {
|
|
23167
23183
|
messages: [],
|
|
23168
23184
|
hasNext: false
|
|
23169
23185
|
};
|
|
@@ -23175,7 +23191,7 @@ function loadMoreMessages(action) {
|
|
|
23175
23191
|
_context16.n = 3;
|
|
23176
23192
|
break;
|
|
23177
23193
|
}
|
|
23178
|
-
|
|
23194
|
+
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
|
|
23179
23195
|
_context16.n = 5;
|
|
23180
23196
|
break;
|
|
23181
23197
|
case 3:
|
|
@@ -23186,13 +23202,13 @@ function loadMoreMessages(action) {
|
|
|
23186
23202
|
_context16.n = 4;
|
|
23187
23203
|
return effects.call(messageQuery.loadPreviousMessageId, messageId);
|
|
23188
23204
|
case 4:
|
|
23189
|
-
|
|
23190
|
-
if (
|
|
23191
|
-
addAllMessages(
|
|
23192
|
-
setMessagesToMap(channelId,
|
|
23205
|
+
result = _context16.v;
|
|
23206
|
+
if (result.messages.length) {
|
|
23207
|
+
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
|
|
23208
|
+
setMessagesToMap(channelId, result.messages, (_result$messages$5 = result.messages[0]) === null || _result$messages$5 === void 0 ? void 0 : _result$messages$5.id, (_result$messages6 = result.messages[result.messages.length - 1]) === null || _result$messages6 === void 0 ? void 0 : _result$messages6.id);
|
|
23193
23209
|
}
|
|
23194
23210
|
_context16.n = 5;
|
|
23195
|
-
return effects.put(setMessagesHasPrevAC(
|
|
23211
|
+
return effects.put(setMessagesHasPrevAC(result.hasNext));
|
|
23196
23212
|
case 5:
|
|
23197
23213
|
_context16.n = 10;
|
|
23198
23214
|
break;
|
|
@@ -23201,7 +23217,7 @@ function loadMoreMessages(action) {
|
|
|
23201
23217
|
_context16.n = 7;
|
|
23202
23218
|
break;
|
|
23203
23219
|
}
|
|
23204
|
-
|
|
23220
|
+
result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
23205
23221
|
_context16.n = 9;
|
|
23206
23222
|
break;
|
|
23207
23223
|
case 7:
|
|
@@ -23209,31 +23225,30 @@ function loadMoreMessages(action) {
|
|
|
23209
23225
|
_context16.n = 9;
|
|
23210
23226
|
break;
|
|
23211
23227
|
}
|
|
23212
|
-
log.info('saga load next from server ... ', messageId);
|
|
23213
23228
|
messageQuery.reverse = false;
|
|
23214
23229
|
_context16.n = 8;
|
|
23215
23230
|
return effects.call(messageQuery.loadNextMessageId, messageId);
|
|
23216
23231
|
case 8:
|
|
23217
|
-
|
|
23218
|
-
if (
|
|
23219
|
-
addAllMessages(
|
|
23220
|
-
setMessagesToMap(channelId,
|
|
23232
|
+
result = _context16.v;
|
|
23233
|
+
if (result.messages.length) {
|
|
23234
|
+
addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
|
|
23235
|
+
setMessagesToMap(channelId, result.messages, (_result$messages$6 = result.messages[0]) === null || _result$messages$6 === void 0 ? void 0 : _result$messages$6.id, (_result$messages7 = result.messages[result.messages.length - 1]) === null || _result$messages7 === void 0 ? void 0 : _result$messages7.id);
|
|
23221
23236
|
}
|
|
23222
23237
|
_context16.n = 9;
|
|
23223
|
-
return effects.put(setMessagesHasNextAC(
|
|
23238
|
+
return effects.put(setMessagesHasNextAC(result.hasNext));
|
|
23224
23239
|
case 9:
|
|
23225
23240
|
_context16.n = 10;
|
|
23226
23241
|
return effects.put(setMessagesHasPrevAC(true));
|
|
23227
23242
|
case 10:
|
|
23228
|
-
if (!(
|
|
23243
|
+
if (!(result.messages && result.messages.length && result.messages.length > 0)) {
|
|
23229
23244
|
_context16.n = 13;
|
|
23230
23245
|
break;
|
|
23231
23246
|
}
|
|
23232
23247
|
_context16.n = 11;
|
|
23233
|
-
return effects.call(loadOGMetadataForLinkMessages,
|
|
23248
|
+
return effects.call(loadOGMetadataForLinkMessages, result.messages);
|
|
23234
23249
|
case 11:
|
|
23235
23250
|
_context16.n = 12;
|
|
23236
|
-
return effects.put(addMessagesAC(JSON.parse(JSON.stringify(
|
|
23251
|
+
return effects.put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
|
|
23237
23252
|
case 12:
|
|
23238
23253
|
_context16.n = 15;
|
|
23239
23254
|
break;
|
|
@@ -23248,29 +23263,20 @@ function loadMoreMessages(action) {
|
|
|
23248
23263
|
_context16.n = 15;
|
|
23249
23264
|
return effects.put(setMessagesHasNextAC(false));
|
|
23250
23265
|
case 15:
|
|
23251
|
-
if (!(Date.now() - now < 10)) {
|
|
23252
|
-
_context16.n = 16;
|
|
23253
|
-
break;
|
|
23254
|
-
}
|
|
23255
|
-
setTimeout(function () {
|
|
23256
|
-
store.dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
23257
|
-
}, 10);
|
|
23258
23266
|
_context16.n = 17;
|
|
23259
23267
|
break;
|
|
23260
23268
|
case 16:
|
|
23261
|
-
_context16.
|
|
23262
|
-
|
|
23269
|
+
_context16.p = 16;
|
|
23270
|
+
_t25 = _context16.v;
|
|
23271
|
+
log.error('[MESSAGE_LIST] loadMoreMessages ERROR:', _t25);
|
|
23263
23272
|
case 17:
|
|
23264
|
-
_context16.
|
|
23265
|
-
|
|
23273
|
+
_context16.p = 17;
|
|
23274
|
+
store.dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
23275
|
+
return _context16.f(17);
|
|
23266
23276
|
case 18:
|
|
23267
|
-
_context16.p = 18;
|
|
23268
|
-
_t25 = _context16.v;
|
|
23269
|
-
log.error('error in load more messages', _t25);
|
|
23270
|
-
case 19:
|
|
23271
23277
|
return _context16.a(2);
|
|
23272
23278
|
}
|
|
23273
|
-
}, _marked10$1, null, [[0, 18]]);
|
|
23279
|
+
}, _marked10$1, null, [[0, 16, 17, 18]]);
|
|
23274
23280
|
}
|
|
23275
23281
|
function addReaction(action) {
|
|
23276
23282
|
var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t26;
|
|
@@ -23390,7 +23396,7 @@ function deleteReaction(action) {
|
|
|
23390
23396
|
}, _marked12$1, null, [[0, 7]]);
|
|
23391
23397
|
}
|
|
23392
23398
|
function getReactions(action) {
|
|
23393
|
-
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery,
|
|
23399
|
+
var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t28;
|
|
23394
23400
|
return _regenerator().w(function (_context19) {
|
|
23395
23401
|
while (1) switch (_context19.p = _context19.n) {
|
|
23396
23402
|
case 0:
|
|
@@ -23413,10 +23419,10 @@ function getReactions(action) {
|
|
|
23413
23419
|
_context19.n = 3;
|
|
23414
23420
|
return effects.call(reactionQuery.loadNext);
|
|
23415
23421
|
case 3:
|
|
23416
|
-
|
|
23422
|
+
result = _context19.v;
|
|
23417
23423
|
query.ReactionsQuery = reactionQuery;
|
|
23418
23424
|
_context19.n = 4;
|
|
23419
|
-
return effects.put(setReactionsListAC(
|
|
23425
|
+
return effects.put(setReactionsListAC(result.reactions, result.hasNext));
|
|
23420
23426
|
case 4:
|
|
23421
23427
|
_context19.n = 5;
|
|
23422
23428
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
@@ -23433,7 +23439,7 @@ function getReactions(action) {
|
|
|
23433
23439
|
}, _marked13$1, null, [[0, 6]]);
|
|
23434
23440
|
}
|
|
23435
23441
|
function loadMoreReactions(action) {
|
|
23436
|
-
var payload, limit, ReactionQuery,
|
|
23442
|
+
var payload, limit, ReactionQuery, result, _t29;
|
|
23437
23443
|
return _regenerator().w(function (_context20) {
|
|
23438
23444
|
while (1) switch (_context20.p = _context20.n) {
|
|
23439
23445
|
case 0:
|
|
@@ -23450,9 +23456,9 @@ function loadMoreReactions(action) {
|
|
|
23450
23456
|
_context20.n = 2;
|
|
23451
23457
|
return effects.call(ReactionQuery.loadNext);
|
|
23452
23458
|
case 2:
|
|
23453
|
-
|
|
23459
|
+
result = _context20.v;
|
|
23454
23460
|
_context20.n = 3;
|
|
23455
|
-
return effects.put(addReactionsToListAC(
|
|
23461
|
+
return effects.put(addReactionsToListAC(result.reactions, result.hasNext));
|
|
23456
23462
|
case 3:
|
|
23457
23463
|
_context20.n = 4;
|
|
23458
23464
|
return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
|
|
@@ -23469,7 +23475,7 @@ function loadMoreReactions(action) {
|
|
|
23469
23475
|
}, _marked14$1, null, [[0, 5]]);
|
|
23470
23476
|
}
|
|
23471
23477
|
function getMessageAttachments(action) {
|
|
23472
|
-
var _action$payload4, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery,
|
|
23478
|
+
var _action$payload4, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, attachments, attachmentIndex, hasPrev, hasNext, _t30;
|
|
23473
23479
|
return _regenerator().w(function (_context21) {
|
|
23474
23480
|
while (1) switch (_context21.p = _context21.n) {
|
|
23475
23481
|
case 0:
|
|
@@ -23505,7 +23511,7 @@ function getMessageAttachments(action) {
|
|
|
23505
23511
|
_context21.n = 4;
|
|
23506
23512
|
return effects.call(AttachmentByTypeQuery.loadPrevious);
|
|
23507
23513
|
case 4:
|
|
23508
|
-
|
|
23514
|
+
result = _context21.v;
|
|
23509
23515
|
_context21.n = 9;
|
|
23510
23516
|
break;
|
|
23511
23517
|
case 5:
|
|
@@ -23516,16 +23522,16 @@ function getMessageAttachments(action) {
|
|
|
23516
23522
|
_context21.n = 6;
|
|
23517
23523
|
return effects.call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
|
|
23518
23524
|
case 6:
|
|
23519
|
-
|
|
23525
|
+
result = _context21.v;
|
|
23520
23526
|
_context21.n = 9;
|
|
23521
23527
|
break;
|
|
23522
23528
|
case 7:
|
|
23523
23529
|
_context21.n = 8;
|
|
23524
23530
|
return effects.call(AttachmentByTypeQuery.loadPrevious);
|
|
23525
23531
|
case 8:
|
|
23526
|
-
|
|
23532
|
+
result = _context21.v;
|
|
23527
23533
|
case 9:
|
|
23528
|
-
attachments =
|
|
23534
|
+
attachments = result.attachments.sort(function (a, b) {
|
|
23529
23535
|
return forPopup ? Number(a.id || 0) - Number(b.id || 0) : Number(b.id || 0) - Number(a.id || 0);
|
|
23530
23536
|
});
|
|
23531
23537
|
if (!forPopup) {
|
|
@@ -23540,13 +23546,13 @@ function getMessageAttachments(action) {
|
|
|
23540
23546
|
return attachment.id === attachmentId;
|
|
23541
23547
|
});
|
|
23542
23548
|
hasPrev = false;
|
|
23543
|
-
if (attachmentIndex >= limit / 2 &&
|
|
23549
|
+
if (attachmentIndex >= limit / 2 && result.hasNext && limit === attachments.length) {
|
|
23544
23550
|
hasPrev = true;
|
|
23545
23551
|
} else {
|
|
23546
23552
|
hasPrev = false;
|
|
23547
23553
|
}
|
|
23548
23554
|
hasNext = false;
|
|
23549
|
-
if (attachmentIndex <= limit / 2 - 1 &&
|
|
23555
|
+
if (attachmentIndex <= limit / 2 - 1 && result.hasNext && limit === attachments.length) {
|
|
23550
23556
|
hasNext = true;
|
|
23551
23557
|
} else {
|
|
23552
23558
|
hasNext = false;
|
|
@@ -23559,7 +23565,7 @@ function getMessageAttachments(action) {
|
|
|
23559
23565
|
case 12:
|
|
23560
23566
|
query.AttachmentByTypeQuery = AttachmentByTypeQuery;
|
|
23561
23567
|
_context21.n = 13;
|
|
23562
|
-
return effects.put(setAttachmentsCompleteAC(
|
|
23568
|
+
return effects.put(setAttachmentsCompleteAC(result.hasNext));
|
|
23563
23569
|
case 13:
|
|
23564
23570
|
_context21.n = 14;
|
|
23565
23571
|
return effects.put(setAttachmentsAC(JSON.parse(JSON.stringify(attachments))));
|
|
@@ -23582,7 +23588,7 @@ function getMessageAttachments(action) {
|
|
|
23582
23588
|
}, _marked15$1, null, [[1, 15, 16, 18]]);
|
|
23583
23589
|
}
|
|
23584
23590
|
function loadMoreMessageAttachments(action) {
|
|
23585
|
-
var _action$payload5, limit, direction, forPopup, attachmentId, AttachmentQuery,
|
|
23591
|
+
var _action$payload5, limit, direction, forPopup, attachmentId, AttachmentQuery, result, _result, attachments, hasNext, _t31;
|
|
23586
23592
|
return _regenerator().w(function (_context22) {
|
|
23587
23593
|
while (1) switch (_context22.p = _context22.n) {
|
|
23588
23594
|
case 0:
|
|
@@ -23603,7 +23609,7 @@ function loadMoreMessageAttachments(action) {
|
|
|
23603
23609
|
return effects.put(setAttachmentsLoadingStateAC(LOADING_STATE.LOADING, forPopup));
|
|
23604
23610
|
case 3:
|
|
23605
23611
|
AttachmentQuery.limit = limit;
|
|
23606
|
-
|
|
23612
|
+
result = {
|
|
23607
23613
|
attachments: [],
|
|
23608
23614
|
hasNext: false
|
|
23609
23615
|
};
|
|
@@ -23618,14 +23624,14 @@ function loadMoreMessageAttachments(action) {
|
|
|
23618
23624
|
_context22.n = 4;
|
|
23619
23625
|
return effects.call(AttachmentQuery.loadNextAttachmentId, attachmentId);
|
|
23620
23626
|
case 4:
|
|
23621
|
-
|
|
23627
|
+
result = _context22.v;
|
|
23622
23628
|
_context22.n = 7;
|
|
23623
23629
|
break;
|
|
23624
23630
|
case 5:
|
|
23625
23631
|
_context22.n = 6;
|
|
23626
23632
|
return effects.call(AttachmentQuery.loadPreviousAttachmentId, attachmentId);
|
|
23627
23633
|
case 6:
|
|
23628
|
-
|
|
23634
|
+
result = _context22.v;
|
|
23629
23635
|
case 7:
|
|
23630
23636
|
_context22.n = 12;
|
|
23631
23637
|
break;
|
|
@@ -23637,16 +23643,16 @@ function loadMoreMessageAttachments(action) {
|
|
|
23637
23643
|
_context22.n = 9;
|
|
23638
23644
|
return effects.call(AttachmentQuery.loadNext);
|
|
23639
23645
|
case 9:
|
|
23640
|
-
|
|
23646
|
+
result = _context22.v;
|
|
23641
23647
|
_context22.n = 12;
|
|
23642
23648
|
break;
|
|
23643
23649
|
case 10:
|
|
23644
23650
|
_context22.n = 11;
|
|
23645
23651
|
return effects.call(AttachmentQuery.loadPrevious);
|
|
23646
23652
|
case 11:
|
|
23647
|
-
|
|
23653
|
+
result = _context22.v;
|
|
23648
23654
|
case 12:
|
|
23649
|
-
|
|
23655
|
+
_result = result, attachments = _result.attachments, hasNext = _result.hasNext;
|
|
23650
23656
|
if (!forPopup) {
|
|
23651
23657
|
_context22.n = 17;
|
|
23652
23658
|
break;
|
|
@@ -23659,7 +23665,7 @@ function loadMoreMessageAttachments(action) {
|
|
|
23659
23665
|
break;
|
|
23660
23666
|
}
|
|
23661
23667
|
_context22.n = 14;
|
|
23662
|
-
return effects.put(setAttachmentsCompleteForPopupAC(undefined,
|
|
23668
|
+
return effects.put(setAttachmentsCompleteForPopupAC(undefined, result.hasNext));
|
|
23663
23669
|
case 14:
|
|
23664
23670
|
_context22.n = 16;
|
|
23665
23671
|
break;
|
|
@@ -23669,7 +23675,7 @@ function loadMoreMessageAttachments(action) {
|
|
|
23669
23675
|
break;
|
|
23670
23676
|
}
|
|
23671
23677
|
_context22.n = 16;
|
|
23672
|
-
return effects.put(setAttachmentsCompleteForPopupAC(
|
|
23678
|
+
return effects.put(setAttachmentsCompleteForPopupAC(result.hasNext, undefined));
|
|
23673
23679
|
case 16:
|
|
23674
23680
|
_context22.n = 20;
|
|
23675
23681
|
break;
|
|
@@ -24476,7 +24482,7 @@ function resendPendingPollActions(action) {
|
|
|
24476
24482
|
}, _marked32$1, null, [[0, 2]]);
|
|
24477
24483
|
}
|
|
24478
24484
|
function getPollVotes(action) {
|
|
24479
|
-
var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery,
|
|
24485
|
+
var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes, _t40;
|
|
24480
24486
|
return _regenerator().w(function (_context39) {
|
|
24481
24487
|
while (1) switch (_context39.p = _context39.n) {
|
|
24482
24488
|
case 0:
|
|
@@ -24504,12 +24510,12 @@ function getPollVotes(action) {
|
|
|
24504
24510
|
_context39.n = 4;
|
|
24505
24511
|
return effects.call(pollVotesQuery.loadNext);
|
|
24506
24512
|
case 4:
|
|
24507
|
-
|
|
24513
|
+
result = _context39.v;
|
|
24508
24514
|
if (!query.PollVotesQueries) {
|
|
24509
24515
|
query.PollVotesQueries = {};
|
|
24510
24516
|
}
|
|
24511
24517
|
query.PollVotesQueries[key] = pollVotesQuery;
|
|
24512
|
-
formattedVotes = (
|
|
24518
|
+
formattedVotes = (result.votes || []).map(function (vote) {
|
|
24513
24519
|
return {
|
|
24514
24520
|
optionId: vote.optionId || optionId,
|
|
24515
24521
|
createdAt: vote.createdAt || new Date().getTime(),
|
|
@@ -24533,7 +24539,7 @@ function getPollVotes(action) {
|
|
|
24533
24539
|
};
|
|
24534
24540
|
});
|
|
24535
24541
|
_context39.n = 5;
|
|
24536
|
-
return effects.put(setPollVotesListAC(pollId, optionId, formattedVotes,
|
|
24542
|
+
return effects.put(setPollVotesListAC(pollId, optionId, formattedVotes, result.hasNext || false));
|
|
24537
24543
|
case 5:
|
|
24538
24544
|
_context39.n = 6;
|
|
24539
24545
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
|
|
@@ -24552,7 +24558,7 @@ function getPollVotes(action) {
|
|
|
24552
24558
|
}, _marked33$1, null, [[0, 7]]);
|
|
24553
24559
|
}
|
|
24554
24560
|
function loadMorePollVotes(action) {
|
|
24555
|
-
var payload, pollId, optionId, limit, key, pollVotesQuery,
|
|
24561
|
+
var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes, _t41;
|
|
24556
24562
|
return _regenerator().w(function (_context40) {
|
|
24557
24563
|
while (1) switch (_context40.p = _context40.n) {
|
|
24558
24564
|
case 0:
|
|
@@ -24576,8 +24582,8 @@ function loadMorePollVotes(action) {
|
|
|
24576
24582
|
_context40.n = 3;
|
|
24577
24583
|
return effects.call(pollVotesQuery.loadNext);
|
|
24578
24584
|
case 3:
|
|
24579
|
-
|
|
24580
|
-
formattedVotes = (
|
|
24585
|
+
result = _context40.v;
|
|
24586
|
+
formattedVotes = (result.votes || []).map(function (vote) {
|
|
24581
24587
|
return {
|
|
24582
24588
|
optionId: vote.optionId || optionId,
|
|
24583
24589
|
createdAt: vote.createdAt || new Date().getTime(),
|
|
@@ -24601,7 +24607,7 @@ function loadMorePollVotes(action) {
|
|
|
24601
24607
|
};
|
|
24602
24608
|
});
|
|
24603
24609
|
_context40.n = 4;
|
|
24604
|
-
return effects.put(addPollVotesToListAC(pollId, optionId, formattedVotes,
|
|
24610
|
+
return effects.put(addPollVotesToListAC(pollId, optionId, formattedVotes, result.hasNext || false));
|
|
24605
24611
|
case 4:
|
|
24606
24612
|
_context40.n = 5;
|
|
24607
24613
|
return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
|
|
@@ -31000,7 +31006,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
31000
31006
|
}, [initialActiveIndex]);
|
|
31001
31007
|
var items = React__default.Children.toArray(children);
|
|
31002
31008
|
var totalItems = items.length;
|
|
31003
|
-
React.
|
|
31009
|
+
React.useLayoutEffect(function () {
|
|
31004
31010
|
if (!isInternalNavigationRef.current && initialActiveIndex >= 0 && initialActiveIndex < totalItems && initialActiveIndex !== currentIndex && lastInitialIndexRef.current !== initialActiveIndex) {
|
|
31005
31011
|
if (skipTransition) {
|
|
31006
31012
|
setIsTransitioning(false);
|
|
@@ -31197,7 +31203,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
31197
31203
|
window.removeEventListener('keydown', handleKeyDown);
|
|
31198
31204
|
};
|
|
31199
31205
|
}, [goToNext, goToPrev, isRTL]);
|
|
31200
|
-
React.
|
|
31206
|
+
React.useLayoutEffect(function () {
|
|
31201
31207
|
if (containerRef.current && !isDraggingRef.current && totalItems > 0) {
|
|
31202
31208
|
var translateX = -currentIndex * 100 / totalItems;
|
|
31203
31209
|
if (skipTransition) {
|
|
@@ -31211,7 +31217,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
31211
31217
|
}
|
|
31212
31218
|
}, [currentIndex, isTransitioning, totalItems, skipTransition]);
|
|
31213
31219
|
var isFirstRenderRef = React.useRef(true);
|
|
31214
|
-
React.
|
|
31220
|
+
React.useLayoutEffect(function () {
|
|
31215
31221
|
if (containerRef.current && totalItems > 0) {
|
|
31216
31222
|
var translateX = -currentIndex * 100 / totalItems;
|
|
31217
31223
|
containerRef.current.style.transform = "translateX(" + translateX + "%)";
|
|
@@ -32457,31 +32463,40 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
32457
32463
|
var _useState2 = React.useState({}),
|
|
32458
32464
|
downloadingFilesMap = _useState2[0],
|
|
32459
32465
|
setDownloadingFilesMap = _useState2[1];
|
|
32460
|
-
var _useState3 = React.useState(
|
|
32461
|
-
|
|
32462
|
-
|
|
32463
|
-
var _useState4 = React.useState(),
|
|
32464
|
-
|
|
32465
|
-
|
|
32466
|
+
var _useState3 = React.useState(),
|
|
32467
|
+
playedVideo = _useState3[0],
|
|
32468
|
+
setPlayedVideo = _useState3[1];
|
|
32469
|
+
var _useState4 = React.useState(true),
|
|
32470
|
+
nextButtonDisabled = _useState4[0],
|
|
32471
|
+
setNextButtonDisabled = _useState4[1];
|
|
32466
32472
|
var _useState5 = React.useState(true),
|
|
32467
|
-
|
|
32468
|
-
|
|
32469
|
-
var _useState6 = React.useState(
|
|
32470
|
-
|
|
32471
|
-
|
|
32472
|
-
var _useState7 = React.useState(
|
|
32473
|
-
|
|
32474
|
-
|
|
32475
|
-
var _useState8 = React.useState(
|
|
32476
|
-
|
|
32477
|
-
|
|
32478
|
-
var _useState9 = React.useState(),
|
|
32479
|
-
messageToDelete = _useState9[0],
|
|
32480
|
-
setMessageToDelete = _useState9[1];
|
|
32473
|
+
prevButtonDisabled = _useState5[0],
|
|
32474
|
+
setPrevButtonDisabled = _useState5[1];
|
|
32475
|
+
var _useState6 = React.useState(false),
|
|
32476
|
+
forwardPopupOpen = _useState6[0],
|
|
32477
|
+
setForwardPopupOpen = _useState6[1];
|
|
32478
|
+
var _useState7 = React.useState(true),
|
|
32479
|
+
readyToPlay = _useState7[0],
|
|
32480
|
+
setReadyToPlay = _useState7[1];
|
|
32481
|
+
var _useState8 = React.useState(),
|
|
32482
|
+
messageToDelete = _useState8[0],
|
|
32483
|
+
setMessageToDelete = _useState8[1];
|
|
32481
32484
|
var attachmentLoadingStateForPopup = useSelector(attachmentForPopupLoadingStateSelector);
|
|
32482
32485
|
var attachmentsForPopupHasPrev = useSelector(attachmentsForPopupHasPrevSelector);
|
|
32483
32486
|
var attachmentsForPopupHasNext = useSelector(attachmentsForPopupHasNextSelector);
|
|
32484
32487
|
var attachmentUpdatedMap = useSelector(attachmentUpdatedMapSelector) || {};
|
|
32488
|
+
var _useState9 = React.useState(function () {
|
|
32489
|
+
if (currentMediaFile.id && currentMediaFile.type === 'image') {
|
|
32490
|
+
var imageKey = getAttachmentURLWithVersion(currentMediaFile.url + '_original_image_url');
|
|
32491
|
+
if (attachmentUpdatedMap[imageKey]) {
|
|
32492
|
+
var _ref2;
|
|
32493
|
+
return _ref2 = {}, _ref2[currentMediaFile.id] = true, _ref2;
|
|
32494
|
+
}
|
|
32495
|
+
}
|
|
32496
|
+
return {};
|
|
32497
|
+
}),
|
|
32498
|
+
itemsLoadedMap = _useState9[0],
|
|
32499
|
+
setItemsLoadedMap = _useState9[1];
|
|
32485
32500
|
var prefixUrl = React.useMemo(function () {
|
|
32486
32501
|
return (currentFile === null || currentFile === void 0 ? void 0 : currentFile.type) === 'image' ? '_original_image_url' : (currentFile === null || currentFile === void 0 ? void 0 : currentFile.type) === 'video' ? '_original_video_url' : '';
|
|
32487
32502
|
}, [currentFile === null || currentFile === void 0 ? void 0 : currentFile.type]);
|
|
@@ -32768,11 +32783,12 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
32768
32783
|
log.error('Error getting initial attachment from cache:', error);
|
|
32769
32784
|
});
|
|
32770
32785
|
}
|
|
32771
|
-
if (
|
|
32786
|
+
if (!attachmentsList.find(function (item) {
|
|
32772
32787
|
return item.id === currentMediaFile.id;
|
|
32773
32788
|
})) {
|
|
32774
|
-
dispatch(
|
|
32789
|
+
dispatch(setAttachmentsForPopupAC([currentMediaFile]));
|
|
32775
32790
|
}
|
|
32791
|
+
dispatch(getAttachmentsAC(channel.id, channelDetailsTabs.media, 34, queryDirection.NEAR, currentMediaFile.id, true));
|
|
32776
32792
|
}, []);
|
|
32777
32793
|
var activeFileIndex = React.useMemo(function () {
|
|
32778
32794
|
if (!(currentFile !== null && currentFile !== void 0 && currentFile.id)) return -1;
|
|
@@ -32833,9 +32849,7 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
32833
32849
|
dispatch(loadMoreAttachmentsAC(34, queryDirection.PREV, attachmentsList[0].id, true));
|
|
32834
32850
|
}
|
|
32835
32851
|
}, [activeFileIndex, attachmentLoadingStateForPopup, attachmentsForPopupHasPrev, attachmentsList, dispatch]);
|
|
32836
|
-
var isCarouselLoading =
|
|
32837
|
-
return attachmentLoadingStateForPopup !== LOADING_STATE.LOADED || activeFileIndex < 0 || !attachmentsList || !attachmentsList.length;
|
|
32838
|
-
}, [attachmentLoadingStateForPopup, activeFileIndex, attachmentsList]);
|
|
32852
|
+
var isCarouselLoading = !attachmentsList.length || activeFileIndex < 0;
|
|
32839
32853
|
var isItemLoading = React.useCallback(function (fileId) {
|
|
32840
32854
|
if (!fileId) return false;
|
|
32841
32855
|
return !itemsLoadedMap[fileId];
|
|
@@ -32938,10 +32952,10 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
32938
32952
|
setPrevButtonDisabled(!attachmentsList[pageIndex - 1]);
|
|
32939
32953
|
}
|
|
32940
32954
|
},
|
|
32941
|
-
renderArrow: function renderArrow(
|
|
32942
|
-
var type =
|
|
32943
|
-
_onClick =
|
|
32944
|
-
isEdge =
|
|
32955
|
+
renderArrow: function renderArrow(_ref3) {
|
|
32956
|
+
var type = _ref3.type,
|
|
32957
|
+
_onClick = _ref3.onClick,
|
|
32958
|
+
isEdge = _ref3.isEdge;
|
|
32945
32959
|
var pointer = type === 'PREV' ? /*#__PURE__*/React__default.createElement(SvgSliderButtonLeft, null) : /*#__PURE__*/React__default.createElement(SvgSliderButtonRight, null);
|
|
32946
32960
|
var disabled = type === 'PREV' ? prevButtonDisabled && !attachmentsForPopupHasPrev : nextButtonDisabled && !attachmentsForPopupHasNext;
|
|
32947
32961
|
var isEdgeButton = isEdge || (type === 'PREV' ? prevButtonDisabled : nextButtonDisabled);
|
|
@@ -32970,7 +32984,7 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
32970
32984
|
}
|
|
32971
32985
|
}, isItemLoading(file.id) && file.type === 'image' && (/*#__PURE__*/React__default.createElement(ItemLoadingCont, null, /*#__PURE__*/React__default.createElement(UploadingIcon, {
|
|
32972
32986
|
color: textOnPrimary
|
|
32973
|
-
}))), file.type === 'image' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null,
|
|
32987
|
+
}))), file.type === 'image' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, attachmentUpdatedMap[getAttachmentURLWithVersion(file.url + '_original_image_url')] && (/*#__PURE__*/React__default.createElement("img", {
|
|
32974
32988
|
loading: 'lazy',
|
|
32975
32989
|
decoding: 'async',
|
|
32976
32990
|
draggable: false,
|
|
@@ -34788,7 +34802,8 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
34788
34802
|
return null;
|
|
34789
34803
|
}, [parsedMetadata]);
|
|
34790
34804
|
var attachmentVideoFirstFrame = React.useMemo(function () {
|
|
34791
|
-
|
|
34805
|
+
var _file$metadata;
|
|
34806
|
+
return attachmentUpdatedMap[getAttachmentURLWithVersion((_file$metadata = file.metadata) === null || _file$metadata === void 0 ? void 0 : _file$metadata.tmb)] || attachmentUpdatedMap[getAttachmentURLWithVersion(file.url)];
|
|
34792
34807
|
}, [attachmentUpdatedMap, file.url]);
|
|
34793
34808
|
var attachmentThumb = React.useMemo(function () {
|
|
34794
34809
|
if (parsedMetadata !== null && parsedMetadata !== void 0 && parsedMetadata.tmb) {
|
|
@@ -34901,7 +34916,7 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
34901
34916
|
isPreview: isPreview,
|
|
34902
34917
|
backgroundColor: backgroundColor,
|
|
34903
34918
|
isDetailsView: isDetailsView
|
|
34904
|
-
},
|
|
34919
|
+
}, /*#__PURE__*/React__default.createElement(UploadInProgress, {
|
|
34905
34920
|
isRepliedMessage: isRepliedMessage,
|
|
34906
34921
|
src: attachmentVideoFirstFrame || (attachmentThumb !== null && attachmentThumb !== void 0 && attachmentThumb.withPrefix ? "data:image/jpeg;base64," + attachmentThumb.thumbnail : attachmentThumb === null || attachmentThumb === void 0 ? void 0 : attachmentThumb.thumbnail),
|
|
34907
34922
|
width: parseInt(width),
|
|
@@ -34913,8 +34928,9 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
34913
34928
|
loading: 'lazy',
|
|
34914
34929
|
decoding: 'async',
|
|
34915
34930
|
fetchpriority: 'high',
|
|
34916
|
-
isPreview: isPreview
|
|
34917
|
-
|
|
34931
|
+
isPreview: isPreview,
|
|
34932
|
+
borderRadius: borderRadius
|
|
34933
|
+
}), !isRepliedMessage && !downloading && (/*#__PURE__*/React__default.createElement(VideoControls, {
|
|
34918
34934
|
className: 'video-controls'
|
|
34919
34935
|
}, !isPreview && !isRepliedMessage && !uploading && !isDetailsView && (/*#__PURE__*/React__default.createElement(VideoPlayButton, null, /*#__PURE__*/React__default.createElement(SvgPlayVideo, null))), /*#__PURE__*/React__default.createElement(VideoTime, {
|
|
34920
34936
|
isDetailsView: isDetailsView,
|
|
@@ -35042,7 +35058,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
35042
35058
|
var imageContRef = React.useRef(null);
|
|
35043
35059
|
var attachmentUpdatedMap = useSelector(attachmentUpdatedMapSelector) || {};
|
|
35044
35060
|
var attachmentUrlFromMap = React.useMemo(function () {
|
|
35045
|
-
|
|
35061
|
+
var _attachment$metadata;
|
|
35062
|
+
return attachmentUpdatedMap[getAttachmentURLWithVersion((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata = attachment.metadata) === null || _attachment$metadata === void 0 ? void 0 : _attachment$metadata.tmb) || '')] || attachmentUpdatedMap[getAttachmentURLWithVersion(attachment.url)];
|
|
35046
35063
|
}, [attachmentUpdatedMap, attachment.url]);
|
|
35047
35064
|
var _useState = React.useState(false),
|
|
35048
35065
|
viewOnceVoiceModalOpen = _useState[0],
|
|
@@ -35092,7 +35109,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
35092
35109
|
renderWidth = _useMemo[0],
|
|
35093
35110
|
renderHeight = _useMemo[1];
|
|
35094
35111
|
var isInUploadingState = attachmentCompilationState[attachment.tid] && (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PAUSED);
|
|
35095
|
-
var attachmentThumb;
|
|
35112
|
+
var attachmentThumb = '';
|
|
35096
35113
|
var withPrefix = true;
|
|
35097
35114
|
if (attachment.type !== attachmentTypes.voice && attachment.type !== attachmentTypes.link && attachmentMetadata && attachmentMetadata.tmb) {
|
|
35098
35115
|
try {
|
|
@@ -35603,7 +35620,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
35603
35620
|
isPreview: isPreview,
|
|
35604
35621
|
isRepliedMessage: isRepliedMessage,
|
|
35605
35622
|
withBorder: !isPreview && !isDetailsView,
|
|
35606
|
-
src:
|
|
35623
|
+
src: attachmentUrlFromMap || attachmentUrl || attachmentThumb,
|
|
35607
35624
|
fitTheContainer: true,
|
|
35608
35625
|
imageMaxHeight: (renderHeight || 400) + "px",
|
|
35609
35626
|
isDetailsView: isDetailsView,
|
|
@@ -35614,9 +35631,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
35614
35631
|
"$shouldAnimate": shouldAnimateImage,
|
|
35615
35632
|
"$isLoaded": imageLoaded,
|
|
35616
35633
|
onLoad: function onLoad() {
|
|
35617
|
-
var currentSrc = attachment.attachmentUrl ||
|
|
35634
|
+
var currentSrc = attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl || attachmentThumb;
|
|
35618
35635
|
var wasThumbnail = previousImageSrcRef.current === attachmentThumb;
|
|
35619
|
-
var isNowFullImage = currentSrc && currentSrc !== attachmentThumb && (attachment.attachmentUrl ||
|
|
35636
|
+
var isNowFullImage = currentSrc && currentSrc !== attachmentThumb && (attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl);
|
|
35620
35637
|
if (wasThumbnail && isNowFullImage) {
|
|
35621
35638
|
setShouldAnimateImage(true);
|
|
35622
35639
|
}
|
|
@@ -35624,11 +35641,12 @@ var Attachment = function Attachment(_ref) {
|
|
|
35624
35641
|
previousImageSrcRef.current = currentSrc;
|
|
35625
35642
|
}
|
|
35626
35643
|
}), !isPreview && !isRepliedMessage && (isInUploadingState || !(attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl || attachmentThumb)) ? (/*#__PURE__*/React__default.createElement(UploadProgress, {
|
|
35627
|
-
backgroundImage: attachmentThumb,
|
|
35644
|
+
backgroundImage: !attachmentUrlFromMap ? attachmentThumb : '',
|
|
35628
35645
|
isRepliedMessage: isRepliedMessage,
|
|
35629
35646
|
width: renderWidth,
|
|
35630
35647
|
height: renderHeight,
|
|
35631
35648
|
withBorder: !isPreview && !isDetailsView,
|
|
35649
|
+
borderRadius: borderRadius,
|
|
35632
35650
|
backgroundColor: backgroundColor && backgroundColor !== 'inherit' ? backgroundColor : overlayBackground2,
|
|
35633
35651
|
isDetailsView: isDetailsView,
|
|
35634
35652
|
imageMinWidth: imageMinWidth,
|
|
@@ -35679,9 +35697,13 @@ var Attachment = function Attachment(_ref) {
|
|
|
35679
35697
|
isDetailsView: isDetailsView,
|
|
35680
35698
|
isRepliedMessage: isRepliedMessage,
|
|
35681
35699
|
withPrefix: withPrefix,
|
|
35682
|
-
backgroundImage: attachmentThumb
|
|
35700
|
+
backgroundImage: !attachmentUrlFromMap ? attachmentThumb : '',
|
|
35683
35701
|
zIndex: 9,
|
|
35684
|
-
borderColor: borderColor
|
|
35702
|
+
borderColor: borderColor,
|
|
35703
|
+
withBorder: !isPreview && !isDetailsView,
|
|
35704
|
+
borderRadius: borderRadius,
|
|
35705
|
+
width: renderWidth,
|
|
35706
|
+
height: renderHeight
|
|
35685
35707
|
}, /*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
35686
35708
|
isRepliedMessage: isRepliedMessage,
|
|
35687
35709
|
isDetailsView: isDetailsView,
|
|
@@ -35719,7 +35741,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
35719
35741
|
height: isRepliedMessage ? '40px' : isDetailsView ? '100%' : (renderHeight || videoAttachmentMaxHeight || 240) + "px",
|
|
35720
35742
|
downloading: downloadingFile,
|
|
35721
35743
|
file: attachment,
|
|
35722
|
-
src: attachment.attachmentUrl || attachmentUrl,
|
|
35744
|
+
src: attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl,
|
|
35723
35745
|
isCachedFile: isCached,
|
|
35724
35746
|
uploading: attachmentCompilationState[attachment.tid] && (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PAUSED),
|
|
35725
35747
|
borderRadius: isRepliedMessage ? '4px' : borderRadius,
|
|
@@ -35734,7 +35756,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
35734
35756
|
height: '48px',
|
|
35735
35757
|
downloading: downloadingFile,
|
|
35736
35758
|
file: attachment,
|
|
35737
|
-
src: attachment.attachmentUrl || attachmentUrl,
|
|
35759
|
+
src: attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl,
|
|
35738
35760
|
borderRadius: borderRadius,
|
|
35739
35761
|
setVideoIsReadyToSend: setVideoIsReadyToSend,
|
|
35740
35762
|
backgroundColor: backgroundColor && backgroundColor !== 'inherit' ? backgroundColor : overlayBackground2,
|
|
@@ -37500,6 +37522,75 @@ var UsersContainer = styled__default.div(_templateObject12$3 || (_templateObject
|
|
|
37500
37522
|
});
|
|
37501
37523
|
|
|
37502
37524
|
var _templateObject$H, _templateObject2$C, _templateObject3$w, _templateObject4$r, _templateObject5$m, _templateObject6$j, _templateObject7$i, _templateObject8$f, _templateObject9$d, _templateObject0$c, _templateObject1$a;
|
|
37525
|
+
var OG_IMAGE_CACHE = 'og-images-v1';
|
|
37526
|
+
var useCachedOGImage = function useCachedOGImage(url) {
|
|
37527
|
+
var dispatch = useDispatch();
|
|
37528
|
+
var attachmentUpdatedMap = useSelector(attachmentUpdatedMapSelector);
|
|
37529
|
+
var reduxCached = url ? attachmentUpdatedMap[getAttachmentURLWithVersion(url)] : undefined;
|
|
37530
|
+
var _useState = React.useState(reduxCached || url),
|
|
37531
|
+
src = _useState[0],
|
|
37532
|
+
setSrc = _useState[1];
|
|
37533
|
+
React.useEffect(function () {
|
|
37534
|
+
if (!url) return;
|
|
37535
|
+
if (reduxCached) {
|
|
37536
|
+
setSrc(reduxCached);
|
|
37537
|
+
return;
|
|
37538
|
+
}
|
|
37539
|
+
setSrc(url);
|
|
37540
|
+
if (!('caches' in window)) return;
|
|
37541
|
+
caches.open(OG_IMAGE_CACHE).then(function (cache) {
|
|
37542
|
+
return cache.match(url);
|
|
37543
|
+
}).then(function (cached) {
|
|
37544
|
+
if (cached) {
|
|
37545
|
+
cached.blob().then(function (blob) {
|
|
37546
|
+
var blobUrl = URL.createObjectURL(blob);
|
|
37547
|
+
setSrc(blobUrl);
|
|
37548
|
+
dispatch(setUpdateMessageAttachmentAC(url, blobUrl));
|
|
37549
|
+
});
|
|
37550
|
+
}
|
|
37551
|
+
})["catch"](function () {});
|
|
37552
|
+
}, [url, reduxCached]);
|
|
37553
|
+
var onImageLoad = React.useCallback(function () {
|
|
37554
|
+
if (!url || !('caches' in window)) return;
|
|
37555
|
+
try {
|
|
37556
|
+
if (new URL(url).origin !== window.location.origin) return;
|
|
37557
|
+
} catch (_unused) {
|
|
37558
|
+
return;
|
|
37559
|
+
}
|
|
37560
|
+
fetch(url, {
|
|
37561
|
+
credentials: 'omit'
|
|
37562
|
+
}).then(function (response) {
|
|
37563
|
+
if (response.ok) {
|
|
37564
|
+
response.clone().blob().then(function (blob) {
|
|
37565
|
+
var blobUrl = URL.createObjectURL(blob);
|
|
37566
|
+
dispatch(setUpdateMessageAttachmentAC(url, blobUrl));
|
|
37567
|
+
caches.open(OG_IMAGE_CACHE).then(function (cache) {
|
|
37568
|
+
return cache.put(url, response);
|
|
37569
|
+
});
|
|
37570
|
+
});
|
|
37571
|
+
}
|
|
37572
|
+
})["catch"](function () {});
|
|
37573
|
+
}, [url]);
|
|
37574
|
+
var onImageError = React.useCallback(function () {
|
|
37575
|
+
if (!url || !('caches' in window)) return;
|
|
37576
|
+
caches.open(OG_IMAGE_CACHE).then(function (cache) {
|
|
37577
|
+
return cache.match(url);
|
|
37578
|
+
}).then(function (cached) {
|
|
37579
|
+
if (cached) {
|
|
37580
|
+
cached.blob().then(function (blob) {
|
|
37581
|
+
var blobUrl = URL.createObjectURL(blob);
|
|
37582
|
+
setSrc(blobUrl);
|
|
37583
|
+
dispatch(setUpdateMessageAttachmentAC(url, blobUrl));
|
|
37584
|
+
});
|
|
37585
|
+
}
|
|
37586
|
+
})["catch"](function () {});
|
|
37587
|
+
}, [url]);
|
|
37588
|
+
return {
|
|
37589
|
+
src: src,
|
|
37590
|
+
onImageLoad: onImageLoad,
|
|
37591
|
+
onImageError: onImageError
|
|
37592
|
+
};
|
|
37593
|
+
};
|
|
37503
37594
|
var validateUrl = function validateUrl(url) {
|
|
37504
37595
|
try {
|
|
37505
37596
|
var urlObj = new URL(url);
|
|
@@ -37515,7 +37606,7 @@ var isDescriptionOnlySymbol = function isDescriptionOnlySymbol(description) {
|
|
|
37515
37606
|
};
|
|
37516
37607
|
var MIN_IMAGE_SIZE = 200;
|
|
37517
37608
|
var OGMetadata = function OGMetadata(_ref) {
|
|
37518
|
-
var _metadata$
|
|
37609
|
+
var _metadata$og, _metadata$og$image, _metadata$og$image$, _metadata$og2, _metadata$og2$favicon, _metadata$og5, _metadata$og6, _metadata$og9, _metadata$og14, _metadata$og14$image, _metadata$og14$image$, _metadata$og18, _metadata$og18$favico, _metadata$og21, _metadata$og22, _metadata$og23;
|
|
37519
37610
|
var attachments = _ref.attachments,
|
|
37520
37611
|
state = _ref.state,
|
|
37521
37612
|
incoming = _ref.incoming,
|
|
@@ -37569,15 +37660,27 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37569
37660
|
var metadata = React.useMemo(function () {
|
|
37570
37661
|
return (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) || null;
|
|
37571
37662
|
}, [attachment, oGMetadata]);
|
|
37572
|
-
var _useState = React.useState(false),
|
|
37573
|
-
shouldAnimate = _useState[0],
|
|
37574
|
-
setShouldAnimate = _useState[1];
|
|
37575
37663
|
var _useState2 = React.useState(false),
|
|
37576
|
-
|
|
37577
|
-
|
|
37664
|
+
shouldAnimate = _useState2[0],
|
|
37665
|
+
setShouldAnimate = _useState2[1];
|
|
37666
|
+
var _useState3 = React.useState(false),
|
|
37667
|
+
imageLoadError = _useState3[0],
|
|
37668
|
+
setImageLoadError = _useState3[1];
|
|
37669
|
+
var _useCachedOGImage = useCachedOGImage(metadata === null || metadata === void 0 ? void 0 : (_metadata$og = metadata.og) === null || _metadata$og === void 0 ? void 0 : (_metadata$og$image = _metadata$og.image) === null || _metadata$og$image === void 0 ? void 0 : (_metadata$og$image$ = _metadata$og$image[0]) === null || _metadata$og$image$ === void 0 ? void 0 : _metadata$og$image$.url),
|
|
37670
|
+
cachedImageSrc = _useCachedOGImage.src,
|
|
37671
|
+
onImageLoad = _useCachedOGImage.onImageLoad,
|
|
37672
|
+
onImageError = _useCachedOGImage.onImageError;
|
|
37673
|
+
var _useCachedOGImage2 = useCachedOGImage(metadata === null || metadata === void 0 ? void 0 : (_metadata$og2 = metadata.og) === null || _metadata$og2 === void 0 ? void 0 : (_metadata$og2$favicon = _metadata$og2.favicon) === null || _metadata$og2$favicon === void 0 ? void 0 : _metadata$og2$favicon.url),
|
|
37674
|
+
cachedFaviconSrc = _useCachedOGImage2.src,
|
|
37675
|
+
onFaviconLoad = _useCachedOGImage2.onImageLoad;
|
|
37578
37676
|
React.useEffect(function () {
|
|
37579
37677
|
setImageLoadError(false);
|
|
37580
37678
|
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
37679
|
+
React.useEffect(function () {
|
|
37680
|
+
if (cachedImageSrc !== null && cachedImageSrc !== void 0 && cachedImageSrc.startsWith('blob:')) {
|
|
37681
|
+
setImageLoadError(false);
|
|
37682
|
+
}
|
|
37683
|
+
}, [cachedImageSrc]);
|
|
37581
37684
|
var ogUrl = React.useMemo(function () {
|
|
37582
37685
|
var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
|
|
37583
37686
|
var urlObj = validateUrl(url);
|
|
@@ -37587,20 +37690,20 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37587
37690
|
return url;
|
|
37588
37691
|
}, [attachment]);
|
|
37589
37692
|
var shouldShowTitle = React.useMemo(function () {
|
|
37590
|
-
var _metadata$
|
|
37591
|
-
return ogShowTitle && (metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37592
|
-
}, [ogShowTitle, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37693
|
+
var _metadata$og3, _metadata$og4;
|
|
37694
|
+
return ogShowTitle && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og3 = metadata.og) === null || _metadata$og3 === void 0 ? void 0 : _metadata$og3.title) && !isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$og4 = metadata.og) === null || _metadata$og4 === void 0 ? void 0 : _metadata$og4.description);
|
|
37695
|
+
}, [ogShowTitle, metadata === null || metadata === void 0 ? void 0 : (_metadata$og5 = metadata.og) === null || _metadata$og5 === void 0 ? void 0 : _metadata$og5.title, metadata === null || metadata === void 0 ? void 0 : (_metadata$og6 = metadata.og) === null || _metadata$og6 === void 0 ? void 0 : _metadata$og6.description]);
|
|
37593
37696
|
var shouldShowDescription = React.useMemo(function () {
|
|
37594
|
-
var _metadata$
|
|
37595
|
-
return ogShowDescription && (metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37596
|
-
}, [ogShowDescription, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37697
|
+
var _metadata$og7, _metadata$og8;
|
|
37698
|
+
return ogShowDescription && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og7 = metadata.og) === null || _metadata$og7 === void 0 ? void 0 : _metadata$og7.description) && !isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$og8 = metadata.og) === null || _metadata$og8 === void 0 ? void 0 : _metadata$og8.description);
|
|
37699
|
+
}, [ogShowDescription, metadata === null || metadata === void 0 ? void 0 : (_metadata$og9 = metadata.og) === null || _metadata$og9 === void 0 ? void 0 : _metadata$og9.description]);
|
|
37597
37700
|
var showOGMetadata = React.useMemo(function () {
|
|
37598
|
-
var _metadata$
|
|
37599
|
-
var descriptionIsSymbol = isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37701
|
+
var _metadata$og0, _metadata$og1, _metadata$og10, _metadata$og11, _metadata$og11$image, _metadata$og11$image$, _metadata$og12, _metadata$og12$favico;
|
|
37702
|
+
var descriptionIsSymbol = isDescriptionOnlySymbol(metadata === null || metadata === void 0 ? void 0 : (_metadata$og0 = metadata.og) === null || _metadata$og0 === void 0 ? void 0 : _metadata$og0.description);
|
|
37600
37703
|
if (descriptionIsSymbol) {
|
|
37601
37704
|
return false;
|
|
37602
37705
|
}
|
|
37603
|
-
return state !== 'deleted' && ((metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37706
|
+
return state !== 'deleted' && ((metadata === null || metadata === void 0 ? void 0 : (_metadata$og1 = metadata.og) === null || _metadata$og1 === void 0 ? void 0 : _metadata$og1.title) || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og10 = metadata.og) === null || _metadata$og10 === void 0 ? void 0 : _metadata$og10.description) || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og11 = metadata.og) === null || _metadata$og11 === void 0 ? void 0 : (_metadata$og11$image = _metadata$og11.image) === null || _metadata$og11$image === void 0 ? void 0 : (_metadata$og11$image$ = _metadata$og11$image[0]) === null || _metadata$og11$image$ === void 0 ? void 0 : _metadata$og11$image$.url) || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og12 = metadata.og) === null || _metadata$og12 === void 0 ? void 0 : (_metadata$og12$favico = _metadata$og12.favicon) === null || _metadata$og12$favico === void 0 ? void 0 : _metadata$og12$favico.url)) && metadata;
|
|
37604
37707
|
}, [state, metadata]);
|
|
37605
37708
|
var calculatedImageHeight = React.useMemo(function () {
|
|
37606
37709
|
if (!(metadata !== null && metadata !== void 0 && metadata.imageWidth) || !(metadata !== null && metadata !== void 0 && metadata.imageHeight)) {
|
|
@@ -37613,17 +37716,17 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37613
37716
|
return Math.floor((metadata === null || metadata === void 0 ? void 0 : metadata.imageHeight) / ((metadata === null || metadata === void 0 ? void 0 : metadata.imageWidth) / maxSize));
|
|
37614
37717
|
}, [metadata === null || metadata === void 0 ? void 0 : metadata.imageWidth, metadata === null || metadata === void 0 ? void 0 : metadata.imageHeight, maxWidth]);
|
|
37615
37718
|
var hasImage = React.useMemo(function () {
|
|
37616
|
-
var _metadata$
|
|
37617
|
-
return (metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37618
|
-
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37719
|
+
var _metadata$og13, _metadata$og13$image, _metadata$og13$image$;
|
|
37720
|
+
return (metadata === null || metadata === void 0 ? void 0 : (_metadata$og13 = metadata.og) === null || _metadata$og13 === void 0 ? void 0 : (_metadata$og13$image = _metadata$og13.image) === null || _metadata$og13$image === void 0 ? void 0 : (_metadata$og13$image$ = _metadata$og13$image[0]) === null || _metadata$og13$image$ === void 0 ? void 0 : _metadata$og13$image$.url) && (!imageLoadError || (cachedImageSrc === null || cachedImageSrc === void 0 ? void 0 : cachedImageSrc.startsWith('blob:')));
|
|
37721
|
+
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$og14 = metadata.og) === null || _metadata$og14 === void 0 ? void 0 : (_metadata$og14$image = _metadata$og14.image) === null || _metadata$og14$image === void 0 ? void 0 : (_metadata$og14$image$ = _metadata$og14$image[0]) === null || _metadata$og14$image$ === void 0 ? void 0 : _metadata$og14$image$.url, imageLoadError, cachedImageSrc]);
|
|
37619
37722
|
var faviconUrl = React.useMemo(function () {
|
|
37620
|
-
var _metadata$
|
|
37723
|
+
var _metadata$og16, _metadata$og16$favico, _metadata$og17, _metadata$og17$favico;
|
|
37621
37724
|
if (ogShowFavicon && hasImage && ((metadata === null || metadata === void 0 ? void 0 : metadata.imageWidth) < MIN_IMAGE_SIZE || (metadata === null || metadata === void 0 ? void 0 : metadata.imageHeight) < MIN_IMAGE_SIZE)) {
|
|
37622
|
-
var _metadata$
|
|
37623
|
-
return metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37725
|
+
var _metadata$og15, _metadata$og15$image, _metadata$og15$image$;
|
|
37726
|
+
return cachedImageSrc || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og15 = metadata.og) === null || _metadata$og15 === void 0 ? void 0 : (_metadata$og15$image = _metadata$og15.image) === null || _metadata$og15$image === void 0 ? void 0 : (_metadata$og15$image$ = _metadata$og15$image[0]) === null || _metadata$og15$image$ === void 0 ? void 0 : _metadata$og15$image$.url);
|
|
37624
37727
|
}
|
|
37625
|
-
return ogShowFavicon && !hasImage && metadata !== null && metadata !== void 0 && (_metadata$
|
|
37626
|
-
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37728
|
+
return ogShowFavicon && !hasImage && metadata !== null && metadata !== void 0 && (_metadata$og16 = metadata.og) !== null && _metadata$og16 !== void 0 && (_metadata$og16$favico = _metadata$og16.favicon) !== null && _metadata$og16$favico !== void 0 && _metadata$og16$favico.url ? cachedFaviconSrc || (metadata === null || metadata === void 0 ? void 0 : (_metadata$og17 = metadata.og) === null || _metadata$og17 === void 0 ? void 0 : (_metadata$og17$favico = _metadata$og17.favicon) === null || _metadata$og17$favico === void 0 ? void 0 : _metadata$og17$favico.url) : '';
|
|
37729
|
+
}, [metadata === null || metadata === void 0 ? void 0 : (_metadata$og18 = metadata.og) === null || _metadata$og18 === void 0 ? void 0 : (_metadata$og18$favico = _metadata$og18.favicon) === null || _metadata$og18$favico === void 0 ? void 0 : _metadata$og18$favico.url, metadata === null || metadata === void 0 ? void 0 : metadata.faviconLoaded, ogShowFavicon, hasImage, cachedImageSrc, cachedFaviconSrc]);
|
|
37627
37730
|
var resolvedOrder = React.useMemo(function () {
|
|
37628
37731
|
return order || {
|
|
37629
37732
|
image: 1,
|
|
@@ -37640,14 +37743,15 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37640
37743
|
React.useEffect(function () {
|
|
37641
37744
|
if (oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) {
|
|
37642
37745
|
if (showOGMetadata && oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url] && metadataGetSuccessCallback && metadata) {
|
|
37643
|
-
|
|
37746
|
+
var show = showImage || hasImage && ((metadata === null || metadata === void 0 ? void 0 : metadata.imageWidth) < MIN_IMAGE_SIZE || (metadata === null || metadata === void 0 ? void 0 : metadata.imageHeight) < MIN_IMAGE_SIZE);
|
|
37747
|
+
metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, true, !!show, metadata);
|
|
37644
37748
|
} else {
|
|
37645
37749
|
metadataGetSuccessCallback === null || metadataGetSuccessCallback === void 0 ? void 0 : metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, false, false, metadata);
|
|
37646
37750
|
}
|
|
37647
37751
|
}
|
|
37648
37752
|
}, [oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, metadata, showOGMetadata, showImage]);
|
|
37649
37753
|
var elements = React.useMemo(function () {
|
|
37650
|
-
var _resolvedOrder$image,
|
|
37754
|
+
var _resolvedOrder$image, _resolvedOrder$title, _metadata$og19, _metadata$og19$title, _resolvedOrder$descri, _metadata$og20, _metadata$og20$descri, _resolvedOrder$link;
|
|
37651
37755
|
return [showImage ? {
|
|
37652
37756
|
key: 'image',
|
|
37653
37757
|
order: (_resolvedOrder$image = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.image) != null ? _resolvedOrder$image : 1,
|
|
@@ -37659,11 +37763,13 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37659
37763
|
maxWidth: maxWidth,
|
|
37660
37764
|
maxHeight: maxHeight || calculatedImageHeight
|
|
37661
37765
|
}, /*#__PURE__*/React__default.createElement(Img, {
|
|
37662
|
-
src:
|
|
37766
|
+
src: cachedImageSrc,
|
|
37663
37767
|
alt: 'OG image',
|
|
37664
37768
|
shouldAnimate: shouldAnimate,
|
|
37769
|
+
onLoad: onImageLoad,
|
|
37665
37770
|
onError: function onError() {
|
|
37666
|
-
|
|
37771
|
+
onImageError();
|
|
37772
|
+
setImageLoadError(true);
|
|
37667
37773
|
}
|
|
37668
37774
|
})))
|
|
37669
37775
|
} : null, {
|
|
@@ -37674,7 +37780,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37674
37780
|
shouldAnimate: shouldAnimate,
|
|
37675
37781
|
padding: infoPadding,
|
|
37676
37782
|
color: textPrimary
|
|
37677
|
-
}, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37783
|
+
}, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og19 = metadata.og) === null || _metadata$og19 === void 0 ? void 0 : (_metadata$og19$title = _metadata$og19.title) === null || _metadata$og19$title === void 0 ? void 0 : _metadata$og19$title.trim())))
|
|
37678
37784
|
}, {
|
|
37679
37785
|
key: 'description',
|
|
37680
37786
|
order: (_resolvedOrder$descri = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.description) != null ? _resolvedOrder$descri : 3,
|
|
@@ -37683,7 +37789,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37683
37789
|
shouldAnimate: shouldAnimate,
|
|
37684
37790
|
color: textSecondary,
|
|
37685
37791
|
padding: infoPadding
|
|
37686
|
-
}, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37792
|
+
}, metadata === null || metadata === void 0 ? void 0 : (_metadata$og20 = metadata.og) === null || _metadata$og20 === void 0 ? void 0 : (_metadata$og20$descri = _metadata$og20.description) === null || _metadata$og20$descri === void 0 ? void 0 : _metadata$og20$descri.trim()))
|
|
37687
37793
|
}, {
|
|
37688
37794
|
key: 'link',
|
|
37689
37795
|
order: (_resolvedOrder$link = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.link) != null ? _resolvedOrder$link : 4,
|
|
@@ -37698,7 +37804,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37698
37804
|
var _a$order, _b$order;
|
|
37699
37805
|
return ((_a$order = a.order) != null ? _a$order : 0) - ((_b$order = b.order) != null ? _b$order : 0);
|
|
37700
37806
|
});
|
|
37701
|
-
}, [hasImage, resolvedOrder, showOGMetadata, maxWidth, calculatedImageHeight, maxHeight, metadata === null || metadata === void 0 ? void 0 : (_metadata$
|
|
37807
|
+
}, [hasImage, resolvedOrder, showOGMetadata, maxWidth, calculatedImageHeight, maxHeight, metadata === null || metadata === void 0 ? void 0 : (_metadata$og21 = metadata.og) === null || _metadata$og21 === void 0 ? void 0 : _metadata$og21.image, shouldAnimate, shouldShowTitle, metadata === null || metadata === void 0 ? void 0 : (_metadata$og22 = metadata.og) === null || _metadata$og22 === void 0 ? void 0 : _metadata$og22.title, infoPadding, shouldShowDescription, metadata === null || metadata === void 0 ? void 0 : (_metadata$og23 = metadata.og) === null || _metadata$og23 === void 0 ? void 0 : _metadata$og23.description, textSecondary, ogShowUrl, ogUrl]);
|
|
37702
37808
|
var textContent = React.useMemo(function () {
|
|
37703
37809
|
return /*#__PURE__*/React__default.createElement(OGText, {
|
|
37704
37810
|
shouldAnimate: shouldAnimate,
|
|
@@ -37725,7 +37831,8 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
37725
37831
|
src: faviconUrl,
|
|
37726
37832
|
alt: '',
|
|
37727
37833
|
loading: 'lazy',
|
|
37728
|
-
decoding: 'async'
|
|
37834
|
+
decoding: 'async',
|
|
37835
|
+
onLoad: onFaviconLoad
|
|
37729
37836
|
})))) : textContent;
|
|
37730
37837
|
}, [hasImage, elements, shouldAnimate, ogContainerShowBackground, ogShowFavicon, faviconUrl, textContent]);
|
|
37731
37838
|
var getChannel = React.useCallback(function () {
|
|
@@ -41052,6 +41159,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41052
41159
|
var loadingRef = React.useRef(false);
|
|
41053
41160
|
var messagesIndexMapRef = React.useRef({});
|
|
41054
41161
|
var scrollRafRef = React.useRef(null);
|
|
41162
|
+
var preserveScrollRafRef = React.useRef(null);
|
|
41055
41163
|
var loadingMessagesTimeoutRef = React.useRef(null);
|
|
41056
41164
|
var renderTopDate = function renderTopDate() {
|
|
41057
41165
|
var container = scrollRef.current;
|
|
@@ -41113,6 +41221,8 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41113
41221
|
if (showScrollToNewMessageButton) {
|
|
41114
41222
|
dispatch(showScrollToNewMessageButtonAC(false));
|
|
41115
41223
|
}
|
|
41224
|
+
nextDisableRef.current = false;
|
|
41225
|
+
prevDisableRef.current = false;
|
|
41116
41226
|
}
|
|
41117
41227
|
if (scrollToReply) {
|
|
41118
41228
|
target.scrollTop = scrollToReply;
|
|
@@ -41172,15 +41282,20 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41172
41282
|
cancelAnimationFrame(scrollRafRef.current);
|
|
41173
41283
|
scrollRafRef.current = null;
|
|
41174
41284
|
}
|
|
41285
|
+
if (preserveScrollRafRef.current !== null) {
|
|
41286
|
+
cancelAnimationFrame(preserveScrollRafRef.current);
|
|
41287
|
+
preserveScrollRafRef.current = null;
|
|
41288
|
+
}
|
|
41175
41289
|
};
|
|
41176
41290
|
}, []);
|
|
41177
41291
|
var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
|
|
41178
41292
|
try {
|
|
41293
|
+
var idx = messages.findIndex(function (msg) {
|
|
41294
|
+
return msg.id === messageId;
|
|
41295
|
+
});
|
|
41179
41296
|
prevDisableRef.current = true;
|
|
41180
41297
|
nextDisableRef.current = true;
|
|
41181
|
-
if (
|
|
41182
|
-
return msg.id === messageId;
|
|
41183
|
-
}) >= 10) {
|
|
41298
|
+
if (idx >= 10) {
|
|
41184
41299
|
var repliedMessage = document.getElementById(messageId);
|
|
41185
41300
|
if (repliedMessage) {
|
|
41186
41301
|
scrollRef.current.scrollTo({
|
|
@@ -41318,29 +41433,34 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41318
41433
|
if (scrollToRepliedMessage) {
|
|
41319
41434
|
loadingRef.current = false;
|
|
41320
41435
|
scrollRef.current.style.scrollBehavior = 'inherit';
|
|
41436
|
+
dispatch(setScrollToMessagesAC(null));
|
|
41321
41437
|
var repliedMessage = document.getElementById(scrollToRepliedMessage);
|
|
41322
41438
|
if (repliedMessage) {
|
|
41323
|
-
|
|
41439
|
+
var targetTop = channel.backToLinkedChannel ? repliedMessage.offsetTop : repliedMessage.offsetTop - scrollRef.current.offsetHeight / 2;
|
|
41440
|
+
setScrollToReply(targetTop);
|
|
41441
|
+
prevDisableRef.current = true;
|
|
41442
|
+
nextDisableRef.current = true;
|
|
41324
41443
|
scrollRef.current.scrollTo({
|
|
41325
|
-
top:
|
|
41444
|
+
top: targetTop,
|
|
41326
41445
|
behavior: scrollToMessageBehavior
|
|
41327
41446
|
});
|
|
41328
41447
|
scrollRef.current.style.scrollBehavior = scrollToMessageBehavior;
|
|
41329
41448
|
if (!channel.backToLinkedChannel && scrollToMessageHighlight) {
|
|
41330
|
-
repliedMessage
|
|
41449
|
+
repliedMessage.classList.add('highlight');
|
|
41331
41450
|
}
|
|
41332
41451
|
var positiveValue = repliedMessage.offsetTop - scrollRef.current.offsetHeight / 2 < 0 ? repliedMessage.offsetTop - scrollRef.current.offsetHeight * -1 : repliedMessage.offsetTop - scrollRef.current.offsetHeight / 2;
|
|
41333
41452
|
setTimeout(function () {
|
|
41334
41453
|
if (!channel.backToLinkedChannel && scrollToMessageHighlight) {
|
|
41335
|
-
var
|
|
41336
|
-
|
|
41454
|
+
var el = document.getElementById(scrollToRepliedMessage);
|
|
41455
|
+
el && el.classList.remove('highlight');
|
|
41337
41456
|
}
|
|
41338
41457
|
prevDisableRef.current = false;
|
|
41458
|
+
nextDisableRef.current = false;
|
|
41459
|
+
shouldLoadMessagesRef.current = '';
|
|
41339
41460
|
setScrollToReply(null);
|
|
41340
41461
|
scrollRef.current.style.scrollBehavior = 'instant';
|
|
41341
41462
|
}, 1000 + positiveValue * 0.1);
|
|
41342
41463
|
}
|
|
41343
|
-
dispatch(setScrollToMessagesAC(null));
|
|
41344
41464
|
}
|
|
41345
41465
|
}, [scrollToRepliedMessage]);
|
|
41346
41466
|
React.useEffect(function () {
|
|
@@ -41353,8 +41473,6 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41353
41473
|
});
|
|
41354
41474
|
}
|
|
41355
41475
|
} else {
|
|
41356
|
-
nextDisableRef.current = true;
|
|
41357
|
-
prevDisableRef.current = true;
|
|
41358
41476
|
scrollRef.current.scrollTo({
|
|
41359
41477
|
top: 0,
|
|
41360
41478
|
behavior: 'smooth'
|
|
@@ -41429,14 +41547,17 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41429
41547
|
}
|
|
41430
41548
|
}, [messages, hiddenMessagesProperties, user === null || user === void 0 ? void 0 : user.id]);
|
|
41431
41549
|
React.useEffect(function () {
|
|
41432
|
-
|
|
41550
|
+
var isPaginating = loadingRef.current && loadDirectionRef.current !== '';
|
|
41551
|
+
var isSendScrollToBottom = scrollToNewMessage.scrollToBottom && !scrollToNewMessage.isIncomingMessage;
|
|
41552
|
+
var shouldRestore = isPaginating && !isSendScrollToBottom;
|
|
41553
|
+
if (shouldRestore && scrollRef.current) {
|
|
41433
41554
|
var isAtBottom = scrollRef.current.scrollTop > -50;
|
|
41434
41555
|
if (!isAtBottom) {
|
|
41435
41556
|
setPreviousScrollTop(scrollRef.current.scrollTop);
|
|
41436
41557
|
setShouldPreserveScroll(true);
|
|
41437
41558
|
}
|
|
41438
41559
|
}
|
|
41439
|
-
if (
|
|
41560
|
+
if (shouldRestore) {
|
|
41440
41561
|
if (loadDirectionRef.current !== 'next') {
|
|
41441
41562
|
var lastVisibleMessage = document.getElementById(lastVisibleMessageIdRef.current);
|
|
41442
41563
|
if (lastVisibleMessage) {
|
|
@@ -41501,7 +41622,11 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41501
41622
|
scrollToBottomRef.current = false;
|
|
41502
41623
|
}
|
|
41503
41624
|
if (shouldPreserveScroll && scrollRef.current && previousScrollTop > 0) {
|
|
41504
|
-
|
|
41625
|
+
if (preserveScrollRafRef.current !== null) {
|
|
41626
|
+
cancelAnimationFrame(preserveScrollRafRef.current);
|
|
41627
|
+
}
|
|
41628
|
+
preserveScrollRafRef.current = requestAnimationFrame(function () {
|
|
41629
|
+
preserveScrollRafRef.current = null;
|
|
41505
41630
|
if (scrollRef.current) {
|
|
41506
41631
|
scrollRef.current.style.scrollBehavior = 'inherit';
|
|
41507
41632
|
scrollRef.current.scrollTop = previousScrollTop;
|
|
@@ -41519,16 +41644,25 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41519
41644
|
}, [messages]);
|
|
41520
41645
|
React.useEffect(function () {
|
|
41521
41646
|
if (messagesLoading === LOADING_STATE.LOADED) {
|
|
41647
|
+
var _messages2, _channel$lastMessage4;
|
|
41648
|
+
var windowHasLatest = messages.length > 0 && ((_messages2 = messages[messages.length - 1]) === null || _messages2 === void 0 ? void 0 : _messages2.id) === (channel === null || channel === void 0 ? void 0 : (_channel$lastMessage4 = channel.lastMessage) === null || _channel$lastMessage4 === void 0 ? void 0 : _channel$lastMessage4.id);
|
|
41649
|
+
if (scrollToNewMessage.scrollToBottom && !scrollToNewMessage.isIncomingMessage && !windowHasLatest && connectionStatus === CONNECTION_STATUS.CONNECTED && channel !== null && channel !== void 0 && channel.id) {
|
|
41650
|
+
dispatch(getMessagesAC(channel, true));
|
|
41651
|
+
}
|
|
41522
41652
|
var timeout = setTimeout(function () {
|
|
41523
41653
|
loadingRef.current = false;
|
|
41524
41654
|
loadFromServerRef.current = false;
|
|
41655
|
+
loadDirectionRef.current = '';
|
|
41525
41656
|
nextDisableRef.current = false;
|
|
41657
|
+
prevDisableRef.current = false;
|
|
41526
41658
|
var currentIndex = messagesIndexMapRef.current[lastVisibleMessageIdRef.current];
|
|
41527
41659
|
if (shouldLoadMessagesRef.current === 'prev' && typeof currentIndex === 'number' && currentIndex < 15) {
|
|
41528
41660
|
handleLoadMoreMessages(MESSAGE_LOAD_DIRECTION.PREV, LOAD_MAX_MESSAGE_COUNT);
|
|
41661
|
+
shouldLoadMessagesRef.current = '';
|
|
41529
41662
|
}
|
|
41530
41663
|
if (shouldLoadMessagesRef.current === 'next' && typeof currentIndex === 'number' && currentIndex > messages.length - 15) {
|
|
41531
41664
|
handleLoadMoreMessages(MESSAGE_LOAD_DIRECTION.NEXT, LOAD_MAX_MESSAGE_COUNT);
|
|
41665
|
+
shouldLoadMessagesRef.current = '';
|
|
41532
41666
|
}
|
|
41533
41667
|
}, 50);
|
|
41534
41668
|
if (loadingMessagesTimeoutRef.current) {
|
|
@@ -41541,17 +41675,16 @@ var MessageList = function MessageList(_ref2) {
|
|
|
41541
41675
|
clearTimeout(loadingMessagesTimeoutRef.current);
|
|
41542
41676
|
}
|
|
41543
41677
|
};
|
|
41544
|
-
}, [messagesLoading, messages, lastVisibleMessageIdRef]);
|
|
41678
|
+
}, [messagesLoading, messages, lastVisibleMessageIdRef, scrollToNewMessage, hasNextMessages, connectionStatus, channel === null || channel === void 0 ? void 0 : channel.id]);
|
|
41545
41679
|
React.useEffect(function () {
|
|
41546
|
-
log.info('connection status is changed.. .... ', connectionStatus, 'channel ... ', channel);
|
|
41547
41680
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED && channel !== null && channel !== void 0 && channel.id) {
|
|
41548
|
-
var _channel$
|
|
41681
|
+
var _channel$lastMessage5;
|
|
41549
41682
|
loadingRef.current = false;
|
|
41550
41683
|
prevDisableRef.current = false;
|
|
41551
41684
|
nextDisableRef.current = false;
|
|
41552
41685
|
clearMessagesMap();
|
|
41553
41686
|
removeAllMessages();
|
|
41554
|
-
var isWithLastVisibleMessageId = lastVisibleMessageIdRef.current !== ((_channel$
|
|
41687
|
+
var isWithLastVisibleMessageId = lastVisibleMessageIdRef.current !== ((_channel$lastMessage5 = channel.lastMessage) === null || _channel$lastMessage5 === void 0 ? void 0 : _channel$lastMessage5.id) && lastVisibleMessageIdRef.current ? lastVisibleMessageIdRef.current : '';
|
|
41555
41688
|
dispatch(getMessagesAC(channel, false, isWithLastVisibleMessageId, 0, false, 'instant', false, true));
|
|
41556
41689
|
}
|
|
41557
41690
|
}, [connectionStatus]);
|
|
@@ -46280,6 +46413,33 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46280
46413
|
var fileType = file.type.split('/')[0];
|
|
46281
46414
|
var tid = uuid.v4();
|
|
46282
46415
|
var reader = new FileReader();
|
|
46416
|
+
var handleAttachmentImageForCache = function handleAttachmentImageForCache(attachment) {
|
|
46417
|
+
try {
|
|
46418
|
+
var _attachment$metadata;
|
|
46419
|
+
var url = URL.createObjectURL(attachment.data);
|
|
46420
|
+
dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata = attachment.metadata) === null || _attachment$metadata === void 0 ? void 0 : _attachment$metadata.tmb) || '', url));
|
|
46421
|
+
return Promise.resolve();
|
|
46422
|
+
} catch (e) {
|
|
46423
|
+
return Promise.reject(e);
|
|
46424
|
+
}
|
|
46425
|
+
};
|
|
46426
|
+
var handleAttachmentVideoForCache = function handleAttachmentVideoForCache(attachment) {
|
|
46427
|
+
try {
|
|
46428
|
+
var _calculateRenderedIma = calculateRenderedImageWidth(attachment.metadata.szh || 400, attachment.metadata.szh || 400),
|
|
46429
|
+
newWidth = _calculateRenderedIma[0],
|
|
46430
|
+
newHeight = _calculateRenderedIma[1];
|
|
46431
|
+
var url = URL.createObjectURL(attachment.data);
|
|
46432
|
+
return Promise.resolve(getVideoFirstFrame(url, newWidth, newHeight, 0.8)).then(function (result) {
|
|
46433
|
+
if (result) {
|
|
46434
|
+
var _attachment$metadata2;
|
|
46435
|
+
var frameBlobUrl = result.frameBlobUrl;
|
|
46436
|
+
dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata2 = attachment.metadata) === null || _attachment$metadata2 === void 0 ? void 0 : _attachment$metadata2.tmb) || '', frameBlobUrl));
|
|
46437
|
+
}
|
|
46438
|
+
});
|
|
46439
|
+
} catch (e) {
|
|
46440
|
+
return Promise.reject(e);
|
|
46441
|
+
}
|
|
46442
|
+
};
|
|
46283
46443
|
reader.onload = function () {
|
|
46284
46444
|
try {
|
|
46285
46445
|
setPendingAttachment(tid, {
|
|
@@ -46292,24 +46452,26 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46292
46452
|
resizeImage(file).then(function (resizedFile) {
|
|
46293
46453
|
try {
|
|
46294
46454
|
return Promise.resolve(createImageThumbnail(file)).then(function (_ref4) {
|
|
46455
|
+
var _resizedFile$blob;
|
|
46295
46456
|
var thumbnail = _ref4.thumbnail,
|
|
46296
46457
|
imageWidth = _ref4.imageWidth,
|
|
46297
46458
|
imageHeight = _ref4.imageHeight;
|
|
46459
|
+
var attachment = {
|
|
46460
|
+
data: file,
|
|
46461
|
+
upload: false,
|
|
46462
|
+
type: isMediaAttachment ? fileType : 'file',
|
|
46463
|
+
attachmentUrl: URL.createObjectURL(resizedFile.blob),
|
|
46464
|
+
tid: tid,
|
|
46465
|
+
size: isMediaAttachment ? resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile === null || resizedFile === void 0 ? void 0 : (_resizedFile$blob = resizedFile.blob) === null || _resizedFile$blob === void 0 ? void 0 : _resizedFile$blob.size : file.size : file.size,
|
|
46466
|
+
metadata: {
|
|
46467
|
+
szw: imageWidth,
|
|
46468
|
+
szh: imageHeight,
|
|
46469
|
+
tmb: thumbnail
|
|
46470
|
+
}
|
|
46471
|
+
};
|
|
46472
|
+
handleAttachmentImageForCache(attachment);
|
|
46298
46473
|
setAttachments(function (prevState) {
|
|
46299
|
-
|
|
46300
|
-
return [].concat(prevState, [{
|
|
46301
|
-
data: file,
|
|
46302
|
-
upload: false,
|
|
46303
|
-
type: isMediaAttachment ? fileType : 'file',
|
|
46304
|
-
attachmentUrl: URL.createObjectURL(resizedFile.blob),
|
|
46305
|
-
tid: tid,
|
|
46306
|
-
size: isMediaAttachment ? resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile === null || resizedFile === void 0 ? void 0 : (_resizedFile$blob = resizedFile.blob) === null || _resizedFile$blob === void 0 ? void 0 : _resizedFile$blob.size : file.size : file.size,
|
|
46307
|
-
metadata: {
|
|
46308
|
-
szw: imageWidth,
|
|
46309
|
-
szh: imageHeight,
|
|
46310
|
-
tmb: thumbnail
|
|
46311
|
-
}
|
|
46312
|
-
}]);
|
|
46474
|
+
return [].concat(prevState, [attachment]);
|
|
46313
46475
|
});
|
|
46314
46476
|
});
|
|
46315
46477
|
} catch (e) {
|
|
@@ -46324,21 +46486,23 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46324
46486
|
width = _ref5.width,
|
|
46325
46487
|
height = _ref5.height,
|
|
46326
46488
|
duration = _ref5.duration;
|
|
46489
|
+
var attachment = {
|
|
46490
|
+
data: file,
|
|
46491
|
+
upload: false,
|
|
46492
|
+
type: isMediaAttachment ? fileType : 'file',
|
|
46493
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
46494
|
+
tid: tid,
|
|
46495
|
+
size: file.size,
|
|
46496
|
+
metadata: {
|
|
46497
|
+
szw: width,
|
|
46498
|
+
szh: height,
|
|
46499
|
+
tmb: thumb,
|
|
46500
|
+
dur: duration
|
|
46501
|
+
}
|
|
46502
|
+
};
|
|
46503
|
+
handleAttachmentVideoForCache(attachment);
|
|
46327
46504
|
setAttachments(function (prevState) {
|
|
46328
|
-
return [].concat(prevState, [
|
|
46329
|
-
data: file,
|
|
46330
|
-
upload: false,
|
|
46331
|
-
type: isMediaAttachment ? fileType : 'file',
|
|
46332
|
-
attachmentUrl: URL.createObjectURL(file),
|
|
46333
|
-
tid: tid,
|
|
46334
|
-
size: file.size,
|
|
46335
|
-
metadata: {
|
|
46336
|
-
szw: width,
|
|
46337
|
-
szh: height,
|
|
46338
|
-
tmb: thumb,
|
|
46339
|
-
dur: duration
|
|
46340
|
-
}
|
|
46341
|
-
}]);
|
|
46505
|
+
return [].concat(prevState, [attachment]);
|
|
46342
46506
|
});
|
|
46343
46507
|
});
|
|
46344
46508
|
} else {
|
|
@@ -46391,20 +46555,22 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46391
46555
|
resizeImage(file).then(function (resizedFileData) {
|
|
46392
46556
|
try {
|
|
46393
46557
|
var resizedFile = new File([resizedFileData.blob], resizedFileData.file.name);
|
|
46558
|
+
var attachment = {
|
|
46559
|
+
data: resizedFile,
|
|
46560
|
+
upload: true,
|
|
46561
|
+
attachmentUrl: URL.createObjectURL(resizedFile),
|
|
46562
|
+
tid: tid,
|
|
46563
|
+
type: fileType,
|
|
46564
|
+
size: resizedFile.size,
|
|
46565
|
+
metadata: JSON.stringify({
|
|
46566
|
+
tmb: metas.thumbnail,
|
|
46567
|
+
szw: resizedFileData.newWidth,
|
|
46568
|
+
szh: resizedFileData.newHeight
|
|
46569
|
+
})
|
|
46570
|
+
};
|
|
46571
|
+
handleAttachmentImageForCache(attachment);
|
|
46394
46572
|
setAttachments(function (prevState) {
|
|
46395
|
-
return [].concat(prevState, [
|
|
46396
|
-
data: resizedFile,
|
|
46397
|
-
upload: true,
|
|
46398
|
-
attachmentUrl: URL.createObjectURL(resizedFile),
|
|
46399
|
-
tid: tid,
|
|
46400
|
-
type: fileType,
|
|
46401
|
-
size: resizedFile.size,
|
|
46402
|
-
metadata: JSON.stringify({
|
|
46403
|
-
tmb: metas.thumbnail,
|
|
46404
|
-
szw: resizedFileData.newWidth,
|
|
46405
|
-
szh: resizedFileData.newHeight
|
|
46406
|
-
})
|
|
46407
|
-
}]);
|
|
46573
|
+
return [].concat(prevState, [attachment]);
|
|
46408
46574
|
});
|
|
46409
46575
|
return Promise.resolve();
|
|
46410
46576
|
} catch (e) {
|
|
@@ -46447,16 +46613,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46447
46613
|
height: height,
|
|
46448
46614
|
dur: duration
|
|
46449
46615
|
});
|
|
46616
|
+
var attachment = {
|
|
46617
|
+
data: file,
|
|
46618
|
+
type: 'video',
|
|
46619
|
+
upload: true,
|
|
46620
|
+
size: file.size,
|
|
46621
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
46622
|
+
tid: tid,
|
|
46623
|
+
metadata: metas
|
|
46624
|
+
};
|
|
46625
|
+
handleAttachmentVideoForCache(attachment);
|
|
46450
46626
|
setAttachments(function (prevState) {
|
|
46451
|
-
return [].concat(prevState, [
|
|
46452
|
-
data: file,
|
|
46453
|
-
type: 'video',
|
|
46454
|
-
upload: true,
|
|
46455
|
-
size: file.size,
|
|
46456
|
-
attachmentUrl: URL.createObjectURL(file),
|
|
46457
|
-
tid: tid,
|
|
46458
|
-
metadata: metas
|
|
46459
|
-
}]);
|
|
46627
|
+
return [].concat(prevState, [attachment]);
|
|
46460
46628
|
});
|
|
46461
46629
|
});
|
|
46462
46630
|
} else {
|
|
@@ -48771,44 +48939,12 @@ var DisappearingMessagesStatus = styled__default.span(_templateObject19$3 || (_t
|
|
|
48771
48939
|
});
|
|
48772
48940
|
var ChevronRightIconWrapper$1 = styled__default.span(_templateObject20$3 || (_templateObject20$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n\n & > svg {\n width: 16px;\n height: 16px;\n transform: rotate(-90deg);\n }\n"])));
|
|
48773
48941
|
|
|
48774
|
-
var _templateObject$_;
|
|
48775
|
-
var MonthHeader = function MonthHeader(_ref) {
|
|
48776
|
-
var currentCreatedAt = _ref.currentCreatedAt,
|
|
48777
|
-
previousCreatedAt = _ref.previousCreatedAt,
|
|
48778
|
-
isFirst = _ref.isFirst,
|
|
48779
|
-
padding = _ref.padding,
|
|
48780
|
-
fullWidth = _ref.fullWidth;
|
|
48781
|
-
var _useColor = useColors(),
|
|
48782
|
-
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY];
|
|
48783
|
-
var monthComponent = React.useMemo(function () {
|
|
48784
|
-
var shouldShowHeader = isFirst || previousCreatedAt && new Date(currentCreatedAt).getMonth() !== new Date(previousCreatedAt).getMonth();
|
|
48785
|
-
if (!shouldShowHeader) {
|
|
48786
|
-
return null;
|
|
48787
|
-
}
|
|
48788
|
-
return /*#__PURE__*/React__default.createElement(MonthHeaderContainer, {
|
|
48789
|
-
color: textSecondary,
|
|
48790
|
-
padding: padding,
|
|
48791
|
-
fullWidth: fullWidth
|
|
48792
|
-
}, new Date(currentCreatedAt).toLocaleDateString('en-US', {
|
|
48793
|
-
month: 'long',
|
|
48794
|
-
year: 'numeric'
|
|
48795
|
-
}));
|
|
48796
|
-
}, [currentCreatedAt, previousCreatedAt, isFirst, textSecondary, padding, fullWidth]);
|
|
48797
|
-
return monthComponent;
|
|
48798
|
-
};
|
|
48799
|
-
var MonthHeaderContainer = styled__default.div(_templateObject$_ || (_templateObject$_ = _taggedTemplateLiteralLoose(["\n padding: ", ";\n width: ", ";\n font-style: normal;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n color: ", ";\n text-transform: uppercase;\n"])), function (props) {
|
|
48800
|
-
return props.padding || '9px 12px';
|
|
48801
|
-
}, function (props) {
|
|
48802
|
-
return props.fullWidth ? '100%' : 'auto';
|
|
48803
|
-
}, function (props) {
|
|
48804
|
-
return props.color;
|
|
48805
|
-
});
|
|
48806
|
-
|
|
48807
|
-
var _templateObject$$, _templateObject2$V;
|
|
48942
|
+
var _templateObject$_, _templateObject2$V, _templateObject3$N, _templateObject4$G, _templateObject5$B;
|
|
48808
48943
|
var Media = function Media(_ref) {
|
|
48809
48944
|
var channel = _ref.channel;
|
|
48810
48945
|
var _useColor = useColors(),
|
|
48811
|
-
background = _useColor[THEME_COLORS.BACKGROUND]
|
|
48946
|
+
background = _useColor[THEME_COLORS.BACKGROUND],
|
|
48947
|
+
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY];
|
|
48812
48948
|
var attachments = useSelector(activeTabAttachmentsSelector, reactRedux.shallowEqual) || [];
|
|
48813
48949
|
var _useState = React.useState(null),
|
|
48814
48950
|
mediaFile = _useState[0],
|
|
@@ -48823,40 +48959,63 @@ var Media = function Media(_ref) {
|
|
|
48823
48959
|
dispatch(setAttachmentsAC([]));
|
|
48824
48960
|
dispatch(getAttachmentsAC(channel.id, channelDetailsTabs.media, 35));
|
|
48825
48961
|
}, [channel.id]);
|
|
48826
|
-
|
|
48827
|
-
|
|
48828
|
-
|
|
48829
|
-
|
|
48830
|
-
|
|
48831
|
-
|
|
48832
|
-
|
|
48833
|
-
|
|
48834
|
-
|
|
48835
|
-
|
|
48836
|
-
|
|
48837
|
-
|
|
48838
|
-
|
|
48839
|
-
|
|
48840
|
-
|
|
48841
|
-
|
|
48842
|
-
|
|
48843
|
-
})
|
|
48844
|
-
|
|
48845
|
-
|
|
48846
|
-
|
|
48847
|
-
|
|
48848
|
-
|
|
48849
|
-
|
|
48850
|
-
|
|
48851
|
-
|
|
48962
|
+
var groups = React.useMemo(function () {
|
|
48963
|
+
var result = [];
|
|
48964
|
+
attachments.forEach(function (att) {
|
|
48965
|
+
var date = new Date(att.createdAt);
|
|
48966
|
+
var key = date.getFullYear() + "-" + date.getMonth();
|
|
48967
|
+
var existing = result.find(function (g) {
|
|
48968
|
+
return g.key === key;
|
|
48969
|
+
});
|
|
48970
|
+
if (existing) {
|
|
48971
|
+
existing.items.push(att);
|
|
48972
|
+
} else {
|
|
48973
|
+
result.push({
|
|
48974
|
+
key: key,
|
|
48975
|
+
date: date,
|
|
48976
|
+
items: [att]
|
|
48977
|
+
});
|
|
48978
|
+
}
|
|
48979
|
+
});
|
|
48980
|
+
return result;
|
|
48981
|
+
}, [attachments]);
|
|
48982
|
+
return /*#__PURE__*/React__default.createElement(Container$o, null, groups.map(function (group) {
|
|
48983
|
+
return /*#__PURE__*/React__default.createElement(MonthSection, {
|
|
48984
|
+
key: group.key
|
|
48985
|
+
}, /*#__PURE__*/React__default.createElement(StickyMonthHeader, {
|
|
48986
|
+
color: textSecondary,
|
|
48987
|
+
background: background
|
|
48988
|
+
}, group.date.toLocaleDateString('en-US', {
|
|
48989
|
+
month: 'long',
|
|
48990
|
+
year: 'numeric'
|
|
48991
|
+
})), /*#__PURE__*/React__default.createElement(ItemsGrid, null, group.items.map(function (file, index) {
|
|
48992
|
+
return /*#__PURE__*/React__default.createElement(MediaItem, {
|
|
48993
|
+
key: file.id + "_" + index
|
|
48994
|
+
}, /*#__PURE__*/React__default.createElement(Attachment$1, {
|
|
48995
|
+
attachment: _extends({}, file, {
|
|
48996
|
+
metadata: isJSON(file.metadata) ? JSON.parse(file.metadata) : file.metadata
|
|
48997
|
+
}),
|
|
48998
|
+
handleMediaItemClick: handleMediaItemClick,
|
|
48999
|
+
backgroundColor: background,
|
|
49000
|
+
borderRadius: '8px',
|
|
49001
|
+
isDetailsView: true
|
|
49002
|
+
}));
|
|
49003
|
+
})));
|
|
48852
49004
|
}), mediaFile && /*#__PURE__*/React__default.createElement(SliderPopup, {
|
|
48853
49005
|
channel: channel,
|
|
48854
49006
|
setIsSliderOpen: setMediaFile,
|
|
48855
49007
|
currentMediaFile: mediaFile
|
|
48856
49008
|
}));
|
|
48857
49009
|
};
|
|
48858
|
-
var Container$o = styled__default.div(_templateObject
|
|
48859
|
-
var
|
|
49010
|
+
var Container$o = styled__default.div(_templateObject$_ || (_templateObject$_ = _taggedTemplateLiteralLoose(["\n padding: 6px 4px;\n list-style: none;\n transition: all 0.2s;\n"])));
|
|
49011
|
+
var MonthSection = styled__default.div(_templateObject2$V || (_templateObject2$V = _taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
|
|
49012
|
+
var StickyMonthHeader = styled__default.div(_templateObject3$N || (_templateObject3$N = _taggedTemplateLiteralLoose(["\n position: sticky;\n top: 44px;\n z-index: 10;\n background: ", ";\n padding: 9px 6px;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n color: ", ";\n"])), function (props) {
|
|
49013
|
+
return props.background;
|
|
49014
|
+
}, function (props) {
|
|
49015
|
+
return props.color;
|
|
49016
|
+
});
|
|
49017
|
+
var ItemsGrid = styled__default.div(_templateObject4$G || (_templateObject4$G = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n"])));
|
|
49018
|
+
var MediaItem = styled__default.div(_templateObject5$B || (_templateObject5$B = _taggedTemplateLiteralLoose(["\n width: calc(33.3333% - 4px);\n aspect-ratio: 1/1;\n box-sizing: border-box;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n overflow: hidden;\n margin: 2px;\n"])));
|
|
48860
49019
|
|
|
48861
49020
|
var _rect$3, _path$1D;
|
|
48862
49021
|
function _extends$1H() {
|
|
@@ -48911,7 +49070,40 @@ function SvgDownloadFile(props) {
|
|
|
48911
49070
|
})));
|
|
48912
49071
|
}
|
|
48913
49072
|
|
|
48914
|
-
var _templateObject
|
|
49073
|
+
var _templateObject$$;
|
|
49074
|
+
var MonthHeader = function MonthHeader(_ref) {
|
|
49075
|
+
var currentCreatedAt = _ref.currentCreatedAt,
|
|
49076
|
+
previousCreatedAt = _ref.previousCreatedAt,
|
|
49077
|
+
isFirst = _ref.isFirst,
|
|
49078
|
+
padding = _ref.padding,
|
|
49079
|
+
fullWidth = _ref.fullWidth;
|
|
49080
|
+
var _useColor = useColors(),
|
|
49081
|
+
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY];
|
|
49082
|
+
var monthComponent = React.useMemo(function () {
|
|
49083
|
+
var shouldShowHeader = isFirst || previousCreatedAt && new Date(currentCreatedAt).getMonth() !== new Date(previousCreatedAt).getMonth();
|
|
49084
|
+
if (!shouldShowHeader) {
|
|
49085
|
+
return null;
|
|
49086
|
+
}
|
|
49087
|
+
return /*#__PURE__*/React__default.createElement(MonthHeaderContainer, {
|
|
49088
|
+
color: textSecondary,
|
|
49089
|
+
padding: padding,
|
|
49090
|
+
fullWidth: fullWidth
|
|
49091
|
+
}, new Date(currentCreatedAt).toLocaleDateString('en-US', {
|
|
49092
|
+
month: 'long',
|
|
49093
|
+
year: 'numeric'
|
|
49094
|
+
}));
|
|
49095
|
+
}, [currentCreatedAt, previousCreatedAt, isFirst, textSecondary, padding, fullWidth]);
|
|
49096
|
+
return monthComponent;
|
|
49097
|
+
};
|
|
49098
|
+
var MonthHeaderContainer = styled__default.div(_templateObject$$ || (_templateObject$$ = _taggedTemplateLiteralLoose(["\n padding: ", ";\n width: ", ";\n font-style: normal;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n color: ", ";\n text-transform: uppercase;\n"])), function (props) {
|
|
49099
|
+
return props.padding || '9px 12px';
|
|
49100
|
+
}, function (props) {
|
|
49101
|
+
return props.fullWidth ? '100%' : 'auto';
|
|
49102
|
+
}, function (props) {
|
|
49103
|
+
return props.color;
|
|
49104
|
+
});
|
|
49105
|
+
|
|
49106
|
+
var _templateObject$10, _templateObject2$W, _templateObject3$O, _templateObject4$H, _templateObject5$C, _templateObject6$x, _templateObject7$v, _templateObject8$q;
|
|
48915
49107
|
var Files = function Files(_ref) {
|
|
48916
49108
|
var channelId = _ref.channelId,
|
|
48917
49109
|
filePreviewIcon = _ref.filePreviewIcon,
|
|
@@ -49043,13 +49235,13 @@ var DownloadWrapper = styled__default.a(_templateObject2$W || (_templateObject2$
|
|
|
49043
49235
|
}, function (props) {
|
|
49044
49236
|
return props.iconColor;
|
|
49045
49237
|
});
|
|
49046
|
-
var ProgressWrapper$2 = styled__default.span(_templateObject3$
|
|
49047
|
-
var FileIconCont = styled__default.span(_templateObject4$
|
|
49238
|
+
var ProgressWrapper$2 = styled__default.span(_templateObject3$O || (_templateObject3$O = _taggedTemplateLiteralLoose(["\n display: inline-block;\n width: 20px;\n height: 20px;\n animation: preloader 1.5s linear infinite;\n\n @keyframes preloader {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])));
|
|
49239
|
+
var FileIconCont = styled__default.span(_templateObject4$H || (_templateObject4$H = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n & > svg {\n width: 40px;\n height: 40px;\n color: ", ";\n rect {\n fill: ", ";\n }\n }\n"])), function (props) {
|
|
49048
49240
|
return props.iconColor;
|
|
49049
49241
|
}, function (props) {
|
|
49050
49242
|
return props.fillColor;
|
|
49051
49243
|
});
|
|
49052
|
-
var FileHoverIconCont = styled__default.span(_templateObject5$
|
|
49244
|
+
var FileHoverIconCont = styled__default.span(_templateObject5$C || (_templateObject5$C = _taggedTemplateLiteralLoose(["\n display: none;\n & > svg {\n width: 40px;\n height: 40px;\n color: ", ";\n rect {\n fill: ", ";\n }\n }\n"])), function (props) {
|
|
49053
49245
|
return props.iconColor;
|
|
49054
49246
|
}, function (props) {
|
|
49055
49247
|
return props.fillColor;
|
|
@@ -49066,7 +49258,7 @@ var FileSizeAndDate = styled__default.span(_templateObject8$q || (_templateObjec
|
|
|
49066
49258
|
return props.color;
|
|
49067
49259
|
});
|
|
49068
49260
|
|
|
49069
|
-
var _templateObject$11, _templateObject2$X, _templateObject3$
|
|
49261
|
+
var _templateObject$11, _templateObject2$X, _templateObject3$P, _templateObject4$I, _templateObject5$D;
|
|
49070
49262
|
var LinkItem = function LinkItem(_ref) {
|
|
49071
49263
|
var link = _ref.link,
|
|
49072
49264
|
linkPreviewIcon = _ref.linkPreviewIcon,
|
|
@@ -49107,11 +49299,11 @@ var LinkHoverIconCont = styled__default.span(_templateObject2$X || (_templateObj
|
|
|
49107
49299
|
}, function (props) {
|
|
49108
49300
|
return props.fillColor;
|
|
49109
49301
|
});
|
|
49110
|
-
var LinkInfoCont = styled__default.div(_templateObject3$
|
|
49111
|
-
var FileItem$1 = styled__default.li(_templateObject4$
|
|
49302
|
+
var LinkInfoCont = styled__default.div(_templateObject3$P || (_templateObject3$P = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n width: calc(100% - 40px);\n"])));
|
|
49303
|
+
var FileItem$1 = styled__default.li(_templateObject4$I || (_templateObject4$I = _taggedTemplateLiteralLoose(["\n padding: 9px 16px;\n a {\n display: flex;\n align-items: center;\n text-decoration: none;\n }\n &:hover {\n background-color: ", ";\n & ", " {\n display: none;\n }\n & ", " {\n display: inline-flex;\n }\n }\n"])), function (props) {
|
|
49112
49304
|
return props.hoverBackgroundColor;
|
|
49113
49305
|
}, LinkIconCont, LinkHoverIconCont);
|
|
49114
|
-
var LinkUrl = styled__default.span(_templateObject5$
|
|
49306
|
+
var LinkUrl = styled__default.span(_templateObject5$D || (_templateObject5$D = _taggedTemplateLiteralLoose(["\n display: block;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: calc(100% - 52px);\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n text-decoration: underline;\n color: ", ";\n"])), function (props) {
|
|
49115
49307
|
return props.color;
|
|
49116
49308
|
});
|
|
49117
49309
|
|
|
@@ -49202,7 +49394,7 @@ function SvgVoicePreviewPause(props) {
|
|
|
49202
49394
|
})));
|
|
49203
49395
|
}
|
|
49204
49396
|
|
|
49205
|
-
var _templateObject$13, _templateObject2$Y, _templateObject3$
|
|
49397
|
+
var _templateObject$13, _templateObject2$Y, _templateObject3$Q, _templateObject4$J, _templateObject5$E, _templateObject6$y, _templateObject7$w, _templateObject8$r;
|
|
49206
49398
|
var VoiceItem = function VoiceItem(_ref) {
|
|
49207
49399
|
var file = _ref.file,
|
|
49208
49400
|
voicePreviewPlayIcon = _ref.voicePreviewPlayIcon,
|
|
@@ -49338,11 +49530,11 @@ var FileHoverIconCont$1 = styled__default.span(_templateObject2$Y || (_templateO
|
|
|
49338
49530
|
}, function (props) {
|
|
49339
49531
|
return props.fill || 'transparent';
|
|
49340
49532
|
});
|
|
49341
|
-
var FileItem$2 = styled__default.li(_templateObject3$
|
|
49533
|
+
var FileItem$2 = styled__default.li(_templateObject3$Q || (_templateObject3$Q = _taggedTemplateLiteralLoose(["\n padding: 9px 16px;\n display: flex;\n align-items: center;\n text-decoration: none;\n\n &:hover {\n background-color: ", ";\n }\n div {\n margin-left: 12px;\n width: 100%;\n }\n img {\n width: 42px;\n height: 42px;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n box-sizing: border-box;\n border-radius: 6px;\n }\n\n &.isHover {\n & ", " {\n display: none;\n }\n & ", " {\n display: inline-flex;\n }\n }\n"])), function (props) {
|
|
49342
49534
|
return props.hoverBackgroundColor;
|
|
49343
49535
|
}, FileIconCont$1, FileHoverIconCont$1);
|
|
49344
|
-
var AudioInfo = styled__default.div(_templateObject4$
|
|
49345
|
-
var AudioTitle = styled__default.span(_templateObject5$
|
|
49536
|
+
var AudioInfo = styled__default.div(_templateObject4$J || (_templateObject4$J = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
|
|
49537
|
+
var AudioTitle = styled__default.span(_templateObject5$E || (_templateObject5$E = _taggedTemplateLiteralLoose(["\n display: block;\n font-style: normal;\n font-weight: 500;\n font-size: 15px;\n line-height: 20px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: calc(100% - 72px);\n color: ", ";\n"])), function (props) {
|
|
49346
49538
|
return props.color;
|
|
49347
49539
|
});
|
|
49348
49540
|
var AudioDate = styled__default.span(_templateObject6$y || (_templateObject6$y = _taggedTemplateLiteralLoose(["\n display: block;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: calc(100% - 72px);\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n color: ", ";\n"])), function (props) {
|
|
@@ -49451,7 +49643,7 @@ function SvgMoreVert(props) {
|
|
|
49451
49643
|
})));
|
|
49452
49644
|
}
|
|
49453
49645
|
|
|
49454
|
-
var _templateObject$15, _templateObject2$Z, _templateObject3$
|
|
49646
|
+
var _templateObject$15, _templateObject2$Z, _templateObject3$R;
|
|
49455
49647
|
var ChangeMemberRole = function ChangeMemberRole(_ref) {
|
|
49456
49648
|
var channelId = _ref.channelId,
|
|
49457
49649
|
member = _ref.member,
|
|
@@ -49555,7 +49747,7 @@ var RoleLabel = styled__default.div(_templateObject2$Z || (_templateObject2$Z =
|
|
|
49555
49747
|
var color = _ref2.color;
|
|
49556
49748
|
return color;
|
|
49557
49749
|
});
|
|
49558
|
-
var RoleSpan = styled__default.span(_templateObject3$
|
|
49750
|
+
var RoleSpan = styled__default.span(_templateObject3$R || (_templateObject3$R = _taggedTemplateLiteralLoose(["\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n text-transform: capitalize;\n"])));
|
|
49559
49751
|
|
|
49560
49752
|
function ResetLinkConfirmModal(_ref) {
|
|
49561
49753
|
var _getInviteLinkOptions;
|
|
@@ -49592,7 +49784,7 @@ function ResetLinkConfirmModal(_ref) {
|
|
|
49592
49784
|
});
|
|
49593
49785
|
}
|
|
49594
49786
|
|
|
49595
|
-
var _templateObject$16, _templateObject2$_, _templateObject3$
|
|
49787
|
+
var _templateObject$16, _templateObject2$_, _templateObject3$S, _templateObject4$K, _templateObject5$F, _templateObject6$z, _templateObject7$x, _templateObject8$s, _templateObject9$l, _templateObject0$j, _templateObject1$f, _templateObject10$a, _templateObject11$8, _templateObject12$7, _templateObject13$6;
|
|
49596
49788
|
function loadImage$1(src) {
|
|
49597
49789
|
return new Promise(function (resolve, reject) {
|
|
49598
49790
|
var img = document.createElement('img');
|
|
@@ -50176,17 +50368,17 @@ var Tabs$1 = styled__default.div(_templateObject2$_ || (_templateObject2$_ = _ta
|
|
|
50176
50368
|
}, function (p) {
|
|
50177
50369
|
return p.borderColor;
|
|
50178
50370
|
});
|
|
50179
|
-
var TabButton = styled__default.button(_templateObject3$
|
|
50371
|
+
var TabButton = styled__default.button(_templateObject3$S || (_templateObject3$S = _taggedTemplateLiteralLoose(["\n height: 36px;\n border: none;\n border-radius: 10px;\n cursor: pointer;\n background-color: ", ";\n ", "\n color: ", ";\n"])), function (p) {
|
|
50180
50372
|
return p.active ? p.activeBackgroundColor : p.backgroundColor;
|
|
50181
50373
|
}, function (p) {
|
|
50182
50374
|
return p.active && "\n box-shadow: 0px 3px 6px -4px #0000001F;\n ";
|
|
50183
50375
|
}, function (p) {
|
|
50184
50376
|
return p.active ? p.activeColor : p.inactiveColor;
|
|
50185
50377
|
});
|
|
50186
|
-
var Description = styled__default.p(_templateObject4$
|
|
50378
|
+
var Description = styled__default.p(_templateObject4$K || (_templateObject4$K = _taggedTemplateLiteralLoose(["\n margin: 8px 0 16px;\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n"])), function (p) {
|
|
50187
50379
|
return p.color;
|
|
50188
50380
|
});
|
|
50189
|
-
var FieldLabel = styled__default.span(_templateObject5$
|
|
50381
|
+
var FieldLabel = styled__default.span(_templateObject5$F || (_templateObject5$F = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n"])), function (p) {
|
|
50190
50382
|
return p.color;
|
|
50191
50383
|
});
|
|
50192
50384
|
var LinkField = styled__default.div(_templateObject6$z || (_templateObject6$z = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n border: 1px solid ", ";\n border-radius: 8px;\n margin-top: 8px;\n padding-left: 12px;\n background-color: ", ";\n"])), function (p) {
|
|
@@ -50218,7 +50410,7 @@ var QrHint = styled__default.p(_templateObject13$6 || (_templateObject13$6 = _ta
|
|
|
50218
50410
|
return p.color;
|
|
50219
50411
|
});
|
|
50220
50412
|
|
|
50221
|
-
var _templateObject$17, _templateObject2$$, _templateObject3$
|
|
50413
|
+
var _templateObject$17, _templateObject2$$, _templateObject3$T, _templateObject4$L, _templateObject5$G, _templateObject6$A, _templateObject7$y, _templateObject8$t, _templateObject9$m;
|
|
50222
50414
|
var Members = function Members(_ref) {
|
|
50223
50415
|
var _members$find;
|
|
50224
50416
|
var channel = _ref.channel,
|
|
@@ -50528,9 +50720,9 @@ var Members = function Members(_ref) {
|
|
|
50528
50720
|
};
|
|
50529
50721
|
var Container$s = styled__default.div(_templateObject$17 || (_templateObject$17 = _taggedTemplateLiteralLoose([""])));
|
|
50530
50722
|
var ActionsMenu$1 = styled__default.div(_templateObject2$$ || (_templateObject2$$ = _taggedTemplateLiteralLoose(["\n position: relative;\n transition: all 0.2s;\n"])));
|
|
50531
|
-
var MemberNamePresence = styled__default.div(_templateObject3$
|
|
50532
|
-
var MemberNameWrapper = styled__default.div(_templateObject4$
|
|
50533
|
-
var MemberName$3 = styled__default.h4(_templateObject5$
|
|
50723
|
+
var MemberNamePresence = styled__default.div(_templateObject3$T || (_templateObject3$T = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n max-width: calc(100% - 84px);\n\n & > ", " {\n display: block;\n }\n"])), SubTitle);
|
|
50724
|
+
var MemberNameWrapper = styled__default.div(_templateObject4$L || (_templateObject4$L = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
50725
|
+
var MemberName$3 = styled__default.h4(_templateObject5$G || (_templateObject5$G = _taggedTemplateLiteralLoose(["\n margin: 0;\n font-weight: 400;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n color: ", ";\n"])), function (props) {
|
|
50534
50726
|
return props.color;
|
|
50535
50727
|
});
|
|
50536
50728
|
var EditMemberIcon = styled__default.span(_templateObject6$A || (_templateObject6$A = _taggedTemplateLiteralLoose(["\n margin-left: auto;\n cursor: pointer;\n padding: 15px;\n opacity: 0;\n visibility: hidden;\n transition: all 0.2s;\n\n & svg {\n color: ", ";\n }\n"])), function (props) {
|
|
@@ -50724,7 +50916,7 @@ var DetailsTabHeader = styled__default.div(_templateObject2$10 || (_templateObje
|
|
|
50724
50916
|
return props.activeTabColor;
|
|
50725
50917
|
});
|
|
50726
50918
|
|
|
50727
|
-
var _templateObject$19, _templateObject2$11, _templateObject3$
|
|
50919
|
+
var _templateObject$19, _templateObject2$11, _templateObject3$U, _templateObject4$M;
|
|
50728
50920
|
var Container$u = styled__default.div(_templateObject$19 || (_templateObject$19 = _taggedTemplateLiteralLoose(["\n ", ";\n height: ", ";\n position: absolute;\n padding: 24px 16px;\n background-color: ", ";\n z-index: 25;\n"])), function (props) {
|
|
50729
50921
|
return props.active ? 'display: block' : 'display: none';
|
|
50730
50922
|
}, function (props) {
|
|
@@ -50733,8 +50925,8 @@ var Container$u = styled__default.div(_templateObject$19 || (_templateObject$19
|
|
|
50733
50925
|
return props.backgroundColor;
|
|
50734
50926
|
});
|
|
50735
50927
|
var AvatarCont = styled__default.div(_templateObject2$11 || (_templateObject2$11 = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n margin-bottom: 4px;\n\n &::after {\n content: '';\n position: absolute;\n width: 120px;\n height: 120px;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n }\n .dropdown-body {\n top: inherit;\n right: inherit;\n bottom: -90px;\n }\n"])));
|
|
50736
|
-
var DropDownWrapper = styled__default.div(_templateObject3$
|
|
50737
|
-
var EditChannelFooter = styled__default(ButtonBlock)(_templateObject4$
|
|
50928
|
+
var DropDownWrapper = styled__default.div(_templateObject3$U || (_templateObject3$U = _taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 4;\n width: 40px;\n height: 40px;\n"])));
|
|
50929
|
+
var EditChannelFooter = styled__default(ButtonBlock)(_templateObject4$M || (_templateObject4$M = _taggedTemplateLiteralLoose(["\n margin-top: 24px;\n\n & > button {\n margin-left: 12px;\n }\n"])));
|
|
50738
50930
|
var EditChannel = function EditChannel(_ref) {
|
|
50739
50931
|
var channel = _ref.channel,
|
|
50740
50932
|
handleToggleEditMode = _ref.handleToggleEditMode,
|
|
@@ -50984,7 +51176,7 @@ var EditChannel = function EditChannel(_ref) {
|
|
|
50984
51176
|
})));
|
|
50985
51177
|
};
|
|
50986
51178
|
|
|
50987
|
-
var _templateObject$1a, _templateObject2$12, _templateObject3$
|
|
51179
|
+
var _templateObject$1a, _templateObject2$12, _templateObject3$V, _templateObject4$N, _templateObject5$H, _templateObject6$B, _templateObject7$z, _templateObject8$u, _templateObject9$n, _templateObject0$k, _templateObject1$g, _templateObject10$b, _templateObject11$9;
|
|
50988
51180
|
var Details = function Details(_ref) {
|
|
50989
51181
|
var _activeChannel$member;
|
|
50990
51182
|
var detailsTitleText = _ref.detailsTitleText,
|
|
@@ -51442,7 +51634,7 @@ var Container$v = styled__default.div(_templateObject$1a || (_templateObject$1a
|
|
|
51442
51634
|
var ChannelDetailsHeader = styled__default.div(_templateObject2$12 || (_templateObject2$12 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 16px;\n position: relative;\n height: 64px;\n box-sizing: border-box;\n border-bottom: 1px solid ", ";\n\n & svg {\n cursor: pointer;\n }\n"])), function (props) {
|
|
51443
51635
|
return props.borderColor;
|
|
51444
51636
|
});
|
|
51445
|
-
var ChatDetails = styled__default.div(_templateObject3$
|
|
51637
|
+
var ChatDetails = styled__default.div(_templateObject3$V || (_templateObject3$V = _taggedTemplateLiteralLoose(["\n //position: relative;\n width: ", ";\n //height: ", ";\n height: ", ";\n overflow-y: auto;\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n"])), function (props) {
|
|
51446
51638
|
return props.size === 'small' ? '300px' : props.size === 'medium' ? '350px' : '400px';
|
|
51447
51639
|
}, function (props) {
|
|
51448
51640
|
return props.height ? "calc(100vh - " + props.heightOffset + "px)" : '100vh';
|
|
@@ -51451,8 +51643,8 @@ var ChatDetails = styled__default.div(_templateObject3$U || (_templateObject3$U
|
|
|
51451
51643
|
}, function (props) {
|
|
51452
51644
|
return props.thumbColor;
|
|
51453
51645
|
});
|
|
51454
|
-
var AboutChannel = styled__default.div(_templateObject4$
|
|
51455
|
-
var AboutChannelTitle = styled__default.h4(_templateObject5$
|
|
51646
|
+
var AboutChannel = styled__default.div(_templateObject4$N || (_templateObject4$N = _taggedTemplateLiteralLoose(["\n margin-top: 20px;\n"])));
|
|
51647
|
+
var AboutChannelTitle = styled__default.h4(_templateObject5$H || (_templateObject5$H = _taggedTemplateLiteralLoose(["\n font-size: 12px;\n margin: 0;\n line-height: 16px;\n color: ", ";\n"])), function (props) {
|
|
51456
51648
|
return props.color;
|
|
51457
51649
|
});
|
|
51458
51650
|
var AboutChannelText = styled__default.h3(_templateObject6$B || (_templateObject6$B = _taggedTemplateLiteralLoose(["\n font-size: 15px;\n margin: 0;\n font-weight: 400;\n line-height: 20px;\n color: ", ";\n"])), function (props) {
|
|
@@ -51786,17 +51978,6 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
51786
51978
|
return msg.id === messageId;
|
|
51787
51979
|
}) >= 10) {
|
|
51788
51980
|
dispatch(scrollToNewMessageAC(true, false, false));
|
|
51789
|
-
dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
51790
|
-
var repliedMessage = document.getElementById(messageId);
|
|
51791
|
-
if (repliedMessage) {
|
|
51792
|
-
var scrollRef = document.getElementById('scrollableDiv');
|
|
51793
|
-
if (scrollRef) {
|
|
51794
|
-
scrollRef.scrollTo({
|
|
51795
|
-
top: 1000,
|
|
51796
|
-
behavior: 'smooth'
|
|
51797
|
-
});
|
|
51798
|
-
}
|
|
51799
|
-
}
|
|
51800
51981
|
} else if (channel !== null && channel !== void 0 && channel.id) {
|
|
51801
51982
|
dispatch(getMessagesAC(channel, true, messageId, undefined, false, 'smooth', true));
|
|
51802
51983
|
}
|