summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-06-15 10:34:20 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2017-06-15 10:34:20 -0400
commitc0a0065472c199166d32b052dd328b0212f5b693 (patch)
tree1d2ba19bfb9a104a4384a42c1e7a892de60c3fa8 /webapp
parent0c04c5334fc89cf62a4bd3c1ce20469523a24026 (diff)
downloadchat-c0a0065472c199166d32b052dd328b0212f5b693.tar.gz
chat-c0a0065472c199166d32b052dd328b0212f5b693.tar.bz2
chat-c0a0065472c199166d32b052dd328b0212f5b693.zip
Move user actions over to use redux and v4 (#6649)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/admin_actions.jsx69
-rw-r--r--webapp/actions/user_actions.jsx296
-rw-r--r--webapp/components/add_users_to_team/add_users_to_team.jsx4
-rw-r--r--webapp/components/admin_console/manage_teams_modal/manage_teams_modal.jsx4
-rw-r--r--webapp/components/claim/components/oauth_to_email.jsx1
-rw-r--r--webapp/components/more_direct_channels/more_direct_channels.jsx4
-rw-r--r--webapp/components/popover_list_members/popover_list_members.jsx4
-rw-r--r--webapp/components/sidebar_header.jsx3
-rw-r--r--webapp/components/status_dropdown/index.jsx4
-rw-r--r--webapp/yarn.lock4
10 files changed, 173 insertions, 220 deletions
diff --git a/webapp/actions/admin_actions.jsx b/webapp/actions/admin_actions.jsx
index 04d0d65bb..307f0c4a7 100644
--- a/webapp/actions/admin_actions.jsx
+++ b/webapp/actions/admin_actions.jsx
@@ -2,14 +2,15 @@
// See License.txt for license information.
import Client from 'client/web_client.jsx';
-import {browserHistory} from 'react-router/es6';
+
+import {clientLogout} from 'actions/global_actions.jsx';
import store from 'stores/redux_store.jsx';
const dispatch = store.dispatch;
const getState = store.getState;
-import {updateUserMfa, updateUserPassword} from 'mattermost-redux/actions/users';
import * as AdminActions from 'mattermost-redux/actions/admin';
+import * as UserActions from 'mattermost-redux/actions/users';
export function saveConfig(config, success, error) {
AdminActions.updateConfig(config)(dispatch, getState).then(
@@ -39,7 +40,7 @@ export function reloadConfig(success, error) {
}
export function adminResetMfa(userId, success, error) {
- updateUserMfa(userId, false)(dispatch, getState).then(
+ UserActions.updateUserMfa(userId, false)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -117,7 +118,7 @@ export function recycleDatabaseConnection(success, error) {
}
export function adminResetPassword(userId, password, success, error) {
- updateUserPassword(userId, '', password)(dispatch, getState).then(
+ UserActions.updateUserPassword(userId, '', password)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -193,60 +194,44 @@ export function allowOAuth2(params, success, error) {
}
export function emailToLdap(loginId, password, token, ldapId, ldapPassword, success, error) {
- Client.emailToLdap(
- loginId,
- password,
- token,
- ldapId,
- ldapPassword,
+ UserActions.switchEmailToLdap(loginId, password, ldapId, ldapPassword, token)(dispatch, getState).then(
(data) => {
- if (success) {
+ if (data && success) {
success(data);
- }
- },
- (err) => {
- if (error) {
- error(err);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.switchLogin.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function emailToOAuth(loginId, password, token, newType, success, error) {
- Client.emailToOAuth(
- loginId,
- password,
- token,
- newType,
+ UserActions.switchEmailToOAuth(newType, loginId, password, token)(dispatch, getState).then(
(data) => {
- if (success) {
+ if (data && success) {
success(data);
- }
- },
- (err) => {
- if (error) {
- error(err);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.switchLogin.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
-export function oauthToEmail(email, password, success, error) {
- Client.oauthToEmail(
- email,
- password,
+export function oauthToEmail(currentService, email, password, success, error) {
+ UserActions.switchOAuthToEmail(currentService, email, password)(dispatch, getState).then(
(data) => {
- if (data.follow_link) {
- browserHistory.push(data.follow_link);
- }
-
- if (success) {
- success(data);
- }
- },
- (err) => {
- if (error) {
- error(err);
+ if (data) {
+ if (data.follow_link) {
+ clientLogout(data.follow_link);
+ }
+ if (success) {
+ success(data);
+ }
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.switchLogin.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx
index 63c716d5d..cd8b05562 100644
--- a/webapp/actions/user_actions.jsx
+++ b/webapp/actions/user_actions.jsx
@@ -1,20 +1,17 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
-
import PreferenceStore from 'stores/preference_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import {getChannelMembersForUserIds} from 'actions/channel_actions.jsx';
-import {loadCurrentLocale} from 'actions/global_actions.jsx';
+import {loadCurrentLocale, clientLogout} from 'actions/global_actions.jsx';
import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
import {getDirectChannelName, getUserIdFromChannelName} from 'utils/utils.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
import Client from 'client/web_client.jsx';
import {Constants, ActionTypes, Preferences} from 'utils/constants.jsx';
@@ -28,34 +25,17 @@ const getState = store.getState;
import * as Selectors from 'mattermost-redux/selectors/entities/users';
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
-import {
- getProfiles,
- getProfilesInChannel,
- getProfilesInTeam,
- getProfilesWithoutTeam,
- getProfilesByIds,
- getMe,
- searchProfiles,
- autocompleteUsers as autocompleteRedux,
- updateMe,
- updateUserMfa,
- checkMfa as checkMfaRedux,
- updateUserPassword,
- createUser,
- login,
- loadMe as loadMeRedux,
- updateUserRoles as updateUserRolesRedux,
- getStatus,
- setStatus
-} from 'mattermost-redux/actions/users';
+import * as UserActions from 'mattermost-redux/actions/users';
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
-import {getTeamMembersByIds, getMyTeamMembers} from 'mattermost-redux/actions/teams';
+import {getTeamMembersByIds, getMyTeamMembers, getMyTeamUnreads} from 'mattermost-redux/actions/teams';
import {getChannelAndMyMember} from 'mattermost-redux/actions/channels';
+import {savePreferences, deletePreferences} from 'mattermost-redux/actions/preferences';
+
import {Preferences as PreferencesRedux} from 'mattermost-redux/constants';
export function loadMe(callback) {
- loadMeRedux()(dispatch, getState).then(
+ UserActions.loadMe()(dispatch, getState).then(
() => {
loadCurrentLocale();
@@ -102,27 +82,26 @@ export function loadMeAndConfig(callback) {
});
}
-export function switchFromLdapToEmail(email, password, token, ldapPassword, onSuccess, onError) {
- Client.ldapToEmail(
- email,
- password,
- token,
- ldapPassword,
+export function switchFromLdapToEmail(email, password, token, ldapPassword, success, error) {
+ UserActions.switchLdapToEmail(ldapPassword, email, password, token)(dispatch, getState).then(
(data) => {
- if (data.follow_link) {
- window.location.href = data.follow_link;
- }
-
- if (onSuccess) {
- onSuccess(data);
+ if (data) {
+ if (data.follow_link) {
+ clientLogout(data.follow_link);
+ }
+ if (success) {
+ success(data);
+ }
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.switchLogin.error;
+ error({id: serverError.server_error_id, ...serverError});
}
- },
- onError
+ }
);
}
export function loadProfilesAndTeamMembers(page, perPage, teamId = TeamStore.getCurrentId(), success) {
- getProfilesInTeam(teamId, page, perPage)(dispatch, getState).then(
+ UserActions.getProfilesInTeam(teamId, page, perPage)(dispatch, getState).then(
(data) => {
loadTeamMembersForProfilesList(data, teamId, success);
loadStatusesForProfilesList(data);
@@ -131,7 +110,7 @@ export function loadProfilesAndTeamMembers(page, perPage, teamId = TeamStore.get
}
export function loadProfilesAndTeamMembersAndChannelMembers(page, perPage, teamId = TeamStore.getCurrentId(), channelId = ChannelStore.getCurrentId(), success, error) {
- getProfilesInChannel(channelId, page, perPage)(dispatch, getState).then(
+ UserActions.getProfilesInChannel(channelId, page, perPage)(dispatch, getState).then(
(data) => {
loadTeamMembersForProfilesList(
data,
@@ -167,7 +146,7 @@ export function loadTeamMembersForProfilesList(profiles, teamId = TeamStore.getC
}
export function loadProfilesWithoutTeam(page, perPage, success) {
- getProfilesWithoutTeam(page, perPage)(dispatch, getState).then(
+ UserActions.getProfilesWithoutTeam(page, perPage)(dispatch, getState).then(
(data) => {
loadStatusesForProfilesMap(data);
@@ -272,7 +251,8 @@ export function loadNewDMIfNeeded(channelId) {
const pref = PreferenceStore.getBool(Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, userId, false);
if (pref === false) {
PreferenceStore.setPreference(Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, userId, 'true');
- AsyncClient.savePreference(Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, userId, 'true');
+ const currentUserId = UserStore.getCurrentId();
+ savePreferences(currentUserId, [{user_id: currentUserId, category: Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, name: userId, value: 'true'}])(dispatch, getState);
loadProfilesForDM();
}
}
@@ -296,7 +276,8 @@ export function loadNewGMIfNeeded(channelId) {
const pref = PreferenceStore.getBool(Preferences.CATEGORY_GROUP_CHANNEL_SHOW, channelId, false);
if (pref === false) {
PreferenceStore.setPreference(Preferences.CATEGORY_GROUP_CHANNEL_SHOW, channelId, 'true');
- AsyncClient.savePreference(Preferences.CATEGORY_GROUP_CHANNEL_SHOW, channelId, 'true');
+ const currentUserId = UserStore.getCurrentId();
+ savePreferences(currentUserId, [{user_id: currentUserId, category: Preferences.CATEGORY_GROUP_CHANNEL_SHOW, name: channelId, value: 'true'}])(dispatch, getState);
loadProfilesForGM();
}
}
@@ -348,7 +329,7 @@ export function loadProfilesForGM() {
});
}
- getProfilesInChannel(channel.id, 0, Constants.MAX_USERS_IN_GM)(dispatch, getState).then(
+ UserActions.getProfilesInChannel(channel.id, 0, Constants.MAX_USERS_IN_GM)(dispatch, getState).then(
(data) => {
populateChannelWithProfiles(channel.id, data);
}
@@ -356,7 +337,8 @@ export function loadProfilesForGM() {
}
if (newPreferences.length > 0) {
- AsyncClient.savePreferences(newPreferences);
+ const currentUserId = UserStore.getCurrentId();
+ savePreferences(currentUserId, newPreferences)(dispatch, getState);
}
}
@@ -396,11 +378,12 @@ export function loadProfilesForDM() {
}
if (newPreferences.length > 0) {
- AsyncClient.savePreferences(newPreferences);
+ const currentUserId = UserStore.getCurrentId();
+ savePreferences(currentUserId, newPreferences)(dispatch, getState);
}
if (profilesToLoad.length > 0) {
- getProfilesByIds(profilesToLoad)(dispatch, getState).then(
+ UserActions.getProfilesByIds(profilesToLoad)(dispatch, getState).then(
() => {
populateDMChannelsWithProfiles(profileIds);
},
@@ -411,15 +394,20 @@ export function loadProfilesForDM() {
}
export function saveTheme(teamId, theme, onSuccess, onError) {
- AsyncClient.savePreference(
- Preferences.CATEGORY_THEME,
- teamId,
- JSON.stringify(theme),
- () => {
- onThemeSaved(teamId, theme, onSuccess);
- },
- (err) => {
- onError(err);
+ const currentUserId = UserStore.getCurrentId();
+ savePreferences(currentUserId, [{
+ user_id: currentUserId,
+ category: Preferences.CATEGORY_THEME,
+ name: teamId,
+ value: JSON.stringify(theme)
+ }])(dispatch, getState).then(
+ (data) => {
+ if (data && onSuccess) {
+ onThemeSaved(teamId, theme, onSuccess);
+ } else if (data == null && onError) {
+ const serverError = getState().requests.users.savePreferences.error;
+ onError({id: serverError.server_error_id, ...serverError});
+ }
}
);
}
@@ -449,20 +437,15 @@ function onThemeSaved(teamId, theme, onSuccess) {
if (toDelete.length > 0) {
// we're saving a new global theme so delete any team-specific ones
- AsyncClient.deletePreferences(toDelete);
-
- // delete them locally before we hear from the server so that the UI flow is smoother
- AppDispatcher.handleServerAction({
- type: ActionTypes.DELETED_PREFERENCES,
- preferences: toDelete
- });
+ const currentUserId = UserStore.getCurrentId();
+ deletePreferences(currentUserId, toDelete)(dispatch, getState);
}
onSuccess();
}
export function searchUsers(term, teamId = TeamStore.getCurrentId(), options = {}, success) {
- searchProfiles(term, {team_id: teamId, ...options})(dispatch, getState).then(
+ UserActions.searchProfiles(term, {team_id: teamId, ...options})(dispatch, getState).then(
(data) => {
loadStatusesForProfilesList(data);
@@ -474,7 +457,7 @@ export function searchUsers(term, teamId = TeamStore.getCurrentId(), options = {
}
export function searchUsersNotInTeam(term, teamId = TeamStore.getCurrentId(), options = {}, success) {
- searchProfiles(term, {not_in_team_id: teamId, ...options})(dispatch, getState).then(
+ UserActions.searchProfiles(term, {not_in_team_id: teamId, ...options})(dispatch, getState).then(
(data) => {
loadStatusesForProfilesList(data);
@@ -488,7 +471,7 @@ export function searchUsersNotInTeam(term, teamId = TeamStore.getCurrentId(), op
export function autocompleteUsersInChannel(username, channelId, success) {
const channel = ChannelStore.get(channelId);
const teamId = channel ? channel.team_id : TeamStore.getCurrentId();
- autocompleteRedux(username, teamId, channelId)(dispatch, getState).then(
+ UserActions.autocompleteRedux(username, teamId, channelId)(dispatch, getState).then(
(data) => {
if (success) {
success(data);
@@ -498,7 +481,7 @@ export function autocompleteUsersInChannel(username, channelId, success) {
}
export function autocompleteUsersInTeam(username, success) {
- autocompleteRedux(username, TeamStore.getCurrentId())(dispatch, getState).then(
+ UserActions.autocompleteRedux(username, TeamStore.getCurrentId())(dispatch, getState).then(
(data) => {
if (success) {
success(data);
@@ -508,7 +491,7 @@ export function autocompleteUsersInTeam(username, success) {
}
export function autocompleteUsers(username, success) {
- autocompleteRedux(username)(dispatch, getState).then(
+ UserActions.autocompleteRedux(username)(dispatch, getState).then(
(data) => {
if (success) {
success(data);
@@ -518,7 +501,7 @@ export function autocompleteUsers(username, success) {
}
export function updateUser(user, type, success, error) {
- updateMe(user)(dispatch, getState).then(
+ UserActions.updateMe(user)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -531,24 +514,20 @@ export function updateUser(user, type, success, error) {
}
export function generateMfaSecret(success, error) {
- Client.generateMfaSecret(
+ UserActions.generateMfaSecret()(dispatch, getState).then(
(data) => {
- if (success) {
+ if (data && success) {
success(data);
- }
- },
- (err) => {
- AsyncClient.dispatchError(err, 'generateMfaSecret');
-
- if (error) {
- error(err);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.generateMfaSecret.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function updateUserNotifyProps(props, success, error) {
- updateMe({notify_props: props})(dispatch, getState).then(
+ UserActions.updateMe({notify_props: props})(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -561,7 +540,7 @@ export function updateUserNotifyProps(props, success, error) {
}
export function updateUserRoles(userId, newRoles, success, error) {
- updateUserRolesRedux(userId, newRoles)(dispatch, getState).then(
+ UserActions.updateUserRolesRedux(userId, newRoles)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -574,7 +553,7 @@ export function updateUserRoles(userId, newRoles, success, error) {
}
export function activateMfa(code, success, error) {
- updateUserMfa(UserStore.getCurrentId(), true, code)(dispatch, getState).then(
+ UserActions.updateUserMfa(UserStore.getCurrentId(), true, code)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -587,7 +566,7 @@ export function activateMfa(code, success, error) {
}
export function deactivateMfa(success, error) {
- updateUserMfa(UserStore.getCurrentId(), false)(dispatch, getState).then(
+ UserActions.updateUserMfa(UserStore.getCurrentId(), false)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -605,7 +584,7 @@ export function checkMfa(loginId, success, error) {
return;
}
- checkMfaRedux(loginId)(dispatch, getState).then(
+ UserActions.checkMfaRedux(loginId)(dispatch, getState).then(
(data) => {
if (data != null && success) {
success(data);
@@ -618,20 +597,20 @@ export function checkMfa(loginId, success, error) {
}
export function updateActive(userId, active, success, error) {
- Client.updateActive(userId, active,
+ UserActions.updateUserActive(userId, active)(dispatch, getState).then(
(data) => {
- UserStore.saveProfile(data);
-
- if (success) {
+ if (data && success) {
success(data);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.updateUser.error;
+ error({id: serverError.server_error_id, ...serverError});
}
- },
- error
+ }
);
}
export function updatePassword(userId, currentPassword, newPassword, success, error) {
- updateUserPassword(userId, currentPassword, newPassword)(dispatch, getState).then(
+ UserActions.updateUserPassword(userId, currentPassword, newPassword)(dispatch, getState).then(
(data) => {
if (data && success) {
success(data);
@@ -644,76 +623,68 @@ export function updatePassword(userId, currentPassword, newPassword, success, er
}
export function verifyEmail(token, success, error) {
- Client.verifyEmail(
- token,
+ UserActions.verifyUserEmail(token)(dispatch, getState).then(
(data) => {
- if (success) {
+ if (data && success) {
success(data);
- }
- },
- (err) => {
- if (error) {
- error(err);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.verifyEmail.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function resetPassword(token, password, success, error) {
- Client.resetPassword(
- token,
- password,
- () => {
- browserHistory.push('/login?extra=' + ActionTypes.PASSWORD_CHANGE);
-
- if (success) {
- success();
- }
- },
- (err) => {
- if (error) {
- error(err);
+ UserActions.resetUserPassword(token, password)(dispatch, getState).then(
+ (data) => {
+ if (data) {
+ browserHistory.push('/login?extra=' + ActionTypes.PASSWORD_CHANGE);
+ if (success) {
+ success(data);
+ }
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.passwordReset.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function resendVerification(email, success, error) {
- Client.resendVerification(
- email,
- () => {
- if (success) {
- success();
- }
- },
- (err) => {
- if (error) {
- error(err);
+ UserActions.sendVerificationEmail(email)(dispatch, getState).then(
+ (data) => {
+ if (data && success) {
+ success(data);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.verifyEmail.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function loginById(userId, password, mfaToken, success, error) {
- Client.loginById(
- userId,
- password,
- mfaToken,
- () => {
- if (success) {
+ UserActions.loginById(userId, password, mfaToken)(dispatch, getState).then(
+ (ok) => {
+ if (ok && success) {
success();
- }
- },
- (err) => {
- if (error) {
- error(err);
+ } else if (!ok && error) {
+ const serverError = getState().requests.users.login.error;
+ if (serverError.server_error_id === 'api.context.mfa_required.app_error') {
+ if (success) {
+ success();
+ }
+ return;
+ }
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function createUserWithInvite(user, data, emailHash, inviteId, success, error) {
- createUser(user, data, emailHash, inviteId)(dispatch, getState).then(
+ UserActions.createUser(user, data, emailHash, inviteId)(dispatch, getState).then(
(resp) => {
if (resp && success) {
success(resp);
@@ -726,7 +697,7 @@ export function createUserWithInvite(user, data, emailHash, inviteId, success, e
}
export function webLogin(loginId, password, token, success, error) {
- login(loginId, password, token)(dispatch, getState).then(
+ UserActions.login(loginId, password, token)(dispatch, getState).then(
(ok) => {
if (ok && success) {
success();
@@ -745,18 +716,19 @@ export function webLogin(loginId, password, token, success, error) {
}
export function webLoginByLdap(loginId, password, token, success, error) {
- Client.webLoginByLdap(
- loginId,
- password,
- token,
- (data) => {
- if (success) {
- success(data);
- }
- },
- (err) => {
- if (error) {
- error(err);
+ UserActions.login(loginId, password, token, true)(dispatch, getState).then(
+ (ok) => {
+ if (ok && success) {
+ success();
+ } else if (!ok && error) {
+ const serverError = getState().requests.users.login.error;
+ if (serverError.server_error_id === 'api.context.mfa_required.app_error') {
+ if (success) {
+ success();
+ }
+ return;
+ }
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
@@ -792,24 +764,20 @@ export function deauthorizeOAuthApp(appId, success, error) {
}
export function uploadProfileImage(userPicture, success, error) {
- Client.uploadProfileImage(
- userPicture,
- () => {
- getMe()(dispatch, getState);
- if (success) {
- success();
- }
- },
- (err) => {
- if (error) {
- error(err);
+ UserActions.uploadProfileImage(Selectors.getCurrentUserId(getState()), userPicture)(dispatch, getState).then(
+ (data) => {
+ if (data && success) {
+ success(data);
+ } else if (data == null && error) {
+ const serverError = getState().requests.users.updateUser.error;
+ error({id: serverError.server_error_id, ...serverError});
}
}
);
}
export function loadProfiles(page, perPage, success) {
- getProfiles(page, perPage)(dispatch, getState).then(
+ UserActions.getProfiles(page, perPage)(dispatch, getState).then(
(data) => {
if (success) {
success(data);
@@ -825,13 +793,13 @@ export function getMissingProfiles(ids) {
return;
}
- getProfilesByIds(missingIds)(dispatch, getState);
+ UserActions.getProfilesByIds(missingIds)(dispatch, getState);
}
export function loadMyTeamMembers() {
getMyTeamMembers()(dispatch, getState).then(
() => {
- AsyncClient.getMyTeamsUnread();
+ getMyTeamUnreads()(dispatch, getState);
}
);
}
@@ -839,7 +807,7 @@ export function loadMyTeamMembers() {
export function autoResetStatus() {
return async (doDispatch, doGetState) => {
const {currentUserId} = getState().entities.users;
- const userStatus = await getStatus(currentUserId)(doDispatch, doGetState);
+ const userStatus = await UserActions.getStatus(currentUserId)(doDispatch, doGetState);
if (!userStatus.manual) {
return userStatus;
@@ -848,7 +816,7 @@ export function autoResetStatus() {
const autoReset = getBool(getState(), PreferencesRedux.CATEGORY_AUTO_RESET_MANUAL_STATUS, currentUserId, false);
if (autoReset) {
- setStatus({user_id: currentUserId, status: 'online'})(doDispatch, doGetState);
+ UserActions.setStatus({user_id: currentUserId, status: 'online'})(doDispatch, doGetState);
return userStatus;
}
diff --git a/webapp/components/add_users_to_team/add_users_to_team.jsx b/webapp/components/add_users_to_team/add_users_to_team.jsx
index ed1a2a29c..691323568 100644
--- a/webapp/components/add_users_to_team/add_users_to_team.jsx
+++ b/webapp/components/add_users_to_team/add_users_to_team.jsx
@@ -12,7 +12,7 @@ import TeamStore from 'stores/team_store.jsx';
import Constants from 'utils/constants.jsx';
import {displayUsernameForUser} from 'utils/utils.jsx';
-import Client from 'client/web_client.jsx';
+import {Client4} from 'mattermost-redux/client';
import PropTypes from 'prop-types';
@@ -170,7 +170,7 @@ export default class AddUsersToTeam extends React.Component {
onClick={() => onAdd(option)}
>
<ProfilePicture
- src={`${Client.getUsersRoute()}/${option.id}/image?time=${option.last_picture_update}`}
+ src={Client4.getProfilePictureUrl(option.id, option.last_picture_update)}
width='32'
height='32'
/>
diff --git a/webapp/components/admin_console/manage_teams_modal/manage_teams_modal.jsx b/webapp/components/admin_console/manage_teams_modal/manage_teams_modal.jsx
index 9012c27e5..a579ab03c 100644
--- a/webapp/components/admin_console/manage_teams_modal/manage_teams_modal.jsx
+++ b/webapp/components/admin_console/manage_teams_modal/manage_teams_modal.jsx
@@ -9,7 +9,7 @@ import {FormattedMessage} from 'react-intl';
import * as TeamActions from 'actions/team_actions.jsx';
-import Client from 'client/web_client.jsx';
+import {Client4} from 'mattermost-redux/client';
import LoadingScreen from 'components/loading_screen.jsx';
@@ -184,7 +184,7 @@ export default class ManageTeamsModal extends React.Component {
<div className='manage-teams__user'>
<img
className='manage-teams__profile-picture'
- src={Client.getProfilePictureUrl(user.id, user.last_picture_update)}
+ src={Client4.getProfilePictureUrl(user.id, user.last_picture_update)}
/>
<div className='manage-teams__info'>
<div className='manage-teams__name'>
diff --git a/webapp/components/claim/components/oauth_to_email.jsx b/webapp/components/claim/components/oauth_to_email.jsx
index 5304de6e5..9944b3306 100644
--- a/webapp/components/claim/components/oauth_to_email.jsx
+++ b/webapp/components/claim/components/oauth_to_email.jsx
@@ -51,6 +51,7 @@ export default class OAuthToEmail extends React.Component {
this.setState(state);
oauthToEmail(
+ this.props.currentType,
this.props.email,
password,
null,
diff --git a/webapp/components/more_direct_channels/more_direct_channels.jsx b/webapp/components/more_direct_channels/more_direct_channels.jsx
index f4134f077..8b5b6d65c 100644
--- a/webapp/components/more_direct_channels/more_direct_channels.jsx
+++ b/webapp/components/more_direct_channels/more_direct_channels.jsx
@@ -12,7 +12,7 @@ import TeamStore from 'stores/team_store.jsx';
import Constants from 'utils/constants.jsx';
import {displayUsernameForUser} from 'utils/utils.jsx';
-import Client from 'client/web_client.jsx';
+import {Client4} from 'mattermost-redux/client';
import PropTypes from 'prop-types';
@@ -227,7 +227,7 @@ export default class MoreDirectChannels extends React.Component {
onClick={() => onAdd(option)}
>
<ProfilePicture
- src={`${Client.getUsersRoute()}/${option.id}/image?time=${option.last_picture_update}`}
+ src={Client4.getProfilePictureUrl(option.id, option.last_picture_update)}
status={`${UserStore.getStatus(option.id)}`}
width='32'
height='32'
diff --git a/webapp/components/popover_list_members/popover_list_members.jsx b/webapp/components/popover_list_members/popover_list_members.jsx
index 6a3fe737b..66242e607 100644
--- a/webapp/components/popover_list_members/popover_list_members.jsx
+++ b/webapp/components/popover_list_members/popover_list_members.jsx
@@ -13,7 +13,7 @@ import ChannelInviteModal from 'components/channel_invite_modal';
import {openDirectChannelToUser} from 'actions/channel_actions.jsx';
-import Client from 'client/web_client.jsx';
+import {Client4} from 'mattermost-redux/client';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import {canManageMembers} from 'utils/channel_utils.jsx';
@@ -132,7 +132,7 @@ export default class PopoverListMembers extends React.Component {
key={'popover-member-' + i}
>
<ProfilePicture
- src={`${Client.getUsersRoute()}/${m.id}/image?time=${m.last_picture_update}`}
+ src={Client4.getProfilePictureUrl(m.id, m.last_picture_update)}
width='26'
height='26'
/>
diff --git a/webapp/components/sidebar_header.jsx b/webapp/components/sidebar_header.jsx
index 51885d152..287945bc5 100644
--- a/webapp/components/sidebar_header.jsx
+++ b/webapp/components/sidebar_header.jsx
@@ -1,9 +1,8 @@
-import PropTypes from 'prop-types';
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
+import PropTypes from 'prop-types';
import PreferenceStore from 'stores/preference_store.jsx';
import * as Utils from 'utils/utils.jsx';
diff --git a/webapp/components/status_dropdown/index.jsx b/webapp/components/status_dropdown/index.jsx
index bd2f7d7d0..e200b2e34 100644
--- a/webapp/components/status_dropdown/index.jsx
+++ b/webapp/components/status_dropdown/index.jsx
@@ -5,7 +5,7 @@ import {
getCurrentUser,
getStatusForUserId
} from 'mattermost-redux/selectors/entities/users';
-import {Client} from 'mattermost-redux/client';
+import {Client4} from 'mattermost-redux/client';
import StatusDropdown from 'components/status_dropdown/status_dropdown.jsx';
@@ -13,7 +13,7 @@ function mapStateToProps(state) {
const currentUser = getCurrentUser(state);
const userId = currentUser.id;
const lastPicUpdate = currentUser.last_picture_update;
- const profilePicture = Client.getProfilePictureUrl(userId, lastPicUpdate);
+ const profilePicture = Client4.getProfilePictureUrl(userId, lastPicUpdate);
const status = getStatusForUserId(state, currentUser.id);
return {
userId,
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 1755bc675..fea8eb6a2 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -4884,7 +4884,7 @@ math-expression-evaluator@^1.2.14:
mattermost-redux@mattermost/mattermost-redux#webapp-master:
version "0.0.1"
- resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/dc9c164de3153a4c33922a8a3f996490e8949e02"
+ resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/1ba6245017789943d286443b95fd75d651437df7"
dependencies:
deep-equal "1.0.1"
harmony-reflect "1.5.1"
@@ -6048,7 +6048,7 @@ react-bootstrap@0.31.0:
uncontrollable "^4.1.0"
warning "^3.0.0"
-react-color@^2.11.7:
+react-color@2.11.7:
version "2.11.7"
resolved "https://registry.yarnpkg.com/react-color/-/react-color-2.11.7.tgz#746465b75feda63c2567607dfbcb276fc954a5b7"
dependencies: