chore: remove trivial single-use helper functions
This commit is contained in:
@@ -903,6 +903,7 @@ impl Backend {
|
||||
}
|
||||
|
||||
fn sync_inbox(&mut self, cx: &mut Context<Self>) {
|
||||
let repo_store = RepoListStore::global(cx);
|
||||
let client = self.client.clone();
|
||||
let me = self.current_user;
|
||||
|
||||
@@ -910,7 +911,7 @@ impl Backend {
|
||||
self.subscribe_bootstrap(Filters::notifications(me), cx);
|
||||
self.subscribe_bootstrap(vec![Filters::authored_activity(me)], cx);
|
||||
|
||||
let relays: HashSet<RelayUrl> = RepoListStore::global(cx)
|
||||
let relays: HashSet<RelayUrl> = repo_store
|
||||
.read(cx)
|
||||
.announcements_of(&me)
|
||||
.into_iter()
|
||||
@@ -944,9 +945,11 @@ impl Backend {
|
||||
this.signer.swap_inner(new_signer);
|
||||
this.current_user = Some(public_key);
|
||||
this.passphrase_required = false;
|
||||
|
||||
this.bootstrap_user(public_key, cx);
|
||||
cx.emit(BackendEvent::SignerChanged);
|
||||
this.sync_inbox(cx);
|
||||
|
||||
cx.emit(BackendEvent::SignerChanged);
|
||||
cx.notify();
|
||||
})?;
|
||||
}
|
||||
@@ -974,7 +977,7 @@ impl Backend {
|
||||
|
||||
let client = self.client.clone();
|
||||
|
||||
cx.spawn(async move |_this, _cx| {
|
||||
cx.background_spawn(async move {
|
||||
let connected: Result<(), Error> = async {
|
||||
for url in relays.iter() {
|
||||
client.add_relay(url).and_connect().await?;
|
||||
|
||||
@@ -72,14 +72,6 @@ fn grasp_list_servers(event: &Event) -> Vec<RelayUrl> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn latest_grasp_list_servers(events: Vec<Event>) -> Vec<RelayUrl> {
|
||||
events
|
||||
.into_iter()
|
||||
.max_by_key(|event| event.created_at)
|
||||
.map(|event| grasp_list_servers(&event))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub async fn user_grasp_list_servers(
|
||||
client: &Client,
|
||||
user: PublicKey,
|
||||
@@ -90,5 +82,12 @@ pub async fn user_grasp_list_servers(
|
||||
.await?
|
||||
.into_iter()
|
||||
.collect();
|
||||
Ok(latest_grasp_list_servers(events))
|
||||
|
||||
let latest = events
|
||||
.into_iter()
|
||||
.max_by_key(|event| event.created_at)
|
||||
.map(|event| grasp_list_servers(&event))
|
||||
.unwrap_or_default();
|
||||
|
||||
Ok(latest)
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ impl RepoStore {
|
||||
utils::sort_newest_first(&mut issues);
|
||||
utils::sort_newest_first(&mut patches);
|
||||
utils::sort_newest_first(&mut pull_requests);
|
||||
utils::sort_oldest_first(&mut comments);
|
||||
comments.sort_by_key(|comment| comment.created_at);
|
||||
|
||||
let maintainers = announcement
|
||||
.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user