Parakeet is a Rust-based Bluesky AppServer aiming to implement most of the functionality required to support the Bluesky client
appview atproto bluesky rust appserver
66
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: threadgate models

Mia e9a26f5d 8722e61a

+24 -14
+2 -2
parakeet-db/src/models.rs
··· 250 250 pub post_uri: String, 251 251 252 252 pub hidden_replies: Vec<Option<String>>, 253 - pub allow: Vec<Option<String>>, 254 - pub allowed_lists: Vec<Option<String>>, 253 + pub allow: Option<Vec<Option<String>>>, 254 + pub allowed_lists: Option<Vec<Option<String>>>, 255 255 256 256 pub record: serde_json::Value, 257 257
+8
parakeet/src/hydration/list.rs
··· 78 78 } 79 79 80 80 pub async fn hydrate_lists_basic(&self, lists: Vec<String>) -> HashMap<String, ListViewBasic> { 81 + if lists.is_empty() { 82 + return HashMap::new(); 83 + } 84 + 81 85 let labels = self.get_label_many(&lists).await; 82 86 let viewers = self.get_list_viewer_states(&lists).await; 83 87 let lists = self.loaders.list.load_many(lists).await; ··· 103 107 } 104 108 105 109 pub async fn hydrate_lists(&self, lists: Vec<String>) -> HashMap<String, ListView> { 110 + if lists.is_empty() { 111 + return HashMap::new(); 112 + } 113 + 106 114 let labels = self.get_label_many(&lists).await; 107 115 let viewers = self.get_list_viewer_states(&lists).await; 108 116 let lists = self.loaders.list.load_many(lists).await;
+14 -12
parakeet/src/hydration/posts.rs
··· 83 83 ) -> Option<ThreadgateView> { 84 84 let threadgate = threadgate?; 85 85 86 - let lists = threadgate 87 - .allowed_lists 88 - .iter() 89 - .flatten() 90 - .cloned() 91 - .collect::<Vec<_>>(); 86 + let lists = match threadgate.allowed_lists.as_ref() { 87 + Some(allowed_lists) => allowed_lists.iter().flatten().cloned().collect(), 88 + None => Vec::new(), 89 + }; 92 90 let lists = self.hydrate_lists_basic(lists).await; 93 91 94 92 Some(build_threadgate_view( ··· 102 100 threadgates: Vec<models::Threadgate>, 103 101 ) -> HashMap<String, ThreadgateView> { 104 102 let lists = threadgates.iter().fold(Vec::new(), |mut acc, c| { 105 - acc.extend(c.allowed_lists.iter().flatten().cloned()); 103 + if let Some(lists) = &c.allowed_lists { 104 + acc.extend(lists.iter().flatten().cloned()); 105 + } 106 106 acc 107 107 }); 108 108 let lists = self.hydrate_lists_basic(lists).await; ··· 110 110 threadgates 111 111 .into_iter() 112 112 .map(|threadgate| { 113 - let this_lists = threadgate 114 - .allowed_lists 115 - .iter() 116 - .filter_map(|v| v.clone().and_then(|v| lists.get(&v).cloned())) 117 - .collect(); 113 + let this_lists = match &threadgate.allowed_lists { 114 + Some(allowed_lists) => allowed_lists 115 + .iter() 116 + .filter_map(|v| v.clone().and_then(|v| lists.get(&v).cloned())) 117 + .collect(), 118 + None => Vec::new(), 119 + }; 118 120 119 121 ( 120 122 threadgate.at_uri.clone(),