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

@ -78,6 +78,9 @@ function textForMemberEvent(ev) {
if (ConferenceHandler && ConferenceHandler.isConferenceUser(ev.getStateKey())) {
return "VoIP conference finished";
}
else if (ev.getPrevContent().membership === "invite") {
return targetName + " rejected the invitation.";
}
else {
return targetName + " left the room.";
}
@ -151,6 +154,28 @@ function textForThreePidInviteEvent(event) {
" to join the room.";
};
function textForHistoryVisibilityEvent(event) {
var senderName = event.sender ? event.sender.name : event.getSender();
var vis = event.getContent().history_visibility;
var text = senderName + " made future room history visible to ";
if (vis === "invited") {
text += "all room members, from the point they are invited.";
}
else if (vis === "joined") {
text += "all room members, from the point they joined.";
}
else if (vis === "shared") {
text += "all room members.";
}
else if (vis === "world_readable") {
text += "anyone.";
}
else {
text += " unknown (" + vis + ")";
}
return text;
};
var handlers = {
'm.room.message': textForMessageEvent,
'm.room.name': textForRoomNameEvent,
@ -159,7 +184,8 @@ var handlers = {
'm.call.invite': textForCallInviteEvent,
'm.call.answer': textForCallAnswerEvent,
'm.call.hangup': textForCallHangupEvent,
'm.room.third_party_invite': textForThreePidInviteEvent
'm.room.third_party_invite': textForThreePidInviteEvent,
'm.room.history_visibility': textForHistoryVisibilityEvent,
};
module.exports = {

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">

View file

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

View file

@ -450,7 +450,7 @@ module.exports = React.createClass({
<input type="radio" id="hvis_sh" name="historyVis" value="shared"
defaultChecked={historyVisibility === "shared"}
onChange={this._onHistoryRadioToggle} />
Members only (since the room began)
Members only (since the point in time of selecting this option)
</label>
<label htmlFor="hvis_inv">
<input type="radio" id="hvis_inv" name="historyVis" value="invited"