Fix not fetching only local communities

This commit is contained in:
Neshura 2023-07-10 23:40:31 +02:00
parent a36115d6e6
commit a366ba9ca1
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
use std::{fs::{self, OpenOptions}, path::Path, io::Write, thread::sleep, time}; use std::{fs::{self, OpenOptions}, path::Path, io::Write, thread::sleep, time};
use lemmy_api_common::{sensitive::Sensitive, post::CreatePost, community::{self, ListCommunities, ListCommunitiesResponse}}; use lemmy_api_common::{sensitive::Sensitive, post::CreatePost, community::{self, ListCommunities, ListCommunitiesResponse}};
use lemmy_db_schema::newtypes::{LanguageId, CommunityId}; use lemmy_db_schema::{newtypes::{LanguageId, CommunityId}, ListingType};
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use url::Url; use url::Url;
@ -271,6 +271,7 @@ impl CommunitiesVector {
pub(crate) fn load(&mut self, auth: &Sensitive<String>, base: &String) { pub(crate) fn load(&mut self, auth: &Sensitive<String>, base: &String) {
let params = ListCommunities { let params = ListCommunities {
auth: Some(auth.clone()), auth: Some(auth.clone()),
type_: Some(ListingType::Local),
..Default::default() ..Default::default()
}; };

View file

@ -134,6 +134,7 @@ fn run_bot(mut terminal: Terminal<CrosstermBackend<&io::Stdout>>) {
loop { loop {
let _ = enable_raw_mode(); let _ = enable_raw_mode();
let _ = execute!(terminal.backend_mut(), EnterAlternateScreen, EnableMouseCapture); let _ = execute!(terminal.backend_mut(), EnterAlternateScreen, EnableMouseCapture);
this.run_once(old); this.run_once(old);
// Update UI // Update UI
@ -141,7 +142,7 @@ fn run_bot(mut terminal: Terminal<CrosstermBackend<&io::Stdout>>) {
ui(f, &this); ui(f, &this);
}).unwrap(); }).unwrap();
thread::sleep(Duration::from_secs(5)); this.idle();
disable_raw_mode().unwrap(); disable_raw_mode().unwrap();
execute!( execute!(
@ -150,8 +151,6 @@ fn run_bot(mut terminal: Terminal<CrosstermBackend<&io::Stdout>>) {
DisableMouseCapture DisableMouseCapture
).unwrap(); ).unwrap();
terminal.show_cursor().unwrap(); terminal.show_cursor().unwrap();
this.idle();
} }