mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Merge pull request #442 from matrix-org/rav/e2e_devices
Convert MemberDeviceInfo to ES6 class
This commit is contained in:
commit
922fb448c5
@ -14,41 +14,43 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var React = require('react');
|
import React from 'react';
|
||||||
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
|
|
||||||
module.exports = React.createClass({
|
export default class MemberDeviceInfo extends React.Component {
|
||||||
displayName: 'MemberDeviceInfo',
|
constructor(props) {
|
||||||
propTypes: {
|
super(props);
|
||||||
userId: React.PropTypes.string.isRequired,
|
this.onVerifyClick = this.onVerifyClick.bind(this);
|
||||||
device: React.PropTypes.object.isRequired,
|
this.onUnverifyClick = this.onUnverifyClick.bind(this);
|
||||||
},
|
this.onBlockClick = this.onBlockClick.bind(this);
|
||||||
|
this.onUnblockClick = this.onUnblockClick.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
onVerifyClick: function() {
|
onVerifyClick() {
|
||||||
MatrixClientPeg.get().setDeviceVerified(
|
MatrixClientPeg.get().setDeviceVerified(
|
||||||
this.props.userId, this.props.device.id, true
|
this.props.userId, this.props.device.id, true
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
onUnverifyClick: function() {
|
onUnverifyClick() {
|
||||||
MatrixClientPeg.get().setDeviceVerified(
|
MatrixClientPeg.get().setDeviceVerified(
|
||||||
this.props.userId, this.props.device.id, false
|
this.props.userId, this.props.device.id, false
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
onBlockClick: function() {
|
onBlockClick() {
|
||||||
MatrixClientPeg.get().setDeviceBlocked(
|
MatrixClientPeg.get().setDeviceBlocked(
|
||||||
this.props.userId, this.props.device.id, true
|
this.props.userId, this.props.device.id, true
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
onUnblockClick: function() {
|
onUnblockClick() {
|
||||||
MatrixClientPeg.get().setDeviceBlocked(
|
MatrixClientPeg.get().setDeviceBlocked(
|
||||||
this.props.userId, this.props.device.id, false
|
this.props.userId, this.props.device.id, false
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
render: function() {
|
render() {
|
||||||
var indicator = null, blockButton = null, verifyButton = null;
|
var indicator = null, blockButton = null, verifyButton = null;
|
||||||
if (this.props.device.blocked) {
|
if (this.props.device.blocked) {
|
||||||
blockButton = (
|
blockButton = (
|
||||||
@ -107,5 +109,11 @@ module.exports = React.createClass({
|
|||||||
{blockButton}
|
{blockButton}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
MemberDeviceInfo.displayName = 'MemberDeviceInfo';
|
||||||
|
MemberDeviceInfo.propTypes = {
|
||||||
|
userId: React.PropTypes.string.isRequired,
|
||||||
|
device: React.PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user