Merge remote-tracking branch 'origin/develop' into dbkr/scalar

This commit is contained in:
David Baker 2016-05-17 10:30:32 +01:00
commit ffe892b4b1
3 changed files with 45 additions and 4 deletions

View file

@ -335,8 +335,14 @@ module.exports = {
input = input.replace(/\s+$/, "");
if (input[0] === "/" && input[1] !== "/") {
var bits = input.match(/^(\S+?)( +(.*))?$/);
var cmd = bits[1].substring(1).toLowerCase();
var args = bits[3];
var cmd, args;
if (bits) {
cmd = bits[1].substring(1).toLowerCase();
args = bits[3];
}
else {
cmd = input;
}
if (cmd === "me") return null;
if (aliases[cmd]) {
cmd = aliases[cmd];

View file

@ -77,4 +77,39 @@ module.exports = {
return cli.setPassword(authDict, new_password);
},
/**
* Returns the email pusher (pusher of type 'email') for a given
* email address. Email pushers all have the same app ID, so since
* pushers are unique over (app ID, pushkey), there will be at most
* one such pusher.
*/
getEmailPusher: function(pushers, address) {
if (pushers === undefined) {
return undefined;
}
for (var i = 0; i < pushers.length; ++i) {
if (pushers[i].kind == 'email' && pushers[i].pushkey == address) {
return pushers[i];
}
}
return undefined;
},
hasEmailPusher: function(pushers, address) {
return this.getEmailPusher(pushers, address) !== undefined;
},
addEmailPusher: function(address) {
return MatrixClientPeg.get().setPusher({
kind: 'email',
app_id: "m.email",
pushkey: address,
app_display_name: 'Email Notifications',
device_display_name: address,
lang: navigator.language,
data: {},
append: true, // We always append for email pushers since we don't want to stop other accounts notifying to the same email address
});
},
};

View file

@ -328,12 +328,12 @@ module.exports = React.createClass({
);
}
var notification_area;
if (!MatrixClientPeg.get().isGuest()) {
if (!MatrixClientPeg.get().isGuest() && this.state.threepids !== undefined) {
notification_area = (<div>
<h3>Notifications</h3>
<div className="mx_UserSettings_section">
<Notifications/>
<Notifications threepids={this.state.threepids} />
</div>
</div>);
}