mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 13:36:30 +03:00
If unconfigured, let get_all_self_addrs() return vec![], not vec![""];
This commit is contained in:
@@ -376,7 +376,7 @@ impl Context {
|
||||
pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>> {
|
||||
let mut ret = Vec::new();
|
||||
|
||||
ret.push(self.get_primary_self_addr().await.unwrap_or_default());
|
||||
ret.extend(self.get_primary_self_addr().await.into_iter());
|
||||
ret.extend(self.get_secondary_self_addrs().await?.into_iter());
|
||||
|
||||
Ok(ret)
|
||||
|
||||
@@ -1509,6 +1509,8 @@ mod tests {
|
||||
async fn test_get_contacts() -> Result<()> {
|
||||
let context = TestContext::new().await;
|
||||
|
||||
assert!(context.get_all_self_addrs().await?.is_empty());
|
||||
|
||||
// Bob is not in the contacts yet.
|
||||
let contacts = Contact::get_all(&context.ctx, 0, Some("bob")).await?;
|
||||
assert_eq!(contacts.len(), 0);
|
||||
|
||||
@@ -844,9 +844,6 @@ async fn prune_tombstones(sql: &Sql) -> Result<()> {
|
||||
/// Use this together with [`rusqlite::ParamsFromIter`] to use dynamically generated
|
||||
/// parameter lists.
|
||||
pub fn repeat_vars(count: usize) -> Result<String> {
|
||||
if count == 0 {
|
||||
bail!("Must have at least one repeat variable");
|
||||
}
|
||||
let mut s = "?,".repeat(count);
|
||||
s.pop(); // Remove trailing comma
|
||||
Ok(s)
|
||||
|
||||
Reference in New Issue
Block a user