mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
feat: do not require ShowEmails to be set to All for adding second relay
This commit is contained in:
@@ -38,8 +38,8 @@ def test_add_second_address(acfactory) -> None:
|
|||||||
with pytest.raises(JsonRpcError):
|
with pytest.raises(JsonRpcError):
|
||||||
account.set_config(option, "1")
|
account.set_config(option, "1")
|
||||||
|
|
||||||
with pytest.raises(JsonRpcError):
|
# show_emails does not matter for multi-relay, can be set to anything
|
||||||
account.set_config("show_emails", "0")
|
account.set_config("show_emails", "0")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("key", ["mvbox_move", "only_fetch_mvbox"])
|
@pytest.mark.parametrize("key", ["mvbox_move", "only_fetch_mvbox"])
|
||||||
@@ -58,8 +58,8 @@ def test_no_second_transport_with_mvbox(acfactory, key) -> None:
|
|||||||
account.add_transport_from_qr(qr)
|
account.add_transport_from_qr(qr)
|
||||||
|
|
||||||
|
|
||||||
def test_no_second_transport_without_classic_emails(acfactory) -> None:
|
def test_second_transport_without_classic_emails(acfactory) -> None:
|
||||||
"""Test that second transport cannot be configured if classic emails are not fetched."""
|
"""Test that second transport can be configured if classic emails are not fetched."""
|
||||||
account = acfactory.new_configured_account()
|
account = acfactory.new_configured_account()
|
||||||
assert len(account.list_transports()) == 1
|
assert len(account.list_transports()) == 1
|
||||||
|
|
||||||
@@ -68,8 +68,7 @@ def test_no_second_transport_without_classic_emails(acfactory) -> None:
|
|||||||
qr = acfactory.get_account_qr()
|
qr = acfactory.get_account_qr()
|
||||||
account.set_config("show_emails", "0")
|
account.set_config("show_emails", "0")
|
||||||
|
|
||||||
with pytest.raises(JsonRpcError):
|
account.add_transport_from_qr(qr)
|
||||||
account.add_transport_from_qr(qr)
|
|
||||||
|
|
||||||
|
|
||||||
def test_change_address(acfactory) -> None:
|
def test_change_address(acfactory) -> None:
|
||||||
|
|||||||
@@ -712,12 +712,7 @@ impl Context {
|
|||||||
Self::check_config(key, value)?;
|
Self::check_config(key, value)?;
|
||||||
|
|
||||||
let n_transports = self.count_transports().await?;
|
let n_transports = self.count_transports().await?;
|
||||||
if n_transports > 1
|
if n_transports > 1 && matches!(key, Config::MvboxMove | Config::OnlyFetchMvbox) {
|
||||||
&& matches!(
|
|
||||||
key,
|
|
||||||
Config::MvboxMove | Config::OnlyFetchMvbox | Config::ShowEmails
|
|
||||||
)
|
|
||||||
{
|
|
||||||
bail!("Cannot reconfigure {key} when multiple transports are configured");
|
bail!("Cannot reconfigure {key} when multiple transports are configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -286,11 +286,6 @@ impl Context {
|
|||||||
"To use additional relays, disable the legacy option \"Settings / Advanced / Move automatically to DeltaChat Folder\"."
|
"To use additional relays, disable the legacy option \"Settings / Advanced / Move automatically to DeltaChat Folder\"."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if self.get_config(Config::ShowEmails).await?.as_deref() != Some("2") {
|
|
||||||
bail!(
|
|
||||||
"To use additional relays, set the legacy option \"Settings / Advanced / Show Classic Emails\" to \"All\"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if self
|
if self
|
||||||
.sql
|
.sql
|
||||||
|
|||||||
Reference in New Issue
Block a user