add icon to member info to indicate all devices of a user are trusted

pull/21833/head
Bruno Windels 2019-02-01 17:08:09 +01:00
parent 48c0e5a3ac
commit 21fe266394
3 changed files with 27 additions and 4 deletions

View File

@ -26,6 +26,10 @@ limitations under the License.
display: flex;
}
.mx_MemberInfo_name > .mx_E2EIcon {
margin-left: 0;
}
.mx_MemberInfo_cancel {
height: 16px;
padding: 10px 15px;

View File

@ -27,9 +27,13 @@ export default function(props) {
}, props.className);
let e2eTitle;
if (isWarning) {
e2eTitle = _t("Some devices in this encrypted room are not trusted");
e2eTitle = props.isUser ?
_t("Some devices for this user are not trusted") :
_t("Some devices in this encrypted room are not trusted");
} else if (isVerified) {
e2eTitle = _t("All devices in this encrypted room are trusted");
e2eTitle = props.isUser ?
_t("All devices for this user are trusted") :
_t("All devices in this encrypted room are trusted");
}
return (<div className={e2eIconClasses} title={e2eTitle} />);
}

View File

@ -43,6 +43,7 @@ import RoomViewStore from '../../../stores/RoomViewStore';
import SdkConfig from '../../../SdkConfig';
import MultiInviter from "../../../utils/MultiInviter";
import SettingsStore from "../../../settings/SettingsStore";
import E2EIcon from "./E2EIcon";
module.exports = withMatrixClient(React.createClass({
displayName: 'MemberInfo',
@ -153,11 +154,19 @@ module.exports = withMatrixClient(React.createClass({
// Promise.resolve to handle transition from static result to promise; can be removed
// in future
Promise.resolve(this.props.matrixClient.getStoredDevicesForUser(userId)).then((devices) => {
this.setState({devices: devices});
this.setState({
devices: devices,
e2eStatus: this._getE2EStatus(devices),
});
});
}
},
_getE2EStatus: function(devices) {
const hasUnverifiedDevice = devices.some((device) => device.isUnverified());
return hasUnverifiedDevice ? "warning" : "verified";
},
onRoom: function(room) {
this.forceUpdate();
},
@ -234,8 +243,13 @@ module.exports = withMatrixClient(React.createClass({
// we got cancelled - presumably a different user now
return;
}
self._disambiguateDevices(devices);
self.setState({devicesLoading: false, devices: devices});
self.setState({
devicesLoading: false,
devices: devices,
e2eStatus: self._getE2EStatus(devices),
});
}, function(err) {
console.log("Error downloading devices", err);
self.setState({devicesLoading: false});
@ -965,6 +979,7 @@ module.exports = withMatrixClient(React.createClass({
<AccessibleButton className="mx_MemberInfo_cancel" onClick={this.onCancel}>
<img src={require("../../../../res/img/minimise.svg")} width="10" height="16" className="mx_filterFlipColor" alt={_t('Close')} />
</AccessibleButton>
{ this.state.e2eStatus ? <E2EIcon status={this.state.e2eStatus} isUser={true} /> : undefined }
<EmojiText element="h2">{ memberName }</EmojiText>
</div>
{ avatarElement }