Merge branch 'develop' into wmwragg/one-to-one-chat
This commit is contained in:
commit
9c0f51fb82
15 changed files with 285 additions and 112 deletions
|
@ -57,12 +57,14 @@ module.exports = React.createClass({
|
|||
}
|
||||
},
|
||||
|
||||
onConferenceNotificationClick: function() {
|
||||
onConferenceNotificationClick: function(ev, type) {
|
||||
dis.dispatch({
|
||||
action: 'place_call',
|
||||
type: "video",
|
||||
type: type,
|
||||
room_id: this.props.room.roomId,
|
||||
});
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -85,14 +87,20 @@ module.exports = React.createClass({
|
|||
|
||||
var conferenceCallNotification = null;
|
||||
if (this.props.displayConfCallNotification) {
|
||||
var supportedText;
|
||||
var supportedText, joinText;
|
||||
if (!MatrixClientPeg.get().supportsVoip()) {
|
||||
supportedText = " (unsupported)";
|
||||
}
|
||||
else {
|
||||
joinText = (<span>
|
||||
Join as <a onClick={(event)=>{ this.onConferenceNotificationClick(event, 'voice')}} href="#">voice</a>
|
||||
or <a onClick={(event)=>{ this.onConferenceNotificationClick(event, 'video') }} href="#">video</a>.
|
||||
</span>);
|
||||
|
||||
}
|
||||
conferenceCallNotification = (
|
||||
<div className="mx_RoomView_ongoingConfCallNotification"
|
||||
onClick={this.onConferenceNotificationClick}>
|
||||
Ongoing conference call {supportedText}
|
||||
<div className="mx_RoomView_ongoingConfCallNotification">
|
||||
Ongoing conference call{ supportedText }. { joinText }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,43 +14,45 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
var React = require('react');
|
||||
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
||||
import React from 'react';
|
||||
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'MemberDeviceInfo',
|
||||
propTypes: {
|
||||
userId: React.PropTypes.string.isRequired,
|
||||
device: React.PropTypes.object.isRequired,
|
||||
},
|
||||
export default class MemberDeviceInfo extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onVerifyClick = this.onVerifyClick.bind(this);
|
||||
this.onUnverifyClick = this.onUnverifyClick.bind(this);
|
||||
this.onBlockClick = this.onBlockClick.bind(this);
|
||||
this.onUnblockClick = this.onUnblockClick.bind(this);
|
||||
}
|
||||
|
||||
onVerifyClick: function() {
|
||||
onVerifyClick() {
|
||||
MatrixClientPeg.get().setDeviceVerified(
|
||||
this.props.userId, this.props.device.id, true
|
||||
this.props.userId, this.props.device.deviceId, true
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
onUnverifyClick: function() {
|
||||
onUnverifyClick() {
|
||||
MatrixClientPeg.get().setDeviceVerified(
|
||||
this.props.userId, this.props.device.id, false
|
||||
this.props.userId, this.props.device.deviceId, false
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
onBlockClick: function() {
|
||||
onBlockClick() {
|
||||
MatrixClientPeg.get().setDeviceBlocked(
|
||||
this.props.userId, this.props.device.id, true
|
||||
this.props.userId, this.props.device.deviceId, true
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
onUnblockClick: function() {
|
||||
onUnblockClick() {
|
||||
MatrixClientPeg.get().setDeviceBlocked(
|
||||
this.props.userId, this.props.device.id, false
|
||||
this.props.userId, this.props.device.deviceId, false
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
render: function() {
|
||||
render() {
|
||||
var indicator = null, blockButton = null, verifyButton = null;
|
||||
if (this.props.device.blocked) {
|
||||
if (this.props.device.isBlocked()) {
|
||||
blockButton = (
|
||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unblock"
|
||||
onClick={this.onUnblockClick}>
|
||||
|
@ -66,7 +68,7 @@ module.exports = React.createClass({
|
|||
);
|
||||
}
|
||||
|
||||
if (this.props.device.verified) {
|
||||
if (this.props.device.isVerified()) {
|
||||
verifyButton = (
|
||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unverify"
|
||||
onClick={this.onUnverifyClick}>
|
||||
|
@ -82,22 +84,22 @@ module.exports = React.createClass({
|
|||
);
|
||||
}
|
||||
|
||||
if (this.props.device.blocked) {
|
||||
if (this.props.device.isBlocked()) {
|
||||
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 = (
|
||||
<div className="mx_MemberDeviceInfo_verified">✔</div>
|
||||
<div className="mx_MemberDeviceInfo_verified">Verified</div>
|
||||
);
|
||||
|
||||
} else {
|
||||
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 (
|
||||
<div className="mx_MemberDeviceInfo">
|
||||
|
@ -107,5 +109,11 @@ module.exports = React.createClass({
|
|||
{blockButton}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
MemberDeviceInfo.displayName = 'MemberDeviceInfo';
|
||||
MemberDeviceInfo.propTypes = {
|
||||
userId: React.PropTypes.string.isRequired,
|
||||
device: React.PropTypes.object.isRequired,
|
||||
};
|
||||
|
|
|
@ -159,7 +159,7 @@ module.exports = React.createClass({
|
|||
if (userId == this.props.member.userId) {
|
||||
// no need to re-download the whole thing; just update our copy of
|
||||
// the list.
|
||||
var devices = MatrixClientPeg.get().listDeviceKeys(userId);
|
||||
var devices = MatrixClientPeg.get().getStoredDevicesForUser(userId);
|
||||
this.setState({devices: devices});
|
||||
}
|
||||
},
|
||||
|
@ -195,7 +195,7 @@ module.exports = React.createClass({
|
|||
// we got cancelled - presumably a different user now
|
||||
return;
|
||||
}
|
||||
var devices = client.listDeviceKeys(member.userId);
|
||||
var devices = client.getStoredDevicesForUser(member.userId);
|
||||
self.setState({devicesLoading: false, devices: devices});
|
||||
}, function(err) {
|
||||
console.log("Error downloading devices", err);
|
||||
|
|
|
@ -65,7 +65,6 @@ module.exports = React.createClass({
|
|||
// Default to false if it's undefined, otherwise react complains about changing
|
||||
// components from uncontrolled to controlled
|
||||
isRoomPublished: this._originalIsRoomPublished || false,
|
||||
scalar_token: null,
|
||||
scalar_error: null,
|
||||
};
|
||||
},
|
||||
|
@ -81,11 +80,16 @@ module.exports = React.createClass({
|
|||
console.error("Failed to get room visibility: " + err);
|
||||
});
|
||||
|
||||
this.getScalarToken().done((token) => {
|
||||
this.setState({scalar_token: token});
|
||||
}, (err) => {
|
||||
this.setState({scalar_error: err});
|
||||
});
|
||||
if (UserSettingsStore.isFeatureEnabled("integration_management")) {
|
||||
this.scalarClient = new ScalarAuthClient();
|
||||
this.scalarClient.connect().done(() => {
|
||||
this.forceUpdate();
|
||||
}, (err) => {
|
||||
this.setState({
|
||||
scalar_error: err
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
dis.dispatch({
|
||||
action: 'ui_opacity',
|
||||
|
@ -249,7 +253,7 @@ module.exports = React.createClass({
|
|||
var roomId = this.props.room.roomId;
|
||||
return MatrixClientPeg.get().sendStateEvent(
|
||||
roomId, "m.room.encryption",
|
||||
{ algorithm: "m.olm.v1.curve25519-aes-sha2" }
|
||||
{ algorithm: "m.megolm.v1.aes-sha2" }
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -395,34 +399,13 @@ module.exports = React.createClass({
|
|||
roomState.mayClientSendStateEvent("m.room.guest_access", cli))
|
||||
},
|
||||
|
||||
getScalarInterfaceUrl: function() {
|
||||
var url = SdkConfig.get().integrations_ui_url;
|
||||
url += "?scalar_token=" + encodeURIComponent(this.state.scalar_token);
|
||||
url += "&room_id=" + encodeURIComponent(this.props.room.roomId);
|
||||
return url;
|
||||
},
|
||||
|
||||
getScalarToken() {
|
||||
var tok = window.localStorage.getItem("mx_scalar_token");
|
||||
if (tok) return q(tok);
|
||||
|
||||
// No saved token, so do the dance to get one. First, we
|
||||
// need an openid bearer token from the HS.
|
||||
return MatrixClientPeg.get().getOpenIdToken().then((token_object) => {
|
||||
// Now we can send that to scalar and exchange it for a scalar token
|
||||
var scalar_auth_client = new ScalarAuthClient();
|
||||
return scalar_auth_client.getScalarToken(token_object);
|
||||
}).then((token_object) => {
|
||||
window.localStorage.setItem("mx_scalar_token", token_object);
|
||||
return token_object;
|
||||
});
|
||||
},
|
||||
|
||||
onManageIntegrations(ev) {
|
||||
ev.preventDefault();
|
||||
var IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager");
|
||||
Modal.createDialog(IntegrationsManager, {
|
||||
src: this.state.scalar_token ? this.getScalarInterfaceUrl() : null
|
||||
src: this.scalarClient.hasCredentials() ?
|
||||
this.scalarClient.getScalarInterfaceUrlForRoom(this.props.room.roomId) :
|
||||
null
|
||||
}, "");
|
||||
},
|
||||
|
||||
|
@ -649,7 +632,7 @@ module.exports = React.createClass({
|
|||
if (UserSettingsStore.isFeatureEnabled("integration_management")) {
|
||||
let integrations_body;
|
||||
|
||||
if (this.state.scalar_token) {
|
||||
if (this.scalarClient.hasCredentials()) {
|
||||
integrations_body = (
|
||||
<div className="mx_RoomSettings_settings">
|
||||
<a href="#" onClick={ this.onManageIntegrations }>Manage integrations</a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue