Commit 70adcb05a7
70adcb05a78033a8e427d31aade14cc72e2698fb
parent: d00ecd4d6b
Unsigned
Damir Jelić <poljar@termina.org.uk> · 2021-08-13 12:05 UTC
feat(room): Add a sign indicating the verification state of the room
Layout: unified · split
src/bar_items/status.rs
+10
| @@ -28,6 +28,16 @@ impl BarItemCallback for Status { |
| 28 | 28 | signs.push( |
| 29 | 29 | server.config().borrow().look().encrypted_room_sign(), |
| 30 | 30 | ); |
| 31 | |
| 32 | if !room.contains_only_verified_devices() { |
| 33 | signs.push( |
| 34 | server |
| 35 | .config() |
| 36 | .borrow() |
| 37 | .look() |
| 38 | .encryption_warning_sign(), |
| 39 | ); |
| 40 | } |
| 31 | 41 | } |
| 32 | 42 | |
| 33 | 43 | if room.is_public() { |
src/config.rs
+7
| @@ -93,6 +93,13 @@ config!( |
| 93 | 93 | "🔒", |
| 94 | 94 | }, |
| 95 | 95 | |
| 96 | encryption_warning_sign: String { |
| 97 | // Description. |
| 98 | "A sign that is used to show that the current room contains unverified devices", |
| 99 | // Default value. |
| 100 | "❗", |
| 101 | }, |
| 102 | |
| 96 | 103 | public_room_sign: String { |
| 97 | 104 | // Description. |
| 98 | 105 | "A sign indicating that the current room is public", |
src/room/mod.rs
+4
| @@ -360,6 +360,10 @@ impl MatrixRoom { |
| 360 | 360 | self.room.is_encrypted() |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | pub fn contains_only_verified_devices(&self) -> bool { |
| 364 | block_on(self.room.contains_only_verified_devices()).unwrap_or_default() |
| 365 | } |
| 366 | |
| 363 | 367 | pub fn is_public(&self) -> bool { |
| 364 | 368 | self.room.is_public() |
| 365 | 369 | } |