From: David ‘Bombe’ Roden
Date: Thu, 28 Nov 2019 18:15:02 +0000 (+0100)
Subject: 🔥 Remove trust settings from options page
X-Git-Tag: v81^2~17^2~2
X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8d519780f593934aca818b1da04b4295efe2169a;p=Sone.git
🔥 Remove trust settings from options page
---
diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt
index 2c454e8..412258d 100644
--- a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt
+++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt
@@ -50,9 +50,6 @@ class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loade
val imagesPerPage = soneRequest.parameters["images-per-page"]?.toIntOrNull()
val insertionDelay = soneRequest.parameters["insertion-delay"]?.toIntOrNull()
val fcpFullAccessRequired = soneRequest.parameters["fcp-full-access-required"]?.toIntOrNull()
- val negativeTrust = soneRequest.parameters["negative-trust"]?.toIntOrNull()
- val positiveTrust = soneRequest.parameters["positive-trust"]?.toIntOrNull()
- val trustComment = soneRequest.parameters["trust-comment"]?.emptyToNull
if (cantSetOption { soneRequest.core.preferences.newPostsPerPage = postsPerPage }) fieldsWithErrors += "posts-per-page"
if (cantSetOption { soneRequest.core.preferences.newCharactersPerPost = charactersPerPost }) fieldsWithErrors += "characters-per-post"
@@ -60,9 +57,6 @@ class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loade
if (cantSetOption { soneRequest.core.preferences.newImagesPerPage = imagesPerPage }) fieldsWithErrors += "images-per-page"
if (cantSetOption { soneRequest.core.preferences.newInsertionDelay = insertionDelay }) fieldsWithErrors += "insertion-delay"
fcpFullAccessRequired?.also { if (cantSetOption { soneRequest.core.preferences.newFcpFullAccessRequired = FullAccessRequired.values()[fcpFullAccessRequired] }) fieldsWithErrors += "fcp-full-access-required" }
- if (cantSetOption { soneRequest.core.preferences.newNegativeTrust = negativeTrust }) fieldsWithErrors += "negative-trust"
- if (cantSetOption { soneRequest.core.preferences.newPositiveTrust = positiveTrust }) fieldsWithErrors += "positive-trust"
- if (cantSetOption { soneRequest.core.preferences.newTrustComment = trustComment }) fieldsWithErrors += "trust-comment"
if (fieldsWithErrors.isEmpty()) {
soneRequest.core.touchConfiguration()
@@ -86,11 +80,8 @@ class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loade
templateContext["images-per-page"] = preferences.imagesPerPage
templateContext["fcp-interface-active"] = preferences.fcpInterfaceActive
templateContext["require-full-access"] = preferences.requireFullAccess
- templateContext["negative-trust"] = preferences.negativeTrust
- templateContext["positive-trust"] = preferences.positiveTrust
templateContext["post-cut-off-length"] = preferences.postCutOffLength
templateContext["posts-per-page"] = preferences.postsPerPage
- templateContext["trust-comment"] = preferences.trustComment
}
}
diff --git a/src/main/resources/i18n/sone.de.properties b/src/main/resources/i18n/sone.de.properties
index dcc6354..3274c88 100644
--- a/src/main/resources/i18n/sone.de.properties
+++ b/src/main/resources/i18n/sone.de.properties
@@ -66,10 +66,6 @@ Page.Options.Option.ImagesPerPage.Description=Anzahl der Bilder pro Seite.
Page.Options.Option.CharactersPerPost.Description=Die Anzahl der Zeichen, die eine Nachricht enthalten muss, damit sie gekürzt angezeigt wird (-1 für ânie kürzenâ). Die Anzahl der tatsächlich angezeigten Zeichen wird in der nächsten Option konfiguriert.
Page.Options.Option.PostCutOffLength.Description=Die Anzahl der Zeichen, die von einer gekürzten Nachricht sichtbar sind (siehe Option hierüber). Wird ignoriert, wenn die Option hierüber deaktiviert ist, bzw. auf -1 steht.
Page.Options.Option.RequireFullAccess.Description=Zugriff auf Sone für alle Rechner, die keinen vollen Zugriff haben, unterbinden.
-Page.Options.Section.TrustOptions.Title=Vertrauenseinstellungen
-Page.Options.Option.PositiveTrust.Description=Die Menge an positivem Vertrauen, die bei einem Klick auf den Haken unter einer Nachricht zugewiesen werden soll.
-Page.Options.Option.NegativeTrust.Description=Die Menge an negativem Vertrauen, die bei einem Klick auf das rote X unter einer Nachricht zugewiesen werden soll. Dieser Wert sollte negativ sein.
-Page.Options.Option.TrustComment.Description=Der Kommentar, der im Web of Trust für Ihre Zuweisung angezeigt werden soll.
Page.Options.Section.FcpOptions.Title=FCP-Schnittstellenoptionen
Page.Options.Option.FcpInterfaceActive.Description=Die FCP-Schnittstelle aktivieren, um anderen Plugins und Programmen den Zugriff auf Ihr Sone-Plugin zu ermöglichen.
Page.Options.Option.FcpFullAccessRequired.Description=FCP-Verbindungen nur von âerlaubten Hostsâ erlauben (siehe {link}Knoten-Konfiguration, Abschnitt âFCPâ{/link}).
diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties
index 896b34f..380059b 100644
--- a/src/main/resources/i18n/sone.en.properties
+++ b/src/main/resources/i18n/sone.en.properties
@@ -68,10 +68,6 @@ Page.Options.Option.ImagesPerPage.Description=The number of images to display on
Page.Options.Option.CharactersPerPost.Description=The number of characters to display from a post before cutting it off and showing a link to expand it (-1 to disable). The actual length of the snippet is determined by the option below.
Page.Options.Option.PostCutOffLength.Description=The number of characters that are displayed if a post is deemed too long (see option above). Ignored if ânumber of characters to displayâ is disabled (set to -1).
Page.Options.Option.RequireFullAccess.Description=Whether to deny access to Sone to any host that has not been granted full access.
-Page.Options.Section.TrustOptions.Title=Trust Settings
-Page.Options.Option.PositiveTrust.Description=The amount of positive trust you want to assign to other Sones by clicking the checkmark below a post or reply.
-Page.Options.Option.NegativeTrust.Description=The amount of trust you want to assign to other Sones by clicking the red X below a post or reply. This value should be negative.
-Page.Options.Option.TrustComment.Description=The comment that will be set in the web of trust for any trust you assign from Sone.
Page.Options.Section.FcpOptions.Title=FCP Interface Settings
Page.Options.Option.FcpInterfaceActive.Description=Activate the FCP interface to allow other plugins and remote clients to access your Sone plugin.
Page.Options.Option.FcpFullAccessRequired.Description=Require FCP connection from allowed hosts (see your {link}nodeâs configuration, section âFCPâ{/link})
diff --git a/src/main/resources/i18n/sone.es.properties b/src/main/resources/i18n/sone.es.properties
index d880e16..318fadc 100644
--- a/src/main/resources/i18n/sone.es.properties
+++ b/src/main/resources/i18n/sone.es.properties
@@ -66,10 +66,6 @@ Page.Options.Option.ImagesPerPage.Description=Número de imágenes a mostrar en
Page.Options.Option.CharactersPerPost.Description=Número de carácteres a mostrar de una publicación antes de acortarla y mostrar un link para expandirla (-1 para deshabilitar esta opción). La longitud de la acortación está determinada por la siguiente opción.
Page.Options.Option.PostCutOffLength.Description=Número de carácteres que son mostrados si una publicación es demasiado larga (Mirar la opción anterior).Ignoralo si "Número de carácteres a mostrar" está desactivado (Valor en -1).
Page.Options.Option.RequireFullAccess.Description=Denegar el acceso a Sone a cualquier host al que no se haya garantizado acceso completo.
-Page.Options.Section.TrustOptions.Title=Opciones de veracidad.
-Page.Options.Option.PositiveTrust.Description=Cantidad de veracidad positiva que quieres asignar a otros Sone al clicar en el tick tras una publicación o respuesta.
-Page.Options.Option.NegativeTrust.Description=Cantidad de veracidad que quieres asignar a otros Sone al clicar la X roja tras una publicación o respuesta. Este valor deberÃa ser negativo.
-Page.Options.Option.TrustComment.Description=El comentario que se mostrara en la Web of Trust para cualquier veracidad que asignes desde Sone.
Page.Options.Section.FcpOptions.Title=Opciones de la interfaz FCP
Page.Options.Option.FcpInterfaceActive.Description=Activar la interfaz FCP para permitir a otros plugins y clientes remotos acceder al plugin de Sone.
Page.Options.Option.FcpFullAccessRequired.Description=Requiere conexión FCP de los hosts permitidos (Comprueva tu {link}configuración del nodo, sección âFCPâ{/link})
@@ -478,4 +474,4 @@ Notification.Mention.Text=Has sido mencionado en las siguientes publicaciones:
Notification.SoneIsInserting.Text=Tu Sone sone://{0} está siendo insertado.
Notification.SoneIsInserted.Text=Tu Sone sone://{0} ha sido insertado en {1,number} {1,choice,0#segundos|1#segundo|1
@@ -160,23 +151,6 @@
<%= Page.Options.Option.RequireFullAccess.Description|l10n|html>
diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt
index 71e1b7b..d2929d9 100644
--- a/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt
+++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt
@@ -25,11 +25,8 @@ class OptionsPageTest : WebPageTest(::OptionsPage) {
core.preferences.newImagesPerPage = 4
core.preferences.newFcpInterfaceActive = true
core.preferences.newRequireFullAccess = true
- core.preferences.newNegativeTrust = 7
- core.preferences.newPositiveTrust = 8
core.preferences.newPostCutOffLength = 51
core.preferences.newPostsPerPage = 10
- core.preferences.newTrustComment = "11"
}
@Before
@@ -77,11 +74,8 @@ class OptionsPageTest : WebPageTest(::OptionsPage) {
assertThat(templateContext["images-per-page"], equalTo(4))
assertThat(templateContext["fcp-interface-active"], equalTo(true))
assertThat(templateContext["require-full-access"], equalTo(true))
- assertThat(templateContext["negative-trust"], equalTo(7))
- assertThat(templateContext["positive-trust"], equalTo(8))
assertThat(templateContext["post-cut-off-length"], equalTo(51))
assertThat(templateContext["posts-per-page"], equalTo(10))
- assertThat(templateContext["trust-comment"], equalTo("11"))
}
}
@@ -284,56 +278,6 @@ class OptionsPageTest : WebPageTest(::OptionsPage) {
}
@Test
- fun `negative trust can not be set to -101`() {
- verifyThatWrongValueForPreferenceIsDetected("negative-trust", "-101")
- }
-
- @Test
- fun `negative trust can be set to -100`() {
- verifyThatPreferencesCanBeSet("negative-trust", "-100", -100) { core.preferences.negativeTrust }
- }
-
- @Test
- fun `negative trust can be set to 100`() {
- verifyThatPreferencesCanBeSet("negative-trust", "100", 100) { core.preferences.negativeTrust }
- }
-
- @Test
- fun `negative trust can not be set to 101`() {
- verifyThatWrongValueForPreferenceIsDetected("negative-trust", "101")
- }
-
- @Test
- fun `negative trust is set to default on invalid value`() {
- verifyThatPreferencesCanBeSet("negative-trust", "invalid", -25) { core.preferences.negativeTrust }
- }
-
- @Test
- fun `positive trust can not be set to -1`() {
- verifyThatWrongValueForPreferenceIsDetected("positive-trust", "-1")
- }
-
- @Test
- fun `positive trust can be set to 0`() {
- verifyThatPreferencesCanBeSet("positive-trust", "0", 0) { core.preferences.positiveTrust }
- }
-
- @Test
- fun `positive trust can be set to 100`() {
- verifyThatPreferencesCanBeSet("positive-trust", "100", 100) { core.preferences.positiveTrust }
- }
-
- @Test
- fun `positive trust can not be set to 101`() {
- verifyThatWrongValueForPreferenceIsDetected("positive-trust", "101")
- }
-
- @Test
- fun `positive trust is set to default on invalid value`() {
- verifyThatPreferencesCanBeSet("positive-trust", "invalid", 75) { core.preferences.positiveTrust }
- }
-
- @Test
fun `post cut off length can not be set to -49`() {
verifyThatWrongValueForPreferenceIsDetected("post-cut-off-length", "-49")
}
@@ -364,16 +308,6 @@ class OptionsPageTest : WebPageTest(::OptionsPage) {
}
@Test
- fun `trust comment can be set`() {
- verifyThatPreferencesCanBeSet("trust-comment", "trust", "trust") { core.preferences.trustComment }
- }
-
- @Test
- fun `trust comment is set to default when set to empty value`() {
- verifyThatPreferencesCanBeSet("trust-comment", "", "Set from Sone Web Interface") { core.preferences.trustComment }
- }
-
- @Test
fun `page can be created by dependency injection`() {
assertThat(baseInjector.getInstance(), notNullValue())
}