Merge pull request #441 from matrix-org/rav/get_stored_devices_for_user
Make MemberInfo to use client.getStoredDevicesForUserpull/21833/head
commit
31e09e6137
|
@ -28,31 +28,31 @@ export default class MemberDeviceInfo extends React.Component {
|
||||||
|
|
||||||
onVerifyClick() {
|
onVerifyClick() {
|
||||||
MatrixClientPeg.get().setDeviceVerified(
|
MatrixClientPeg.get().setDeviceVerified(
|
||||||
this.props.userId, this.props.device.id, true
|
this.props.userId, this.props.device.deviceId, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onUnverifyClick() {
|
onUnverifyClick() {
|
||||||
MatrixClientPeg.get().setDeviceVerified(
|
MatrixClientPeg.get().setDeviceVerified(
|
||||||
this.props.userId, this.props.device.id, false
|
this.props.userId, this.props.device.deviceId, false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlockClick() {
|
onBlockClick() {
|
||||||
MatrixClientPeg.get().setDeviceBlocked(
|
MatrixClientPeg.get().setDeviceBlocked(
|
||||||
this.props.userId, this.props.device.id, true
|
this.props.userId, this.props.device.deviceId, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onUnblockClick() {
|
onUnblockClick() {
|
||||||
MatrixClientPeg.get().setDeviceBlocked(
|
MatrixClientPeg.get().setDeviceBlocked(
|
||||||
this.props.userId, this.props.device.id, false
|
this.props.userId, this.props.device.deviceId, false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var indicator = null, blockButton = null, verifyButton = null;
|
var indicator = null, blockButton = null, verifyButton = null;
|
||||||
if (this.props.device.blocked) {
|
if (this.props.device.isBlocked()) {
|
||||||
blockButton = (
|
blockButton = (
|
||||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unblock"
|
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unblock"
|
||||||
onClick={this.onUnblockClick}>
|
onClick={this.onUnblockClick}>
|
||||||
|
@ -68,7 +68,7 @@ export default class MemberDeviceInfo extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.device.verified) {
|
if (this.props.device.isVerified()) {
|
||||||
verifyButton = (
|
verifyButton = (
|
||||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unverify"
|
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unverify"
|
||||||
onClick={this.onUnverifyClick}>
|
onClick={this.onUnverifyClick}>
|
||||||
|
@ -84,22 +84,22 @@ export default class MemberDeviceInfo extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.device.blocked) {
|
if (this.props.device.isBlocked()) {
|
||||||
indicator = (
|
indicator = (
|
||||||
<div className="mx_MemberDeviceInfo_blocked">✖</div>
|
<div className="mx_MemberDeviceInfo_blocked">Blocked</div>
|
||||||
);
|
);
|
||||||
} else if (this.props.device.verified) {
|
} else if (this.props.device.isVerified()) {
|
||||||
indicator = (
|
indicator = (
|
||||||
<div className="mx_MemberDeviceInfo_verified">✔</div>
|
<div className="mx_MemberDeviceInfo_verified">Verified</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
indicator = (
|
indicator = (
|
||||||
<div className="mx_MemberDeviceInfo_unverified">?</div>
|
<div className="mx_MemberDeviceInfo_unverified">Unverified</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var deviceName = this.props.device.display_name || this.props.device.id;
|
var deviceName = this.props.device.display_name || this.props.device.deviceId;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_MemberDeviceInfo">
|
<div className="mx_MemberDeviceInfo">
|
||||||
|
|
|
@ -159,7 +159,7 @@ module.exports = React.createClass({
|
||||||
if (userId == this.props.member.userId) {
|
if (userId == this.props.member.userId) {
|
||||||
// no need to re-download the whole thing; just update our copy of
|
// no need to re-download the whole thing; just update our copy of
|
||||||
// the list.
|
// the list.
|
||||||
var devices = MatrixClientPeg.get().listDeviceKeys(userId);
|
var devices = MatrixClientPeg.get().getStoredDevicesForUser(userId);
|
||||||
this.setState({devices: devices});
|
this.setState({devices: devices});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -195,7 +195,7 @@ module.exports = React.createClass({
|
||||||
// we got cancelled - presumably a different user now
|
// we got cancelled - presumably a different user now
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var devices = client.listDeviceKeys(member.userId);
|
var devices = client.getStoredDevicesForUser(member.userId);
|
||||||
self.setState({devicesLoading: false, devices: devices});
|
self.setState({devicesLoading: false, devices: devices});
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.log("Error downloading devices", err);
|
console.log("Error downloading devices", err);
|
||||||
|
|
Loading…
Reference in New Issue