Commit 3908d948da
Unregistered key
Layout: unified · split
src/windows/room/not_joined.rs +22 −14
| @@ -1,10 +1,11 @@ | ||
| 1 | 1 | use matrix_sdk::ruma::RoomOrAliasId; |
| 2 | use matrix_sdk::ruma::room::{JoinRuleSummary, RestrictedSummary}; | |
| 2 | use matrix_sdk::ruma::room::{JoinRuleSummary, RestrictedSummary, RoomType as MatrixRoomType}; | |
| 3 | 3 | |
| 4 | 4 | use crate::base::{HomeserverAction, SyncInfo}; |
| 5 | 5 | use crate::prelude::*; |
| 6 | use crate::windows::ROOM_PREVIEW_DEBOUNCE; | |
| 6 | use crate::util::wrap; | |
| 7 | 7 | use crate::windows::room::RoomState; |
| 8 | use crate::windows::{ROOM_PREVIEW_DEBOUNCE, room_name_from_preview}; | |
| 8 | 9 | use crate::worker::ClientResponse; |
| 9 | 10 | |
| 10 | 11 | fn can_join_restricted(summary: &RestrictedSummary, sync_info: &SyncInfo) -> bool { |
| @@ -289,22 +290,29 @@ impl StatefulWidget for NotJoined<'_> { | ||
| 289 | 290 | |
| 290 | 291 | match preview { |
| 291 | 292 | Some((Ok(preview), _)) => { |
| 292 | let mut name_line = vec![]; | |
| 293 | if let Some(name) = &preview.name { | |
| 294 | name_line.push(Span::styled(name, StyleModifier::BOLD)); | |
| 295 | name_line.push(Span::raw(" ")); | |
| 296 | } | |
| 293 | lines.push(Line::from(room_name_from_preview(preview))); | |
| 294 | ||
| 295 | let mut info_line = vec![]; | |
| 297 | 296 | if let Some(alias) = &preview.canonical_alias { |
| 298 | name_line.push(Span::raw(alias.as_str())); | |
| 299 | name_line.push(Span::raw(" ")); | |
| 297 | info_line.push(", ".into()); | |
| 298 | info_line.push(Span::styled(alias.as_str(), default_style.bold())); | |
| 299 | } | |
| 300 | if Some(MatrixRoomType::Space) == preview.room_type { | |
| 301 | info_line.push(", ".into()); | |
| 302 | info_line.push("Space".into()); | |
| 303 | } else if Some(true) == preview.is_direct { | |
| 304 | info_line.push(", ".into()); | |
| 305 | info_line.push("DM".into()); | |
| 306 | } | |
| 307 | ||
| 308 | if !info_line.is_empty() { | |
| 309 | info_line.push(")".into()); | |
| 310 | info_line[0] = "(".into(); | |
| 311 | lines.push(Line::from(info_line)); | |
| 300 | 312 | } |
| 301 | 313 | |
| 302 | name_line.push(Span::raw("(")); | |
| 303 | name_line.push(Span::raw(state.alias().as_str())); | |
| 304 | name_line.push(Span::raw(")")); | |
| 305 | lines.push(Line::from(name_line)); | |
| 306 | 314 | if let Some(topic) = &preview.topic { |
| 307 | lines.push(Line::raw(topic)); | |
| 315 | lines.extend(wrap(topic, area.width.into()).map(|(line, _)| Line::raw(line))); | |
| 308 | 316 | } |
| 309 | 317 | |
| 310 | 318 | lines.push(Line::raw("")); |