merge develop

This commit is contained in:
Matthew Hodgson 2016-03-16 14:37:12 +00:00
commit 90aa4223f2
7 changed files with 52 additions and 10 deletions

View file

@ -191,7 +191,7 @@ module.exports = React.createClass({
}
},
_registerAsGuest: function() {
_registerAsGuest: function(showWarning) {
var self = this;
console.log("Doing guest login on %s", this.getCurrentHsUrl());
var hsUrl = this.getCurrentHsUrl();
@ -209,6 +209,13 @@ module.exports = React.createClass({
guest: true
});
}, function(err) {
if (showWarning) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Failed to login as guest",
description: err.data
});
}
console.error("Failed to register as guest: " + err + " " + err.data);
self._setAutoRegisterAsGuest(false);
});
@ -1096,7 +1103,7 @@ module.exports = React.createClass({
customHsUrl={this.getCurrentHsUrl()}
customIsUrl={this.getCurrentIsUrl()}
onForgotPasswordClick={this.onForgotPasswordClick}
onLoginAsGuestClick={this.props.enableGuest && this.props.config && this.props.config.default_hs_url ? this._registerAsGuest: undefined}
onLoginAsGuestClick={this.props.enableGuest && this.props.config && this.props.config.default_hs_url ? this._registerAsGuest.bind(this, true) : undefined}
onCancelClick={ this.state.guestCreds ? this.onReturnToGuestClick : null }
/>
);

View file

@ -1217,11 +1217,10 @@ module.exports = React.createClass({
/>
);
}
else if (this.state.canPeek &&
(!myMember || myMember.membership !== "join")) {
else if (!myMember || myMember.membership !== "join") {
aux = (
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true}
spinner={this.state.joining}
spinner={this.state.joining} canPreview={ this.state.canPeek }
/>
);
}

View file

@ -19,7 +19,7 @@ var ReactDOM = require("react-dom");
var GeminiScrollbar = require('react-gemini-scrollbar');
var q = require("q");
var DEBUG_SCROLL = true;
var DEBUG_SCROLL = false;
if (DEBUG_SCROLL) {
// using bind means that we get to keep useful line numbers in the console

View file

@ -90,6 +90,15 @@ module.exports = React.createClass({
},
onAvatarPickerClick: function(ev) {
if (MatrixClientPeg.get().isGuest()) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Error",
description: "Guests can't set avatars. Please register.",
});
return;
}
if (this.refs.file_label) {
this.refs.file_label.click();
}
@ -271,7 +280,7 @@ module.exports = React.createClass({
var addThreepidSection;
if (this.state.email_add_pending) {
addThreepidSection = <Loader />;
} else {
} else if (!MatrixClientPeg.get().isGuest()) {
addThreepidSection = (
<div className="mx_UserSettings_profileTableRow" key="new">
<div className="mx_UserSettings_profileLabelCell">