Commit 1af77dee47
Unsigned
Layout: unified · split
src/room/mod.rs +1 −31
| @@ -143,6 +143,7 @@ const HISTORY_PAGE_TAGS: [&str; 2] = | ||
| 143 | 143 | ["matrix_history_page", "matrix_smart_filter"]; |
| 144 | 144 | const RESTORED_HISTORY_BATCH_SIZE: u16 = 25; |
| 145 | 145 | const INTERACTIVE_HISTORY_BATCH_SIZE: u16 = 25; |
| 146 | ||
| 146 | 147 | // Restore one current page eagerly. Further pages are user-driven so a noisy |
| 147 | 148 | // room cannot monopolize its history lock while the GUI is asking for older |
| 148 | 149 | // messages in the room the user is actually viewing. |
| @@ -3288,37 +3289,6 @@ mod tests { | ||
| 3288 | 3289 | assert!(!should_continue_restored_history(0, 13, false)); |
| 3289 | 3290 | } |
| 3290 | 3291 | |
| 3291 | #[test] | |
| 3292 | fn history_paging_requires_an_available_cursor() { | |
| 3293 | assert!(!has_history_page(&None)); | |
| 3294 | assert!(has_history_page(&Some(PrevBatch::Backwards(None)))); | |
| 3295 | assert!(has_history_page(&Some(PrevBatch::Backwards(Some( | |
| 3296 | "token".to_owned() | |
| 3297 | ))))); | |
| 3298 | assert!(has_history_page(&Some(PrevBatch::Forward( | |
| 3299 | "token".to_owned() | |
| 3300 | )))); | |
| 3301 | } | |
| 3302 | ||
| 3303 | #[test] | |
| 3304 | fn history_page_markers_are_machine_readable_and_hideable() { | |
| 3305 | assert_eq!( | |
| 3306 | HISTORY_PAGE_TAGS, | |
| 3307 | ["matrix_history_page", "matrix_smart_filter"] | |
| 3308 | ); | |
| 3309 | assert_eq!( | |
| 3310 | history_page_marker(&HistoryPageResult::Page { | |
| 3311 | added: 25, | |
| 3312 | exhausted: false, | |
| 3313 | }), | |
| 3314 | "matrix_history_page added=25 exhausted=0" | |
| 3315 | ); | |
| 3316 | assert_eq!( | |
| 3317 | history_page_marker(&HistoryPageResult::Unavailable), | |
| 3318 | "matrix_history_page added=0 exhausted=1 state=unavailable" | |
| 3319 | ); | |
| 3320 | } | |
| 3321 | ||
| 3322 | 3292 | #[test] |
| 3323 | 3293 | fn already_rendered_events_are_not_printed_again() { |
| 3324 | 3294 | assert!(should_render_event(false)); |