mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 06:16:30 +03:00
refactor: Remove mostly-unused function get_secondary_self_addrs() (#8173)
This commit is contained in:
@@ -945,12 +945,7 @@ impl Context {
|
|||||||
/// Returns `false` if no addresses are configured.
|
/// Returns `false` if no addresses are configured.
|
||||||
pub(crate) async fn is_self_addr(&self, addr: &str) -> Result<bool> {
|
pub(crate) async fn is_self_addr(&self, addr: &str) -> Result<bool> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.get_config(Config::ConfiguredAddr)
|
.get_all_self_addrs()
|
||||||
.await?
|
|
||||||
.iter()
|
|
||||||
.any(|a| addr_cmp(addr, a))
|
|
||||||
|| self
|
|
||||||
.get_secondary_self_addrs()
|
|
||||||
.await?
|
.await?
|
||||||
.iter()
|
.iter()
|
||||||
.any(|a| addr_cmp(addr, a)))
|
.any(|a| addr_cmp(addr, a)))
|
||||||
@@ -1000,14 +995,6 @@ impl Context {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns all secondary self addresses.
|
|
||||||
pub(crate) async fn get_secondary_self_addrs(&self) -> Result<Vec<String>> {
|
|
||||||
self.sql.query_map_vec("SELECT addr FROM transports WHERE addr NOT IN (SELECT value FROM config WHERE keyname='configured_addr')", (), |row| {
|
|
||||||
let addr: String = row.get(0)?;
|
|
||||||
Ok(addr)
|
|
||||||
}).await
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns all published secondary self addresses.
|
/// Returns all published secondary self addresses.
|
||||||
/// See `[Context::set_transport_unpublished]`
|
/// See `[Context::set_transport_unpublished]`
|
||||||
pub(crate) async fn get_published_secondary_self_addrs(&self) -> Result<Vec<String>> {
|
pub(crate) async fn get_published_secondary_self_addrs(&self) -> Result<Vec<String>> {
|
||||||
|
|||||||
@@ -843,7 +843,7 @@ impl Context {
|
|||||||
|
|
||||||
/// Returns information about the context as key-value pairs.
|
/// Returns information about the context as key-value pairs.
|
||||||
pub async fn get_info(&self) -> Result<BTreeMap<&'static str, String>> {
|
pub async fn get_info(&self) -> Result<BTreeMap<&'static str, String>> {
|
||||||
let secondary_addrs = self.get_secondary_self_addrs().await?.join(", ");
|
let all_self_addrs = self.get_all_self_addrs().await?.join(", ");
|
||||||
let all_transports: Vec<String> = ConfiguredLoginParam::load_all(self)
|
let all_transports: Vec<String> = ConfiguredLoginParam::load_all(self)
|
||||||
.await?
|
.await?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -945,7 +945,7 @@ impl Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.insert("secondary_addrs", secondary_addrs);
|
res.insert("all_self_addrs", all_self_addrs);
|
||||||
res.insert(
|
res.insert(
|
||||||
"who_can_call_me",
|
"who_can_call_me",
|
||||||
self.get_config_int(Config::WhoCanCallMe).await?.to_string(),
|
self.get_config_int(Config::WhoCanCallMe).await?.to_string(),
|
||||||
|
|||||||
@@ -422,13 +422,6 @@ async fn check_addrs(
|
|||||||
a.get_published_self_addrs().await.unwrap(),
|
a.get_published_self_addrs().await.unwrap(),
|
||||||
published_self_addrs.clone(),
|
published_self_addrs.clone(),
|
||||||
);
|
);
|
||||||
assert_eq(
|
|
||||||
a.get_secondary_self_addrs().await.unwrap(),
|
|
||||||
concat(&[
|
|
||||||
addresses.secondary_published,
|
|
||||||
addresses.secondary_unpublished,
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
assert_eq(
|
assert_eq(
|
||||||
a.get_published_secondary_self_addrs().await.unwrap(),
|
a.get_published_secondary_self_addrs().await.unwrap(),
|
||||||
concat(&[addresses.secondary_published]),
|
concat(&[addresses.secondary_published]),
|
||||||
|
|||||||
Reference in New Issue
Block a user