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