-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Degraded Conversation - plain indication
- Loading branch information
Showing
23 changed files
with
351 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...components/MessagesList/Message/E2EIVerificationMessage/E2EIVerificationMessage.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2022 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
import {CSSObject} from '@emotion/react'; | ||
|
||
export const MessageIcon: CSSObject = { | ||
alignItems: 'center', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
|
||
maxHeight: 'var(--avatar-diameter-s)', | ||
width: 'var(--conversation-message-sender-width)', | ||
}; | ||
|
||
export const IconInfo: CSSObject = { | ||
fill: 'var(--red-500)', | ||
}; |
52 changes: 52 additions & 0 deletions
52
.../components/MessagesList/Message/E2EIVerificationMessage/E2EIVerificationMessage.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2021 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
import {render} from '@testing-library/react'; | ||
import ko from 'knockout'; | ||
|
||
import {E2EIVerificationMessage as VerificationMessageEntity} from 'src/script/entity/message/E2EIVerificationMessage'; | ||
import {E2EIVerificationMessageType} from 'src/script/message/E2EIVerificationMessageType'; | ||
|
||
import {E2EIVerificationMessage} from './E2EIVerificationMessage'; | ||
|
||
import {withTheme} from '../../../../auth/util/test/TestUtil'; | ||
|
||
const createVerificationMessage = (partialVerificationMessage: Partial<VerificationMessageEntity>) => { | ||
const verificationMessage: Partial<VerificationMessageEntity> = { | ||
...partialVerificationMessage, | ||
}; | ||
return verificationMessage as VerificationMessageEntity; | ||
}; | ||
|
||
describe('E2EIVerificationMessage', () => { | ||
describe('with verified message', () => { | ||
it('shows verified icon when message is verified', async () => { | ||
const message = createVerificationMessage({ | ||
messageType: ko.observable<E2EIVerificationMessageType>(E2EIVerificationMessageType.VERIFIED), | ||
}); | ||
|
||
const {getByTestId} = render(withTheme(<E2EIVerificationMessage message={message} />)); | ||
|
||
const elementMessageVerification = getByTestId('element-message-verification'); | ||
expect(elementMessageVerification.getAttribute('data-uie-value')).toEqual(E2EIVerificationMessageType.VERIFIED); | ||
}); | ||
}); | ||
|
||
// TODO: Add more test for another e2ei verification states | ||
}); |
106 changes: 106 additions & 0 deletions
106
...cript/components/MessagesList/Message/E2EIVerificationMessage/E2EIVerificationMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
import {MLSVerified} from '@wireapp/react-ui-kit'; | ||
|
||
import {Icon} from 'Components/Icon'; | ||
import {useKoSubscribableChildren} from 'Util/ComponentUtil'; | ||
import {replaceLink, t} from 'Util/LocalizerUtil'; | ||
|
||
import {MessageIcon, IconInfo} from './E2EIVerificationMessage.styles'; | ||
|
||
import {Config} from '../../../../Config'; | ||
import {E2EIVerificationMessage as E2EIVerificationMessageEntity} from '../../../../entity/message/E2EIVerificationMessage'; | ||
import {E2EIVerificationMessageType} from '../../../../message/E2EIVerificationMessageType'; | ||
|
||
export interface E2EIVerificationMessageProps { | ||
message: E2EIVerificationMessageEntity; | ||
} | ||
|
||
export const E2EIVerificationMessage = ({message}: E2EIVerificationMessageProps) => { | ||
const {messageType} = useKoSubscribableChildren(message, ['messageType']); | ||
|
||
const user = 'Deniz Agha'; | ||
|
||
const isVerified = messageType === E2EIVerificationMessageType.VERIFIED; | ||
const isUnverified = messageType === E2EIVerificationMessageType.UNVERIFIED; | ||
const isNewDevice = messageType === E2EIVerificationMessageType.NEW_DEVICE; | ||
const isNewMember = messageType === E2EIVerificationMessageType.NEW_MEMBER; | ||
const isDegraded = messageType === E2EIVerificationMessageType.DEGRADED; | ||
|
||
const learnMoreReplacement = replaceLink(Config.getConfig().URL.SUPPORT.E2EI_VERIFICATION); | ||
|
||
return ( | ||
<div className="message-header"> | ||
<div css={MessageIcon}> | ||
{isVerified ? ( | ||
<MLSVerified data-uie-name="conversation-title-bar-verified-icon" /> | ||
) : ( | ||
<Icon.Info css={IconInfo} /> | ||
)} | ||
</div> | ||
|
||
<div | ||
className="message-header-label message-header-label--verification" | ||
data-uie-name="element-message-verification" | ||
data-uie-value={messageType} | ||
> | ||
{isVerified && ( | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: t('tooltipConversationAllE2EIVerified', {}, learnMoreReplacement), | ||
}} | ||
/> | ||
)} | ||
|
||
{isNewDevice && ( | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: t('tooltipConversationAllE2EINewDeviceAdded', {user}), | ||
}} | ||
/> | ||
)} | ||
|
||
{isNewMember && ( | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: t('tooltipConversationAllE2EINewUserAdded', {user}), | ||
}} | ||
/> | ||
)} | ||
|
||
{isUnverified && ( | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: t('tooltipConversationAllE2EINewUserAdded', {user}), | ||
}} | ||
/> | ||
)} | ||
|
||
{isDegraded && ( | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: t('tooltipConversationAllE2EICertificateRevoked', {user}, learnMoreReplacement), | ||
}} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/script/components/MessagesList/Message/E2EIVerificationMessage/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
export * from './E2EIVerificationMessage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.