Merge pull request #7067 from thundernest/autodiscovery_result_source
Add source to `AutoDiscoveryResult.Settings`
This commit is contained in:
commit
23add3be6f
10 changed files with 18 additions and 0 deletions
|
@ -10,6 +10,8 @@ internal class AutoDiscoveryResultFormatter(private val echo: (String) -> Unit)
|
||||||
val outgoingServer = requireNotNull(settings.outgoingServerSettings as? SmtpServerSettings)
|
val outgoingServer = requireNotNull(settings.outgoingServerSettings as? SmtpServerSettings)
|
||||||
|
|
||||||
echo("------------------------------")
|
echo("------------------------------")
|
||||||
|
echo("Source: ${settings.source}")
|
||||||
|
echo("")
|
||||||
echo("Incoming server:")
|
echo("Incoming server:")
|
||||||
echo(" Hostname: ${incomingServer.hostname.value}")
|
echo(" Hostname: ${incomingServer.hostname.value}")
|
||||||
echo(" Port: ${incomingServer.port.value}")
|
echo(" Port: ${incomingServer.port.value}")
|
||||||
|
|
|
@ -73,6 +73,7 @@ internal class GetAutoDiscovery(
|
||||||
username = "username",
|
username = "username",
|
||||||
),
|
),
|
||||||
isTrusted = isTrusted,
|
isTrusted = isTrusted,
|
||||||
|
source = "fake",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ internal fun AutoDiscoveryStatusBodyViewPreview() {
|
||||||
username = "",
|
username = "",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "preview",
|
||||||
),
|
),
|
||||||
onEditConfigurationClick = {},
|
onEditConfigurationClick = {},
|
||||||
)
|
)
|
||||||
|
|
|
@ -88,6 +88,7 @@ internal fun AutoDiscoveryStatusViewTrustedPreview() {
|
||||||
username = "",
|
username = "",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "preview",
|
||||||
),
|
),
|
||||||
onEditConfigurationClick = {},
|
onEditConfigurationClick = {},
|
||||||
)
|
)
|
||||||
|
@ -115,6 +116,7 @@ internal fun AutoDiscoveryStatusViewUntrustedPreview() {
|
||||||
username = "",
|
username = "",
|
||||||
),
|
),
|
||||||
isTrusted = false,
|
isTrusted = false,
|
||||||
|
source = "preview",
|
||||||
),
|
),
|
||||||
onEditConfigurationClick = {},
|
onEditConfigurationClick = {},
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,5 +26,6 @@ object AutoDiscoverySettingsFixture {
|
||||||
username = "outgoing_username",
|
username = "outgoing_username",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "test",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,7 @@ class AccountAutoDiscoveryStateMapperKtTest {
|
||||||
username = AUTO_DISCOVERY_USERNAME,
|
username = AUTO_DISCOVERY_USERNAME,
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "test",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,11 @@ sealed interface AutoDiscoveryResult {
|
||||||
* the user has given consent.
|
* the user has given consent.
|
||||||
*/
|
*/
|
||||||
val isTrusted: Boolean,
|
val isTrusted: Boolean,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String describing the source of the server settings. Use a URI if possible.
|
||||||
|
*/
|
||||||
|
val source: String,
|
||||||
) : AutoDiscoveryResult
|
) : AutoDiscoveryResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,6 +41,7 @@ internal class RealAutoconfigFetcher(
|
||||||
incomingServerSettings = parserResult.incomingServerSettings,
|
incomingServerSettings = parserResult.incomingServerSettings,
|
||||||
outgoingServerSettings = parserResult.outgoingServerSettings,
|
outgoingServerSettings = parserResult.outgoingServerSettings,
|
||||||
isTrusted = fetchResult.isTrusted,
|
isTrusted = fetchResult.isTrusted,
|
||||||
|
source = autoconfigUrl.toString(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ internal class MockAutoconfigFetcher : AutoconfigFetcher {
|
||||||
username = "irrelevant@domain.example",
|
username = "irrelevant@domain.example",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "result 1",
|
||||||
)
|
)
|
||||||
val RESULT_TWO = AutoDiscoveryResult.Settings(
|
val RESULT_TWO = AutoDiscoveryResult.Settings(
|
||||||
incomingServerSettings = ImapServerSettings(
|
incomingServerSettings = ImapServerSettings(
|
||||||
|
@ -67,6 +68,7 @@ internal class MockAutoconfigFetcher : AutoconfigFetcher {
|
||||||
username = "irrelevant@company.example",
|
username = "irrelevant@company.example",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "result 2",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,7 @@ class PriorityParallelRunnerTest {
|
||||||
username = "user@domain.example",
|
username = "user@domain.example",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "result 1",
|
||||||
)
|
)
|
||||||
|
|
||||||
private val DISCOVERY_RESULT_TWO = AutoDiscoveryResult.Settings(
|
private val DISCOVERY_RESULT_TWO = AutoDiscoveryResult.Settings(
|
||||||
|
@ -174,6 +175,7 @@ class PriorityParallelRunnerTest {
|
||||||
username = "user@domain.example",
|
username = "user@domain.example",
|
||||||
),
|
),
|
||||||
isTrusted = true,
|
isTrusted = true,
|
||||||
|
source = "result 2",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue