Convering client to react-router.
Этот коммит содержится в:
@@ -5,6 +5,7 @@ import SettingItemMax from '../setting_item_max.jsx';
|
||||
|
||||
import * as Client from '../../utils/client.jsx';
|
||||
import * as Utils from '../../utils/utils.jsx';
|
||||
import * as GlobalActions from '../../action_creators/global_actions.jsx';
|
||||
|
||||
import {FormattedMessage} from 'mm-intl';
|
||||
|
||||
@@ -41,7 +42,7 @@ export default class ManageLanguage extends React.Component {
|
||||
submitUser(user) {
|
||||
Client.updateUser(user,
|
||||
() => {
|
||||
window.location.reload(true);
|
||||
GlobalActions.newLocalizationSelected(user.locale);
|
||||
},
|
||||
(err) => {
|
||||
let serverError;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import SettingItemMin from '../setting_item_min.jsx';
|
||||
import SettingItemMax from '../setting_item_max.jsx';
|
||||
import * as EventHelpers from '../../dispatcher/event_helpers.jsx';
|
||||
import * as GlobalActions from '../../action_creators/global_actions.jsx';
|
||||
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl';
|
||||
|
||||
@@ -28,7 +28,7 @@ class DeveloperTab extends React.Component {
|
||||
}
|
||||
register() {
|
||||
this.props.closeModal();
|
||||
EventHelpers.showRegisterAppModal();
|
||||
GlobalActions.showRegisterAppModal();
|
||||
}
|
||||
render() {
|
||||
var appSection;
|
||||
|
||||
@@ -13,7 +13,7 @@ import Constants from '../../utils/constants.jsx';
|
||||
import * as AsyncClient from '../../utils/async_client.jsx';
|
||||
import * as Utils from '../../utils/utils.jsx';
|
||||
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl';
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedDate} from 'mm-intl';
|
||||
|
||||
const holders = defineMessages({
|
||||
usernameReserved: {
|
||||
@@ -712,7 +712,7 @@ class UserSettingsGeneralTab extends React.Component {
|
||||
<SettingPicture
|
||||
title={formatMessage(holders.profilePicture)}
|
||||
submit={this.submitPicture}
|
||||
src={'/api/v1/users/' + user.id + '/image?time=' + user.last_picture_update + '&' + Utils.getSessionIndex()}
|
||||
src={'/api/v1/users/' + user.id + '/image?time=' + user.last_picture_update}
|
||||
server_error={serverError}
|
||||
client_error={clientError}
|
||||
updateSection={(e) => {
|
||||
@@ -729,7 +729,14 @@ class UserSettingsGeneralTab extends React.Component {
|
||||
let minMessage = formatMessage(holders.uploadImage);
|
||||
if (user.last_picture_update) {
|
||||
minMessage = formatMessage(holders.imageUpdated, {
|
||||
date: new Date(user.last_picture_update).toLocaleDateString(global.window.mm_locale, {month: 'short', day: '2-digit', year: 'numeric'})
|
||||
date: (
|
||||
<FormattedDate
|
||||
value={new Date(user.last_picture_update)}
|
||||
day='2-digit'
|
||||
month='short'
|
||||
year='numeric'
|
||||
/>
|
||||
)
|
||||
});
|
||||
}
|
||||
pictureSection = (
|
||||
@@ -805,4 +812,4 @@ UserSettingsGeneralTab.propTypes = {
|
||||
collapseModal: React.PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default injectIntl(UserSettingsGeneralTab);
|
||||
export default injectIntl(UserSettingsGeneralTab);
|
||||
|
||||
@@ -73,27 +73,35 @@ class UserSettingsModal extends React.Component {
|
||||
|
||||
this.updateTab = this.updateTab.bind(this);
|
||||
this.updateSection = this.updateSection.bind(this);
|
||||
this.onUserChanged = this.onUserChanged.bind(this);
|
||||
|
||||
this.state = {
|
||||
active_tab: 'general',
|
||||
active_section: '',
|
||||
showConfirmModal: false,
|
||||
enforceFocus: true
|
||||
enforceFocus: true,
|
||||
currentUser: UserStore.getCurrentUser()
|
||||
};
|
||||
|
||||
this.requireConfirm = false;
|
||||
}
|
||||
|
||||
onUserChanged() {
|
||||
this.setState({currentUser: UserStore.getCurrentUser()});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.show) {
|
||||
this.handleShow();
|
||||
}
|
||||
UserStore.addChangeListener(this.onUserChanged);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (this.props.show && !prevProps.show) {
|
||||
this.handleShow();
|
||||
}
|
||||
UserStore.removeChangeListener(this.onUserChanged);
|
||||
}
|
||||
|
||||
handleShow() {
|
||||
@@ -235,8 +243,10 @@ class UserSettingsModal extends React.Component {
|
||||
|
||||
render() {
|
||||
const {formatMessage} = this.props.intl;
|
||||
var currentUser = UserStore.getCurrentUser();
|
||||
var isAdmin = Utils.isAdmin(currentUser.roles);
|
||||
if (this.state.currentUser == null) {
|
||||
return (<div/>);
|
||||
}
|
||||
var isAdmin = Utils.isAdmin(this.state.currentUser.roles);
|
||||
var tabs = [];
|
||||
|
||||
tabs.push({name: 'general', uiName: formatMessage(holders.general), icon: 'glyphicon glyphicon-cog'});
|
||||
|
||||
@@ -14,7 +14,7 @@ import * as AsyncClient from '../../utils/async_client.jsx';
|
||||
import * as Utils from '../../utils/utils.jsx';
|
||||
import Constants from '../../utils/constants.jsx';
|
||||
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl';
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedTime, FormattedDate} from 'mm-intl';
|
||||
|
||||
const holders = defineMessages({
|
||||
currentPasswordError: {
|
||||
@@ -218,11 +218,24 @@ class SecurityTab extends React.Component {
|
||||
var describe;
|
||||
var d = new Date(this.props.user.last_password_update);
|
||||
|
||||
const locale = global.window.mm_locale;
|
||||
const hours12 = !Utils.isMilitaryTime();
|
||||
describe = formatMessage(holders.lastUpdated, {
|
||||
date: d.toLocaleDateString(locale, {month: 'short', day: '2-digit', year: 'numeric'}),
|
||||
time: d.toLocaleTimeString(locale, {hour12: hours12, hour: '2-digit', minute: '2-digit'})
|
||||
date: (
|
||||
<FormattedDate
|
||||
value={d}
|
||||
day='2-digit'
|
||||
month='short'
|
||||
year='numeric'
|
||||
/>
|
||||
),
|
||||
time: (
|
||||
<FormattedTime
|
||||
value={d}
|
||||
hour12={hours12}
|
||||
hour='2-digit'
|
||||
minute='2-digit'
|
||||
/>
|
||||
)
|
||||
});
|
||||
|
||||
updateSectionStatus = function updateSection() {
|
||||
@@ -251,7 +264,7 @@ class SecurityTab extends React.Component {
|
||||
<div>
|
||||
<a
|
||||
className='btn btn-primary'
|
||||
href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email)}
|
||||
href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='user.settings.security.switchEmail'
|
||||
@@ -269,7 +282,7 @@ class SecurityTab extends React.Component {
|
||||
<div>
|
||||
<a
|
||||
className='btn btn-primary'
|
||||
href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&new_type=' + Constants.GITLAB_SERVICE}
|
||||
href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service + '&new_type=' + Constants.GITLAB_SERVICE}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='user.settings.security.switchGitlab'
|
||||
@@ -287,7 +300,7 @@ class SecurityTab extends React.Component {
|
||||
<div>
|
||||
<a
|
||||
className='btn btn-primary'
|
||||
href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&new_type=' + Constants.GOOGLE_SERVICE}
|
||||
href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service + '&new_type=' + Constants.GOOGLE_SERVICE}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='user.settings.security.switchGoogle'
|
||||
@@ -456,4 +469,4 @@ SecurityTab.propTypes = {
|
||||
setEnforceFocus: React.PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default injectIntl(SecurityTab);
|
||||
export default injectIntl(SecurityTab);
|
||||
|
||||
Ссылка в новой задаче
Block a user