show when e2ee is enabled in timeline

This commit is contained in:
Bruno Windels 2020-09-14 15:44:07 +02:00
parent 8c4d68def9
commit aa5d55bbf2
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,28 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import {SimpleTile} from "./SimpleTile.js";
export class EncryptionEnabledTile extends SimpleTile {
get shape() {
return "announcement";
}
get announcement() {
const senderName = this._entry.displayName || this._entry.sender;
return this.i18n`${senderName} has enabled end-to-end encryption`;
}
}

View file

@ -21,6 +21,7 @@ import {LocationTile} from "./tiles/LocationTile.js";
import {RoomNameTile} from "./tiles/RoomNameTile.js"; import {RoomNameTile} from "./tiles/RoomNameTile.js";
import {RoomMemberTile} from "./tiles/RoomMemberTile.js"; import {RoomMemberTile} from "./tiles/RoomMemberTile.js";
import {EncryptedEventTile} from "./tiles/EncryptedEventTile.js"; import {EncryptedEventTile} from "./tiles/EncryptedEventTile.js";
import {EncryptionEnabledTile} from "./tiles/EncryptionEnabledTile.js";
export function tilesCreator({room, ownUserId, clock}) { export function tilesCreator({room, ownUserId, clock}) {
return function tilesCreator(entry, emitUpdate) { return function tilesCreator(entry, emitUpdate) {
@ -53,6 +54,8 @@ export function tilesCreator({room, ownUserId, clock}) {
return new RoomMemberTile(options); return new RoomMemberTile(options);
case "m.room.encrypted": case "m.room.encrypted":
return new EncryptedEventTile(options); return new EncryptedEventTile(options);
case "m.room.encryption":
return new EncryptionEnabledTile(options);
default: default:
// unknown type not rendered // unknown type not rendered
return null; return null;