General code cleanup / tweaks / fixes
- Swap Phases enum to be using string literals - Swap roomId prop on UserSettings for a more sane onUserSettingsClose and make MatrixChat responsible for swapping the room. - s/then/done/ when terminating Promise chains to avoid subtle errors. - Rejig render() of UserSettings so we don't need to indent quite so much.
This commit is contained in:
@@ -17,19 +17,10 @@ limitations under the License.
|
||||
'use strict';
|
||||
|
||||
var MatrixClientPeg = require("./MatrixClientPeg");
|
||||
var sdk = require('./index');
|
||||
|
||||
// XXX: should we be doing something here to use this as a singleton rather than
|
||||
// class methods?
|
||||
var Notifier = require("./Notifier");
|
||||
|
||||
module.exports = {
|
||||
|
||||
// we add these wrappers to the js-sdk here in case we want to do react-specific
|
||||
// dispatches or similar in future, and to give us a place to clearly separate
|
||||
// business logic specific from the 'thin' react component and parent wiring component
|
||||
// which actually handles the UI.
|
||||
// XXX: I'm not convinced this abstraction is worth it though.
|
||||
|
||||
loadProfileInfo: function() {
|
||||
var cli = MatrixClientPeg.get();
|
||||
return cli.getProfileInfo(cli.credentials.userId);
|
||||
@@ -48,13 +39,10 @@ module.exports = {
|
||||
},
|
||||
|
||||
getEnableNotifications: function() {
|
||||
var Notifier = sdk.getComponent('organisms.Notifier');
|
||||
return Notifier.isEnabled();
|
||||
},
|
||||
|
||||
setEnableNotifications: function(enable) {
|
||||
var Notifier = sdk.getComponent('organisms.Notifier');
|
||||
var self = this;
|
||||
if (!Notifier.supportsDesktopNotifications()) {
|
||||
return;
|
||||
}
|
||||
@@ -70,11 +58,6 @@ module.exports = {
|
||||
password: old_password
|
||||
};
|
||||
|
||||
this.setState({
|
||||
phase: this.Phases.Uploading,
|
||||
errorString: '',
|
||||
})
|
||||
|
||||
return cli.setPassword(authDict, new_password);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user