Merge pull request #1590 from rgarmsen2295/plt-169
PLT-169 Fixes issue where cancelling a change in notification settings would not be reflected in the minimized section
Этот коммит содержится в:
@@ -78,7 +78,9 @@ export default class NotificationsTab extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
|
this.handleCancel = this.handleCancel.bind(this);
|
||||||
this.updateSection = this.updateSection.bind(this);
|
this.updateSection = this.updateSection.bind(this);
|
||||||
|
this.updateState = this.updateState.bind(this);
|
||||||
this.onListenerChange = this.onListenerChange.bind(this);
|
this.onListenerChange = this.onListenerChange.bind(this);
|
||||||
this.handleNotifyRadio = this.handleNotifyRadio.bind(this);
|
this.handleNotifyRadio = this.handleNotifyRadio.bind(this);
|
||||||
this.handleEmailRadio = this.handleEmailRadio.bind(this);
|
this.handleEmailRadio = this.handleEmailRadio.bind(this);
|
||||||
@@ -128,10 +130,21 @@ export default class NotificationsTab extends React.Component {
|
|||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
handleCancel(e) {
|
||||||
|
this.updateState();
|
||||||
|
this.props.updateSection('');
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
updateSection(section) {
|
updateSection(section) {
|
||||||
this.setState(getNotificationsStateFromStores());
|
this.updateState();
|
||||||
this.props.updateSection(section);
|
this.props.updateSection(section);
|
||||||
}
|
}
|
||||||
|
updateState() {
|
||||||
|
const newState = getNotificationsStateFromStores();
|
||||||
|
if (!Utils.areObjectsEqual(newState, this.state)) {
|
||||||
|
this.setState(newState);
|
||||||
|
}
|
||||||
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
UserStore.addChangeListener(this.onListenerChange);
|
UserStore.addChangeListener(this.onListenerChange);
|
||||||
}
|
}
|
||||||
@@ -139,10 +152,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
UserStore.removeChangeListener(this.onListenerChange);
|
UserStore.removeChangeListener(this.onListenerChange);
|
||||||
}
|
}
|
||||||
onListenerChange() {
|
onListenerChange() {
|
||||||
var newState = getNotificationsStateFromStores();
|
this.updateState();
|
||||||
if (!Utils.areObjectsEqual(newState, this.state)) {
|
|
||||||
this.setState(newState);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
handleNotifyRadio(notifyLevel) {
|
handleNotifyRadio(notifyLevel) {
|
||||||
this.setState({notifyLevel: notifyLevel});
|
this.setState({notifyLevel: notifyLevel});
|
||||||
@@ -245,11 +255,6 @@ export default class NotificationsTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleUpdateDesktopSection = function updateDesktopSection(e) {
|
|
||||||
this.props.updateSection('');
|
|
||||||
e.preventDefault();
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
const extraInfo = <span>{'Desktop notifications are available on Firefox, Safari, and Chrome.'}</span>;
|
const extraInfo = <span>{'Desktop notifications are available on Firefox, Safari, and Chrome.'}</span>;
|
||||||
|
|
||||||
desktopSection = (
|
desktopSection = (
|
||||||
@@ -259,7 +264,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleSubmit}
|
submit={this.handleSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
updateSection={handleUpdateDesktopSection}
|
updateSection={this.handleCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -324,11 +329,6 @@ export default class NotificationsTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleUpdateSoundSection = function updateSoundSection(e) {
|
|
||||||
this.props.updateSection('');
|
|
||||||
e.preventDefault();
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
const extraInfo = <span>{'Desktop notification sounds are available on Firefox, Safari, Chrome, Internet Explorer, and Edge.'}</span>;
|
const extraInfo = <span>{'Desktop notification sounds are available on Firefox, Safari, Chrome, Internet Explorer, and Edge.'}</span>;
|
||||||
|
|
||||||
soundSection = (
|
soundSection = (
|
||||||
@@ -338,7 +338,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleSubmit}
|
submit={this.handleSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
updateSection={handleUpdateSoundSection}
|
updateSection={this.handleCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -405,18 +405,13 @@ export default class NotificationsTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleUpdateEmailSection = function updateEmailSection(e) {
|
|
||||||
this.props.updateSection('');
|
|
||||||
e.preventDefault();
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
emailSection = (
|
emailSection = (
|
||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title='Email notifications'
|
title='Email notifications'
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleSubmit}
|
submit={this.handleSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
updateSection={handleUpdateEmailSection}
|
updateSection={this.handleCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -566,17 +561,13 @@ export default class NotificationsTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleUpdateKeysSection = function updateKeysSection(e) {
|
|
||||||
this.props.updateSection('');
|
|
||||||
e.preventDefault();
|
|
||||||
}.bind(this);
|
|
||||||
keysSection = (
|
keysSection = (
|
||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title='Words that trigger mentions'
|
title='Words that trigger mentions'
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleSubmit}
|
submit={this.handleSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
updateSection={handleUpdateKeysSection}
|
updateSection={this.handleCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -653,7 +644,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
ref='wrapper'
|
ref='wrapper'
|
||||||
className='user-settings'
|
className='user-settings'
|
||||||
>
|
>
|
||||||
<h3 className='tab-header'>Notifications</h3>
|
<h3 className='tab-header'>{'Notifications'}</h3>
|
||||||
<div className='divider-dark first'/>
|
<div className='divider-dark first'/>
|
||||||
{desktopSection}
|
{desktopSection}
|
||||||
<div className='divider-light'/>
|
<div className='divider-light'/>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user