From: David ‘Bombe’ Roden Date: Sat, 18 Apr 2020 21:49:46 +0000 (+0200) Subject: 🚧 Add strict filtering to preferences loader X-Git-Tag: v82^2~8 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7e42d9da5be1d45c8a4ed5fc9e178edf403a2c41;p=Sone.git 🚧 Add strict filtering to preferences loader --- diff --git a/src/main/kotlin/net/pterodactylus/sone/core/PreferencesLoader.kt b/src/main/kotlin/net/pterodactylus/sone/core/PreferencesLoader.kt index 32c35cb..62b60ae 100644 --- a/src/main/kotlin/net/pterodactylus/sone/core/PreferencesLoader.kt +++ b/src/main/kotlin/net/pterodactylus/sone/core/PreferencesLoader.kt @@ -17,6 +17,7 @@ class PreferencesLoader(private val preferences: Preferences) { loadRequireFullAccess(configuration) loadFcpInterfaceActive(configuration) loadFcpFullAccessRequired(configuration) + loadStrictFiltering(configuration) } private fun loadInsertionDelay(configuration: Configuration) { @@ -55,4 +56,8 @@ class PreferencesLoader(private val preferences: Preferences) { preferences.newFcpFullAccessRequired = fullAccessRequiredInteger?.let { FullAccessRequired.values()[it] } } + private fun loadStrictFiltering(configuration: Configuration) { + preferences.newStrictFiltering = configuration.getBooleanValue("Option/StrictFiltering").getValue(null) + } + } diff --git a/src/test/kotlin/net/pterodactylus/sone/core/PreferencesLoaderTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/PreferencesLoaderTest.kt index 0cd7e6d..cb8df38 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/PreferencesLoaderTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/PreferencesLoaderTest.kt @@ -28,6 +28,7 @@ class PreferencesLoaderTest { setupBooleanValue("RequireFullAccess", true) setupBooleanValue("ActivateFcpInterface", true) setupIntValue("FcpFullAccessRequired", 1) + setupBooleanValue("StrictFiltering", true) } private fun setupIntValue(optionName: String, value: Int) { @@ -49,6 +50,7 @@ class PreferencesLoaderTest { assertThat(preferences.requireFullAccess, equalTo(true)) assertThat(preferences.fcpInterfaceActive, equalTo(true)) assertThat(preferences.fcpFullAccessRequired, equalTo(FullAccessRequired.WRITING)) + assertThat(preferences.strictFiltering, equalTo(true)) } @Test