Start moving webapp to Redux (#6140)
* Start moving webapp to Redux * Fix localforage import * Updates per feedback * Feedback udpates and a few fixes * Minor updates * Fix statuses, config not loading properly, getMe sanitizing too much * Fix preferences * Fix user autocomplete * Fix sessions and audits * Fix error handling for all redux actions * Use new directory structure for components and containers * Refresh immediately on logout instead of after timeout * Add fetch polyfill
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
cc07c00507
Коммит
6c4c706313
@@ -8,7 +8,6 @@ import TeamStore from 'stores/team_store.jsx';
|
||||
import ErrorStore from 'stores/error_store.jsx';
|
||||
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
import {loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
|
||||
|
||||
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
|
||||
import Client from 'client/web_client.jsx';
|
||||
@@ -323,231 +322,6 @@ export function getUser(userId, success, error) {
|
||||
);
|
||||
}
|
||||
|
||||
export function getProfiles(offset = UserStore.getPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
|
||||
const callName = `getProfiles${offset}${limit}`;
|
||||
|
||||
if (isCallInProgress(callName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker[callName] = utils.getTimestamp();
|
||||
Client.getProfiles(
|
||||
offset,
|
||||
limit,
|
||||
(data) => {
|
||||
callTracker[callName] = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_PROFILES,
|
||||
profiles: data
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker[callName] = 0;
|
||||
dispatchError(err, 'getProfiles');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getProfilesInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
|
||||
const callName = `getProfilesInTeam${teamId}${offset}${limit}`;
|
||||
|
||||
if (isCallInProgress(callName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker[callName] = utils.getTimestamp();
|
||||
Client.getProfilesInTeam(
|
||||
teamId,
|
||||
offset,
|
||||
limit,
|
||||
(data) => {
|
||||
callTracker[callName] = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_PROFILES_IN_TEAM,
|
||||
profiles: data,
|
||||
team_id: teamId,
|
||||
offset,
|
||||
count: Object.keys(data).length
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker[callName] = 0;
|
||||
dispatchError(err, 'getProfilesInTeam');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getProfilesNotInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
|
||||
const callName = `getProfilesNotInTeam${teamId}${offset}${limit}`;
|
||||
|
||||
if (isCallInProgress(callName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker[callName] = utils.getTimestamp();
|
||||
Client.getProfilesNotInTeam(
|
||||
teamId,
|
||||
offset,
|
||||
limit,
|
||||
(data) => {
|
||||
callTracker[callName] = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_PROFILES_NOT_IN_TEAM,
|
||||
profiles: data,
|
||||
team_id: teamId,
|
||||
offset,
|
||||
count: Object.keys(data).length
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker[callName] = 0;
|
||||
dispatchError(err, 'getProfilesNotInTeam');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getProfilesInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
|
||||
const callName = `getProfilesInChannel${channelId}${offset}${limit}`;
|
||||
|
||||
if (isCallInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker[callName] = utils.getTimestamp();
|
||||
Client.getProfilesInChannel(
|
||||
channelId,
|
||||
offset,
|
||||
limit,
|
||||
(data) => {
|
||||
callTracker[callName] = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_PROFILES_IN_CHANNEL,
|
||||
channel_id: channelId,
|
||||
profiles: data,
|
||||
offset,
|
||||
count: Object.keys(data).length
|
||||
});
|
||||
|
||||
loadStatusesForProfilesMap(data);
|
||||
},
|
||||
(err) => {
|
||||
callTracker[callName] = 0;
|
||||
dispatchError(err, 'getProfilesInChannel');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getProfilesNotInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getNotInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
|
||||
const callName = `getProfilesNotInChannel${channelId}${offset}${limit}`;
|
||||
|
||||
if (isCallInProgress(callName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker[callName] = utils.getTimestamp();
|
||||
Client.getProfilesNotInChannel(
|
||||
channelId,
|
||||
offset,
|
||||
limit,
|
||||
(data) => {
|
||||
callTracker[callName] = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_PROFILES_NOT_IN_CHANNEL,
|
||||
channel_id: channelId,
|
||||
profiles: data,
|
||||
offset,
|
||||
count: Object.keys(data).length
|
||||
});
|
||||
|
||||
loadStatusesForProfilesMap(data);
|
||||
},
|
||||
(err) => {
|
||||
callTracker[callName] = 0;
|
||||
dispatchError(err, 'getProfilesNotInChannel');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getProfilesByIds(userIds) {
|
||||
const callName = 'getProfilesByIds' + JSON.stringify(userIds);
|
||||
|
||||
if (isCallInProgress(callName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userIds || userIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker[callName] = utils.getTimestamp();
|
||||
Client.getProfilesByIds(
|
||||
userIds,
|
||||
(data) => {
|
||||
callTracker[callName] = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_PROFILES,
|
||||
profiles: data
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker[callName] = 0;
|
||||
dispatchError(err, 'getProfilesByIds');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getSessions() {
|
||||
if (isCallInProgress('getSessions')) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker.getSessions = utils.getTimestamp();
|
||||
Client.getSessions(
|
||||
UserStore.getCurrentId(),
|
||||
(data) => {
|
||||
callTracker.getSessions = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_SESSIONS,
|
||||
sessions: data
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker.getSessions = 0;
|
||||
dispatchError(err, 'getSessions');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getAudits() {
|
||||
if (isCallInProgress('getAudits')) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker.getAudits = utils.getTimestamp();
|
||||
Client.getAudits(
|
||||
UserStore.getCurrentId(),
|
||||
(data) => {
|
||||
callTracker.getAudits = 0;
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_AUDITS,
|
||||
audits: data
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker.getAudits = 0;
|
||||
dispatchError(err, 'getAudits');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getLogs() {
|
||||
if (isCallInProgress('getLogs')) {
|
||||
return;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
import * as Utils from './utils.jsx';
|
||||
import ChannelInviteModal from 'components/channel_invite_modal.jsx';
|
||||
import ChannelInviteModal from 'components/channel_invite_modal';
|
||||
import EditChannelHeaderModal from 'components/edit_channel_header_modal.jsx';
|
||||
import ToggleModalButton from 'components/toggle_modal_button.jsx';
|
||||
import UserProfile from 'components/user_profile.jsx';
|
||||
|
||||
Ссылка в новой задаче
Block a user