mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 03:01:30 +03:00
Add room intro warning when e2ee is not enabled
This commit is contained in:
parent
dd8abb0206
commit
fa534e4755
3 changed files with 41 additions and 0 deletions
|
@ -69,4 +69,24 @@ limitations under the License.
|
|||
font-size: $font-15px;
|
||||
color: $secondary-fg-color;
|
||||
}
|
||||
|
||||
.mx_NewRoomIntro_message:not(:first-child) {
|
||||
padding-top: 1em;
|
||||
margin-top: 1em;
|
||||
border-top: 1px solid currentColor;
|
||||
}
|
||||
|
||||
.mx_NewRoomIntro_message[role=alert]::before {
|
||||
--size: 25px;
|
||||
content: "!";
|
||||
float: left;
|
||||
border-radius: 50%;
|
||||
width: var(--size);
|
||||
height: var(--size);
|
||||
line-height: var(--size);
|
||||
text-align: center;
|
||||
background: $button-danger-bg-color;
|
||||
color: #fff;
|
||||
margin-right: calc(var(--size) / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,14 @@ import dis from "../../../dispatcher/dispatcher";
|
|||
import SpaceStore from "../../../stores/SpaceStore";
|
||||
import {showSpaceInvite} from "../../../utils/space";
|
||||
|
||||
import { privateShouldBeEncrypted } from "../../../createRoom";
|
||||
|
||||
function hasExpectedEncryptionSettings(room): boolean {
|
||||
const isEncrypted: boolean = room._client.isRoomEncrypted(room.roomId);
|
||||
const isPublic: boolean = room.getJoinRule() === "public";
|
||||
return isPublic || !privateShouldBeEncrypted() || isEncrypted;
|
||||
}
|
||||
|
||||
const NewRoomIntro = () => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
const {room, roomId} = useContext(RoomContext);
|
||||
|
@ -168,6 +176,18 @@ const NewRoomIntro = () => {
|
|||
|
||||
return <div className="mx_NewRoomIntro">
|
||||
{ body }
|
||||
|
||||
{ !hasExpectedEncryptionSettings(room) && <p className="mx_NewRoomIntro_message" role="alert">
|
||||
{_t("Messages in this room are not end-to-end encrypted. " +
|
||||
"Messages sent in an unencrypted room can be seen by the server and third parties. " +
|
||||
"<a>Learn more about encryption.</a>", {},
|
||||
{
|
||||
a: sub => <a href="https://element.io/help#encryption"
|
||||
rel="noreferrer noopener" target="_blank"
|
||||
>{sub}</a>,
|
||||
})}
|
||||
|
||||
</p>}
|
||||
</div>;
|
||||
};
|
||||
|
||||
|
|
|
@ -1490,6 +1490,7 @@
|
|||
"Invite to just this room": "Invite to just this room",
|
||||
"Add a photo, so people can easily spot your room.": "Add a photo, so people can easily spot your room.",
|
||||
"This is the start of <roomName/>.": "This is the start of <roomName/>.",
|
||||
"Messages in this room are not end-to-end encrypted. Messages sent in an unencrypted room can be seen by the server and third parties. <a>Learn more about encryption.</a>": "Messages in this room are not end-to-end encrypted. Messages sent in an unencrypted room can be seen by the server and third parties. <a>Learn more about encryption.</a>",
|
||||
"No pinned messages.": "No pinned messages.",
|
||||
"Loading...": "Loading...",
|
||||
"Pinned Messages": "Pinned Messages",
|
||||
|
|
Loading…
Reference in a new issue