mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 08:56:29 +03:00
Use plain get_config(Config::ConfiguredAddr) to not ignore db errors
This commit is contained in:
@@ -338,8 +338,8 @@ impl Context {
|
|||||||
/// determine whether the specified addr maps to the/a self addr
|
/// determine whether the specified addr maps to the/a self addr
|
||||||
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_primary_self_addr()
|
.get_config(Config::ConfiguredAddr)
|
||||||
.await
|
.await?
|
||||||
.iter()
|
.iter()
|
||||||
.any(|a| addr_cmp(addr, a))
|
.any(|a| addr_cmp(addr, a))
|
||||||
|| self
|
|| self
|
||||||
@@ -372,7 +372,7 @@ impl Context {
|
|||||||
|
|
||||||
/// Returns all primary and secondary self addresses.
|
/// Returns all primary and secondary self addresses.
|
||||||
pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>> {
|
pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>> {
|
||||||
let primary_addrs = self.get_primary_self_addr().await.into_iter();
|
let primary_addrs = self.get_config(Config::ConfiguredAddr).await?.into_iter();
|
||||||
let secondary_addrs = self.get_secondary_self_addrs().await?.into_iter();
|
let secondary_addrs = self.get_secondary_self_addrs().await?.into_iter();
|
||||||
|
|
||||||
Ok(primary_addrs.chain(secondary_addrs).collect())
|
Ok(primary_addrs.chain(secondary_addrs).collect())
|
||||||
@@ -391,6 +391,7 @@ impl Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the primary self address.
|
/// Returns the primary self address.
|
||||||
|
/// Returns an error if no self addr is configured.
|
||||||
pub async fn get_primary_self_addr(&self) -> Result<String> {
|
pub async fn get_primary_self_addr(&self) -> Result<String> {
|
||||||
self.get_config(Config::ConfiguredAddr)
|
self.get_config(Config::ConfiguredAddr)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
|
|||||||
|
|
||||||
progress!(ctx, 910);
|
progress!(ctx, 910);
|
||||||
|
|
||||||
if ctx.get_primary_self_addr().await.ok().as_deref() != Some(¶m.addr) {
|
if ctx.get_config(Config::ConfiguredAddr).await?.as_deref() != Some(¶m.addr) {
|
||||||
// Switched account, all server UIDs we know are invalid
|
// Switched account, all server UIDs we know are invalid
|
||||||
job::schedule_resync(ctx).await?;
|
job::schedule_resync(ctx).await?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,7 +297,10 @@ impl Contact {
|
|||||||
.await?;
|
.await?;
|
||||||
if contact_id == ContactId::SELF {
|
if contact_id == ContactId::SELF {
|
||||||
contact.name = stock_str::self_msg(context).await;
|
contact.name = stock_str::self_msg(context).await;
|
||||||
contact.addr = context.get_primary_self_addr().await.unwrap_or_default();
|
contact.addr = context
|
||||||
|
.get_config(Config::ConfiguredAddr)
|
||||||
|
.await?
|
||||||
|
.unwrap_or_default();
|
||||||
contact.status = context
|
contact.status = context
|
||||||
.get_config(Config::Selfstatus)
|
.get_config(Config::Selfstatus)
|
||||||
.await?
|
.await?
|
||||||
@@ -726,7 +729,10 @@ impl Contact {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if let Some(query) = query {
|
if let Some(query) = query {
|
||||||
let self_addr = context.get_primary_self_addr().await.unwrap_or_default();
|
let self_addr = context
|
||||||
|
.get_config(Config::ConfiguredAddr)
|
||||||
|
.await?
|
||||||
|
.unwrap_or_default();
|
||||||
let self_name = context
|
let self_name = context
|
||||||
.get_config(Config::Displayname)
|
.get_config(Config::Displayname)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
Reference in New Issue
Block a user