Merge up from develop
This commit is contained in:
commit
524eeaa315
27 changed files with 780 additions and 171 deletions
|
@ -188,7 +188,10 @@ module.exports = React.createClass({
|
|||
for (let i = 0; i < dmRooms.length; i++) {
|
||||
let room = MatrixClientPeg.get().getRoom(dmRooms[i]);
|
||||
if (room) {
|
||||
return room;
|
||||
const me = room.getMember(MatrixClientPeg.get().credentials.userId);
|
||||
if (me.membership == 'join') {
|
||||
return room;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,6 +224,17 @@ module.exports = React.createClass({
|
|||
})
|
||||
.done();
|
||||
}
|
||||
// // Start the chat
|
||||
// createRoom({dmUserId: addr})
|
||||
// .catch(function(err) {
|
||||
// var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
// Modal.createDialog(ErrorDialog, {
|
||||
// title: "Failure to invite user",
|
||||
// description: err.toString()
|
||||
// });
|
||||
// return null;
|
||||
// })
|
||||
// .done();
|
||||
|
||||
// Close - this will happen before the above, as that is async
|
||||
this.props.onFinished(true, addr);
|
||||
|
|
123
src/components/views/dialogs/EncryptedEventDialog.js
Normal file
123
src/components/views/dialogs/EncryptedEventDialog.js
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
Copyright 2015, 2016 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 React = require("react");
|
||||
var sdk = require('../../../index');
|
||||
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'EncryptedEventDialog',
|
||||
|
||||
propTypes: {
|
||||
onFinished: React.PropTypes.func,
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
var client = MatrixClientPeg.get();
|
||||
client.on("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
var client = MatrixClientPeg.get();
|
||||
if (client) {
|
||||
client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
||||
}
|
||||
},
|
||||
|
||||
refreshDevice: function() {
|
||||
// XXX: gutwrench - is there any reason not to expose this on MatrixClient itself?
|
||||
return MatrixClientPeg.get()._crypto.getDeviceByIdentityKey(
|
||||
this.props.event.getSender(),
|
||||
this.props.event.getWireContent().algorithm,
|
||||
this.props.event.getWireContent().sender_key
|
||||
);
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return { device: this.refreshDevice() };
|
||||
},
|
||||
|
||||
onDeviceVerificationChanged: function(userId, device) {
|
||||
if (userId == this.props.event.getSender()) {
|
||||
this.setState({ device: this.refreshDevice() });
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var event = this.props.event;
|
||||
var device = this.state.device;
|
||||
|
||||
var MemberDeviceInfo = sdk.getComponent('rooms.MemberDeviceInfo');
|
||||
|
||||
return (
|
||||
<div className="mx_EncryptedEventDialog">
|
||||
<div className="mx_Dialog_title">
|
||||
End-to-end encryption information
|
||||
</div>
|
||||
<div className="mx_Dialog_content">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Sent by</td>
|
||||
<td>{ event.getSender() }</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sender device name</td>
|
||||
<td>{ device.getDisplayName() }</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sender device ID</td>
|
||||
<td>{ device.deviceId }</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sender device verification:</td>
|
||||
<td>{ MatrixClientPeg.get().isEventSenderVerified(event) ? "verified" : <b>NOT verified</b> }</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sender device ed25519 fingerprint</td>
|
||||
<td>{ device.getFingerprint() }</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sender device curve25519 identity key</td>
|
||||
<td>{ event.getWireContent().sender_key }</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Algorithm</td>
|
||||
<td>{ event.getWireContent().algorithm }</td>
|
||||
</tr>
|
||||
{
|
||||
event.getContent().msgtype === 'm.bad.encrypted' ? (
|
||||
<tr>
|
||||
<td>Decryption error</td>
|
||||
<td>{ event.getContent().body }</td>
|
||||
</tr>
|
||||
) : ''
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="mx_Dialog_buttons">
|
||||
<button className="mx_Dialog_primary" onClick={ this.props.onFinished } autoFocus={ true }>
|
||||
OK
|
||||
</button>
|
||||
<MemberDeviceInfo ref="memberDeviceInfo" hideInfo={true} device={ this.state.device } userId={ this.props.event.getSender() }/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -18,6 +18,11 @@ var dis = require("../../../dispatcher");
|
|||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'LogoutPrompt',
|
||||
|
||||
propTypes: {
|
||||
onFinished: React.PropTypes.func,
|
||||
},
|
||||
|
||||
logOut: function() {
|
||||
dis.dispatch({action: 'logout'});
|
||||
if (this.props.onFinished) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue