Multiple fixes to major performance issues with teams with 50+ users
Этот коммит содержится в:
@@ -588,13 +588,21 @@ export function getMe() {
|
||||
}
|
||||
|
||||
export function getStatuses() {
|
||||
if (isCallInProgress('getStatuses')) {
|
||||
const directChannels = ChannelStore.getAll().filter((channel) => channel.type === Constants.DM_CHANNEL);
|
||||
|
||||
const teammateIds = [];
|
||||
for (var i = 0; i < directChannels.length; i++) {
|
||||
const teammate = utils.getDirectTeammate(directChannels[i].id);
|
||||
teammateIds.push(teammate.id);
|
||||
}
|
||||
|
||||
if (isCallInProgress('getStatuses') || teammateIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker.getStatuses = utils.getTimestamp();
|
||||
client.getStatuses(
|
||||
function getStatusesSuccess(data, textStatus, xhr) {
|
||||
client.getStatuses(teammateIds,
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getStatuses = 0;
|
||||
|
||||
if (xhr.status === 304 || !data) {
|
||||
@@ -606,7 +614,7 @@ export function getStatuses() {
|
||||
statuses: data
|
||||
});
|
||||
},
|
||||
function getStatusesFailure(err) {
|
||||
(err) => {
|
||||
callTracker.getStatuses = 0;
|
||||
dispatchError(err, 'getStatuses');
|
||||
}
|
||||
|
||||
@@ -1069,12 +1069,13 @@ export function exportTeam(success, error) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getStatuses(success, error) {
|
||||
export function getStatuses(ids, success, error) {
|
||||
$.ajax({
|
||||
url: '/api/v1/users/status',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'GET',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(ids),
|
||||
success,
|
||||
error: function onError(xhr, status, err) {
|
||||
var e = handleError('getStatuses', xhr, status, err);
|
||||
|
||||
@@ -127,6 +127,7 @@ module.exports = {
|
||||
MAX_DMS: 20,
|
||||
DM_CHANNEL: 'D',
|
||||
OPEN_CHANNEL: 'O',
|
||||
PRIVATE_CHANNEL: 'P',
|
||||
INVITE_TEAM: 'I',
|
||||
OPEN_TEAM: 'O',
|
||||
MAX_POST_LEN: 4000,
|
||||
|
||||
Ссылка в новой задаче
Block a user