Merge branch 'develop' into matthew/settings

This commit is contained in:
Matthew Hodgson 2015-12-18 00:14:36 +00:00
commit 272d7362fb
7 changed files with 57 additions and 12 deletions

View File

@ -1,3 +1,19 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var MatrixClientPeg = require('./MatrixClientPeg'); var MatrixClientPeg = require('./MatrixClientPeg');
var dis = require('./dispatcher'); var dis = require('./dispatcher');

View File

@ -116,8 +116,17 @@ class Register extends Signup {
_tryRegister(authDict) { _tryRegister(authDict) {
var self = this; var self = this;
var bindEmail;
if (this.username && this.password) {
// only need to bind_email when sending u/p - sending it at other
// times clobbers the u/p resulting in M_MISSING_PARAM (password)
bindEmail = true;
}
return MatrixClientPeg.get().register( return MatrixClientPeg.get().register(
this.username, this.password, this.params.sessionId, authDict this.username, this.password, this.params.sessionId, authDict, bindEmail
).then(function(result) { ).then(function(result) {
self.credentials = result; self.credentials = result;
self.setStep("COMPLETE"); self.setStep("COMPLETE");

View File

@ -9,7 +9,17 @@ function textForMemberEvent(ev) {
) : ""; ) : "";
switch (ev.getContent().membership) { switch (ev.getContent().membership) {
case 'invite': case 'invite':
var threePidContent = ev.getContent().third_party_invite;
if (threePidContent) {
// TODO: When we have third_party_invite.display_name we should
// do this as "$displayname received the invitation from $sender"
// or equiv
return targetName + " received an invitation from " + senderName +
".";
}
else {
return senderName + " invited " + targetName + "."; return senderName + " invited " + targetName + ".";
}
case 'ban': case 'ban':
return senderName + " banned " + targetName + "." + reason; return senderName + " banned " + targetName + "." + reason;
case 'join': case 'join':
@ -101,6 +111,12 @@ function textForCallInviteEvent(event) {
return senderName + " placed a " + type + " call." + supported; return senderName + " placed a " + type + " call." + supported;
}; };
function textForThreePidInviteEvent(event) {
var senderName = event.sender ? event.sender.name : event.getSender();
return senderName + " sent an invitation to " + event.getContent().display_name +
" to join the room.";
};
var handlers = { var handlers = {
'm.room.message': textForMessageEvent, 'm.room.message': textForMessageEvent,
'm.room.name': textForRoomNameEvent, 'm.room.name': textForRoomNameEvent,
@ -109,6 +125,7 @@ var handlers = {
'm.call.invite': textForCallInviteEvent, 'm.call.invite': textForCallInviteEvent,
'm.call.answer': textForCallAnswerEvent, 'm.call.answer': textForCallAnswerEvent,
'm.call.hangup': textForCallHangupEvent, 'm.call.hangup': textForCallHangupEvent,
'm.room.third_party_invite': textForThreePidInviteEvent
}; };
module.exports = { module.exports = {

View File

@ -41,7 +41,8 @@ module.exports = React.createClass({
config: React.PropTypes.object.isRequired, config: React.PropTypes.object.isRequired,
ConferenceHandler: React.PropTypes.any, ConferenceHandler: React.PropTypes.any,
onNewScreen: React.PropTypes.func, onNewScreen: React.PropTypes.func,
registrationUrl: React.PropTypes.string registrationUrl: React.PropTypes.string,
startingQueryParams: React.PropTypes.object
}, },
PageTypes: { PageTypes: {
@ -75,6 +76,12 @@ module.exports = React.createClass({
return s; return s;
}, },
getDefaultProps: function() {
return {
startingQueryParams: {}
};
},
componentDidMount: function() { componentDidMount: function() {
this.dispatcherRef = dis.register(this.onAction); this.dispatcherRef = dis.register(this.onAction);
if (this.state.logged_in) { if (this.state.logged_in) {
@ -706,6 +713,7 @@ module.exports = React.createClass({
clientSecret={this.state.register_client_secret} clientSecret={this.state.register_client_secret}
sessionId={this.state.register_session_id} sessionId={this.state.register_session_id}
idSid={this.state.register_id_sid} idSid={this.state.register_id_sid}
email={this.props.startingQueryParams.email}
hsUrl={this.props.config.default_hs_url} hsUrl={this.props.config.default_hs_url}
isUrl={this.props.config.default_is_url} isUrl={this.props.config.default_is_url}
registrationUrl={this.props.registrationUrl} registrationUrl={this.props.registrationUrl}

View File

@ -318,11 +318,7 @@ module.exports = React.createClass({
if (this.state.searchResults) return; if (this.state.searchResults) return;
if (this.needsScrollReset) {
if (DEBUG_SCROLL) console.log("Resetting scroll position after tile count change");
this._restoreSavedScrollState(); this._restoreSavedScrollState();
this.needsScrollReset = false;
}
// have to fill space in case we're accepting an invite // have to fill space in case we're accepting an invite
if (!this.state.paginating) this.fillSpace(); if (!this.state.paginating) this.fillSpace();
@ -683,10 +679,6 @@ module.exports = React.createClass({
} }
++count; ++count;
} }
if (count != this.lastEventTileCount) {
if (DEBUG_SCROLL) console.log("Queuing scroll reset (event count changed; now "+count+"; was "+this.lastEventTileCount+")");
this.needsScrollReset = true;
}
this.lastEventTileCount = count; this.lastEventTileCount = count;
return ret; return ret;
}, },

View File

@ -39,6 +39,7 @@ module.exports = React.createClass({
idSid: React.PropTypes.string, idSid: React.PropTypes.string,
hsUrl: React.PropTypes.string, hsUrl: React.PropTypes.string,
isUrl: React.PropTypes.string, isUrl: React.PropTypes.string,
email: React.PropTypes.string,
// registration shouldn't know or care how login is done. // registration shouldn't know or care how login is done.
onLoginClick: React.PropTypes.func.isRequired onLoginClick: React.PropTypes.func.isRequired
}, },
@ -185,6 +186,7 @@ module.exports = React.createClass({
registerStep = ( registerStep = (
<RegistrationForm <RegistrationForm
showEmail={true} showEmail={true}
defaultEmail={this.props.email}
minPasswordLength={MIN_PASSWORD_LENGTH} minPasswordLength={MIN_PASSWORD_LENGTH}
onError={this.onFormValidationFailed} onError={this.onFormValidationFailed}
onRegisterClick={this.onFormSubmit} /> onRegisterClick={this.onFormSubmit} />

View File

@ -44,6 +44,7 @@ var eventTileTypes = {
'm.call.hangup' : 'messages.TextualEvent', 'm.call.hangup' : 'messages.TextualEvent',
'm.room.name' : 'messages.TextualEvent', 'm.room.name' : 'messages.TextualEvent',
'm.room.topic' : 'messages.TextualEvent', 'm.room.topic' : 'messages.TextualEvent',
'm.room.third_party_invite': 'messages.TextualEvent'
}; };
var MAX_READ_AVATARS = 5; var MAX_READ_AVATARS = 5;