🔥 Remove trust settings from preferences
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 28 Nov 2019 18:15:28 +0000 (19:15 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 28 Nov 2019 19:03:35 +0000 (20:03 +0100)
src/main/java/net/pterodactylus/sone/core/PreferencesLoader.java
src/main/kotlin/net/pterodactylus/sone/core/Preferences.kt
src/test/java/net/pterodactylus/sone/core/PreferencesLoaderTest.java
src/test/kotlin/net/pterodactylus/sone/core/PreferencesTest.kt

index a730983..5fa33e4 100644 (file)
@@ -23,9 +23,6 @@ public class PreferencesLoader {
                loadCharactersPerPost(configuration);
                loadPostCutOffLength(configuration);
                loadRequireFullAccess(configuration);
-               loadPositiveTrust(configuration);
-               loadNegativeTrust(configuration);
-               loadTrustComment(configuration);
                loadFcpInterfaceActive(configuration);
                loadFcpFullAccessRequired(configuration);
        }
@@ -69,24 +66,6 @@ public class PreferencesLoader {
                                                .getValue(null));
        }
 
-       private void loadPositiveTrust(Configuration configuration) {
-               preferences.setNewPositiveTrust(
-                               configuration.getIntValue("Option/PositiveTrust")
-                                               .getValue(null));
-       }
-
-       private void loadNegativeTrust(Configuration configuration) {
-               preferences.setNewNegativeTrust(
-                               configuration.getIntValue("Option/NegativeTrust")
-                                               .getValue(null));
-       }
-
-       private void loadTrustComment(Configuration configuration) {
-               preferences.setNewTrustComment(
-                               configuration.getStringValue("Option/TrustComment")
-                                               .getValue(null));
-       }
-
        private void loadFcpInterfaceActive(Configuration configuration) {
                preferences.setNewFcpInterfaceActive(configuration.getBooleanValue(
                                "Option/ActivateFcpInterface").getValue(null));
index 783552e..7363ed0 100644 (file)
@@ -77,24 +77,6 @@ class Preferences(private val eventBus: EventBus) {
                get() = unsupported
                set(value) = _requireFullAccess.set(value)
 
-       private val _positiveTrust = DefaultOption(75, range(0, 100))
-       val positiveTrust: Int get() = _positiveTrust.get()
-       var newPositiveTrust: Int?
-               get() = unsupported
-               set(value) = _positiveTrust.set(value)
-
-       private val _negativeTrust = DefaultOption(-25, range(-100, 100))
-       val negativeTrust: Int get() = _negativeTrust.get()
-       var newNegativeTrust: Int?
-               get() = unsupported
-               set(value) = _negativeTrust.set(value)
-
-       private val _trustComment = DefaultOption("Set from Sone Web Interface")
-       val trustComment: String get() = _trustComment.get()
-       var newTrustComment: String?
-               get() = unsupported
-               set(value) = _trustComment.set(value)
-
        private val _fcpInterfaceActive = DefaultOption(false)
        val fcpInterfaceActive: Boolean get() = _fcpInterfaceActive.get()
        var newFcpInterfaceActive: Boolean?
@@ -125,9 +107,6 @@ class Preferences(private val eventBus: EventBus) {
                configuration.getIntValue("Option/CharactersPerPost").value = _charactersPerPost.real
                configuration.getIntValue("Option/PostCutOffLength").value = _postCutOffLength.real
                configuration.getBooleanValue("Option/RequireFullAccess").value = _requireFullAccess.real
-               configuration.getIntValue("Option/PositiveTrust").value = _positiveTrust.real
-               configuration.getIntValue("Option/NegativeTrust").value = _negativeTrust.real
-               configuration.getStringValue("Option/TrustComment").value = _trustComment.real
                configuration.getBooleanValue("Option/ActivateFcpInterface").value = _fcpInterfaceActive.real
                configuration.getIntValue("Option/FcpFullAccessRequired").value = toInt(_fcpFullAccessRequired.real)
        }
index d550f25..72831fc 100644 (file)
@@ -33,10 +33,6 @@ public class PreferencesLoaderTest {
                setupIntValue("CharactersPerPost", 150);
                setupIntValue("PostCutOffLength", 300);
                setupBooleanValue("RequireFullAccess", true);
-               setupIntValue("PositiveTrust", 50);
-               setupIntValue("NegativeTrust", -50);
-               when(configuration.getStringValue("Option/TrustComment")).thenReturn(
-                               TestValue.from("Trusted"));
                setupBooleanValue("ActivateFcpInterface", true);
                setupIntValue("FcpFullAccessRequired", 1);
        }
@@ -62,9 +58,6 @@ public class PreferencesLoaderTest {
                assertThat(preferences.getCharactersPerPost(), is(150));
                assertThat(preferences.getPostCutOffLength(), is(300));
                assertThat(preferences.getRequireFullAccess(), is(true));
-               assertThat(preferences.getPositiveTrust(), is(50));
-               assertThat(preferences.getNegativeTrust(), is(-50));
-               assertThat(preferences.getTrustComment(), is("Trusted"));
                assertThat(preferences.getFcpInterfaceActive(), is(true));
                assertThat(preferences.getFcpFullAccessRequired(), is(WRITING));
        }
index 199604b..6da6658 100644 (file)
@@ -180,69 +180,6 @@ class PreferencesTest {
        }
 
        @Test
-       fun `preferences retain positive trust`() {
-               preferences.newPositiveTrust = 15
-               assertThat(preferences.positiveTrust, equalTo(15))
-       }
-
-       @Test(expected = IllegalArgumentException::class)
-       fun `invalid positive trust is rejected`() {
-               preferences.newPositiveTrust = -15
-       }
-
-       @Test
-       fun `preferences return default value when positive trust is set to null`() {
-               preferences.newPositiveTrust = null
-               assertThat(preferences.positiveTrust, equalTo(75))
-       }
-
-       @Test
-       fun `preferences start with positive trust default value`() {
-               assertThat(preferences.positiveTrust, equalTo(75))
-       }
-
-       @Test
-       fun `preferences retain negative trust`() {
-               preferences.newNegativeTrust = -15
-               assertThat(preferences.negativeTrust, equalTo(-15))
-       }
-
-       @Test(expected = IllegalArgumentException::class)
-       fun `invalid negative trust is rejected`() {
-               preferences.newNegativeTrust = 150
-       }
-
-       @Test
-       fun `preferences return default value when negative trust is set to null`() {
-               preferences.newNegativeTrust = null
-               assertThat(preferences.negativeTrust, equalTo(-25))
-       }
-
-       @Test
-       fun `preferences start with negative trust default value`() {
-               assertThat(preferences.negativeTrust, equalTo(-25))
-       }
-
-       @Test
-       fun `preferences retain trust comment`() {
-               preferences.newTrustComment = "Trust"
-               assertThat(preferences.trustComment, equalTo("Trust"))
-       }
-
-       @Test
-       fun `preferences return default value when trust comment is set to null`() {
-               preferences.newTrustComment = null
-               assertThat(preferences.trustComment,
-                               equalTo("Set from Sone Web Interface"))
-       }
-
-       @Test
-       fun `preferences start with trust comment default value`() {
-               assertThat(preferences.trustComment,
-                               equalTo("Set from Sone Web Interface"))
-       }
-
-       @Test
        fun `preferences retain fcp interface active of true`() {
                preferences.newFcpInterfaceActive = true
                assertThat(preferences.fcpInterfaceActive, equalTo(true))