Commit af4f370540
Unsigned
Layout: unified · split
src/completions.rs +5 −1
| @@ -89,7 +89,11 @@ impl CompletionCallback for UsersCompletion { | ||
| 89 | 89 | let tracked_users = self |
| 90 | 90 | .servers |
| 91 | 91 | .runtime() |
| 92 | .block_on(connection.client().encryption().tracked_users()); | |
| 92 | .block_on(connection.client().encryption().tracked_users()) | |
| 93 | .unwrap_or_else(|e| { | |
| 94 | tracing::warn!("Error getting tracked users: {e}"); | |
| 95 | Default::default() | |
| 96 | }); | |
| 93 | 97 | |
| 94 | 98 | for user in tracked_users.into_iter() { |
| 95 | 99 | completion.add_with_options( |
src/config.rs +1
| @@ -20,6 +20,7 @@ use std::{ | ||
| 20 | 20 | rc::Rc, |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | use strum::VariantNames; | |
| 23 | 24 | use strum_macros::EnumVariantNames; |
| 24 | 25 | use weechat::{ |
| 25 | 26 | config, |
src/connection.rs +39 −46
| @@ -16,7 +16,7 @@ use matrix_sdk::{ | ||
| 16 | 16 | self, |
| 17 | 17 | config::SyncSettings, |
| 18 | 18 | deserialized_responses::AmbiguityChange, |
| 19 | room::{Joined, Messages, MessagesOptions}, | |
| 19 | room::{Messages, MessagesOptions, Room}, | |
| 20 | 20 | ruma::{ |
| 21 | 21 | api::client::{ |
| 22 | 22 | device::{ |
| @@ -37,7 +37,7 @@ use matrix_sdk::{ | ||
| 37 | 37 | }, |
| 38 | 38 | OwnedDeviceId, OwnedRoomId, OwnedTransactionId, |
| 39 | 39 | }, |
| 40 | Client, LoopCtrl, Result as MatrixResult, | |
| 40 | Client, LoopCtrl, Result as MatrixResult, RoomMemberships, | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 | use weechat::{Task, Weechat}; |
| @@ -56,10 +56,10 @@ pub struct InteractiveAuthInfo { | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | impl InteractiveAuthInfo { |
| 59 | pub fn as_auth_data(&self) -> AuthData<'_> { | |
| 59 | pub fn as_auth_data(&self) -> AuthData { | |
| 60 | 60 | AuthData::Password(Password::new( |
| 61 | UserIdentifier::UserIdOrLocalpart(&self.user), | |
| 62 | &self.password, | |
| 61 | UserIdentifier::UserIdOrLocalpart(self.user.clone()), | |
| 62 | self.password.clone(), | |
| 63 | 63 | )) |
| 64 | 64 | } |
| 65 | 65 | } |
| @@ -74,7 +74,7 @@ pub enum ClientMessage { | ||
| 74 | 74 | bool, |
| 75 | 75 | Option<AmbiguityChange>, |
| 76 | 76 | ), |
| 77 | RestoredRoom(Joined), | |
| 77 | RestoredRoom(Room), | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /// Struct representing an active connection to the homeserver. |
| @@ -151,12 +151,17 @@ impl Connection { | ||
| 151 | 151 | /// event will contain the same id in the unsigned part of the event. |
| 152 | 152 | pub async fn send_message( |
| 153 | 153 | &self, |
| 154 | room: Joined, | |
| 154 | room: Room, | |
| 155 | 155 | content: AnyMessageLikeEventContent, |
| 156 | 156 | transaction_id: Option<OwnedTransactionId>, |
| 157 | 157 | ) -> MatrixResult<RoomSendResponse> { |
| 158 | 158 | self.spawn(async move { |
| 159 | room.send(content, transaction_id.as_deref()).await | |
| 159 | let mut msg = room.send(content); | |
| 160 | if let Some(txn_id) = transaction_id.as_deref() { | |
| 161 | msg = msg.with_transaction_id(txn_id); | |
| 162 | } | |
| 163 | ||
| 164 | msg.await | |
| 160 | 165 | }) |
| 161 | 166 | .await |
| 162 | 167 | } |
| @@ -182,23 +187,22 @@ impl Connection { | ||
| 182 | 187 | /// Fetch historical messages for the given room. |
| 183 | 188 | pub async fn room_messages( |
| 184 | 189 | &self, |
| 185 | room: Joined, | |
| 190 | room: Room, | |
| 186 | 191 | prev_batch: PrevBatch, |
| 187 | 192 | ) -> MatrixResult<Messages> { |
| 188 | Ok(self | |
| 189 | .spawn(async move { | |
| 190 | let request = match &prev_batch { | |
| 191 | PrevBatch::Backwards(t) => { | |
| 192 | MessagesOptions::backward().from(Some(t.as_ref())) | |
| 193 | } | |
| 194 | PrevBatch::Forward(t) => { | |
| 195 | MessagesOptions::forward().from(Some(t.as_ref())) | |
| 196 | } | |
| 197 | }; | |
| 193 | self.spawn(async move { | |
| 194 | let request = match &prev_batch { | |
| 195 | PrevBatch::Backwards(t) => { | |
| 196 | MessagesOptions::backward().from(Some(t.as_ref())) | |
| 197 | } | |
| 198 | PrevBatch::Forward(t) => { | |
| 199 | MessagesOptions::forward().from(Some(t.as_ref())) | |
| 200 | } | |
| 201 | }; | |
| 198 | 202 | |
| 199 | room.messages(request).await | |
| 200 | }) | |
| 201 | .await?) | |
| 203 | room.messages(request).await | |
| 204 | }) | |
| 205 | .await | |
| 202 | 206 | } |
| 203 | 207 | |
| 204 | 208 | /// Get the list of our own devices. |
| @@ -217,7 +221,7 @@ impl Connection { | ||
| 217 | 221 | /// * `typing` - Should we set or unset the typing notice. |
| 218 | 222 | pub async fn send_typing_notice( |
| 219 | 223 | &self, |
| 220 | room: Joined, | |
| 224 | room: Room, | |
| 221 | 225 | typing: bool, |
| 222 | 226 | ) -> MatrixResult<()> { |
| 223 | 227 | self.spawn(async move { room.typing_notice(typing).await }) |
| @@ -303,7 +307,7 @@ impl Connection { | ||
| 303 | 307 | } |
| 304 | 308 | |
| 305 | 309 | #[allow(clippy::field_reassign_with_default)] |
| 306 | fn sync_filter() -> FilterDefinition<'static> { | |
| 310 | fn sync_filter() -> FilterDefinition { | |
| 307 | 311 | let mut filter = FilterDefinition::default(); |
| 308 | 312 | let mut room_filter = RoomFilter::default(); |
| 309 | 313 | let mut event_filter = RoomEventFilter::default(); |
| @@ -352,6 +356,7 @@ impl Connection { | ||
| 352 | 356 | let first_login = device_id.is_none(); |
| 353 | 357 | |
| 354 | 358 | let mut builder = client |
| 359 | .matrix_auth() | |
| 355 | 360 | .login_username(&username, &password) |
| 356 | 361 | .initial_device_display_name("WeeChat-Matrix-rs"); |
| 357 | 362 | |
| @@ -408,10 +413,10 @@ impl Connection { | ||
| 408 | 413 | .await |
| 409 | 414 | .unwrap(); |
| 410 | 415 | |
| 411 | let sync_token = client.sync_token().await; | |
| 416 | let sync_token: Option<String> = None; | |
| 412 | 417 | let sync_settings = SyncSettings::new() |
| 413 | 418 | .timeout(DEFAULT_SYNC_TIMEOUT) |
| 414 | .filter(Filter::FilterId(&filter)); | |
| 419 | .filter(Filter::FilterId(filter)); | |
| 415 | 420 | |
| 416 | 421 | let sync_settings = if let Some(t) = sync_token { |
| 417 | 422 | sync_settings.token(t) |
| @@ -426,11 +431,8 @@ impl Connection { | ||
| 426 | 431 | let _ret = client |
| 427 | 432 | .sync_with_callback(sync_settings, |response| async move { |
| 428 | 433 | for (room_id, room) in response.rooms.join { |
| 429 | for event in room | |
| 430 | .state | |
| 431 | .events | |
| 432 | .iter() | |
| 433 | .filter_map(|e| e.deserialize().ok()) | |
| 434 | for event in | |
| 435 | room.state.iter().filter_map(|e| e.deserialize().ok()) | |
| 434 | 436 | { |
| 435 | 437 | if let AnySyncStateEvent::RoomMember(m) = event { |
| 436 | 438 | let change = response |
| @@ -505,32 +507,23 @@ impl Connection { | ||
| 505 | 507 | } |
| 506 | 508 | } |
| 507 | 509 | |
| 508 | if let Some(r) = client_ref.get_joined_room(&room_id) { | |
| 510 | if let Some(r) = client_ref.get_room(&room_id) { | |
| 509 | 511 | if !r.are_members_synced() { |
| 510 | 512 | let room_id = room_id.clone(); |
| 511 | 513 | let channel = sync_channel.clone(); |
| 512 | 514 | |
| 513 | 515 | tokio::spawn(async move { |
| 514 | if let Ok(Some(members)) = | |
| 515 | r.sync_members().await | |
| 516 | if let Ok(members) = | |
| 517 | r.members(RoomMemberships::ACTIVE).await | |
| 516 | 518 | { |
| 517 | for member in members.chunk.into_iter() { | |
| 518 | let change = members | |
| 519 | .ambiguity_changes | |
| 520 | .changes | |
| 521 | .get(&room_id) | |
| 522 | .and_then(|c| { | |
| 523 | c.get(member.event_id()) | |
| 524 | }) | |
| 525 | .cloned(); | |
| 526 | ||
| 519 | for member in members { | |
| 527 | 520 | if let Err(e) = channel |
| 528 | 521 | .send(Ok( |
| 529 | 522 | ClientMessage::MemberEvent( |
| 530 | 523 | room_id.clone(), |
| 531 | member.into(), | |
| 524 | member.event().as_sync().expect("Member event is not a StateSyncEvent").to_owned(), | |
| 532 | 525 | true, |
| 533 | change, | |
| 526 | None, | |
| 534 | 527 | ), |
| 535 | 528 | )) |
| 536 | 529 | .await |
src/room/members.rs +7 −5
| @@ -6,7 +6,7 @@ use tracing::{error, info}; | ||
| 6 | 6 | |
| 7 | 7 | use matrix_sdk::{ |
| 8 | 8 | deserialized_responses::AmbiguityChange, |
| 9 | room::{Joined, RoomMember}, | |
| 9 | room::{Room, RoomMember}, | |
| 10 | 10 | ruma::{ |
| 11 | 11 | events::{ |
| 12 | 12 | room::member::{MembershipState, RoomMemberEventContent}, |
| @@ -26,7 +26,7 @@ use crate::render::render_membership; | ||
| 26 | 26 | |
| 27 | 27 | #[derive(Clone)] |
| 28 | 28 | pub struct Members { |
| 29 | room: Joined, | |
| 29 | room: Room, | |
| 30 | 30 | pub(super) runtime: Handle, |
| 31 | 31 | ambiguity_map: Rc<DashMap<OwnedUserId, bool>>, |
| 32 | 32 | nicks: Rc<DashMap<OwnedUserId, String>>, |
| @@ -41,7 +41,7 @@ pub struct WeechatRoomMember { | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | impl Members { |
| 44 | pub fn new(room: Joined, runtime: Handle) -> Self { | |
| 44 | pub fn new(room: Room, runtime: Handle) -> Self { | |
| 45 | 45 | Self { |
| 46 | 46 | room, |
| 47 | 47 | runtime, |
| @@ -247,7 +247,7 @@ impl Members { | ||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | fn room(&self) -> &Joined { | |
| 250 | fn room(&self) -> &Room { | |
| 251 | 251 | &self.room |
| 252 | 252 | } |
| 253 | 253 | |
| @@ -257,7 +257,9 @@ impl Members { | ||
| 257 | 257 | |
| 258 | 258 | let room_name = if room_name == "#" { |
| 259 | 259 | "##".to_owned() |
| 260 | } else if room_name.starts_with('#') || room.is_direct() { | |
| 260 | } else if room_name.starts_with('#') | |
| 261 | || self.runtime.block_on(room.is_direct()).unwrap_or(false) | |
| 262 | { | |
| 261 | 263 | room_name |
| 262 | 264 | } else { |
| 263 | 265 | format!("#{}", room_name) |
src/room/mod.rs +30 −12
| @@ -47,7 +47,7 @@ use url::Url; | ||
| 47 | 47 | use matrix_sdk::{ |
| 48 | 48 | async_trait, |
| 49 | 49 | deserialized_responses::AmbiguityChange, |
| 50 | room::Joined, | |
| 50 | room::Room, | |
| 51 | 51 | ruma::{ |
| 52 | 52 | events::{ |
| 53 | 53 | room::{ |
| @@ -148,7 +148,7 @@ pub struct MatrixRoom { | ||
| 148 | 148 | homeserver: Rc<Url>, |
| 149 | 149 | room_id: Rc<RoomId>, |
| 150 | 150 | own_user_id: Rc<UserId>, |
| 151 | room: Joined, | |
| 151 | room: Room, | |
| 152 | 152 | buffer: Rc<RefCell<Option<BufferHandle>>>, |
| 153 | 153 | |
| 154 | 154 | config: Rc<RefCell<Config>>, |
| @@ -202,7 +202,7 @@ impl RoomHandle { | ||
| 202 | 202 | runtime: Handle, |
| 203 | 203 | connection: &Rc<RefCell<Option<Connection>>>, |
| 204 | 204 | config: Rc<RefCell<Config>>, |
| 205 | room: Joined, | |
| 205 | room: Room, | |
| 206 | 206 | homeserver: Url, |
| 207 | 207 | room_id: &RoomId, |
| 208 | 208 | own_user_id: &UserId, |
| @@ -287,7 +287,13 @@ impl RoomHandle { | ||
| 287 | 287 | |
| 288 | 288 | buffer.set_localvar("server", server_name); |
| 289 | 289 | buffer.set_localvar("nick", &own_nick); |
| 290 | buffer.set_localvar("domain", room.room_id().server_name().as_str()); | |
| 290 | buffer.set_localvar( | |
| 291 | "domain", | |
| 292 | room.room_id() | |
| 293 | .server_name() | |
| 294 | .map(|name| name.as_str()) | |
| 295 | .unwrap_or_default(), | |
| 296 | ); | |
| 291 | 297 | buffer.set_localvar("room_id", room.room_id().as_str()); |
| 292 | 298 | if room.is_direct() { |
| 293 | 299 | buffer.set_localvar("type", "private") |
| @@ -307,7 +313,7 @@ impl RoomHandle { | ||
| 307 | 313 | pub async fn restore( |
| 308 | 314 | server_name: &str, |
| 309 | 315 | runtime: Handle, |
| 310 | room: Joined, | |
| 316 | room: Room, | |
| 311 | 317 | connection: &Rc<RefCell<Option<Connection>>>, |
| 312 | 318 | config: Rc<RefCell<Config>>, |
| 313 | 319 | homeserver: Url, |
| @@ -369,7 +375,10 @@ impl BufferInputCallbackAsync for MatrixRoom { | ||
| 369 | 375 | |
| 370 | 376 | impl MatrixRoom { |
| 371 | 377 | pub fn is_encrypted(&self) -> bool { |
| 372 | self.room.is_encrypted() | |
| 378 | self.members | |
| 379 | .runtime | |
| 380 | .block_on(self.room.is_encrypted()) | |
| 381 | .unwrap_or_default() | |
| 373 | 382 | } |
| 374 | 383 | |
| 375 | 384 | pub fn contains_only_verified_devices(&self) -> bool { |
| @@ -384,7 +393,10 @@ impl MatrixRoom { | ||
| 384 | 393 | } |
| 385 | 394 | |
| 386 | 395 | pub fn is_direct(&self) -> bool { |
| 387 | self.room.is_direct() | |
| 396 | self.members | |
| 397 | .runtime | |
| 398 | .block_on(self.room.is_direct()) | |
| 399 | .unwrap_or_default() | |
| 388 | 400 | } |
| 389 | 401 | |
| 390 | 402 | pub fn alias(&self) -> Option<OwnedRoomAliasId> { |
| @@ -440,8 +452,12 @@ impl MatrixRoom { | ||
| 440 | 452 | // TODO: remove this unwrap. |
| 441 | 453 | let redacter = self.members.get(&event.sender).await.unwrap(); |
| 442 | 454 | |
| 443 | let event_id_tag = | |
| 444 | Cow::from(format!("{}_id_{}", PLUGIN_NAME, event.redacts)); | |
| 455 | // TODO: handle unwrapping redacts Option<EventId> properly for rooms versions 11+ | |
| 456 | let event_id_tag = Cow::from(format!( | |
| 457 | "{}_id_{}", | |
| 458 | PLUGIN_NAME, | |
| 459 | event.redacts.clone().unwrap() | |
| 460 | )); | |
| 445 | 461 | let tag = Cow::from("matrix_redacted"); |
| 446 | 462 | |
| 447 | 463 | let reason = if let Some(r) = &event.content.reason { |
| @@ -1011,7 +1027,9 @@ impl MatrixRoom { | ||
| 1011 | 1027 | event_id, |
| 1012 | 1028 | send_time, |
| 1013 | 1029 | &sender, |
| 1014 | &AnyMessageLikeEventContent::RoomMessage(content.clone()), | |
| 1030 | &AnyMessageLikeEventContent::RoomMessage( | |
| 1031 | content.clone().with_relation(None), | |
| 1032 | ), | |
| 1015 | 1033 | ) |
| 1016 | 1034 | .await |
| 1017 | 1035 | .map(|r| { |
| @@ -1054,7 +1072,7 @@ impl MatrixRoom { | ||
| 1054 | 1072 | SyncMessageLikeEvent::Redacted(e), |
| 1055 | 1073 | ) = event |
| 1056 | 1074 | { |
| 1057 | let redacter = e.unsigned.redacted_because.as_ref()?.sender(); | |
| 1075 | let redacter = e.unsigned.redacted_because.sender.as_ref(); | |
| 1058 | 1076 | let redacter = self.members.get(redacter).await?; |
| 1059 | 1077 | let sender = self.members.get(&e.sender).await?; |
| 1060 | 1078 | |
| @@ -1139,7 +1157,7 @@ impl MatrixRoom { | ||
| 1139 | 1157 | } |
| 1140 | 1158 | } |
| 1141 | 1159 | |
| 1142 | pub fn room(&self) -> &Joined { | |
| 1160 | pub fn room(&self) -> &Room { | |
| 1143 | 1161 | &self.room |
| 1144 | 1162 | } |
| 1145 | 1163 | |
src/server.rs +5 −6
| @@ -69,7 +69,7 @@ use matrix_sdk::{ | ||
| 69 | 69 | self, |
| 70 | 70 | deserialized_responses::AmbiguityChange, |
| 71 | 71 | encryption::RoomKeyImportResult, |
| 72 | room::Joined, | |
| 72 | room::Room, | |
| 73 | 73 | ruma::{ |
| 74 | 74 | api::client::session::login::v3::Response as LoginResponse, |
| 75 | 75 | events::{ |
| @@ -467,7 +467,7 @@ impl InnerServer { | ||
| 467 | 467 | let room = client |
| 468 | 468 | .as_ref() |
| 469 | 469 | .expect("Receiving events without a client") |
| 470 | .get_joined_room(room_id); | |
| 470 | .get_room(room_id); | |
| 471 | 471 | |
| 472 | 472 | let room = room.unwrap_or_else(|| { |
| 473 | 473 | panic!( |
| @@ -503,7 +503,7 @@ impl InnerServer { | ||
| 503 | 503 | self.settings.borrow().password.clone() |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | pub async fn restore_room(&self, room: Joined) { | |
| 506 | pub async fn restore_room(&self, room: Room) { | |
| 507 | 507 | let homeserver = self |
| 508 | 508 | .settings |
| 509 | 509 | .borrow() |
| @@ -758,8 +758,7 @@ impl InnerServer { | ||
| 758 | 758 | |
| 759 | 759 | let mut client_builder = Client::builder() |
| 760 | 760 | .homeserver_url(homeserver) |
| 761 | .sled_store(self.get_server_path(), Some("DEFAULT_PASSPHRASE")) | |
| 762 | .expect("Couldn't open the store"); | |
| 761 | .sqlite_store(self.get_server_path(), Some("DEFAULT_PASSPHRASE")); | |
| 763 | 762 | |
| 764 | 763 | if let Some(proxy) = settings.proxy.as_ref() { |
| 765 | 764 | client_builder = client_builder.proxy(proxy); |
| @@ -806,7 +805,7 @@ impl InnerServer { | ||
| 806 | 805 | match c.delete_devices(devices.clone(), None).await { |
| 807 | 806 | Ok(_) => print_success(), |
| 808 | 807 | Err(e) => { |
| 809 | if let Some(info) = e.uiaa_response() { | |
| 808 | if let Some(info) = e.as_uiaa_response() { | |
| 810 | 809 | let auth_info = { |
| 811 | 810 | let settings = self.settings.borrow(); |
| 812 | 811 | InteractiveAuthInfo { |
src/utils.rs +16 −5
| @@ -1,6 +1,9 @@ | ||
| 1 | 1 | use matrix_sdk::ruma::{ |
| 2 | 2 | events::{ |
| 3 | room::message::{Relation, RoomMessageEventContent}, | |
| 3 | room::message::{ | |
| 4 | Relation, RoomMessageEventContent, | |
| 5 | RoomMessageEventContentWithoutRelation, | |
| 6 | }, | |
| 4 | 7 | AnyMessageLikeEvent, AnySyncMessageLikeEvent, |
| 5 | 8 | }, |
| 6 | 9 | EventId, UserId, |
| @@ -24,7 +27,9 @@ impl ToTag for UserId { | ||
| 24 | 27 | |
| 25 | 28 | pub trait Edit { |
| 26 | 29 | fn is_edit(&self) -> bool; |
| 27 | fn get_edit(&self) -> Option<(&EventId, &RoomMessageEventContent)>; | |
| 30 | fn get_edit( | |
| 31 | &self, | |
| 32 | ) -> Option<(&EventId, &RoomMessageEventContentWithoutRelation)>; | |
| 28 | 33 | } |
| 29 | 34 | |
| 30 | 35 | impl Edit for RoomMessageEventContent { |
| @@ -32,7 +37,9 @@ impl Edit for RoomMessageEventContent { | ||
| 32 | 37 | matches!(self.relates_to.as_ref(), Some(Relation::Replacement(_))) |
| 33 | 38 | } |
| 34 | 39 | |
| 35 | fn get_edit(&self) -> Option<(&EventId, &RoomMessageEventContent)> { | |
| 40 | fn get_edit( | |
| 41 | &self, | |
| 42 | ) -> Option<(&EventId, &RoomMessageEventContentWithoutRelation)> { | |
| 36 | 43 | if let Some(Relation::Replacement(r)) = self.relates_to.as_ref() { |
| 37 | 44 | Some((&r.event_id, &r.new_content)) |
| 38 | 45 | } else { |
| @@ -52,7 +59,9 @@ impl Edit for AnySyncMessageLikeEvent { | ||
| 52 | 59 | } |
| 53 | 60 | } |
| 54 | 61 | |
| 55 | fn get_edit(&self) -> Option<(&EventId, &RoomMessageEventContent)> { | |
| 62 | fn get_edit( | |
| 63 | &self, | |
| 64 | ) -> Option<(&EventId, &RoomMessageEventContentWithoutRelation)> { | |
| 56 | 65 | if let AnySyncMessageLikeEvent::RoomMessage(e) = self { |
| 57 | 66 | e.as_original().map(|e| e.content.get_edit()).flatten() |
| 58 | 67 | } else { |
| @@ -72,7 +81,9 @@ impl Edit for AnyMessageLikeEvent { | ||
| 72 | 81 | } |
| 73 | 82 | } |
| 74 | 83 | |
| 75 | fn get_edit(&self) -> Option<(&EventId, &RoomMessageEventContent)> { | |
| 84 | fn get_edit( | |
| 85 | &self, | |
| 86 | ) -> Option<(&EventId, &RoomMessageEventContentWithoutRelation)> { | |
| 76 | 87 | if let AnyMessageLikeEvent::RoomMessage(e) = self { |
| 77 | 88 | e.as_original().map(|e| e.content.get_edit()).flatten() |
| 78 | 89 | } else { |