PLT-4257 Add pop-up asking if user wants to reset status (#6526)
* Add pop-up asking if user wants to reset status * Update test snapshot * Update prop name for old uses of confirm modal * Updating checkbox (#6586) * Updating style for checkbox (#6596)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
02f09b8af9
Коммит
6e7b912ec6
@@ -26,6 +26,7 @@ const dispatch = store.dispatch;
|
||||
const getState = store.getState;
|
||||
|
||||
import * as Selectors from 'mattermost-redux/selectors/entities/users';
|
||||
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
|
||||
|
||||
import {
|
||||
getProfiles,
|
||||
@@ -43,12 +44,15 @@ import {
|
||||
createUser,
|
||||
login,
|
||||
loadMe as loadMeRedux,
|
||||
updateUserRoles as updateUserRolesRedux
|
||||
updateUserRoles as updateUserRolesRedux,
|
||||
getStatus,
|
||||
setStatus
|
||||
} from 'mattermost-redux/actions/users';
|
||||
|
||||
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
|
||||
import {getTeamMembersByIds, getMyTeamMembers} from 'mattermost-redux/actions/teams';
|
||||
import {getChannelAndMyMember} from 'mattermost-redux/actions/channels';
|
||||
import {Preferences as PreferencesRedux} from 'mattermost-redux/constants';
|
||||
|
||||
export function loadMe(callback) {
|
||||
loadMeRedux()(dispatch, getState).then(
|
||||
@@ -831,3 +835,23 @@ export function loadMyTeamMembers() {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function autoResetStatus() {
|
||||
return async (doDispatch, doGetState) => {
|
||||
const {currentUserId} = getState().entities.users;
|
||||
const userStatus = await getStatus(currentUserId)(doDispatch, doGetState);
|
||||
|
||||
if (!userStatus.manual) {
|
||||
return userStatus;
|
||||
}
|
||||
|
||||
const autoReset = getBool(getState(), PreferencesRedux.CATEGORY_AUTO_RESET_MANUAL_STATUS, currentUserId, false);
|
||||
|
||||
if (autoReset) {
|
||||
setStatus({user_id: currentUserId, status: 'online'})(doDispatch, doGetState);
|
||||
return userStatus;
|
||||
}
|
||||
|
||||
return userStatus;
|
||||
};
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user