feat(client): finish node menu, categories, node settings and forum client wiring
This commit is contained in:
parent
f04691c3cd
commit
c2fc5529b7
20 changed files with 1374 additions and 446 deletions
|
|
@ -238,8 +238,13 @@ pub fn tick(window: &MainWindow, state: &crate::AppState) {
|
|||
window.set_image_uploading(false);
|
||||
window.set_image_status("".into());
|
||||
}
|
||||
let visible_model = if window.get_show_forum() {window.get_forum_replies()} else {window.get_messages()};
|
||||
let visible: Vec<String> = visible_model.iter()
|
||||
let visible_model = if window.get_show_forum() {
|
||||
window.get_forum_replies()
|
||||
} else {
|
||||
window.get_messages()
|
||||
};
|
||||
let visible: Vec<String> = visible_model
|
||||
.iter()
|
||||
.filter_map(|item| source_key(&item.media_source, state))
|
||||
.collect();
|
||||
m.cache.retain(|key, _| visible.contains(key));
|
||||
|
|
@ -357,7 +362,11 @@ pub fn tick(window: &MainWindow, state: &crate::AppState) {
|
|||
k.starts_with("attachment:") && e.image.is_none() && e.error == "Loading image…"
|
||||
})
|
||||
.count();
|
||||
let model = if window.get_show_forum() {window.get_forum_replies()} else {window.get_messages()};
|
||||
let model = if window.get_show_forum() {
|
||||
window.get_forum_replies()
|
||||
} else {
|
||||
window.get_messages()
|
||||
};
|
||||
let mut slots = 3usize.saturating_sub(m.workers + pending_fetches);
|
||||
for row in 0..model.row_count() {
|
||||
let Some(mut item) = model.row_data(row) else {
|
||||
|
|
@ -366,9 +375,13 @@ pub fn tick(window: &MainWindow, state: &crate::AppState) {
|
|||
let previous = item.clone();
|
||||
let body = item.media_source.to_string();
|
||||
let source = body.as_str();
|
||||
let attachment = if window.get_show_forum() { None } else { source
|
||||
.strip_prefix("vnox-attachment:")
|
||||
.filter(|id| uuid::Uuid::parse_str(id).is_ok()) };
|
||||
let attachment = if window.get_show_forum() {
|
||||
None
|
||||
} else {
|
||||
source
|
||||
.strip_prefix("vnox-attachment:")
|
||||
.filter(|id| uuid::Uuid::parse_str(id).is_ok())
|
||||
};
|
||||
let remote = chat_images::image_url(source);
|
||||
let key = if let Some(id) = attachment {
|
||||
format!(
|
||||
|
|
@ -453,7 +466,9 @@ pub fn tick(window: &MainWindow, state: &crate::AppState) {
|
|||
}
|
||||
|
||||
fn source_key(source: &str, state: &crate::AppState) -> Option<String> {
|
||||
if super::forum::visible(&state.ui) && source.starts_with("vnox-attachment:") { return None; }
|
||||
if super::forum::visible(&state.ui) && source.starts_with("vnox-attachment:") {
|
||||
return None;
|
||||
}
|
||||
if let Some(id) = source
|
||||
.strip_prefix("vnox-attachment:")
|
||||
.filter(|id| uuid::Uuid::parse_str(id).is_ok())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue