Let EnterpriseService prevent usage of homeserver (#4682)

* Add check on homeserver url.

* Update screenshots

* Add missing test

* Update submodule link.

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Benoit Marty 2025-05-06 19:25:07 +02:00 committed by GitHub
parent 390337c426
commit 8ca5f8bc9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 108 additions and 5 deletions

View file

@ -23,6 +23,7 @@ class DefaultEnterpriseService @Inject constructor() : EnterpriseService {
override suspend fun isEnterpriseUser(sessionId: SessionId) = false
override fun defaultHomeserver() = null
override suspend fun isAllowedToConnectToHomeserver(homeserverUrl: String) = true
override fun semanticColorsLight(): SemanticColors = compoundColorsLight

View file

@ -8,6 +8,7 @@
package io.element.android.features.enterprise.impl
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
import io.element.android.libraries.matrix.test.A_SESSION_ID
import kotlinx.coroutines.test.runTest
import org.junit.Test
@ -25,6 +26,12 @@ class DefaultEnterpriseServiceTest {
assertThat<String?>(defaultEnterpriseService.defaultHomeserver()).isNull()
}
@Test
fun `isAllowedToConnectToHomeserver is true for all homeserver urls`() = runTest {
val defaultEnterpriseService = DefaultEnterpriseService()
assertThat(defaultEnterpriseService.isAllowedToConnectToHomeserver(A_HOMESERVER_URL)).isTrue()
}
@Test
fun `isEnterpriseUser always return false`() = runTest {
val defaultEnterpriseService = DefaultEnterpriseService()