sceyt-chat-react-uikit 1.7.5-beta.17 → 1.7.5-beta.19
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 +651 -594
- package/index.modern.js +651 -594
- package/package.json +1 -1
- package/types/index.d.ts +13 -15
package/index.modern.js
CHANGED
|
@@ -8957,21 +8957,59 @@ var EditorTheme = {
|
|
|
8957
8957
|
var isMessageUnsupported = function isMessageUnsupported(message) {
|
|
8958
8958
|
return (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.TEXT && (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.MEDIA && (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.FILE && (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.LINK && (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.POLL && (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.DELETED && (message === null || message === void 0 ? void 0 : message.type) !== MESSAGE_TYPE.SYSTEM;
|
|
8959
8959
|
};
|
|
8960
|
-
var
|
|
8960
|
+
var deleteVoteFromPollDetails = function deleteVoteFromPollDetails(votes, deletedVote) {
|
|
8961
8961
|
var newVotes = [];
|
|
8962
|
-
var
|
|
8962
|
+
for (var _iterator = _createForOfIteratorHelperLoose(votes), _step; !(_step = _iterator()).done;) {
|
|
8963
8963
|
var vote = _step.value;
|
|
8964
|
-
if (
|
|
8965
|
-
return deletedVote.optionId === vote.optionId && deletedVote.user.id === vote.user.id;
|
|
8966
|
-
})) {
|
|
8964
|
+
if (deletedVote.optionId !== vote.optionId || deletedVote.user.id !== vote.user.id) {
|
|
8967
8965
|
newVotes.push(vote);
|
|
8968
8966
|
}
|
|
8969
|
-
};
|
|
8970
|
-
for (var _iterator = _createForOfIteratorHelperLoose(votes), _step; !(_step = _iterator()).done;) {
|
|
8971
|
-
_loop();
|
|
8972
8967
|
}
|
|
8973
8968
|
return newVotes;
|
|
8974
8969
|
};
|
|
8970
|
+
var handleVoteDetails = function handleVoteDetails(voteDetails, message) {
|
|
8971
|
+
var _extends2;
|
|
8972
|
+
if (!voteDetails || !(message !== null && message !== void 0 && message.pollDetails)) {
|
|
8973
|
+
return undefined;
|
|
8974
|
+
}
|
|
8975
|
+
var existingPollDetails = message.pollDetails;
|
|
8976
|
+
var existingVoteDetails = existingPollDetails.voteDetails || {
|
|
8977
|
+
votesPerOption: {},
|
|
8978
|
+
votes: [],
|
|
8979
|
+
ownVotes: []
|
|
8980
|
+
};
|
|
8981
|
+
if (voteDetails.type === 'close') {
|
|
8982
|
+
return _extends({}, existingPollDetails, {
|
|
8983
|
+
closed: true
|
|
8984
|
+
});
|
|
8985
|
+
}
|
|
8986
|
+
if (!voteDetails.vote) {
|
|
8987
|
+
return existingPollDetails;
|
|
8988
|
+
}
|
|
8989
|
+
var vote = voteDetails.vote;
|
|
8990
|
+
var optionId = vote.optionId;
|
|
8991
|
+
var currentVotesPerOption = existingVoteDetails.votesPerOption || {};
|
|
8992
|
+
var newVotesPerOption = _extends({}, currentVotesPerOption, (_extends2 = {}, _extends2[optionId] = (currentVotesPerOption[optionId] || 0) + voteDetails.incrementVotesPerOptionCount, _extends2));
|
|
8993
|
+
var newVotes = existingVoteDetails.votes || [];
|
|
8994
|
+
var newOwnVotes = existingVoteDetails.ownVotes || [];
|
|
8995
|
+
if (voteDetails.type === 'add') {
|
|
8996
|
+
newVotes = [].concat(newVotes, [vote]);
|
|
8997
|
+
} else if (voteDetails.type === 'delete') {
|
|
8998
|
+
newVotes = deleteVoteFromPollDetails(newVotes, vote);
|
|
8999
|
+
} else if (voteDetails.type === 'addOwn') {
|
|
9000
|
+
newOwnVotes = [].concat(newOwnVotes, [vote]);
|
|
9001
|
+
} else if (voteDetails.type === 'deleteOwn') {
|
|
9002
|
+
newOwnVotes = deleteVoteFromPollDetails(newOwnVotes, vote);
|
|
9003
|
+
}
|
|
9004
|
+
var newVoteDetails = {
|
|
9005
|
+
votesPerOption: newVotesPerOption,
|
|
9006
|
+
votes: newVotes,
|
|
9007
|
+
ownVotes: newOwnVotes
|
|
9008
|
+
};
|
|
9009
|
+
return _extends({}, existingPollDetails, {
|
|
9010
|
+
voteDetails: newVoteDetails
|
|
9011
|
+
});
|
|
9012
|
+
};
|
|
8975
9013
|
|
|
8976
9014
|
var baseUrlForInviteMembers = '';
|
|
8977
9015
|
var autoSelectFitsChannel = false;
|
|
@@ -10026,35 +10064,13 @@ var addAllMessages = function addAllMessages(messages, direction) {
|
|
|
10026
10064
|
var updateMessageOnAllMessages = function updateMessageOnAllMessages(messageId, updatedParams, voteDetails) {
|
|
10027
10065
|
activeChannelAllMessages = activeChannelAllMessages.map(function (message) {
|
|
10028
10066
|
if (message.tid === messageId || message.id === messageId) {
|
|
10029
|
-
var _voteDetails$votes, _message$pollDetails;
|
|
10030
10067
|
if (updatedParams.state === MESSAGE_STATUS.DELETE) {
|
|
10031
10068
|
return _extends({}, updatedParams);
|
|
10032
10069
|
}
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
var _voteDetails$votes2, _voteDetails$votes2$, _voteDetails$votes2$$;
|
|
10036
|
-
return vote.user.id !== (voteDetails === null || voteDetails === void 0 ? void 0 : (_voteDetails$votes2 = voteDetails.votes) === null || _voteDetails$votes2 === void 0 ? void 0 : (_voteDetails$votes2$ = _voteDetails$votes2[0]) === null || _voteDetails$votes2$ === void 0 ? void 0 : (_voteDetails$votes2$$ = _voteDetails$votes2$.user) === null || _voteDetails$votes2$$ === void 0 ? void 0 : _voteDetails$votes2$$.id);
|
|
10037
|
-
}));
|
|
10038
|
-
}
|
|
10039
|
-
var updatedMessage = _extends({}, message, updatedParams, voteDetails && voteDetails.votes && voteDetails.votesPerOption && message.pollDetails ? {
|
|
10040
|
-
pollDetails: _extends({}, message.pollDetails, {
|
|
10041
|
-
votes: [].concat(((_message$pollDetails = message.pollDetails) === null || _message$pollDetails === void 0 ? void 0 : _message$pollDetails.votes) || [], voteDetails.votes),
|
|
10042
|
-
votesPerOption: voteDetails.votesPerOption
|
|
10043
|
-
})
|
|
10044
|
-
} : {});
|
|
10045
|
-
if (voteDetails && voteDetails.deletedVotes && updatedMessage.pollDetails) {
|
|
10046
|
-
updatedMessage = _extends({}, updatedMessage, {
|
|
10047
|
-
pollDetails: _extends({}, updatedMessage.pollDetails, {
|
|
10048
|
-
votes: deleteVotesFromPollDetails(updatedMessage.pollDetails.votes, voteDetails.deletedVotes),
|
|
10049
|
-
votesPerOption: voteDetails.votesPerOption
|
|
10050
|
-
})
|
|
10051
|
-
});
|
|
10052
|
-
}
|
|
10053
|
-
if (voteDetails && voteDetails.closed && updatedMessage.pollDetails) {
|
|
10070
|
+
var updatedMessage = _extends({}, message, updatedParams);
|
|
10071
|
+
if (voteDetails) {
|
|
10054
10072
|
updatedMessage = _extends({}, updatedMessage, {
|
|
10055
|
-
pollDetails:
|
|
10056
|
-
closed: voteDetails.closed
|
|
10057
|
-
})
|
|
10073
|
+
pollDetails: handleVoteDetails(voteDetails, updatedMessage)
|
|
10058
10074
|
});
|
|
10059
10075
|
}
|
|
10060
10076
|
return updatedMessage;
|
|
@@ -10176,34 +10192,14 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
|
|
|
10176
10192
|
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10177
10193
|
continue;
|
|
10178
10194
|
} else {
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
votesPerOption: voteDetails.votesPerOption
|
|
10184
|
-
})
|
|
10185
|
-
} : {});
|
|
10186
|
-
if (voteDetails && voteDetails !== null && voteDetails !== void 0 && (_voteDetails$votes3 = voteDetails.votes) !== null && _voteDetails$votes3 !== void 0 && _voteDetails$votes3.length && !voteDetails.multipleVotes && updatedMessageData.pollDetails) {
|
|
10187
|
-
updatedMessageData.pollDetails.votes = [].concat((updatedMessageData.pollDetails.votes || []).filter(function (vote) {
|
|
10188
|
-
var _voteDetails$votes4, _voteDetails$votes4$, _voteDetails$votes4$$;
|
|
10189
|
-
return vote.user.id !== (voteDetails === null || voteDetails === void 0 ? void 0 : (_voteDetails$votes4 = voteDetails.votes) === null || _voteDetails$votes4 === void 0 ? void 0 : (_voteDetails$votes4$ = _voteDetails$votes4[0]) === null || _voteDetails$votes4$ === void 0 ? void 0 : (_voteDetails$votes4$$ = _voteDetails$votes4$.user) === null || _voteDetails$votes4$$ === void 0 ? void 0 : _voteDetails$votes4$$.id);
|
|
10190
|
-
}));
|
|
10191
|
-
}
|
|
10192
|
-
if (voteDetails && voteDetails.deletedVotes && updatedMessageData.pollDetails) {
|
|
10193
|
-
updatedMessageData = _extends({}, updatedMessageData, {
|
|
10194
|
-
pollDetails: _extends({}, updatedMessageData.pollDetails, {
|
|
10195
|
-
votes: deleteVotesFromPollDetails(updatedMessageData.pollDetails.votes, voteDetails.deletedVotes),
|
|
10196
|
-
votesPerOption: voteDetails.votesPerOption
|
|
10197
|
-
})
|
|
10198
|
-
});
|
|
10199
|
-
}
|
|
10200
|
-
if (voteDetails && voteDetails.closed && updatedMessageData.pollDetails) {
|
|
10201
|
-
updatedMessageData = _extends({}, updatedMessageData, {
|
|
10202
|
-
pollDetails: _extends({}, updatedMessageData.pollDetails, {
|
|
10203
|
-
closed: voteDetails.closed
|
|
10204
|
-
})
|
|
10205
|
-
});
|
|
10195
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params);
|
|
10196
|
+
var voteDetailsData = void 0;
|
|
10197
|
+
if (voteDetails) {
|
|
10198
|
+
voteDetailsData = handleVoteDetails(voteDetails, updatedMessageData);
|
|
10206
10199
|
}
|
|
10200
|
+
updatedMessageData = _extends({}, updatedMessageData, {
|
|
10201
|
+
pollDetails: voteDetailsData
|
|
10202
|
+
});
|
|
10207
10203
|
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10208
10204
|
continue;
|
|
10209
10205
|
}
|
|
@@ -11240,32 +11236,10 @@ var messageSlice = createSlice({
|
|
|
11240
11236
|
if (params.state === MESSAGE_STATUS.DELETE) {
|
|
11241
11237
|
return _extends({}, params);
|
|
11242
11238
|
} else {
|
|
11243
|
-
var
|
|
11244
|
-
if (voteDetails
|
|
11245
|
-
message.pollDetails.votes = [].concat((message.pollDetails.votes || []).filter(function (vote) {
|
|
11246
|
-
var _voteDetails$votes2, _voteDetails$votes2$, _voteDetails$votes2$$;
|
|
11247
|
-
return vote.user.id !== (voteDetails === null || voteDetails === void 0 ? void 0 : (_voteDetails$votes2 = voteDetails.votes) === null || _voteDetails$votes2 === void 0 ? void 0 : (_voteDetails$votes2$ = _voteDetails$votes2[0]) === null || _voteDetails$votes2$ === void 0 ? void 0 : (_voteDetails$votes2$$ = _voteDetails$votes2$.user) === null || _voteDetails$votes2$$ === void 0 ? void 0 : _voteDetails$votes2$$.id);
|
|
11248
|
-
}));
|
|
11249
|
-
}
|
|
11250
|
-
var messageData = _extends({}, message, params, voteDetails && voteDetails.votes && voteDetails.votesPerOption && message.pollDetails ? {
|
|
11251
|
-
pollDetails: _extends({}, message.pollDetails, {
|
|
11252
|
-
votes: [].concat(message.pollDetails.votes || [], voteDetails.votes),
|
|
11253
|
-
votesPerOption: voteDetails.votesPerOption
|
|
11254
|
-
})
|
|
11255
|
-
} : {});
|
|
11256
|
-
if (voteDetails && voteDetails.deletedVotes && messageData.pollDetails) {
|
|
11239
|
+
var messageData = _extends({}, message, params);
|
|
11240
|
+
if (voteDetails) {
|
|
11257
11241
|
messageData = _extends({}, messageData, {
|
|
11258
|
-
pollDetails:
|
|
11259
|
-
votes: deleteVotesFromPollDetails(messageData.pollDetails.votes, voteDetails.deletedVotes),
|
|
11260
|
-
votesPerOption: voteDetails.votesPerOption || {}
|
|
11261
|
-
})
|
|
11262
|
-
});
|
|
11263
|
-
}
|
|
11264
|
-
if (voteDetails && voteDetails.closed && messageData.pollDetails) {
|
|
11265
|
-
messageData = _extends({}, messageData, {
|
|
11266
|
-
pollDetails: _extends({}, messageData.pollDetails, {
|
|
11267
|
-
closed: voteDetails.closed
|
|
11268
|
-
})
|
|
11242
|
+
pollDetails: handleVoteDetails(voteDetails, messageData)
|
|
11269
11243
|
});
|
|
11270
11244
|
}
|
|
11271
11245
|
if (messageData.deliveryStatus !== MESSAGE_DELIVERY_STATUS.PENDING) {
|
|
@@ -14347,7 +14321,7 @@ function watchForEvents() {
|
|
|
14347
14321
|
};
|
|
14348
14322
|
});
|
|
14349
14323
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
14350
|
-
var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3, _channel5, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel6, _activeChannelId6, updateLastMessage, markersMap, activeChannelMessages, lastMessage, _channelId, _channel7, _channel8, deletedMessage, _activeChannelId7, _channelExists7, _channel9, _message, _activeChannelId8, _channelExists8, _channel0, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _channel1, pollDetails, messageId, _activeChannelId0, addedVotes, obj, _store$getState$Messa, key, hasNext,
|
|
14324
|
+
var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3, _channel5, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel6, _activeChannelId6, updateLastMessage, markersMap, activeChannelMessages, lastMessage, _channelId, _channel7, _channel8, deletedMessage, _activeChannelId7, _channelExists7, _channel9, _message, _activeChannelId8, _channelExists8, _channel0, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _pollDetailsData$chan, _pollDetailsData$chan2, _channel1, pollDetails, messageId, pollDetailsData, _activeChannelId0, addedVotes, deletedVotes, objs, _iterator, _step, vote, _iterator2, _step2, _vote, _i, _objs, obj, _store$getState$Messa, key, hasNext, _i2, _objs2, _obj, _pollDetailsData$chan3, _channel10, _pollDetails, _messageId, _pollDetailsData, _activeChannelId1, _deletedVotes, _objs3, _iterator3, _step3, _vote2, _i3, _objs4, _obj2, _i4, _objs5, _obj3, _pollDetailsData2$cha, _channel11, _pollDetails2, _messageId2, _activeChannelId10, _pollDetailsData2, retractedVotes, _objs6, _iterator4, _step4, _vote4, _i5, _objs7, _obj4, _iterator5, _step5, _vote3, _channel12, _messageId3, _activeChannelId11, _obj5, _channel13, _user, _message3, _reaction, channelFromMap, _isSelf, _activeChannelId12, _channelUpdateParams, _channel14, _updatedChannel, _channel15, _activeChannelId13, channelExist, _channel16, _channel17, _channel18, _channel19, _channel20, _channel21, _channel22, _groupName5, _channel23, _groupName6, _channel24, members, _activeChannelId14, i, _channel25, _channel26, _channelId2, from, name, status, _t, _t2;
|
|
14351
14325
|
return _regenerator().w(function (_context) {
|
|
14352
14326
|
while (1) switch (_context.p = _context.n) {
|
|
14353
14327
|
case 0:
|
|
@@ -14359,7 +14333,7 @@ function watchForEvents() {
|
|
|
14359
14333
|
type = _yield$take.type;
|
|
14360
14334
|
args = _yield$take.args;
|
|
14361
14335
|
_t = type;
|
|
14362
|
-
_context.n = _t === CHANNEL_EVENT_TYPES.CREATE ? 2 : _t === CHANNEL_EVENT_TYPES.JOIN ? 7 : _t === CHANNEL_EVENT_TYPES.LEAVE ? 9 : _t === CHANNEL_EVENT_TYPES.BLOCK ? 22 : _t === CHANNEL_EVENT_TYPES.UNBLOCK ? 24 : _t === CHANNEL_EVENT_TYPES.KICK_MEMBERS ? 25 : _t === CHANNEL_EVENT_TYPES.ADD_MEMBERS ? 36 : _t === CHANNEL_EVENT_TYPES.UPDATE_CHANNEL ? 46 : _t === CHANNEL_EVENT_TYPES.MESSAGE ? 51 : _t === CHANNEL_EVENT_TYPES.MESSAGE_MARKERS_RECEIVED ? 68 : _t === CHANNEL_EVENT_TYPES.DELETE ? 75 : _t === CHANNEL_EVENT_TYPES.DELETE_MESSAGE ? 77 : _t === CHANNEL_EVENT_TYPES.EDIT_MESSAGE ? 82 : _t === CHANNEL_EVENT_TYPES.REACTION_ADDED ? 87 : _t === CHANNEL_EVENT_TYPES.POLL_ADDED ? 95 : _t === CHANNEL_EVENT_TYPES.POLL_DELETED ?
|
|
14336
|
+
_context.n = _t === CHANNEL_EVENT_TYPES.CREATE ? 2 : _t === CHANNEL_EVENT_TYPES.JOIN ? 7 : _t === CHANNEL_EVENT_TYPES.LEAVE ? 9 : _t === CHANNEL_EVENT_TYPES.BLOCK ? 22 : _t === CHANNEL_EVENT_TYPES.UNBLOCK ? 24 : _t === CHANNEL_EVENT_TYPES.KICK_MEMBERS ? 25 : _t === CHANNEL_EVENT_TYPES.ADD_MEMBERS ? 36 : _t === CHANNEL_EVENT_TYPES.UPDATE_CHANNEL ? 46 : _t === CHANNEL_EVENT_TYPES.MESSAGE ? 51 : _t === CHANNEL_EVENT_TYPES.MESSAGE_MARKERS_RECEIVED ? 68 : _t === CHANNEL_EVENT_TYPES.DELETE ? 75 : _t === CHANNEL_EVENT_TYPES.DELETE_MESSAGE ? 77 : _t === CHANNEL_EVENT_TYPES.EDIT_MESSAGE ? 82 : _t === CHANNEL_EVENT_TYPES.REACTION_ADDED ? 87 : _t === CHANNEL_EVENT_TYPES.POLL_ADDED ? 95 : _t === CHANNEL_EVENT_TYPES.POLL_DELETED ? 105 : _t === CHANNEL_EVENT_TYPES.POLL_RETRACTED ? 113 : _t === CHANNEL_EVENT_TYPES.POLL_CLOSED ? 121 : _t === CHANNEL_EVENT_TYPES.REACTION_DELETED ? 125 : _t === CHANNEL_EVENT_TYPES.UNREAD_MESSAGES_INFO ? 130 : _t === CHANNEL_EVENT_TYPES.CLEAR_HISTORY ? 133 : _t === CHANNEL_EVENT_TYPES.MUTE ? 139 : _t === CHANNEL_EVENT_TYPES.UNMUTE ? 141 : _t === CHANNEL_EVENT_TYPES.PINED ? 143 : _t === CHANNEL_EVENT_TYPES.UNPINED ? 145 : _t === CHANNEL_EVENT_TYPES.HIDE ? 147 : _t === CHANNEL_EVENT_TYPES.UNHIDE ? 149 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_UNREAD ? 151 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_READ ? 154 : _t === CHANNEL_EVENT_TYPES.CHANGE_ROLE ? 157 : _t === CHANNEL_EVENT_TYPES.FROZEN ? 164 : _t === CHANNEL_EVENT_TYPES.UNFROZEN ? 165 : _t === CHANNEL_EVENT_TYPES.CHANNEL_EVENT ? 166 : _t === CONNECTION_EVENT_TYPES.CONNECTION_STATUS_CHANGED ? 175 : 178;
|
|
14363
14337
|
break;
|
|
14364
14338
|
case 2:
|
|
14365
14339
|
createdChannel = args.createdChannel;
|
|
@@ -14393,7 +14367,7 @@ function watchForEvents() {
|
|
|
14393
14367
|
addChannelToAllChannels(createdChannel);
|
|
14394
14368
|
}
|
|
14395
14369
|
case 6:
|
|
14396
|
-
return _context.a(3,
|
|
14370
|
+
return _context.a(3, 179);
|
|
14397
14371
|
case 7:
|
|
14398
14372
|
channel = args.channel;
|
|
14399
14373
|
log.info('channel JOIN ... . ', channel);
|
|
@@ -14404,7 +14378,7 @@ function watchForEvents() {
|
|
|
14404
14378
|
if (!_chan2) {
|
|
14405
14379
|
addChannelToAllChannels(channel);
|
|
14406
14380
|
}
|
|
14407
|
-
return _context.a(3,
|
|
14381
|
+
return _context.a(3, 179);
|
|
14408
14382
|
case 9:
|
|
14409
14383
|
_channel = args.channel, member = args.member;
|
|
14410
14384
|
log.info('channel LEAVE ... ', _channel, member);
|
|
@@ -14472,7 +14446,7 @@ function watchForEvents() {
|
|
|
14472
14446
|
mutedTill: _channel.mutedTill
|
|
14473
14447
|
});
|
|
14474
14448
|
case 21:
|
|
14475
|
-
return _context.a(3,
|
|
14449
|
+
return _context.a(3, 179);
|
|
14476
14450
|
case 22:
|
|
14477
14451
|
log.info('channel BLOCK ... ');
|
|
14478
14452
|
_channel2 = args.channel;
|
|
@@ -14484,10 +14458,10 @@ function watchForEvents() {
|
|
|
14484
14458
|
_context.n = 23;
|
|
14485
14459
|
return put(removeChannelAC(_channel2.id));
|
|
14486
14460
|
case 23:
|
|
14487
|
-
return _context.a(3,
|
|
14461
|
+
return _context.a(3, 179);
|
|
14488
14462
|
case 24:
|
|
14489
14463
|
log.info('channel UNBLOCK ... ');
|
|
14490
|
-
return _context.a(3,
|
|
14464
|
+
return _context.a(3, 179);
|
|
14491
14465
|
case 25:
|
|
14492
14466
|
_channel3 = args.channel, removedMembers = args.removedMembers;
|
|
14493
14467
|
log.info('channel KICK_MEMBERS ... ', removedMembers);
|
|
@@ -14557,7 +14531,7 @@ function watchForEvents() {
|
|
|
14557
14531
|
muted: _channel3.muted,
|
|
14558
14532
|
mutedTill: _channel3.mutedTill
|
|
14559
14533
|
});
|
|
14560
|
-
return _context.a(3,
|
|
14534
|
+
return _context.a(3, 179);
|
|
14561
14535
|
case 36:
|
|
14562
14536
|
_channel4 = args.channel, addedMembers = args.addedMembers;
|
|
14563
14537
|
log.info('channel ADD_MEMBERS ... ', addedMembers);
|
|
@@ -14612,7 +14586,7 @@ function watchForEvents() {
|
|
|
14612
14586
|
muted: _channel4.muted,
|
|
14613
14587
|
mutedTill: _channel4.mutedTill
|
|
14614
14588
|
});
|
|
14615
|
-
return _context.a(3,
|
|
14589
|
+
return _context.a(3, 179);
|
|
14616
14590
|
case 46:
|
|
14617
14591
|
log.info('channel UPDATE_CHANNEL ... ');
|
|
14618
14592
|
updatedChannel = args.updatedChannel;
|
|
@@ -14659,7 +14633,7 @@ function watchForEvents() {
|
|
|
14659
14633
|
mutedTill: mutedTill,
|
|
14660
14634
|
metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
|
|
14661
14635
|
});
|
|
14662
|
-
return _context.a(3,
|
|
14636
|
+
return _context.a(3, 179);
|
|
14663
14637
|
case 51:
|
|
14664
14638
|
_channel5 = args.channel, message = args.message;
|
|
14665
14639
|
log.info('channel MESSAGE ... id : ', message.id, ', channel.id: ', _channel5.id);
|
|
@@ -14824,7 +14798,7 @@ function watchForEvents() {
|
|
|
14824
14798
|
});
|
|
14825
14799
|
updateChannelLastMessageOnAllChannels(_channel5.id, _channel5.lastMessage);
|
|
14826
14800
|
case 67:
|
|
14827
|
-
return _context.a(3,
|
|
14801
|
+
return _context.a(3, 179);
|
|
14828
14802
|
case 68:
|
|
14829
14803
|
channelId = args.channelId, markerList = args.markerList;
|
|
14830
14804
|
_context.n = 69;
|
|
@@ -14894,7 +14868,7 @@ function watchForEvents() {
|
|
|
14894
14868
|
_context.n = 74;
|
|
14895
14869
|
return put(updateMessagesMarkersAC(channelId, markerList.name, markerList));
|
|
14896
14870
|
case 74:
|
|
14897
|
-
return _context.a(3,
|
|
14871
|
+
return _context.a(3, 179);
|
|
14898
14872
|
case 75:
|
|
14899
14873
|
_channelId = args.channelId;
|
|
14900
14874
|
log.info('channel DELETE ... ');
|
|
@@ -14903,7 +14877,7 @@ function watchForEvents() {
|
|
|
14903
14877
|
return put(setChannelToRemoveAC(_channel7));
|
|
14904
14878
|
case 76:
|
|
14905
14879
|
deleteChannelFromAllChannels(_channelId);
|
|
14906
|
-
return _context.a(3,
|
|
14880
|
+
return _context.a(3, 179);
|
|
14907
14881
|
case 77:
|
|
14908
14882
|
_channel8 = args.channel, deletedMessage = args.deletedMessage;
|
|
14909
14883
|
_context.n = 78;
|
|
@@ -14947,7 +14921,7 @@ function watchForEvents() {
|
|
|
14947
14921
|
muted: _channel8.muted,
|
|
14948
14922
|
mutedTill: _channel8.mutedTill
|
|
14949
14923
|
}, deletedMessage);
|
|
14950
|
-
return _context.a(3,
|
|
14924
|
+
return _context.a(3, 179);
|
|
14951
14925
|
case 82:
|
|
14952
14926
|
_channel9 = args.channel, _message = args.message;
|
|
14953
14927
|
_context.n = 83;
|
|
@@ -14996,7 +14970,7 @@ function watchForEvents() {
|
|
|
14996
14970
|
});
|
|
14997
14971
|
}
|
|
14998
14972
|
updateChannelOnAllChannels(_channel9.id, {}, _message);
|
|
14999
|
-
return _context.a(3,
|
|
14973
|
+
return _context.a(3, 179);
|
|
15000
14974
|
case 87:
|
|
15001
14975
|
_channel0 = args.channel, user = args.user, _message2 = args.message, reaction = args.reaction;
|
|
15002
14976
|
isSelf = user.id === SceytChatClient.user.id;
|
|
@@ -15073,208 +15047,271 @@ function watchForEvents() {
|
|
|
15073
15047
|
if (checkChannelExistsOnMessagesMap(_channel0.id)) {
|
|
15074
15048
|
addReactionToMessageOnMap(_channel0.id, _message2, reaction, true);
|
|
15075
15049
|
}
|
|
15076
|
-
return _context.a(3,
|
|
15050
|
+
return _context.a(3, 179);
|
|
15077
15051
|
case 95:
|
|
15078
15052
|
_channel1 = args.channel, pollDetails = args.pollDetails, messageId = args.messageId;
|
|
15053
|
+
pollDetailsData = pollDetails;
|
|
15079
15054
|
_context.n = 96;
|
|
15080
15055
|
return call(getActiveChannelId);
|
|
15081
15056
|
case 96:
|
|
15082
15057
|
_activeChannelId0 = _context.v;
|
|
15083
|
-
addedVotes = (
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15058
|
+
addedVotes = (pollDetailsData === null || pollDetailsData === void 0 ? void 0 : (_pollDetailsData$chan = pollDetailsData.changedVotes) === null || _pollDetailsData$chan === void 0 ? void 0 : _pollDetailsData$chan.addedVotes) || [];
|
|
15059
|
+
deletedVotes = (pollDetailsData === null || pollDetailsData === void 0 ? void 0 : (_pollDetailsData$chan2 = pollDetailsData.changedVotes) === null || _pollDetailsData$chan2 === void 0 ? void 0 : _pollDetailsData$chan2.removedVotes) || [];
|
|
15060
|
+
objs = [];
|
|
15061
|
+
for (_iterator = _createForOfIteratorHelperLoose(deletedVotes); !(_step = _iterator()).done;) {
|
|
15062
|
+
vote = _step.value;
|
|
15063
|
+
objs.push({
|
|
15064
|
+
type: vote.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15065
|
+
vote: vote,
|
|
15066
|
+
incrementVotesPerOptionCount: -((deletedVotes === null || deletedVotes === void 0 ? void 0 : deletedVotes.length) || 0)
|
|
15067
|
+
});
|
|
15068
|
+
}
|
|
15069
|
+
for (_iterator2 = _createForOfIteratorHelperLoose(addedVotes); !(_step2 = _iterator2()).done;) {
|
|
15070
|
+
_vote = _step2.value;
|
|
15071
|
+
objs.push({
|
|
15072
|
+
type: _vote.user.id === SceytChatClient.user.id ? 'addOwn' : 'add',
|
|
15073
|
+
vote: _vote,
|
|
15074
|
+
incrementVotesPerOptionCount: (addedVotes === null || addedVotes === void 0 ? void 0 : addedVotes.length) || 0
|
|
15075
|
+
});
|
|
15076
|
+
}
|
|
15077
|
+
_i = 0, _objs = objs;
|
|
15078
|
+
case 97:
|
|
15079
|
+
if (!(_i < _objs.length)) {
|
|
15080
|
+
_context.n = 101;
|
|
15081
|
+
break;
|
|
15082
|
+
}
|
|
15083
|
+
obj = _objs[_i];
|
|
15084
|
+
if (!(pollDetailsData !== null && pollDetailsData !== void 0 && pollDetailsData.id && obj.vote)) {
|
|
15085
|
+
_context.n = 100;
|
|
15091
15086
|
break;
|
|
15092
15087
|
}
|
|
15093
|
-
key =
|
|
15088
|
+
key = pollDetailsData.id + "_" + obj.vote.optionId;
|
|
15094
15089
|
hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[key]) || false;
|
|
15095
|
-
|
|
15096
|
-
case 97:
|
|
15097
|
-
if ((_step = _iterator()).done) {
|
|
15090
|
+
if (!(obj.type === 'addOwn')) {
|
|
15098
15091
|
_context.n = 99;
|
|
15099
15092
|
break;
|
|
15100
15093
|
}
|
|
15101
|
-
vote = _step.value;
|
|
15102
15094
|
_context.n = 98;
|
|
15103
|
-
return put(addPollVotesToListAC(
|
|
15095
|
+
return put(addPollVotesToListAC(pollDetailsData.id, obj.vote.optionId, [obj.vote], hasNext, undefined));
|
|
15104
15096
|
case 98:
|
|
15105
|
-
_context.n =
|
|
15097
|
+
_context.n = 100;
|
|
15106
15098
|
break;
|
|
15107
15099
|
case 99:
|
|
15100
|
+
_context.n = 100;
|
|
15101
|
+
return put(deletePollVotesFromListAC(pollDetailsData.id, obj.vote.optionId, [obj.vote], messageId));
|
|
15102
|
+
case 100:
|
|
15103
|
+
_i++;
|
|
15104
|
+
_context.n = 97;
|
|
15105
|
+
break;
|
|
15106
|
+
case 101:
|
|
15107
|
+
_i2 = 0, _objs2 = objs;
|
|
15108
|
+
case 102:
|
|
15109
|
+
if (!(_i2 < _objs2.length)) {
|
|
15110
|
+
_context.n = 104;
|
|
15111
|
+
break;
|
|
15112
|
+
}
|
|
15113
|
+
_obj = _objs2[_i2];
|
|
15108
15114
|
updateMessageOnMap(_channel1.id, {
|
|
15109
15115
|
messageId: messageId,
|
|
15110
15116
|
params: {}
|
|
15111
|
-
},
|
|
15117
|
+
}, {
|
|
15118
|
+
type: _obj.type,
|
|
15119
|
+
vote: _obj.vote,
|
|
15120
|
+
incrementVotesPerOptionCount: _obj.incrementVotesPerOptionCount
|
|
15121
|
+
});
|
|
15112
15122
|
if (!(_channel1.id === _activeChannelId0)) {
|
|
15113
|
-
_context.n =
|
|
15123
|
+
_context.n = 103;
|
|
15114
15124
|
break;
|
|
15115
15125
|
}
|
|
15116
|
-
updateMessageOnAllMessages(messageId, {},
|
|
15117
|
-
_context.n =
|
|
15118
|
-
return put(updateMessageAC(messageId, {}, undefined,
|
|
15119
|
-
case
|
|
15120
|
-
|
|
15121
|
-
case 101:
|
|
15122
|
-
_channel10 = args.channel, _pollDetails = args.pollDetails, _messageId = args.messageId;
|
|
15126
|
+
updateMessageOnAllMessages(messageId, {}, _obj);
|
|
15127
|
+
_context.n = 103;
|
|
15128
|
+
return put(updateMessageAC(messageId, {}, undefined, _obj));
|
|
15129
|
+
case 103:
|
|
15130
|
+
_i2++;
|
|
15123
15131
|
_context.n = 102;
|
|
15132
|
+
break;
|
|
15133
|
+
case 104:
|
|
15134
|
+
return _context.a(3, 179);
|
|
15135
|
+
case 105:
|
|
15136
|
+
_channel10 = args.channel, _pollDetails = args.pollDetails, _messageId = args.messageId;
|
|
15137
|
+
_pollDetailsData = _pollDetails;
|
|
15138
|
+
_context.n = 106;
|
|
15124
15139
|
return call(getActiveChannelId);
|
|
15125
|
-
case
|
|
15140
|
+
case 106:
|
|
15126
15141
|
_activeChannelId1 = _context.v;
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15142
|
+
_deletedVotes = (_pollDetailsData === null || _pollDetailsData === void 0 ? void 0 : (_pollDetailsData$chan3 = _pollDetailsData.changedVotes) === null || _pollDetailsData$chan3 === void 0 ? void 0 : _pollDetailsData$chan3.removedVotes) || [];
|
|
15143
|
+
_objs3 = [];
|
|
15144
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(_deletedVotes); !(_step3 = _iterator3()).done;) {
|
|
15145
|
+
_vote2 = _step3.value;
|
|
15146
|
+
_objs3.push({
|
|
15147
|
+
type: _vote2.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15148
|
+
vote: _vote2,
|
|
15149
|
+
incrementVotesPerOptionCount: -((_deletedVotes === null || _deletedVotes === void 0 ? void 0 : _deletedVotes.length) || 0)
|
|
15150
|
+
});
|
|
15151
|
+
}
|
|
15152
|
+
_i3 = 0, _objs4 = _objs3;
|
|
15153
|
+
case 107:
|
|
15154
|
+
if (!(_i3 < _objs4.length)) {
|
|
15155
|
+
_context.n = 109;
|
|
15130
15156
|
break;
|
|
15131
15157
|
}
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
_context.n = 105;
|
|
15158
|
+
_obj2 = _objs4[_i3];
|
|
15159
|
+
if (!(_pollDetailsData !== null && _pollDetailsData !== void 0 && _pollDetailsData.id && _obj2.vote)) {
|
|
15160
|
+
_context.n = 108;
|
|
15136
15161
|
break;
|
|
15137
15162
|
}
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
_context.n =
|
|
15163
|
+
_context.n = 108;
|
|
15164
|
+
return put(deletePollVotesFromListAC(_pollDetailsData.id, _obj2.vote.optionId, [_obj2.vote], _messageId));
|
|
15165
|
+
case 108:
|
|
15166
|
+
_i3++;
|
|
15167
|
+
_context.n = 107;
|
|
15143
15168
|
break;
|
|
15144
|
-
case
|
|
15169
|
+
case 109:
|
|
15170
|
+
_i4 = 0, _objs5 = _objs3;
|
|
15171
|
+
case 110:
|
|
15172
|
+
if (!(_i4 < _objs5.length)) {
|
|
15173
|
+
_context.n = 112;
|
|
15174
|
+
break;
|
|
15175
|
+
}
|
|
15176
|
+
_obj3 = _objs5[_i4];
|
|
15145
15177
|
updateMessageOnMap(_channel10.id, {
|
|
15146
15178
|
messageId: _messageId,
|
|
15147
15179
|
params: {}
|
|
15148
|
-
},
|
|
15149
|
-
deletedVotes: deletedVotes,
|
|
15150
|
-
votesPerOption: _pollDetails.votesPerOption
|
|
15151
|
-
});
|
|
15180
|
+
}, _obj3);
|
|
15152
15181
|
if (!(_channel10.id === _activeChannelId1)) {
|
|
15153
|
-
_context.n =
|
|
15182
|
+
_context.n = 111;
|
|
15154
15183
|
break;
|
|
15155
15184
|
}
|
|
15156
|
-
updateMessageOnAllMessages(_messageId, {},
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
case
|
|
15166
|
-
return _context.a(3, 171);
|
|
15167
|
-
case 107:
|
|
15185
|
+
updateMessageOnAllMessages(_messageId, {}, _obj3);
|
|
15186
|
+
_context.n = 111;
|
|
15187
|
+
return put(updateMessageAC(_messageId, {}, undefined, _obj3));
|
|
15188
|
+
case 111:
|
|
15189
|
+
_i4++;
|
|
15190
|
+
_context.n = 110;
|
|
15191
|
+
break;
|
|
15192
|
+
case 112:
|
|
15193
|
+
return _context.a(3, 179);
|
|
15194
|
+
case 113:
|
|
15168
15195
|
_channel11 = args.channel, _pollDetails2 = args.pollDetails, _messageId2 = args.messageId;
|
|
15169
|
-
_context.n =
|
|
15196
|
+
_context.n = 114;
|
|
15170
15197
|
return call(getActiveChannelId);
|
|
15171
|
-
case
|
|
15198
|
+
case 114:
|
|
15172
15199
|
_activeChannelId10 = _context.v;
|
|
15173
|
-
|
|
15200
|
+
_pollDetailsData2 = _pollDetails2;
|
|
15201
|
+
retractedVotes = (_pollDetailsData2 === null || _pollDetailsData2 === void 0 ? void 0 : (_pollDetailsData2$cha = _pollDetailsData2.changedVotes) === null || _pollDetailsData2$cha === void 0 ? void 0 : _pollDetailsData2$cha.removedVotes) || [];
|
|
15202
|
+
_objs6 = [];
|
|
15203
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(retractedVotes); !(_step4 = _iterator4()).done;) {
|
|
15204
|
+
_vote4 = _step4.value;
|
|
15205
|
+
_objs6.push({
|
|
15206
|
+
type: _vote4.user.id === SceytChatClient.user.id ? 'deleteOwn' : 'delete',
|
|
15207
|
+
vote: _vote4,
|
|
15208
|
+
incrementVotesPerOptionCount: -((retractedVotes === null || retractedVotes === void 0 ? void 0 : retractedVotes.length) || 0)
|
|
15209
|
+
});
|
|
15210
|
+
}
|
|
15211
|
+
_i5 = 0, _objs7 = _objs6;
|
|
15212
|
+
case 115:
|
|
15213
|
+
if (!(_i5 < _objs7.length)) {
|
|
15214
|
+
_context.n = 120;
|
|
15215
|
+
break;
|
|
15216
|
+
}
|
|
15217
|
+
_obj4 = _objs7[_i5];
|
|
15174
15218
|
updateMessageOnMap(_channel11.id, {
|
|
15175
15219
|
messageId: _messageId2,
|
|
15176
15220
|
params: {}
|
|
15177
|
-
},
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
});
|
|
15181
|
-
if (!(_pollDetails2 !== null && _pollDetails2 !== void 0 && _pollDetails2.id && retractedVotes.length > 0)) {
|
|
15182
|
-
_context.n = 111;
|
|
15221
|
+
}, _obj4);
|
|
15222
|
+
if (!(_pollDetailsData2 !== null && _pollDetailsData2 !== void 0 && _pollDetailsData2.id && retractedVotes.length > 0)) {
|
|
15223
|
+
_context.n = 118;
|
|
15183
15224
|
break;
|
|
15184
15225
|
}
|
|
15185
|
-
|
|
15186
|
-
case
|
|
15187
|
-
if ((
|
|
15188
|
-
_context.n =
|
|
15226
|
+
_iterator5 = _createForOfIteratorHelperLoose(retractedVotes);
|
|
15227
|
+
case 116:
|
|
15228
|
+
if ((_step5 = _iterator5()).done) {
|
|
15229
|
+
_context.n = 118;
|
|
15189
15230
|
break;
|
|
15190
15231
|
}
|
|
15191
|
-
|
|
15192
|
-
_context.n =
|
|
15193
|
-
return put(deletePollVotesFromListAC(
|
|
15194
|
-
case
|
|
15195
|
-
_context.n =
|
|
15232
|
+
_vote3 = _step5.value;
|
|
15233
|
+
_context.n = 117;
|
|
15234
|
+
return put(deletePollVotesFromListAC(_pollDetailsData2.id, _vote3.optionId, [_vote3], _messageId2));
|
|
15235
|
+
case 117:
|
|
15236
|
+
_context.n = 116;
|
|
15196
15237
|
break;
|
|
15197
|
-
case
|
|
15238
|
+
case 118:
|
|
15198
15239
|
if (!(_channel11.id === _activeChannelId10)) {
|
|
15199
|
-
_context.n =
|
|
15240
|
+
_context.n = 119;
|
|
15200
15241
|
break;
|
|
15201
15242
|
}
|
|
15202
|
-
updateMessageOnAllMessages(_messageId2, {},
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
case
|
|
15212
|
-
return _context.a(3, 171);
|
|
15213
|
-
case 113:
|
|
15243
|
+
updateMessageOnAllMessages(_messageId2, {}, _obj4);
|
|
15244
|
+
_context.n = 119;
|
|
15245
|
+
return put(updateMessageAC(_messageId2, {}, undefined, _obj4));
|
|
15246
|
+
case 119:
|
|
15247
|
+
_i5++;
|
|
15248
|
+
_context.n = 115;
|
|
15249
|
+
break;
|
|
15250
|
+
case 120:
|
|
15251
|
+
return _context.a(3, 179);
|
|
15252
|
+
case 121:
|
|
15214
15253
|
_channel12 = args.channel, _messageId3 = args.messageId;
|
|
15215
|
-
_context.n =
|
|
15254
|
+
_context.n = 122;
|
|
15216
15255
|
return call(getActiveChannelId);
|
|
15217
|
-
case
|
|
15256
|
+
case 122:
|
|
15218
15257
|
_activeChannelId11 = _context.v;
|
|
15258
|
+
_obj5 = {
|
|
15259
|
+
type: 'close',
|
|
15260
|
+
incrementVotesPerOptionCount: 0
|
|
15261
|
+
};
|
|
15219
15262
|
updateMessageOnMap(_channel12.id, {
|
|
15220
15263
|
messageId: _messageId3,
|
|
15221
15264
|
params: {}
|
|
15222
|
-
},
|
|
15223
|
-
closed: true
|
|
15224
|
-
});
|
|
15265
|
+
}, _obj5);
|
|
15225
15266
|
if (!(_channel12.id === _activeChannelId11)) {
|
|
15226
|
-
_context.n =
|
|
15267
|
+
_context.n = 124;
|
|
15227
15268
|
break;
|
|
15228
15269
|
}
|
|
15229
|
-
updateMessageOnAllMessages(_messageId3, {},
|
|
15230
|
-
|
|
15231
|
-
});
|
|
15232
|
-
|
|
15233
|
-
return
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
case
|
|
15237
|
-
return _context.a(3, 171);
|
|
15238
|
-
case 116:
|
|
15239
|
-
return _context.a(3, 171);
|
|
15240
|
-
case 117:
|
|
15270
|
+
updateMessageOnAllMessages(_messageId3, {}, _obj5);
|
|
15271
|
+
_context.n = 123;
|
|
15272
|
+
return put(updateMessageAC(_messageId3, {}, undefined, _obj5));
|
|
15273
|
+
case 123:
|
|
15274
|
+
return _context.a(3, 179);
|
|
15275
|
+
case 124:
|
|
15276
|
+
return _context.a(3, 179);
|
|
15277
|
+
case 125:
|
|
15241
15278
|
_channel13 = args.channel, _user = args.user, _message3 = args.message, _reaction = args.reaction;
|
|
15242
15279
|
log.info('channel REACTION_DELETED ... ', _channel13);
|
|
15243
15280
|
channelFromMap = getChannelFromMap(_channel13.id);
|
|
15244
15281
|
_isSelf = _user.id === SceytChatClient.user.id;
|
|
15245
|
-
_context.n =
|
|
15282
|
+
_context.n = 126;
|
|
15246
15283
|
return call(getActiveChannelId);
|
|
15247
|
-
case
|
|
15284
|
+
case 126:
|
|
15248
15285
|
_activeChannelId12 = _context.v;
|
|
15249
15286
|
if (!(_channel13.id === _activeChannelId12)) {
|
|
15250
|
-
_context.n =
|
|
15287
|
+
_context.n = 128;
|
|
15251
15288
|
break;
|
|
15252
15289
|
}
|
|
15253
|
-
_context.n =
|
|
15290
|
+
_context.n = 127;
|
|
15254
15291
|
return put(deleteReactionFromMessageAC(_message3, _reaction, _isSelf));
|
|
15255
|
-
case
|
|
15292
|
+
case 127:
|
|
15256
15293
|
removeReactionOnAllMessages(_message3, _reaction, true);
|
|
15257
|
-
case
|
|
15294
|
+
case 128:
|
|
15258
15295
|
_channelUpdateParams = JSON.parse(JSON.stringify(_channel13));
|
|
15259
15296
|
if (channelFromMap && channelFromMap.lastReactedMessage && channelFromMap.lastReactedMessage.id === _message3.id) {
|
|
15260
15297
|
_channelUpdateParams.lastReactedMessage = null;
|
|
15261
15298
|
}
|
|
15262
|
-
_context.n =
|
|
15299
|
+
_context.n = 129;
|
|
15263
15300
|
return put(updateChannelDataAC(_channel13.id, _channelUpdateParams));
|
|
15264
|
-
case
|
|
15301
|
+
case 129:
|
|
15265
15302
|
updateChannelOnAllChannels(_channel13.id, _channelUpdateParams);
|
|
15266
15303
|
if (checkChannelExistsOnMessagesMap(_channel13.id)) {
|
|
15267
15304
|
removeReactionToMessageOnMap(_channel13.id, _message3, _reaction, true);
|
|
15268
15305
|
}
|
|
15269
|
-
return _context.a(3,
|
|
15270
|
-
case
|
|
15306
|
+
return _context.a(3, 179);
|
|
15307
|
+
case 130:
|
|
15271
15308
|
_channel14 = args.channel;
|
|
15272
15309
|
if (!_channel14) {
|
|
15273
|
-
_context.n =
|
|
15310
|
+
_context.n = 132;
|
|
15274
15311
|
break;
|
|
15275
15312
|
}
|
|
15276
15313
|
_updatedChannel = JSON.parse(JSON.stringify(_channel14));
|
|
15277
|
-
_context.n =
|
|
15314
|
+
_context.n = 131;
|
|
15278
15315
|
return put(updateChannelDataAC(_channel14.id, {
|
|
15279
15316
|
lastMessage: _channel14.lastMessage,
|
|
15280
15317
|
newMessageCount: _channel14.newMessageCount,
|
|
@@ -15287,36 +15324,36 @@ function watchForEvents() {
|
|
|
15287
15324
|
lastDisplayedMessageId: _channel14.lastDisplayedMessageId,
|
|
15288
15325
|
messageRetentionPeriod: _channel14.messageRetentionPeriod
|
|
15289
15326
|
}));
|
|
15290
|
-
case
|
|
15327
|
+
case 131:
|
|
15291
15328
|
updateChannelOnAllChannels(_channel14.id, _updatedChannel);
|
|
15292
|
-
case
|
|
15293
|
-
return _context.a(3,
|
|
15294
|
-
case
|
|
15329
|
+
case 132:
|
|
15330
|
+
return _context.a(3, 179);
|
|
15331
|
+
case 133:
|
|
15295
15332
|
_channel15 = args.channel;
|
|
15296
15333
|
log.info('CLEAR_HISTORY: ', _channel15);
|
|
15297
|
-
_context.n =
|
|
15334
|
+
_context.n = 134;
|
|
15298
15335
|
return call(getActiveChannelId);
|
|
15299
|
-
case
|
|
15336
|
+
case 134:
|
|
15300
15337
|
_activeChannelId13 = _context.v;
|
|
15301
|
-
_context.n =
|
|
15338
|
+
_context.n = 135;
|
|
15302
15339
|
return call(checkChannelExists, _channel15.id);
|
|
15303
|
-
case
|
|
15340
|
+
case 135:
|
|
15304
15341
|
channelExist = _context.v;
|
|
15305
15342
|
if (!(_channel15.id === _activeChannelId13)) {
|
|
15306
|
-
_context.n =
|
|
15343
|
+
_context.n = 137;
|
|
15307
15344
|
break;
|
|
15308
15345
|
}
|
|
15309
|
-
_context.n =
|
|
15346
|
+
_context.n = 136;
|
|
15310
15347
|
return put(clearMessagesAC());
|
|
15311
|
-
case
|
|
15348
|
+
case 136:
|
|
15312
15349
|
removeAllMessages();
|
|
15313
|
-
case
|
|
15350
|
+
case 137:
|
|
15314
15351
|
removeMessagesFromMap(_channel15.id);
|
|
15315
15352
|
if (!channelExist) {
|
|
15316
|
-
_context.n =
|
|
15353
|
+
_context.n = 138;
|
|
15317
15354
|
break;
|
|
15318
15355
|
}
|
|
15319
|
-
_context.n =
|
|
15356
|
+
_context.n = 138;
|
|
15320
15357
|
return put(updateChannelDataAC(_channel15.id, {
|
|
15321
15358
|
lastMessage: null,
|
|
15322
15359
|
newMessageCount: 0,
|
|
@@ -15324,7 +15361,7 @@ function watchForEvents() {
|
|
|
15324
15361
|
muted: _channel15.muted,
|
|
15325
15362
|
mutedTill: _channel15.mutedTill
|
|
15326
15363
|
}));
|
|
15327
|
-
case
|
|
15364
|
+
case 138:
|
|
15328
15365
|
updateChannelOnAllChannels(_channel15.id, {
|
|
15329
15366
|
lastMessage: null,
|
|
15330
15367
|
newMessageCount: 0,
|
|
@@ -15332,173 +15369,173 @@ function watchForEvents() {
|
|
|
15332
15369
|
muted: _channel15.muted,
|
|
15333
15370
|
mutedTill: _channel15.mutedTill
|
|
15334
15371
|
});
|
|
15335
|
-
return _context.a(3,
|
|
15336
|
-
case
|
|
15372
|
+
return _context.a(3, 179);
|
|
15373
|
+
case 139:
|
|
15337
15374
|
_channel16 = args.channel;
|
|
15338
15375
|
log.info('channel MUTE ... ');
|
|
15339
|
-
_context.n =
|
|
15376
|
+
_context.n = 140;
|
|
15340
15377
|
return put(updateChannelDataAC(_channel16.id, {
|
|
15341
15378
|
muted: _channel16.muted,
|
|
15342
15379
|
mutedTill: _channel16.mutedTill
|
|
15343
15380
|
}));
|
|
15344
|
-
case
|
|
15381
|
+
case 140:
|
|
15345
15382
|
updateChannelOnAllChannels(_channel16.id, {
|
|
15346
15383
|
muted: _channel16.muted,
|
|
15347
15384
|
mutedTill: _channel16.mutedTill
|
|
15348
15385
|
});
|
|
15349
|
-
return _context.a(3,
|
|
15350
|
-
case
|
|
15386
|
+
return _context.a(3, 179);
|
|
15387
|
+
case 141:
|
|
15351
15388
|
_channel17 = args.channel;
|
|
15352
15389
|
log.info('channel UNMUTE ... ');
|
|
15353
|
-
_context.n =
|
|
15390
|
+
_context.n = 142;
|
|
15354
15391
|
return put(updateChannelDataAC(_channel17.id, {
|
|
15355
15392
|
muted: _channel17.muted,
|
|
15356
15393
|
mutedTill: _channel17.mutedTill
|
|
15357
15394
|
}));
|
|
15358
|
-
case
|
|
15395
|
+
case 142:
|
|
15359
15396
|
updateChannelOnAllChannels(_channel17.id, {
|
|
15360
15397
|
muted: _channel17.muted,
|
|
15361
15398
|
mutedTill: _channel17.mutedTill
|
|
15362
15399
|
});
|
|
15363
|
-
return _context.a(3,
|
|
15364
|
-
case
|
|
15400
|
+
return _context.a(3, 179);
|
|
15401
|
+
case 143:
|
|
15365
15402
|
_channel18 = args.channel;
|
|
15366
15403
|
log.info('channel PINED ... ');
|
|
15367
|
-
_context.n =
|
|
15404
|
+
_context.n = 144;
|
|
15368
15405
|
return put(updateChannelDataAC(_channel18.id, {
|
|
15369
15406
|
pinnedAt: _channel18.pinnedAt
|
|
15370
15407
|
}, true));
|
|
15371
|
-
case
|
|
15408
|
+
case 144:
|
|
15372
15409
|
updateChannelOnAllChannels(_channel18.id, {
|
|
15373
15410
|
pinnedAt: _channel18.pinnedAt
|
|
15374
15411
|
});
|
|
15375
|
-
return _context.a(3,
|
|
15376
|
-
case
|
|
15412
|
+
return _context.a(3, 179);
|
|
15413
|
+
case 145:
|
|
15377
15414
|
_channel19 = args.channel;
|
|
15378
15415
|
log.info('channel UNPINED ... ');
|
|
15379
|
-
_context.n =
|
|
15416
|
+
_context.n = 146;
|
|
15380
15417
|
return put(updateChannelDataAC(_channel19.id, {
|
|
15381
15418
|
pinnedAt: _channel19.pinnedAt
|
|
15382
15419
|
}, false, true));
|
|
15383
|
-
case
|
|
15420
|
+
case 146:
|
|
15384
15421
|
updateChannelOnAllChannels(_channel19.id, {
|
|
15385
15422
|
pinnedAt: _channel19.pinnedAt
|
|
15386
15423
|
});
|
|
15387
|
-
return _context.a(3,
|
|
15388
|
-
case
|
|
15424
|
+
return _context.a(3, 179);
|
|
15425
|
+
case 147:
|
|
15389
15426
|
_channel20 = args.channel;
|
|
15390
15427
|
log.info('channel HIDE ... ');
|
|
15391
|
-
_context.n =
|
|
15428
|
+
_context.n = 148;
|
|
15392
15429
|
return put(setChannelToHideAC(_channel20));
|
|
15393
|
-
case
|
|
15394
|
-
return _context.a(3,
|
|
15395
|
-
case
|
|
15430
|
+
case 148:
|
|
15431
|
+
return _context.a(3, 179);
|
|
15432
|
+
case 149:
|
|
15396
15433
|
_channel21 = args.channel;
|
|
15397
15434
|
log.info('channel UNHIDE ... ');
|
|
15398
|
-
_context.n =
|
|
15435
|
+
_context.n = 150;
|
|
15399
15436
|
return put(setChannelToUnHideAC(_channel21));
|
|
15400
|
-
case
|
|
15401
|
-
return _context.a(3,
|
|
15402
|
-
case
|
|
15437
|
+
case 150:
|
|
15438
|
+
return _context.a(3, 179);
|
|
15439
|
+
case 151:
|
|
15403
15440
|
_channel22 = args.channel;
|
|
15404
|
-
_context.n =
|
|
15441
|
+
_context.n = 152;
|
|
15405
15442
|
return put(updateChannelDataAC(_channel22.id, {
|
|
15406
15443
|
unread: _channel22.unread,
|
|
15407
15444
|
muted: _channel22.muted,
|
|
15408
15445
|
mutedTill: _channel22.mutedTill
|
|
15409
15446
|
}));
|
|
15410
|
-
case
|
|
15447
|
+
case 152:
|
|
15411
15448
|
_groupName5 = getChannelGroupName(_channel22);
|
|
15412
|
-
_context.n =
|
|
15449
|
+
_context.n = 153;
|
|
15413
15450
|
return put(updateSearchedChannelDataAC(_channel22.id, {
|
|
15414
15451
|
unread: _channel22.unread
|
|
15415
15452
|
}, _groupName5));
|
|
15416
|
-
case
|
|
15453
|
+
case 153:
|
|
15417
15454
|
updateChannelOnAllChannels(_channel22.id, {
|
|
15418
15455
|
unread: _channel22.unread
|
|
15419
15456
|
});
|
|
15420
|
-
return _context.a(3,
|
|
15421
|
-
case
|
|
15457
|
+
return _context.a(3, 179);
|
|
15458
|
+
case 154:
|
|
15422
15459
|
_channel23 = args.channel;
|
|
15423
|
-
_context.n =
|
|
15460
|
+
_context.n = 155;
|
|
15424
15461
|
return put(updateChannelDataAC(_channel23.id, {
|
|
15425
15462
|
unread: _channel23.unread,
|
|
15426
15463
|
muted: _channel23.muted,
|
|
15427
15464
|
mutedTill: _channel23.mutedTill
|
|
15428
15465
|
}));
|
|
15429
|
-
case
|
|
15466
|
+
case 155:
|
|
15430
15467
|
_groupName6 = getChannelGroupName(_channel23);
|
|
15431
|
-
_context.n =
|
|
15468
|
+
_context.n = 156;
|
|
15432
15469
|
return put(updateSearchedChannelDataAC(_channel23.id, {
|
|
15433
15470
|
unread: _channel23.unread
|
|
15434
15471
|
}, _groupName6));
|
|
15435
|
-
case
|
|
15472
|
+
case 156:
|
|
15436
15473
|
updateChannelOnAllChannels(_channel23.id, {
|
|
15437
15474
|
unread: _channel23.unread
|
|
15438
15475
|
});
|
|
15439
|
-
return _context.a(3,
|
|
15440
|
-
case
|
|
15476
|
+
return _context.a(3, 179);
|
|
15477
|
+
case 157:
|
|
15441
15478
|
_channel24 = args.channel, members = args.members;
|
|
15442
15479
|
log.info('channel CHANGE_ROLE channel ... ', _channel24);
|
|
15443
15480
|
log.info('channel CHANGE_ROLE member ... ', members);
|
|
15444
|
-
_context.n =
|
|
15481
|
+
_context.n = 158;
|
|
15445
15482
|
return call(getActiveChannelId);
|
|
15446
|
-
case
|
|
15483
|
+
case 158:
|
|
15447
15484
|
_activeChannelId14 = _context.v;
|
|
15448
15485
|
if (!(_channel24.id === _activeChannelId14)) {
|
|
15449
|
-
_context.n =
|
|
15486
|
+
_context.n = 159;
|
|
15450
15487
|
break;
|
|
15451
15488
|
}
|
|
15452
|
-
_context.n =
|
|
15489
|
+
_context.n = 159;
|
|
15453
15490
|
return put(updateMembersAC(members));
|
|
15454
|
-
case
|
|
15491
|
+
case 159:
|
|
15455
15492
|
i = 0;
|
|
15456
|
-
case
|
|
15493
|
+
case 160:
|
|
15457
15494
|
if (!(i < members.length)) {
|
|
15458
|
-
_context.n =
|
|
15495
|
+
_context.n = 163;
|
|
15459
15496
|
break;
|
|
15460
15497
|
}
|
|
15461
15498
|
if (!(members[i].id === SceytChatClient.user.id)) {
|
|
15462
|
-
_context.n =
|
|
15499
|
+
_context.n = 162;
|
|
15463
15500
|
break;
|
|
15464
15501
|
}
|
|
15465
|
-
_context.n =
|
|
15502
|
+
_context.n = 161;
|
|
15466
15503
|
return put(updateChannelDataAC(_channel24.id, {
|
|
15467
15504
|
userRole: members[i].role,
|
|
15468
15505
|
muted: _channel24.muted,
|
|
15469
15506
|
mutedTill: _channel24.mutedTill
|
|
15470
15507
|
}));
|
|
15471
|
-
case
|
|
15508
|
+
case 161:
|
|
15472
15509
|
updateChannelOnAllChannels(_channel24.id, {
|
|
15473
15510
|
userRole: members[i].role,
|
|
15474
15511
|
muted: _channel24.muted,
|
|
15475
15512
|
mutedTill: _channel24.mutedTill
|
|
15476
15513
|
});
|
|
15477
|
-
case
|
|
15514
|
+
case 162:
|
|
15478
15515
|
i++;
|
|
15479
|
-
_context.n =
|
|
15516
|
+
_context.n = 160;
|
|
15480
15517
|
break;
|
|
15481
|
-
case
|
|
15482
|
-
return _context.a(3,
|
|
15483
|
-
case
|
|
15518
|
+
case 163:
|
|
15519
|
+
return _context.a(3, 179);
|
|
15520
|
+
case 164:
|
|
15484
15521
|
_channel25 = args.channel;
|
|
15485
15522
|
log.info('channel frozen channel ... ', _channel25);
|
|
15486
|
-
return _context.a(3,
|
|
15487
|
-
case
|
|
15523
|
+
return _context.a(3, 179);
|
|
15524
|
+
case 165:
|
|
15488
15525
|
_channel26 = args.channel;
|
|
15489
15526
|
log.info('channel unfrozen channel ... ', _channel26);
|
|
15490
|
-
return _context.a(3,
|
|
15491
|
-
case
|
|
15527
|
+
return _context.a(3, 179);
|
|
15528
|
+
case 166:
|
|
15492
15529
|
_channelId2 = args.channelId, from = args.from, name = args.name;
|
|
15493
15530
|
log.info('channel event received >>>... . . . . . ', args);
|
|
15494
15531
|
if (!(from.id === SceytChatClient.user.id)) {
|
|
15495
|
-
_context.n =
|
|
15532
|
+
_context.n = 167;
|
|
15496
15533
|
break;
|
|
15497
15534
|
}
|
|
15498
|
-
return _context.a(3,
|
|
15499
|
-
case
|
|
15535
|
+
return _context.a(3, 179);
|
|
15536
|
+
case 167:
|
|
15500
15537
|
if (!(name === 'start_typing')) {
|
|
15501
|
-
_context.n =
|
|
15538
|
+
_context.n = 169;
|
|
15502
15539
|
break;
|
|
15503
15540
|
}
|
|
15504
15541
|
if (!usersTimeout[_channelId2]) {
|
|
@@ -15510,27 +15547,27 @@ function watchForEvents() {
|
|
|
15510
15547
|
usersTimeout[_channelId2][from.id] = setTimeout(function () {
|
|
15511
15548
|
channelListener.onReceivedChannelEvent(_channelId2, from, 'stop_typing');
|
|
15512
15549
|
}, 5000);
|
|
15513
|
-
_context.n =
|
|
15550
|
+
_context.n = 168;
|
|
15514
15551
|
return put(switchTypingIndicatorAC(true, _channelId2, from));
|
|
15515
|
-
case
|
|
15516
|
-
_context.n =
|
|
15552
|
+
case 168:
|
|
15553
|
+
_context.n = 174;
|
|
15517
15554
|
break;
|
|
15518
|
-
case
|
|
15555
|
+
case 169:
|
|
15519
15556
|
if (!(name === 'stop_typing')) {
|
|
15520
|
-
_context.n =
|
|
15557
|
+
_context.n = 171;
|
|
15521
15558
|
break;
|
|
15522
15559
|
}
|
|
15523
15560
|
if (usersTimeout[_channelId2] && usersTimeout[_channelId2][from.id]) {
|
|
15524
15561
|
clearTimeout(usersTimeout[_channelId2][from.id]);
|
|
15525
15562
|
}
|
|
15526
|
-
_context.n =
|
|
15563
|
+
_context.n = 170;
|
|
15527
15564
|
return put(switchTypingIndicatorAC(false, _channelId2, from));
|
|
15528
|
-
case
|
|
15529
|
-
_context.n =
|
|
15565
|
+
case 170:
|
|
15566
|
+
_context.n = 174;
|
|
15530
15567
|
break;
|
|
15531
|
-
case
|
|
15568
|
+
case 171:
|
|
15532
15569
|
if (!(name === 'start_recording')) {
|
|
15533
|
-
_context.n =
|
|
15570
|
+
_context.n = 173;
|
|
15534
15571
|
break;
|
|
15535
15572
|
}
|
|
15536
15573
|
if (!usersTimeout[_channelId2]) {
|
|
@@ -15542,50 +15579,50 @@ function watchForEvents() {
|
|
|
15542
15579
|
usersTimeout[_channelId2][from.id] = setTimeout(function () {
|
|
15543
15580
|
channelListener.onReceivedChannelEvent(_channelId2, from, 'stop_recording');
|
|
15544
15581
|
}, 5000);
|
|
15545
|
-
_context.n =
|
|
15582
|
+
_context.n = 172;
|
|
15546
15583
|
return put(switchRecordingIndicatorAC(true, _channelId2, from));
|
|
15547
|
-
case
|
|
15548
|
-
_context.n =
|
|
15584
|
+
case 172:
|
|
15585
|
+
_context.n = 174;
|
|
15549
15586
|
break;
|
|
15550
|
-
case
|
|
15587
|
+
case 173:
|
|
15551
15588
|
if (!(name === 'stop_recording')) {
|
|
15552
|
-
_context.n =
|
|
15589
|
+
_context.n = 174;
|
|
15553
15590
|
break;
|
|
15554
15591
|
}
|
|
15555
15592
|
if (usersTimeout[_channelId2] && usersTimeout[_channelId2][from.id]) {
|
|
15556
15593
|
clearTimeout(usersTimeout[_channelId2][from.id]);
|
|
15557
15594
|
}
|
|
15558
|
-
_context.n =
|
|
15595
|
+
_context.n = 174;
|
|
15559
15596
|
return put(switchRecordingIndicatorAC(false, _channelId2, from));
|
|
15560
|
-
case
|
|
15561
|
-
return _context.a(3,
|
|
15562
|
-
case
|
|
15597
|
+
case 174:
|
|
15598
|
+
return _context.a(3, 179);
|
|
15599
|
+
case 175:
|
|
15563
15600
|
status = args.status;
|
|
15564
15601
|
log.info('connection status changed . . . . . ', status);
|
|
15565
|
-
_context.n =
|
|
15602
|
+
_context.n = 176;
|
|
15566
15603
|
return put(setConnectionStatusAC(status));
|
|
15567
|
-
case
|
|
15604
|
+
case 176:
|
|
15568
15605
|
if (!(status === CONNECTION_STATUS.CONNECTED)) {
|
|
15569
|
-
_context.n =
|
|
15606
|
+
_context.n = 177;
|
|
15570
15607
|
break;
|
|
15571
15608
|
}
|
|
15572
|
-
_context.n =
|
|
15609
|
+
_context.n = 177;
|
|
15573
15610
|
return put(getRolesAC());
|
|
15574
|
-
case
|
|
15575
|
-
return _context.a(3,
|
|
15576
|
-
case
|
|
15611
|
+
case 177:
|
|
15612
|
+
return _context.a(3, 179);
|
|
15613
|
+
case 178:
|
|
15577
15614
|
log.warn('UNHANDLED EVENT FROM REDUX-SAGA EVENT-CHANNEL');
|
|
15578
|
-
case
|
|
15579
|
-
_context.n =
|
|
15615
|
+
case 179:
|
|
15616
|
+
_context.n = 181;
|
|
15580
15617
|
break;
|
|
15581
|
-
case
|
|
15582
|
-
_context.p =
|
|
15618
|
+
case 180:
|
|
15619
|
+
_context.p = 180;
|
|
15583
15620
|
_t2 = _context.v;
|
|
15584
15621
|
log.error('Error in watchForEvents:', _t2);
|
|
15585
|
-
case
|
|
15622
|
+
case 181:
|
|
15586
15623
|
return _context.a(2);
|
|
15587
15624
|
}
|
|
15588
|
-
}, _callee, null, [[0,
|
|
15625
|
+
}, _callee, null, [[0, 180]]);
|
|
15589
15626
|
});
|
|
15590
15627
|
case 1:
|
|
15591
15628
|
return _context2.d(_regeneratorValues(_loop()), 2);
|
|
@@ -20678,71 +20715,9 @@ function getMessageMarkers(action) {
|
|
|
20678
20715
|
}
|
|
20679
20716
|
}, _marked16$1, null, [[0, 5, 6, 8]]);
|
|
20680
20717
|
}
|
|
20681
|
-
var updatePollDetails = function updatePollDetails(pollDetails, optionId, addVote, allowMultipleVotes) {
|
|
20682
|
-
if (addVote === void 0) {
|
|
20683
|
-
addVote = true;
|
|
20684
|
-
}
|
|
20685
|
-
if (allowMultipleVotes === void 0) {
|
|
20686
|
-
allowMultipleVotes = false;
|
|
20687
|
-
}
|
|
20688
|
-
var user = getClient().user;
|
|
20689
|
-
if (addVote) {
|
|
20690
|
-
var _user$presence, _pollDetails$ownVotes, _pollDetails$ownVotes2, _pollDetails$ownVotes3, _pollDetails$votesPer2, _pollDetails$ownVotes4, _pollDetails$ownVotes5, _ref3, _pollDetails$votesPer3, _extends3;
|
|
20691
|
-
var vote = {
|
|
20692
|
-
optionId: optionId,
|
|
20693
|
-
createdAt: new Date().getTime(),
|
|
20694
|
-
user: {
|
|
20695
|
-
id: user.id,
|
|
20696
|
-
presence: {
|
|
20697
|
-
status: ((_user$presence = user.presence) === null || _user$presence === void 0 ? void 0 : _user$presence.status) || 'online'
|
|
20698
|
-
},
|
|
20699
|
-
profile: {
|
|
20700
|
-
avatar: user.avatarUrl || '',
|
|
20701
|
-
firstName: user.firstName,
|
|
20702
|
-
lastName: user.lastName,
|
|
20703
|
-
metadata: user.metadata || '',
|
|
20704
|
-
metadataMap: user.metadataMap || {},
|
|
20705
|
-
updatedAt: new Date().getTime(),
|
|
20706
|
-
username: user.username || '',
|
|
20707
|
-
createdAt: new Date().getTime()
|
|
20708
|
-
},
|
|
20709
|
-
createdAt: new Date().getTime()
|
|
20710
|
-
}
|
|
20711
|
-
};
|
|
20712
|
-
if (allowMultipleVotes) {
|
|
20713
|
-
var _pollDetails$votesPer, _extends2;
|
|
20714
|
-
return _extends({}, pollDetails, {
|
|
20715
|
-
votesPerOption: _extends({}, pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.votesPerOption, (_extends2 = {}, _extends2[optionId] = ((pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$votesPer = pollDetails.votesPerOption) === null || _pollDetails$votesPer === void 0 ? void 0 : _pollDetails$votesPer[optionId]) || 0) + 1, _extends2)),
|
|
20716
|
-
ownVotes: [].concat((pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.ownVotes) || [], [vote])
|
|
20717
|
-
});
|
|
20718
|
-
}
|
|
20719
|
-
var isVotedAlready = ((pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$ownVotes = pollDetails.ownVotes) === null || _pollDetails$ownVotes === void 0 ? void 0 : _pollDetails$ownVotes.length) || 0) > 0;
|
|
20720
|
-
return _extends({}, pollDetails, {
|
|
20721
|
-
votesPerOption: _extends({}, pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.votesPerOption, isVotedAlready ? (_ref3 = {}, _ref3[String(pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$ownVotes2 = pollDetails.ownVotes) === null || _pollDetails$ownVotes2 === void 0 ? void 0 : (_pollDetails$ownVotes3 = _pollDetails$ownVotes2[0]) === null || _pollDetails$ownVotes3 === void 0 ? void 0 : _pollDetails$ownVotes3.optionId)] = ((pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$votesPer2 = pollDetails.votesPerOption) === null || _pollDetails$votesPer2 === void 0 ? void 0 : _pollDetails$votesPer2[String(pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$ownVotes4 = pollDetails.ownVotes) === null || _pollDetails$ownVotes4 === void 0 ? void 0 : (_pollDetails$ownVotes5 = _pollDetails$ownVotes4[0]) === null || _pollDetails$ownVotes5 === void 0 ? void 0 : _pollDetails$ownVotes5.optionId)]) || 0) - 1, _ref3) : {}, (_extends3 = {}, _extends3[optionId] = ((pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$votesPer3 = pollDetails.votesPerOption) === null || _pollDetails$votesPer3 === void 0 ? void 0 : _pollDetails$votesPer3[optionId]) || 0) + 1, _extends3)),
|
|
20722
|
-
ownVotes: [vote]
|
|
20723
|
-
});
|
|
20724
|
-
} else {
|
|
20725
|
-
var _pollDetails$votesPer5, _extends5;
|
|
20726
|
-
if (allowMultipleVotes) {
|
|
20727
|
-
var _pollDetails$votesPer4, _extends4;
|
|
20728
|
-
return _extends({}, pollDetails, {
|
|
20729
|
-
votesPerOption: _extends({}, pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.votesPerOption, (_extends4 = {}, _extends4[optionId] = ((pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$votesPer4 = pollDetails.votesPerOption) === null || _pollDetails$votesPer4 === void 0 ? void 0 : _pollDetails$votesPer4[optionId]) || 0) - 1, _extends4)),
|
|
20730
|
-
ownVotes: [].concat(((pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.ownVotes) || []).filter(function (vote) {
|
|
20731
|
-
return vote.optionId !== optionId;
|
|
20732
|
-
}))
|
|
20733
|
-
});
|
|
20734
|
-
}
|
|
20735
|
-
return _extends({}, pollDetails, {
|
|
20736
|
-
votesPerOption: _extends({}, pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.votesPerOption, (_extends5 = {}, _extends5[optionId] = ((pollDetails === null || pollDetails === void 0 ? void 0 : (_pollDetails$votesPer5 = pollDetails.votesPerOption) === null || _pollDetails$votesPer5 === void 0 ? void 0 : _pollDetails$votesPer5[optionId]) || 0) - 1, _extends5)),
|
|
20737
|
-
ownVotes: [].concat(((pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.ownVotes) || []).filter(function (vote) {
|
|
20738
|
-
return vote.optionId !== optionId;
|
|
20739
|
-
}))
|
|
20740
|
-
});
|
|
20741
|
-
}
|
|
20742
|
-
};
|
|
20743
20718
|
function executeAddPollVote(channelId, pollId, optionId, message) {
|
|
20744
|
-
var _message$pollDetails;
|
|
20745
|
-
var channel,
|
|
20719
|
+
var _user$presence, _message$pollDetails;
|
|
20720
|
+
var channel, user, vote, objs, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4, _i2, _objs, obj;
|
|
20746
20721
|
return _regenerator().w(function (_context19) {
|
|
20747
20722
|
while (1) switch (_context19.n) {
|
|
20748
20723
|
case 0:
|
|
@@ -20750,35 +20725,78 @@ function executeAddPollVote(channelId, pollId, optionId, message) {
|
|
|
20750
20725
|
return call(getChannelFromMap, channelId);
|
|
20751
20726
|
case 1:
|
|
20752
20727
|
channel = _context19.v;
|
|
20753
|
-
|
|
20728
|
+
if (message.pollDetails) {
|
|
20729
|
+
_context19.n = 2;
|
|
20730
|
+
break;
|
|
20731
|
+
}
|
|
20732
|
+
return _context19.a(2);
|
|
20733
|
+
case 2:
|
|
20734
|
+
user = getClient().user;
|
|
20735
|
+
vote = {
|
|
20736
|
+
optionId: optionId,
|
|
20737
|
+
createdAt: new Date().getTime(),
|
|
20738
|
+
user: {
|
|
20739
|
+
id: user.id,
|
|
20740
|
+
presence: {
|
|
20741
|
+
status: ((_user$presence = user.presence) === null || _user$presence === void 0 ? void 0 : _user$presence.status) || 'online'
|
|
20742
|
+
},
|
|
20743
|
+
profile: {
|
|
20744
|
+
avatar: user.avatarUrl || '',
|
|
20745
|
+
firstName: user.firstName,
|
|
20746
|
+
lastName: user.lastName,
|
|
20747
|
+
metadata: user.metadata || '',
|
|
20748
|
+
metadataMap: user.metadataMap || {},
|
|
20749
|
+
updatedAt: new Date().getTime(),
|
|
20750
|
+
username: user.username || '',
|
|
20751
|
+
createdAt: new Date().getTime()
|
|
20752
|
+
},
|
|
20753
|
+
createdAt: new Date().getTime()
|
|
20754
|
+
}
|
|
20755
|
+
};
|
|
20756
|
+
objs = [{
|
|
20757
|
+
type: 'addOwn',
|
|
20758
|
+
vote: vote,
|
|
20759
|
+
incrementVotesPerOptionCount: 1
|
|
20760
|
+
}];
|
|
20761
|
+
if (!((_message$pollDetails = message.pollDetails) !== null && _message$pollDetails !== void 0 && _message$pollDetails.allowMultipleVotes)) {
|
|
20762
|
+
objs.push({
|
|
20763
|
+
type: 'deleteOwn',
|
|
20764
|
+
vote: (_message$pollDetails2 = message.pollDetails) === null || _message$pollDetails2 === void 0 ? void 0 : (_message$pollDetails3 = _message$pollDetails2.voteDetails) === null || _message$pollDetails3 === void 0 ? void 0 : (_message$pollDetails4 = _message$pollDetails3.ownVotes) === null || _message$pollDetails4 === void 0 ? void 0 : _message$pollDetails4[0],
|
|
20765
|
+
incrementVotesPerOptionCount: -1
|
|
20766
|
+
});
|
|
20767
|
+
}
|
|
20768
|
+
_i2 = 0, _objs = objs;
|
|
20769
|
+
case 3:
|
|
20770
|
+
if (!(_i2 < _objs.length)) {
|
|
20771
|
+
_context19.n = 6;
|
|
20772
|
+
break;
|
|
20773
|
+
}
|
|
20774
|
+
obj = _objs[_i2];
|
|
20754
20775
|
updateMessageOnMap(channel.id, {
|
|
20755
20776
|
messageId: message.id,
|
|
20756
|
-
params: {
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
})));
|
|
20763
|
-
_context19.n = 2;
|
|
20764
|
-
return put(updateMessageAC(message.id, {
|
|
20765
|
-
pollDetails: pollDetails
|
|
20766
|
-
}));
|
|
20767
|
-
case 2:
|
|
20777
|
+
params: {}
|
|
20778
|
+
}, obj);
|
|
20779
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
20780
|
+
_context19.n = 4;
|
|
20781
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
20782
|
+
case 4:
|
|
20768
20783
|
if (!channel) {
|
|
20769
|
-
_context19.n =
|
|
20784
|
+
_context19.n = 5;
|
|
20770
20785
|
break;
|
|
20771
20786
|
}
|
|
20772
|
-
_context19.n =
|
|
20787
|
+
_context19.n = 5;
|
|
20773
20788
|
return call(channel.addVote, message.id, pollId, [optionId]);
|
|
20774
|
-
case
|
|
20789
|
+
case 5:
|
|
20790
|
+
_i2++;
|
|
20791
|
+
_context19.n = 3;
|
|
20792
|
+
break;
|
|
20793
|
+
case 6:
|
|
20775
20794
|
return _context19.a(2);
|
|
20776
20795
|
}
|
|
20777
20796
|
}, _marked17$1);
|
|
20778
20797
|
}
|
|
20779
|
-
function updateMessageOptimisticallyForAddPollVote(channelId,
|
|
20780
|
-
var
|
|
20781
|
-
var channel, pollDetails;
|
|
20798
|
+
function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
|
|
20799
|
+
var channel, obj;
|
|
20782
20800
|
return _regenerator().w(function (_context20) {
|
|
20783
20801
|
while (1) switch (_context20.n) {
|
|
20784
20802
|
case 0:
|
|
@@ -20792,27 +20810,31 @@ function updateMessageOptimisticallyForAddPollVote(channelId, optionId, message)
|
|
|
20792
20810
|
}
|
|
20793
20811
|
return _context20.a(2);
|
|
20794
20812
|
case 2:
|
|
20795
|
-
|
|
20813
|
+
if (message.pollDetails) {
|
|
20814
|
+
_context20.n = 3;
|
|
20815
|
+
break;
|
|
20816
|
+
}
|
|
20817
|
+
return _context20.a(2);
|
|
20818
|
+
case 3:
|
|
20819
|
+
obj = {
|
|
20820
|
+
type: 'addOwn',
|
|
20821
|
+
vote: vote,
|
|
20822
|
+
incrementVotesPerOptionCount: 1
|
|
20823
|
+
};
|
|
20796
20824
|
updateMessageOnMap(channel.id, {
|
|
20797
20825
|
messageId: message.id,
|
|
20798
|
-
params: {
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
})));
|
|
20805
|
-
_context20.n = 3;
|
|
20806
|
-
return put(updateMessageAC(message.id, {
|
|
20807
|
-
pollDetails: pollDetails
|
|
20808
|
-
}));
|
|
20809
|
-
case 3:
|
|
20826
|
+
params: {}
|
|
20827
|
+
}, obj);
|
|
20828
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
20829
|
+
_context20.n = 4;
|
|
20830
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
20831
|
+
case 4:
|
|
20810
20832
|
return _context20.a(2);
|
|
20811
20833
|
}
|
|
20812
20834
|
}, _marked18$1);
|
|
20813
20835
|
}
|
|
20814
20836
|
function addPollVote(action) {
|
|
20815
|
-
var payload, channelId, pollId, optionId, _message4, sceytChatClient,
|
|
20837
|
+
var payload, channelId, pollId, optionId, _message4, sceytChatClient, _user$presence2, connectionState, user, vote, pendingAction, conflictCheck, channel, _getMessagesFromMap2, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t19;
|
|
20816
20838
|
return _regenerator().w(function (_context21) {
|
|
20817
20839
|
while (1) switch (_context21.p = _context21.n) {
|
|
20818
20840
|
case 0:
|
|
@@ -20825,6 +20847,28 @@ function addPollVote(action) {
|
|
|
20825
20847
|
break;
|
|
20826
20848
|
}
|
|
20827
20849
|
connectionState = sceytChatClient.connectionState;
|
|
20850
|
+
user = sceytChatClient.user;
|
|
20851
|
+
vote = {
|
|
20852
|
+
optionId: optionId,
|
|
20853
|
+
createdAt: new Date().getTime(),
|
|
20854
|
+
user: {
|
|
20855
|
+
id: user.id,
|
|
20856
|
+
presence: {
|
|
20857
|
+
status: ((_user$presence2 = user.presence) === null || _user$presence2 === void 0 ? void 0 : _user$presence2.status) || 'online'
|
|
20858
|
+
},
|
|
20859
|
+
profile: {
|
|
20860
|
+
avatar: user.avatarUrl || '',
|
|
20861
|
+
firstName: user.firstName,
|
|
20862
|
+
lastName: user.lastName,
|
|
20863
|
+
metadata: user.metadata || '',
|
|
20864
|
+
metadataMap: user.metadataMap || {},
|
|
20865
|
+
updatedAt: new Date().getTime(),
|
|
20866
|
+
username: user.username || '',
|
|
20867
|
+
createdAt: new Date().getTime()
|
|
20868
|
+
},
|
|
20869
|
+
createdAt: new Date().getTime()
|
|
20870
|
+
}
|
|
20871
|
+
};
|
|
20828
20872
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
20829
20873
|
_context21.n = 6;
|
|
20830
20874
|
break;
|
|
@@ -20852,31 +20896,22 @@ function addPollVote(action) {
|
|
|
20852
20896
|
currentMessage = ((_getMessagesFromMap2 = getMessagesFromMap(channelId)) === null || _getMessagesFromMap2 === void 0 ? void 0 : _getMessagesFromMap2.find(function (msg) {
|
|
20853
20897
|
return msg.id === _message4.id || msg.tid === _message4.id;
|
|
20854
20898
|
})) || _message4;
|
|
20855
|
-
hasVotedAnotherOption = (((_currentMessage$pollD = currentMessage.pollDetails) === null || _currentMessage$pollD === void 0 ? void 0 : _currentMessage$pollD.ownVotes) || []).some(function (vote) {
|
|
20856
|
-
return vote.optionId !== optionId;
|
|
20857
|
-
});
|
|
20858
|
-
pollDetails = currentMessage.pollDetails;
|
|
20859
|
-
if (hasVotedAnotherOption && !((_pollDetails = pollDetails) !== null && _pollDetails !== void 0 && _pollDetails.allowMultipleVotes)) {
|
|
20860
|
-
pollDetails = updatePollDetails(pollDetails, optionId, false, false);
|
|
20861
|
-
}
|
|
20862
|
-
pollDetails = JSON.parse(JSON.stringify(updatePollDetails(pollDetails, optionId, true, ((_pollDetails2 = pollDetails) === null || _pollDetails2 === void 0 ? void 0 : _pollDetails2.allowMultipleVotes) || false)));
|
|
20863
20899
|
hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[pollId]) || false;
|
|
20864
20900
|
_context21.n = 2;
|
|
20865
|
-
return put(addPollVotesToListAC(pollId, optionId, [(_currentMessage$
|
|
20901
|
+
return put(addPollVotesToListAC(pollId, optionId, [(_currentMessage$pollD = currentMessage.pollDetails) === null || _currentMessage$pollD === void 0 ? void 0 : (_currentMessage$pollD2 = _currentMessage$pollD.voteDetails) === null || _currentMessage$pollD2 === void 0 ? void 0 : (_currentMessage$pollD3 = _currentMessage$pollD2.ownVotes) === null || _currentMessage$pollD3 === void 0 ? void 0 : _currentMessage$pollD3[0]], hasNext, _message4.id));
|
|
20866
20902
|
case 2:
|
|
20903
|
+
obj = {
|
|
20904
|
+
type: 'addOwn',
|
|
20905
|
+
vote: vote,
|
|
20906
|
+
incrementVotesPerOptionCount: 1
|
|
20907
|
+
};
|
|
20867
20908
|
updateMessageOnMap(channel.id, {
|
|
20868
20909
|
messageId: _message4.id,
|
|
20869
|
-
params: {
|
|
20870
|
-
|
|
20871
|
-
|
|
20872
|
-
});
|
|
20873
|
-
updateMessageOnAllMessages(_message4.id, JSON.parse(JSON.stringify({
|
|
20874
|
-
pollDetails: pollDetails
|
|
20875
|
-
})));
|
|
20910
|
+
params: {}
|
|
20911
|
+
}, obj);
|
|
20912
|
+
updateMessageOnAllMessages(_message4.id, {}, obj);
|
|
20876
20913
|
_context21.n = 3;
|
|
20877
|
-
return put(updateMessageAC(_message4.id, {
|
|
20878
|
-
pollDetails: pollDetails
|
|
20879
|
-
}));
|
|
20914
|
+
return put(updateMessageAC(_message4.id, {}, undefined, obj));
|
|
20880
20915
|
case 3:
|
|
20881
20916
|
_context21.n = 5;
|
|
20882
20917
|
break;
|
|
@@ -20885,7 +20920,7 @@ function addPollVote(action) {
|
|
|
20885
20920
|
_context21.n = 5;
|
|
20886
20921
|
break;
|
|
20887
20922
|
}
|
|
20888
|
-
return _context21.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId,
|
|
20923
|
+
return _context21.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, _message4, vote)), 5);
|
|
20889
20924
|
case 5:
|
|
20890
20925
|
if (!conflictCheck.shouldSkip) {
|
|
20891
20926
|
setPendingPollAction(pendingAction);
|
|
@@ -20906,8 +20941,8 @@ function addPollVote(action) {
|
|
|
20906
20941
|
}, _marked19$1, null, [[0, 8]]);
|
|
20907
20942
|
}
|
|
20908
20943
|
function executeDeletePollVote(channelId, pollId, optionId, message) {
|
|
20909
|
-
var _message$
|
|
20910
|
-
var channel,
|
|
20944
|
+
var _message$pollDetails5, _message$pollDetails6, _message$pollDetails7;
|
|
20945
|
+
var channel, vote, obj;
|
|
20911
20946
|
return _regenerator().w(function (_context22) {
|
|
20912
20947
|
while (1) switch (_context22.n) {
|
|
20913
20948
|
case 0:
|
|
@@ -20915,35 +20950,47 @@ function executeDeletePollVote(channelId, pollId, optionId, message) {
|
|
|
20915
20950
|
return call(getChannelFromMap, channelId);
|
|
20916
20951
|
case 1:
|
|
20917
20952
|
channel = _context22.v;
|
|
20918
|
-
|
|
20953
|
+
if (message.pollDetails) {
|
|
20954
|
+
_context22.n = 2;
|
|
20955
|
+
break;
|
|
20956
|
+
}
|
|
20957
|
+
return _context22.a(2);
|
|
20958
|
+
case 2:
|
|
20959
|
+
vote = (_message$pollDetails5 = message.pollDetails) === null || _message$pollDetails5 === void 0 ? void 0 : (_message$pollDetails6 = _message$pollDetails5.voteDetails) === null || _message$pollDetails6 === void 0 ? void 0 : (_message$pollDetails7 = _message$pollDetails6.ownVotes) === null || _message$pollDetails7 === void 0 ? void 0 : _message$pollDetails7.find(function (vote) {
|
|
20960
|
+
return vote.optionId === optionId;
|
|
20961
|
+
});
|
|
20962
|
+
if (vote) {
|
|
20963
|
+
_context22.n = 3;
|
|
20964
|
+
break;
|
|
20965
|
+
}
|
|
20966
|
+
return _context22.a(2);
|
|
20967
|
+
case 3:
|
|
20968
|
+
obj = {
|
|
20969
|
+
type: 'deleteOwn',
|
|
20970
|
+
vote: vote,
|
|
20971
|
+
incrementVotesPerOptionCount: -1
|
|
20972
|
+
};
|
|
20919
20973
|
updateMessageOnMap(channel.id, {
|
|
20920
20974
|
messageId: message.id,
|
|
20921
|
-
params: {
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
});
|
|
20928
|
-
_context22.n = 2;
|
|
20929
|
-
return put(updateMessageAC(message.id, {
|
|
20930
|
-
pollDetails: pollDetails
|
|
20931
|
-
}));
|
|
20932
|
-
case 2:
|
|
20975
|
+
params: {}
|
|
20976
|
+
}, obj);
|
|
20977
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
20978
|
+
_context22.n = 4;
|
|
20979
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
20980
|
+
case 4:
|
|
20933
20981
|
if (!channel) {
|
|
20934
|
-
_context22.n =
|
|
20982
|
+
_context22.n = 5;
|
|
20935
20983
|
break;
|
|
20936
20984
|
}
|
|
20937
|
-
_context22.n =
|
|
20985
|
+
_context22.n = 5;
|
|
20938
20986
|
return call(channel.deleteVote, message.id, pollId, [optionId]);
|
|
20939
|
-
case
|
|
20987
|
+
case 5:
|
|
20940
20988
|
return _context22.a(2);
|
|
20941
20989
|
}
|
|
20942
20990
|
}, _marked20$1);
|
|
20943
20991
|
}
|
|
20944
|
-
function updateMessageOptimisticallyForDeletePollVote(channelId,
|
|
20945
|
-
var
|
|
20946
|
-
var channel, pollDetails;
|
|
20992
|
+
function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote) {
|
|
20993
|
+
var channel, obj;
|
|
20947
20994
|
return _regenerator().w(function (_context23) {
|
|
20948
20995
|
while (1) switch (_context23.n) {
|
|
20949
20996
|
case 0:
|
|
@@ -20957,27 +21004,31 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, optionId, messa
|
|
|
20957
21004
|
}
|
|
20958
21005
|
return _context23.a(2);
|
|
20959
21006
|
case 2:
|
|
20960
|
-
|
|
21007
|
+
if (message.pollDetails) {
|
|
21008
|
+
_context23.n = 3;
|
|
21009
|
+
break;
|
|
21010
|
+
}
|
|
21011
|
+
return _context23.a(2);
|
|
21012
|
+
case 3:
|
|
21013
|
+
obj = {
|
|
21014
|
+
type: 'deleteOwn',
|
|
21015
|
+
vote: vote,
|
|
21016
|
+
incrementVotesPerOptionCount: -1
|
|
21017
|
+
};
|
|
20961
21018
|
updateMessageOnMap(channel.id, {
|
|
20962
21019
|
messageId: message.id,
|
|
20963
|
-
params: {
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
});
|
|
20970
|
-
_context23.n = 3;
|
|
20971
|
-
return put(updateMessageAC(message.id, {
|
|
20972
|
-
pollDetails: pollDetails
|
|
20973
|
-
}));
|
|
20974
|
-
case 3:
|
|
21020
|
+
params: {}
|
|
21021
|
+
}, obj);
|
|
21022
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21023
|
+
_context23.n = 4;
|
|
21024
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21025
|
+
case 4:
|
|
20975
21026
|
return _context23.a(2);
|
|
20976
21027
|
}
|
|
20977
21028
|
}, _marked21$1);
|
|
20978
21029
|
}
|
|
20979
21030
|
function deletePollVote(action) {
|
|
20980
|
-
var payload, channelId, pollId, optionId, _message5, sceytChatClient, connectionState, pendingAction, conflictCheck, channel, _getMessagesFromMap3,
|
|
21031
|
+
var payload, channelId, pollId, optionId, _message5, sceytChatClient, _message5$pollDetails, _message5$pollDetails2, _message5$pollDetails3, connectionState, vote, pendingAction, conflictCheck, channel, _getMessagesFromMap3, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t20;
|
|
20981
21032
|
return _regenerator().w(function (_context24) {
|
|
20982
21033
|
while (1) switch (_context24.p = _context24.n) {
|
|
20983
21034
|
case 0:
|
|
@@ -20986,12 +21037,21 @@ function deletePollVote(action) {
|
|
|
20986
21037
|
channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, _message5 = payload.message;
|
|
20987
21038
|
sceytChatClient = getClient();
|
|
20988
21039
|
if (!sceytChatClient) {
|
|
20989
|
-
_context24.n =
|
|
21040
|
+
_context24.n = 8;
|
|
20990
21041
|
break;
|
|
20991
21042
|
}
|
|
20992
21043
|
connectionState = sceytChatClient.connectionState;
|
|
21044
|
+
vote = (_message5$pollDetails = _message5.pollDetails) === null || _message5$pollDetails === void 0 ? void 0 : (_message5$pollDetails2 = _message5$pollDetails.voteDetails) === null || _message5$pollDetails2 === void 0 ? void 0 : (_message5$pollDetails3 = _message5$pollDetails2.ownVotes) === null || _message5$pollDetails3 === void 0 ? void 0 : _message5$pollDetails3.find(function (vote) {
|
|
21045
|
+
return vote.optionId === optionId;
|
|
21046
|
+
});
|
|
21047
|
+
if (vote) {
|
|
21048
|
+
_context24.n = 1;
|
|
21049
|
+
break;
|
|
21050
|
+
}
|
|
21051
|
+
return _context24.a(2);
|
|
21052
|
+
case 1:
|
|
20993
21053
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
20994
|
-
_context24.n =
|
|
21054
|
+
_context24.n = 7;
|
|
20995
21055
|
break;
|
|
20996
21056
|
}
|
|
20997
21057
|
pendingAction = {
|
|
@@ -21003,67 +21063,65 @@ function deletePollVote(action) {
|
|
|
21003
21063
|
};
|
|
21004
21064
|
conflictCheck = checkPendingPollActionConflict(pendingAction);
|
|
21005
21065
|
if (!(conflictCheck.hasConflict && conflictCheck.shouldSkip)) {
|
|
21006
|
-
_context24.n =
|
|
21066
|
+
_context24.n = 5;
|
|
21007
21067
|
break;
|
|
21008
21068
|
}
|
|
21009
|
-
_context24.n =
|
|
21069
|
+
_context24.n = 2;
|
|
21010
21070
|
return call(getChannelFromMap, channelId);
|
|
21011
|
-
case
|
|
21071
|
+
case 2:
|
|
21012
21072
|
channel = _context24.v;
|
|
21013
21073
|
if (!channel) {
|
|
21014
|
-
_context24.n =
|
|
21074
|
+
_context24.n = 4;
|
|
21015
21075
|
break;
|
|
21016
21076
|
}
|
|
21017
21077
|
currentMessage = ((_getMessagesFromMap3 = getMessagesFromMap(channelId)) === null || _getMessagesFromMap3 === void 0 ? void 0 : _getMessagesFromMap3.find(function (msg) {
|
|
21018
21078
|
return msg.id === _message5.id || msg.tid === _message5.id;
|
|
21019
21079
|
})) || _message5;
|
|
21020
|
-
pollDetails = JSON.parse(JSON.stringify(updatePollDetails(currentMessage.pollDetails, optionId, false, ((_message5$pollDetails = _message5.pollDetails) === null || _message5$pollDetails === void 0 ? void 0 : _message5$pollDetails.allowMultipleVotes) || false)));
|
|
21021
|
-
_context24.n = 2;
|
|
21022
|
-
return put(deletePollVotesFromListAC(pollId, optionId, [(_currentMessage$pollD4 = currentMessage.pollDetails) === null || _currentMessage$pollD4 === void 0 ? void 0 : (_currentMessage$pollD5 = _currentMessage$pollD4.ownVotes) === null || _currentMessage$pollD5 === void 0 ? void 0 : _currentMessage$pollD5[0]], _message5.id));
|
|
21023
|
-
case 2:
|
|
21024
|
-
updateMessageOnMap(channel.id, {
|
|
21025
|
-
messageId: _message5.id,
|
|
21026
|
-
params: {
|
|
21027
|
-
pollDetails: pollDetails
|
|
21028
|
-
}
|
|
21029
|
-
});
|
|
21030
|
-
updateMessageOnAllMessages(_message5.id, JSON.parse(JSON.stringify({
|
|
21031
|
-
pollDetails: pollDetails
|
|
21032
|
-
})));
|
|
21033
21080
|
_context24.n = 3;
|
|
21034
|
-
return put(
|
|
21035
|
-
pollDetails: pollDetails
|
|
21036
|
-
}));
|
|
21081
|
+
return put(deletePollVotesFromListAC(pollId, optionId, [(_currentMessage$pollD4 = currentMessage.pollDetails) === null || _currentMessage$pollD4 === void 0 ? void 0 : (_currentMessage$pollD5 = _currentMessage$pollD4.voteDetails) === null || _currentMessage$pollD5 === void 0 ? void 0 : (_currentMessage$pollD6 = _currentMessage$pollD5.ownVotes) === null || _currentMessage$pollD6 === void 0 ? void 0 : _currentMessage$pollD6[0]], _message5.id));
|
|
21037
21082
|
case 3:
|
|
21038
|
-
|
|
21039
|
-
|
|
21083
|
+
obj = {
|
|
21084
|
+
type: 'deleteOwn',
|
|
21085
|
+
vote: vote,
|
|
21086
|
+
incrementVotesPerOptionCount: -1
|
|
21087
|
+
};
|
|
21088
|
+
updateMessageOnMap(channel.id, {
|
|
21089
|
+
messageId: _message5.id,
|
|
21090
|
+
params: {}
|
|
21091
|
+
}, obj);
|
|
21092
|
+
updateMessageOnAllMessages(_message5.id, {}, obj);
|
|
21093
|
+
_context24.n = 4;
|
|
21094
|
+
return put(updateMessageAC(_message5.id, {}, undefined, obj));
|
|
21040
21095
|
case 4:
|
|
21096
|
+
_context24.n = 6;
|
|
21097
|
+
break;
|
|
21098
|
+
case 5:
|
|
21041
21099
|
if (conflictCheck.shouldSkip) {
|
|
21042
|
-
_context24.n =
|
|
21100
|
+
_context24.n = 6;
|
|
21043
21101
|
break;
|
|
21044
21102
|
}
|
|
21045
|
-
return _context24.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId,
|
|
21046
|
-
case
|
|
21103
|
+
return _context24.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, _message5, vote)), 6);
|
|
21104
|
+
case 6:
|
|
21047
21105
|
if (!conflictCheck.shouldSkip) {
|
|
21048
21106
|
setPendingPollAction(pendingAction);
|
|
21049
21107
|
}
|
|
21050
21108
|
return _context24.a(2);
|
|
21051
|
-
case 6:
|
|
21052
|
-
return _context24.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, _message5)), 7);
|
|
21053
21109
|
case 7:
|
|
21054
|
-
_context24.
|
|
21055
|
-
break;
|
|
21110
|
+
return _context24.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, _message5)), 8);
|
|
21056
21111
|
case 8:
|
|
21057
|
-
_context24.
|
|
21112
|
+
_context24.n = 10;
|
|
21113
|
+
break;
|
|
21114
|
+
case 9:
|
|
21115
|
+
_context24.p = 9;
|
|
21058
21116
|
_t20 = _context24.v;
|
|
21059
21117
|
log.error('error in delete poll vote', _t20);
|
|
21060
|
-
case
|
|
21118
|
+
case 10:
|
|
21061
21119
|
return _context24.a(2);
|
|
21062
21120
|
}
|
|
21063
|
-
}, _marked22$1, null, [[0,
|
|
21121
|
+
}, _marked22$1, null, [[0, 9]]);
|
|
21064
21122
|
}
|
|
21065
21123
|
function executeClosePoll(channelId, pollId, message) {
|
|
21066
|
-
var channel,
|
|
21124
|
+
var channel, obj;
|
|
21067
21125
|
return _regenerator().w(function (_context25) {
|
|
21068
21126
|
while (1) switch (_context25.n) {
|
|
21069
21127
|
case 0:
|
|
@@ -21071,22 +21129,17 @@ function executeClosePoll(channelId, pollId, message) {
|
|
|
21071
21129
|
return call(getChannelFromMap, channelId);
|
|
21072
21130
|
case 1:
|
|
21073
21131
|
channel = _context25.v;
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21132
|
+
obj = {
|
|
21133
|
+
type: 'close',
|
|
21134
|
+
incrementVotesPerOptionCount: 0
|
|
21135
|
+
};
|
|
21136
|
+
updateMessageOnMap(channel.id, {
|
|
21078
21137
|
messageId: message.id,
|
|
21079
|
-
params: {
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
-
});
|
|
21083
|
-
updateMessageOnAllMessages(message.id, {
|
|
21084
|
-
pollDetails: pollDetails
|
|
21085
|
-
});
|
|
21138
|
+
params: {}
|
|
21139
|
+
}, obj);
|
|
21140
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21086
21141
|
_context25.n = 2;
|
|
21087
|
-
return put(updateMessageAC(message.id, {
|
|
21088
|
-
pollDetails: pollDetails
|
|
21089
|
-
}));
|
|
21142
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21090
21143
|
case 2:
|
|
21091
21144
|
if (!channel) {
|
|
21092
21145
|
_context25.n = 3;
|
|
@@ -21176,8 +21229,8 @@ function closePoll(action) {
|
|
|
21176
21229
|
}
|
|
21177
21230
|
}, _marked25$1, null, [[0, 4]]);
|
|
21178
21231
|
}
|
|
21179
|
-
function executeRetractPollVote(channelId, pollId, message) {
|
|
21180
|
-
var channel,
|
|
21232
|
+
function executeRetractPollVote(channelId, pollId, message, objs) {
|
|
21233
|
+
var channel, _iterator, _step, obj;
|
|
21181
21234
|
return _regenerator().w(function (_context28) {
|
|
21182
21235
|
while (1) switch (_context28.n) {
|
|
21183
21236
|
case 0:
|
|
@@ -21185,38 +21238,37 @@ function executeRetractPollVote(channelId, pollId, message) {
|
|
|
21185
21238
|
return call(getChannelFromMap, channelId);
|
|
21186
21239
|
case 1:
|
|
21187
21240
|
channel = _context28.v;
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21241
|
+
_iterator = _createForOfIteratorHelperLoose(objs);
|
|
21242
|
+
case 2:
|
|
21243
|
+
if ((_step = _iterator()).done) {
|
|
21244
|
+
_context28.n = 4;
|
|
21245
|
+
break;
|
|
21192
21246
|
}
|
|
21247
|
+
obj = _step.value;
|
|
21193
21248
|
updateMessageOnMap(channelId, {
|
|
21194
21249
|
messageId: message.id,
|
|
21195
|
-
params: {
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
});
|
|
21250
|
+
params: {}
|
|
21251
|
+
}, obj);
|
|
21252
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21253
|
+
_context28.n = 3;
|
|
21254
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21255
|
+
case 3:
|
|
21202
21256
|
_context28.n = 2;
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
}));
|
|
21206
|
-
case 2:
|
|
21257
|
+
break;
|
|
21258
|
+
case 4:
|
|
21207
21259
|
if (!channel) {
|
|
21208
|
-
_context28.n =
|
|
21260
|
+
_context28.n = 5;
|
|
21209
21261
|
break;
|
|
21210
21262
|
}
|
|
21211
|
-
_context28.n =
|
|
21263
|
+
_context28.n = 5;
|
|
21212
21264
|
return call(channel.retractVote, message.id, pollId);
|
|
21213
|
-
case
|
|
21265
|
+
case 5:
|
|
21214
21266
|
return _context28.a(2);
|
|
21215
21267
|
}
|
|
21216
21268
|
}, _marked26$1);
|
|
21217
21269
|
}
|
|
21218
|
-
function updateMessageOptimisticallyForRetractPollVote(channelId, message) {
|
|
21219
|
-
var channel,
|
|
21270
|
+
function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
|
|
21271
|
+
var channel, _iterator2, _step2, obj;
|
|
21220
21272
|
return _regenerator().w(function (_context29) {
|
|
21221
21273
|
while (1) switch (_context29.n) {
|
|
21222
21274
|
case 0:
|
|
@@ -21230,31 +21282,30 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message) {
|
|
|
21230
21282
|
}
|
|
21231
21283
|
return _context29.a(2);
|
|
21232
21284
|
case 2:
|
|
21233
|
-
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21285
|
+
_iterator2 = _createForOfIteratorHelperLoose(objs);
|
|
21286
|
+
case 3:
|
|
21287
|
+
if ((_step2 = _iterator2()).done) {
|
|
21288
|
+
_context29.n = 5;
|
|
21289
|
+
break;
|
|
21237
21290
|
}
|
|
21291
|
+
obj = _step2.value;
|
|
21238
21292
|
updateMessageOnMap(channelId, {
|
|
21239
21293
|
messageId: message.id,
|
|
21240
|
-
params: {
|
|
21241
|
-
pollDetails: pollDetails
|
|
21242
|
-
}
|
|
21243
|
-
});
|
|
21244
|
-
updateMessageOnAllMessages(message.id, {
|
|
21245
|
-
pollDetails: pollDetails
|
|
21294
|
+
params: {}
|
|
21246
21295
|
});
|
|
21296
|
+
updateMessageOnAllMessages(message.id, {}, obj);
|
|
21297
|
+
_context29.n = 4;
|
|
21298
|
+
return put(updateMessageAC(message.id, {}, undefined, obj));
|
|
21299
|
+
case 4:
|
|
21247
21300
|
_context29.n = 3;
|
|
21248
|
-
|
|
21249
|
-
|
|
21250
|
-
}));
|
|
21251
|
-
case 3:
|
|
21301
|
+
break;
|
|
21302
|
+
case 5:
|
|
21252
21303
|
return _context29.a(2);
|
|
21253
21304
|
}
|
|
21254
21305
|
}, _marked27$1);
|
|
21255
21306
|
}
|
|
21256
21307
|
function retractPollVote(action) {
|
|
21257
|
-
var payload, channelId, pollId, _message7, sceytChatClient, connectionState, _t22;
|
|
21308
|
+
var payload, channelId, pollId, _message7, sceytChatClient, connectionState, objs, _iterator3, _step3, _message7$pollDetails, _message7$pollDetails2, vote, _t22;
|
|
21258
21309
|
return _regenerator().w(function (_context30) {
|
|
21259
21310
|
while (1) switch (_context30.p = _context30.n) {
|
|
21260
21311
|
case 0:
|
|
@@ -21267,11 +21318,20 @@ function retractPollVote(action) {
|
|
|
21267
21318
|
break;
|
|
21268
21319
|
}
|
|
21269
21320
|
connectionState = sceytChatClient.connectionState;
|
|
21321
|
+
objs = [];
|
|
21322
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(((_message7$pollDetails = _message7.pollDetails) === null || _message7$pollDetails === void 0 ? void 0 : (_message7$pollDetails2 = _message7$pollDetails.voteDetails) === null || _message7$pollDetails2 === void 0 ? void 0 : _message7$pollDetails2.ownVotes) || []); !(_step3 = _iterator3()).done;) {
|
|
21323
|
+
vote = _step3.value;
|
|
21324
|
+
objs.push({
|
|
21325
|
+
type: 'deleteOwn',
|
|
21326
|
+
vote: vote,
|
|
21327
|
+
incrementVotesPerOptionCount: -1
|
|
21328
|
+
});
|
|
21329
|
+
}
|
|
21270
21330
|
if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
|
|
21271
21331
|
_context30.n = 2;
|
|
21272
21332
|
break;
|
|
21273
21333
|
}
|
|
21274
|
-
return _context30.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, _message7)), 1);
|
|
21334
|
+
return _context30.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, _message7, objs)), 1);
|
|
21275
21335
|
case 1:
|
|
21276
21336
|
setPendingPollAction({
|
|
21277
21337
|
type: 'RETRACT_POLL_VOTE',
|
|
@@ -21281,7 +21341,7 @@ function retractPollVote(action) {
|
|
|
21281
21341
|
});
|
|
21282
21342
|
return _context30.a(2);
|
|
21283
21343
|
case 2:
|
|
21284
|
-
return _context30.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, _message7)), 3);
|
|
21344
|
+
return _context30.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, _message7, objs)), 3);
|
|
21285
21345
|
case 3:
|
|
21286
21346
|
_context30.n = 5;
|
|
21287
21347
|
break;
|
|
@@ -33982,7 +34042,7 @@ var MessageStatusUpdated = styled.span(_templateObject4$m || (_templateObject4$m
|
|
|
33982
34042
|
var _templateObject$C, _templateObject2$x, _templateObject3$r, _templateObject4$n, _templateObject5$i, _templateObject6$g, _templateObject7$e, _templateObject8$d, _templateObject9$b, _templateObject0$a, _templateObject1$7, _templateObject10$4;
|
|
33983
34043
|
var POLL_VOTES_LIMIT = 20;
|
|
33984
34044
|
var AllVotesPopup = function AllVotesPopup(_ref) {
|
|
33985
|
-
var _pollVotesHasMore$key, _poll$
|
|
34045
|
+
var _pollVotesHasMore$key, _poll$voteDetails, _poll$voteDetails$vot, _poll$voteDetails3;
|
|
33986
34046
|
var onClose = _ref.onClose,
|
|
33987
34047
|
poll = _ref.poll,
|
|
33988
34048
|
messageId = _ref.messageId,
|
|
@@ -34004,7 +34064,7 @@ var AllVotesPopup = function AllVotesPopup(_ref) {
|
|
|
34004
34064
|
var allVotes = pollVotesList[key] || [];
|
|
34005
34065
|
var hasMore = (_pollVotesHasMore$key = pollVotesHasMore[key]) != null ? _pollVotesHasMore$key : false;
|
|
34006
34066
|
var isLoading = pollVotesLoadingState[key] === LOADING_STATE.LOADING;
|
|
34007
|
-
var totalVotes = ((_poll$
|
|
34067
|
+
var totalVotes = ((_poll$voteDetails = poll.voteDetails) === null || _poll$voteDetails === void 0 ? void 0 : (_poll$voteDetails$vot = _poll$voteDetails.votesPerOption) === null || _poll$voteDetails$vot === void 0 ? void 0 : _poll$voteDetails$vot[optionId]) || 0;
|
|
34008
34068
|
var isLoadingInitial = allVotes.length === 0 && (isLoading || totalVotes > 0);
|
|
34009
34069
|
useEffect(function () {
|
|
34010
34070
|
if (allVotes.length === 0 && totalVotes > 0 && !isLoading) {
|
|
@@ -34037,11 +34097,11 @@ var AllVotesPopup = function AllVotesPopup(_ref) {
|
|
|
34037
34097
|
}
|
|
34038
34098
|
};
|
|
34039
34099
|
var ownVote = useMemo(function () {
|
|
34040
|
-
var _poll$
|
|
34041
|
-
return poll === null || poll === void 0 ? void 0 : (_poll$
|
|
34100
|
+
var _poll$voteDetails2, _poll$voteDetails2$ow;
|
|
34101
|
+
return poll === null || poll === void 0 ? void 0 : (_poll$voteDetails2 = poll.voteDetails) === null || _poll$voteDetails2 === void 0 ? void 0 : (_poll$voteDetails2$ow = _poll$voteDetails2.ownVotes) === null || _poll$voteDetails2$ow === void 0 ? void 0 : _poll$voteDetails2$ow.find(function (vote) {
|
|
34042
34102
|
return vote.optionId === optionId;
|
|
34043
34103
|
});
|
|
34044
|
-
}, [poll === null || poll === void 0 ? void 0 : poll.ownVotes, optionId]);
|
|
34104
|
+
}, [poll === null || poll === void 0 ? void 0 : (_poll$voteDetails3 = poll.voteDetails) === null || _poll$voteDetails3 === void 0 ? void 0 : _poll$voteDetails3.ownVotes, optionId]);
|
|
34045
34105
|
return /*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
|
|
34046
34106
|
backgroundColor: background,
|
|
34047
34107
|
maxWidth: '560px',
|
|
@@ -34130,7 +34190,7 @@ var Loader = styled.div(_templateObject10$4 || (_templateObject10$4 = _taggedTem
|
|
|
34130
34190
|
|
|
34131
34191
|
var _templateObject$D, _templateObject2$y, _templateObject3$s, _templateObject4$o, _templateObject5$j, _templateObject6$h, _templateObject7$f, _templateObject8$e, _templateObject9$c, _templateObject0$b;
|
|
34132
34192
|
var VotesResultsPopup = function VotesResultsPopup(_ref) {
|
|
34133
|
-
var _poll$options$find;
|
|
34193
|
+
var _poll$voteDetails3, _poll$voteDetails4, _poll$options$find;
|
|
34134
34194
|
var onClose = _ref.onClose,
|
|
34135
34195
|
poll = _ref.poll,
|
|
34136
34196
|
messageId = _ref.messageId,
|
|
@@ -34151,21 +34211,17 @@ var VotesResultsPopup = function VotesResultsPopup(_ref) {
|
|
|
34151
34211
|
var optionIdToVotes = useMemo(function () {
|
|
34152
34212
|
var votes = {};
|
|
34153
34213
|
poll.options.forEach(function (opt) {
|
|
34154
|
-
var
|
|
34214
|
+
var _poll$voteDetails, _poll$voteDetails2;
|
|
34215
|
+
var allOptionVotes = (((_poll$voteDetails = poll.voteDetails) === null || _poll$voteDetails === void 0 ? void 0 : _poll$voteDetails.votes) || []).filter(function (vote) {
|
|
34155
34216
|
return vote.optionId === opt.id;
|
|
34156
34217
|
});
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
if (ownVote) {
|
|
34162
|
-
allOptionVotes.push(ownVote);
|
|
34163
|
-
}
|
|
34164
|
-
}
|
|
34165
|
-
votes[opt.id] = allOptionVotes;
|
|
34218
|
+
var ownVote = (_poll$voteDetails2 = poll.voteDetails) === null || _poll$voteDetails2 === void 0 ? void 0 : _poll$voteDetails2.ownVotes.find(function (vote) {
|
|
34219
|
+
return vote.optionId === opt.id;
|
|
34220
|
+
});
|
|
34221
|
+
votes[opt.id] = [].concat(ownVote ? [ownVote] : [], (allOptionVotes === null || allOptionVotes === void 0 ? void 0 : allOptionVotes.slice(0, ownVote ? 4 : 5)) || []);
|
|
34166
34222
|
});
|
|
34167
34223
|
return votes;
|
|
34168
|
-
}, [poll.votes, poll.options, poll.ownVotes]);
|
|
34224
|
+
}, [(_poll$voteDetails3 = poll.voteDetails) === null || _poll$voteDetails3 === void 0 ? void 0 : _poll$voteDetails3.votes, poll.options, (_poll$voteDetails4 = poll.voteDetails) === null || _poll$voteDetails4 === void 0 ? void 0 : _poll$voteDetails4.ownVotes]);
|
|
34169
34225
|
var handleShowAll = useCallback(function (optionId) {
|
|
34170
34226
|
if (onViewMoreOption) {
|
|
34171
34227
|
onViewMoreOption(optionId);
|
|
@@ -34203,9 +34259,9 @@ var VotesResultsPopup = function VotesResultsPopup(_ref) {
|
|
|
34203
34259
|
color: textPrimary,
|
|
34204
34260
|
marginBottom: '16px'
|
|
34205
34261
|
}, "Vote results"), /*#__PURE__*/React__default.createElement(OptionsList, null, poll.options.map(function (opt) {
|
|
34206
|
-
var _poll$
|
|
34262
|
+
var _poll$voteDetails5, _poll$voteDetails5$vo;
|
|
34207
34263
|
var allVotes = optionIdToVotes[opt.id] || [];
|
|
34208
|
-
var totalVotes = ((_poll$
|
|
34264
|
+
var totalVotes = ((_poll$voteDetails5 = poll.voteDetails) === null || _poll$voteDetails5 === void 0 ? void 0 : (_poll$voteDetails5$vo = _poll$voteDetails5.votesPerOption) === null || _poll$voteDetails5$vo === void 0 ? void 0 : _poll$voteDetails5$vo[opt.id]) || 0;
|
|
34209
34265
|
return /*#__PURE__*/React__default.createElement(OptionBlock, {
|
|
34210
34266
|
key: opt.id,
|
|
34211
34267
|
background: surface1,
|
|
@@ -34309,6 +34365,7 @@ function SvgFilledCheckbox(props) {
|
|
|
34309
34365
|
|
|
34310
34366
|
var _templateObject$E, _templateObject2$z, _templateObject3$t, _templateObject4$p, _templateObject5$k, _templateObject6$i, _templateObject7$g, _templateObject8$f, _templateObject9$d, _templateObject0$c, _templateObject1$8, _templateObject10$5, _templateObject11$4, _templateObject12$3;
|
|
34311
34367
|
var PollMessage = function PollMessage(_ref) {
|
|
34368
|
+
var _poll$voteDetails3, _poll$voteDetails4, _poll$voteDetails5, _poll$voteDetails6, _poll$voteDetails7;
|
|
34312
34369
|
var message = _ref.message;
|
|
34313
34370
|
var _useColor = useColors(),
|
|
34314
34371
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -34328,20 +34385,20 @@ var PollMessage = function PollMessage(_ref) {
|
|
|
34328
34385
|
showResults = _useState[0],
|
|
34329
34386
|
setShowResults = _useState[1];
|
|
34330
34387
|
var isHaveResults = useMemo(function () {
|
|
34331
|
-
var _poll$
|
|
34332
|
-
return ((_poll$
|
|
34333
|
-
}, [poll === null || poll === void 0 ? void 0 : poll.votes, poll === null || poll === void 0 ? void 0 : poll.ownVotes]);
|
|
34388
|
+
var _poll$voteDetails$vot, _poll$voteDetails, _poll$voteDetails$vot2, _poll$voteDetails$own, _poll$voteDetails2, _poll$voteDetails2$ow;
|
|
34389
|
+
return ((_poll$voteDetails$vot = poll === null || poll === void 0 ? void 0 : (_poll$voteDetails = poll.voteDetails) === null || _poll$voteDetails === void 0 ? void 0 : (_poll$voteDetails$vot2 = _poll$voteDetails.votes) === null || _poll$voteDetails$vot2 === void 0 ? void 0 : _poll$voteDetails$vot2.length) != null ? _poll$voteDetails$vot : 0) > 0 || ((_poll$voteDetails$own = poll === null || poll === void 0 ? void 0 : (_poll$voteDetails2 = poll.voteDetails) === null || _poll$voteDetails2 === void 0 ? void 0 : (_poll$voteDetails2$ow = _poll$voteDetails2.ownVotes) === null || _poll$voteDetails2$ow === void 0 ? void 0 : _poll$voteDetails2$ow.length) != null ? _poll$voteDetails$own : 0) > 0;
|
|
34390
|
+
}, [poll === null || poll === void 0 ? void 0 : (_poll$voteDetails3 = poll.voteDetails) === null || _poll$voteDetails3 === void 0 ? void 0 : _poll$voteDetails3.votes, poll === null || poll === void 0 ? void 0 : (_poll$voteDetails4 = poll.voteDetails) === null || _poll$voteDetails4 === void 0 ? void 0 : _poll$voteDetails4.ownVotes]);
|
|
34334
34391
|
if (!poll) {
|
|
34335
34392
|
return null;
|
|
34336
34393
|
}
|
|
34337
|
-
var votesPerOption = poll.votesPerOption || {};
|
|
34394
|
+
var votesPerOption = ((_poll$voteDetails5 = poll.voteDetails) === null || _poll$voteDetails5 === void 0 ? void 0 : _poll$voteDetails5.votesPerOption) || {};
|
|
34338
34395
|
var maxVotes = poll.options.reduce(function (acc, opt) {
|
|
34339
34396
|
return Math.max(acc, votesPerOption[opt.id] || 0);
|
|
34340
34397
|
}, 0);
|
|
34341
|
-
var ownVotedOptionIds = new Set((poll.ownVotes || []).map(function (v) {
|
|
34398
|
+
var ownVotedOptionIds = new Set((((_poll$voteDetails6 = poll.voteDetails) === null || _poll$voteDetails6 === void 0 ? void 0 : _poll$voteDetails6.ownVotes) || []).map(function (v) {
|
|
34342
34399
|
return v.optionId;
|
|
34343
34400
|
}));
|
|
34344
|
-
var votesUsers = poll.votes || [];
|
|
34401
|
+
var votesUsers = ((_poll$voteDetails7 = poll.voteDetails) === null || _poll$voteDetails7 === void 0 ? void 0 : _poll$voteDetails7.votes) || [];
|
|
34345
34402
|
var canVote = !poll.closed;
|
|
34346
34403
|
var handleVote = function handleVote(optionId) {
|
|
34347
34404
|
if (!canVote) return;
|
|
@@ -34367,8 +34424,8 @@ var PollMessage = function PollMessage(_ref) {
|
|
|
34367
34424
|
return v.optionId === opt.id;
|
|
34368
34425
|
}).slice(0, 3);
|
|
34369
34426
|
if (optionVotesUsers.length < 3) {
|
|
34370
|
-
var _poll$
|
|
34371
|
-
poll === null || poll === void 0 ? void 0 : (_poll$
|
|
34427
|
+
var _poll$voteDetails8, _poll$voteDetails8$ow;
|
|
34428
|
+
poll === null || poll === void 0 ? void 0 : (_poll$voteDetails8 = poll.voteDetails) === null || _poll$voteDetails8 === void 0 ? void 0 : (_poll$voteDetails8$ow = _poll$voteDetails8.ownVotes) === null || _poll$voteDetails8$ow === void 0 ? void 0 : _poll$voteDetails8$ow.forEach(function (vote) {
|
|
34372
34429
|
if (vote.optionId === opt.id) {
|
|
34373
34430
|
optionVotesUsers.push(vote);
|
|
34374
34431
|
}
|
|
@@ -42511,7 +42568,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
42511
42568
|
},
|
|
42512
42569
|
iconWidth: '20px',
|
|
42513
42570
|
iconColor: iconInactive
|
|
42514
|
-
}, /*#__PURE__*/React__default.createElement(SvgChoseFile, null), chooseFileAttachmentText != null ? chooseFileAttachmentText : 'File')), (pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.showAddPoll) &&
|
|
42571
|
+
}, /*#__PURE__*/React__default.createElement(SvgChoseFile, null), chooseFileAttachmentText != null ? chooseFileAttachmentText : 'File')), (pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.showAddPoll) && (/*#__PURE__*/React__default.createElement(DropdownOptionLi, {
|
|
42515
42572
|
key: 3,
|
|
42516
42573
|
textColor: textPrimary,
|
|
42517
42574
|
hoverBackground: backgroundHovered,
|