Skip to content

Commit

Permalink
fix: E2EI Device status displaying (#17032)
Browse files Browse the repository at this point in the history
* fix: E2EI Device status displaying

* improvements

* rename from not_downloaded to not_activated
  • Loading branch information
przemvs committed Mar 11, 2024
1 parent 4bf3e8f commit 068b5d1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/script/components/userDevices/DeviceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const DeviceDetails = ({

return (
<div className={cx('participant-devices__header', {'participant-devices__header--padding': !noPadding})}>
{deviceIdentity && <MLSDeviceDetails identity={deviceIdentity} />}
{deviceIdentity && <MLSDeviceDetails identity={deviceIdentity} isSelfUser={user.isMe} />}

<div className="device-proteus-details">
<h3 className="device-details-title paragraph-body-3">{t('participantDevicesProteusDeviceVerification')}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const DetailedDevice: React.FC<DeviceProps> = ({
<DeviceVerificationBadges device={device} getIdentity={getIdentity} />
</h3>

{getIdentity && <MLSDeviceDetails isCurrentDevice={isCurrentDevice} identity={getIdentity()} />}
{getIdentity && <MLSDeviceDetails isCurrentDevice={isCurrentDevice} identity={getIdentity()} isSelfUser />}

<ProteusDeviceDetails device={device} fingerprint={fingerprint} isProteusVerified={isProteusVerified} />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const Device = ({device, isSSO, onSelect, onRemove, getDeviceIdentity, de
<DeviceVerificationBadges device={device} getIdentity={getDeviceIdentity} />
</div>

{deviceIdentity && (
{deviceIdentity?.thumbprint && (
<p className="preferences-devices-id">
<span>{t('preferencesMLSThumbprint')}</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

import {WireIdentity} from 'src/script/E2EIdentity';
import {MLSStatuses, WireIdentity} from 'src/script/E2EIdentity';
import {t} from 'Util/LocalizerUtil';
import {splitFingerprint} from 'Util/StringUtil';

Expand All @@ -30,15 +30,24 @@ import {FormattedId} from '../FormattedId';
interface MLSDeviceDetailsProps {
isCurrentDevice?: boolean;
identity?: WireIdentity;
isSelfUser?: boolean;
}

export const MLSDeviceDetails = ({isCurrentDevice, identity}: MLSDeviceDetailsProps) => {
export const MLSDeviceDetails = ({isCurrentDevice, identity, isSelfUser = false}: MLSDeviceDetailsProps) => {
if (!isCurrentDevice && !identity) {
return null;
}

const certificateState = identity?.status ?? MLSStatuses.NOT_ACTIVATED;

if (!isSelfUser && certificateState === MLSStatuses.NOT_ACTIVATED) {
return null;
}

return (
<div css={styles.wrapper}>
<h4 className="paragraph-body-3">{t('mlsSignature', MLSPublicKeys.ED25519.toUpperCase())}</h4>

{identity?.thumbprint && (
<>
<p className="label-2 preferences-label preferences-devices-fingerprint-label">{t('mlsThumbprint')}</p>
Expand All @@ -48,7 +57,10 @@ export const MLSDeviceDetails = ({isCurrentDevice, identity}: MLSDeviceDetailsPr
</p>
</>
)}
<E2EICertificateDetails identity={identity} isCurrentDevice={isCurrentDevice} />

{(isSelfUser || (!isSelfUser && certificateState !== MLSStatuses.NOT_ACTIVATED)) && (
<E2EICertificateDetails identity={identity} isCurrentDevice={isCurrentDevice} />
)}
</div>
);
};

0 comments on commit 068b5d1

Please sign in to comment.