}
/**
- * Sets the trust value of the given origin Sone for the target Sone.
- *
- * @param origin
- * The origin Sone
- * @param target
- * The target Sone
- * @param trustValue
- * The trust value (from {@code -100} to {@code 100})
- */
- public void setTrust(Sone origin, Sone target, int trustValue) {
- checkNotNull(origin, "origin must not be null");
- checkArgument(origin.getIdentity() instanceof OwnIdentity, "origin must be a local Sone");
- checkNotNull(target, "target must not be null");
- checkArgument((trustValue >= -100) && (trustValue <= 100), "trustValue must be within [-100, 100]");
- webOfTrustUpdater.setTrust((OwnIdentity) origin.getIdentity(), target.getIdentity(), trustValue, preferences.getTrustComment());
- }
-
- /**
- * Removes any trust assignment for the given target Sone.
- *
- * @param origin
- * The trust origin
- * @param target
- * The trust target
- */
- public void removeTrust(Sone origin, Sone target) {
- checkNotNull(origin, "origin must not be null");
- checkNotNull(target, "target must not be null");
- checkArgument(origin.getIdentity() instanceof OwnIdentity, "origin must be a local Sone");
- webOfTrustUpdater.setTrust((OwnIdentity) origin.getIdentity(), target.getIdentity(), null, null);
- }
-
- /**
- * Assigns the configured positive trust value for the given target.
- *
- * @param origin
- * The trust origin
- * @param target
- * The trust target
- */
- public void trustSone(Sone origin, Sone target) {
- setTrust(origin, target, preferences.getPositiveTrust());
- }
-
- /**
- * Assigns the configured negative trust value for the given target.
- *
- * @param origin
- * The trust origin
- * @param target
- * The trust target
- */
- public void distrustSone(Sone origin, Sone target) {
- setTrust(origin, target, preferences.getNegativeTrust());
- }
-
- /**
- * Removes the trust assignment for the given target.
- *
- * @param origin
- * The trust origin
- * @param target
- * The trust target
- */
- public void untrustSone(Sone origin, Sone target) {
- removeTrust(origin, target);
- }
-
- /**
* Updates the stored Sone with the given Sone.
*
* @param sone
loadCharactersPerPost(configuration);
loadPostCutOffLength(configuration);
loadRequireFullAccess(configuration);
- loadPositiveTrust(configuration);
- loadNegativeTrust(configuration);
- loadTrustComment(configuration);
loadFcpInterfaceActive(configuration);
loadFcpFullAccessRequired(configuration);
}
.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));
package net.pterodactylus.sone.core;
-import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
import net.pterodactylus.util.service.Service;
@ImplementedBy(WebOfTrustUpdaterImpl.class)
public interface WebOfTrustUpdater extends Service {
- void setTrust(OwnIdentity truster, Identity trustee, Integer score, String comment);
boolean addContextWait(OwnIdentity ownIdentity, String context);
void removeContext(OwnIdentity ownIdentity, String context);
void setProperty(OwnIdentity ownIdentity, String propertyName, String propertyValue);
import java.util.logging.Logger;
import net.pterodactylus.sone.freenet.plugin.PluginException;
-import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
-import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.freenet.wot.WebOfTrustConnector;
-import net.pterodactylus.sone.freenet.wot.WebOfTrustException;
import net.pterodactylus.util.service.AbstractService;
import com.google.common.annotations.VisibleForTesting;
//
/**
- * Updates the trust relation between the truster and the trustee. This method
- * will return immediately and perform a trust update in the background.
- *
- * @param truster
- * The identity giving the trust
- * @param trustee
- * The identity receiving the trust
- * @param score
- * The new level of trust (from -100 to 100, may be {@code null} to remove
- * the trust completely)
- * @param comment
- * The comment of the trust relation
- */
- @Override
- public void setTrust(OwnIdentity truster, Identity trustee, Integer score, String comment) {
- SetTrustJob setTrustJob = new SetTrustJob(truster, trustee, score, comment);
- if (updateJobs.contains(setTrustJob)) {
- updateJobs.remove(setTrustJob);
- }
- logger.log(Level.FINER, "Adding Trust Update Job: " + setTrustJob);
- try {
- updateJobs.put(setTrustJob);
- } catch (InterruptedException e) {
- /* the queue is unbounded so it should never block. */
- }
- }
-
- /**
* Adds the given context to the given own identity, waiting for completion of
* the operation.
*
}
/**
- * Update job that sets the trust relation between two identities.
- */
- @VisibleForTesting
- class SetTrustJob extends WebOfTrustUpdateJob {
-
- /** The identity giving the trust. */
- private final OwnIdentity truster;
-
- /** The identity receiving the trust. */
- private final Identity trustee;
-
- /** The score of the relation. */
- private final Integer score;
-
- /** The comment of the relation. */
- private final String comment;
-
- /**
- * Creates a new set trust job.
- *
- * @param truster
- * The identity giving the trust
- * @param trustee
- * The identity receiving the trust
- * @param score
- * The score of the trust (from -100 to 100, may be {@code null} to remote
- * the trust relation completely)
- * @param comment
- * The comment of the trust relation
- */
- public SetTrustJob(OwnIdentity truster, Identity trustee, Integer score, String comment) {
- this.truster = checkNotNull(truster, "truster must not be null");
- this.trustee = checkNotNull(trustee, "trustee must not be null");
- this.score = score;
- this.comment = comment;
- }
-
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings("synthetic-access")
- public void run() {
- try {
- if (score != null) {
- webOfTrustConnector.setTrust(truster, trustee, score, comment);
- trustee.setTrust(truster, new Trust(score, null, 0));
- } else {
- webOfTrustConnector.removeTrust(truster, trustee);
- trustee.removeTrust(truster);
- }
- finish(true);
- } catch (WebOfTrustException wote1) {
- logger.log(Level.WARNING, "Could not set Trust value for " + truster + " -> " + trustee + " to " + score + " (" + comment + ")!", wote1);
- finish(false);
- }
- }
-
- //
- // OBJECT METHODS
- //
-
- /** {@inheritDoc} */
- @Override
- public boolean equals(Object object) {
- if ((object == null) || !object.getClass().equals(getClass())) {
- return false;
- }
- SetTrustJob updateJob = (SetTrustJob) object;
- return updateJob.truster.equals(truster) && updateJob.trustee.equals(trustee);
- }
-
- /** {@inheritDoc} */
- @Override
- public int hashCode() {
- return getClass().hashCode() ^ truster.hashCode() ^ trustee.hashCode();
- }
-
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return String.format("%s[truster=%s,trustee=%s]", getClass().getSimpleName(), truster.getId(), trustee.getId());
- }
-
- }
-
- /**
* Base class for context updates of an {@link OwnIdentity}.
*/
@VisibleForTesting
@Inject lateinit var deleteReplyPage: DeleteReplyPage
@Inject lateinit var deleteSonePage: DeleteSonePage
@Inject lateinit var dismissNotificationPage: DismissNotificationPage
- @Inject lateinit var distrustPage: DistrustPage
@Inject lateinit var editAlbumPage: EditAlbumPage
@Inject lateinit var editImagePage: EditImagePage
@Inject lateinit var editProfileFieldPage: EditProfileFieldPage
@Inject lateinit var optionsPage: OptionsPage
@Inject lateinit var rescuePage: RescuePage
@Inject lateinit var searchPage: SearchPage
- @Inject lateinit var trustPage: TrustPage
@Inject lateinit var unbookmarkPage: UnbookmarkPage
@Inject lateinit var unfollowSonePage: UnfollowSonePage
@Inject lateinit var unlikePage: UnlikePage
@Inject lateinit var unlockSonePage: UnlockSonePage
- @Inject lateinit var untrustPage: UntrustPage
@Inject lateinit var uploadImagePage: UploadImagePage
@Inject lateinit var viewPostPage: ViewPostPage
@Inject lateinit var viewSonePage: ViewSonePage
import net.pterodactylus.sone.web.ajax.DeleteProfileFieldAjaxPage;
import net.pterodactylus.sone.web.ajax.DeleteReplyAjaxPage;
import net.pterodactylus.sone.web.ajax.DismissNotificationAjaxPage;
-import net.pterodactylus.sone.web.ajax.DistrustAjaxPage;
import net.pterodactylus.sone.web.ajax.EditAlbumAjaxPage;
import net.pterodactylus.sone.web.ajax.EditImageAjaxPage;
import net.pterodactylus.sone.web.ajax.EditProfileFieldAjaxPage;
import net.pterodactylus.sone.web.ajax.LockSoneAjaxPage;
import net.pterodactylus.sone.web.ajax.MarkAsKnownAjaxPage;
import net.pterodactylus.sone.web.ajax.MoveProfileFieldAjaxPage;
-import net.pterodactylus.sone.web.ajax.TrustAjaxPage;
import net.pterodactylus.sone.web.ajax.UnbookmarkAjaxPage;
import net.pterodactylus.sone.web.ajax.UnfollowSoneAjaxPage;
import net.pterodactylus.sone.web.ajax.UnlikeAjaxPage;
import net.pterodactylus.sone.web.ajax.UnlockSoneAjaxPage;
-import net.pterodactylus.sone.web.ajax.UntrustAjaxPage;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.sone.web.page.TemplateRenderer;
import net.pterodactylus.sone.web.pages.*;
pageToadletRegistry.addPage(new UploadImagePage(this, loaders, templateRenderer));
pageToadletRegistry.addPage(new EditImagePage(this, loaders, templateRenderer));
pageToadletRegistry.addPage(new DeleteImagePage(this, loaders, templateRenderer));
- pageToadletRegistry.addPage(new TrustPage(this, loaders, templateRenderer));
- pageToadletRegistry.addPage(new DistrustPage(this, loaders, templateRenderer));
- pageToadletRegistry.addPage(new UntrustPage(this, loaders, templateRenderer));
pageToadletRegistry.addPage(new MarkAsKnownPage(this, loaders, templateRenderer));
pageToadletRegistry.addPage(new BookmarkPage(this, loaders, templateRenderer));
pageToadletRegistry.addPage(new UnbookmarkPage(this, loaders, templateRenderer));
pageToadletRegistry.addPage(new UnfollowSoneAjaxPage(this));
pageToadletRegistry.addPage(new EditAlbumAjaxPage(this));
pageToadletRegistry.addPage(new EditImageAjaxPage(this, parserFilter, shortenFilter, renderFilter));
- pageToadletRegistry.addPage(new TrustAjaxPage(this));
- pageToadletRegistry.addPage(new DistrustAjaxPage(this));
- pageToadletRegistry.addPage(new UntrustAjaxPage(this));
pageToadletRegistry.addPage(new LikeAjaxPage(this));
pageToadletRegistry.addPage(new UnlikeAjaxPage(this));
pageToadletRegistry.addPage(new GetLikesAjaxPage(this));
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?
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)
}
performRequest(SimpleFieldSetBuilder().put("Message", "RemoveProperty").put("Identity", ownIdentity.id).put("Property", name).get())
}
- override fun getTrust(ownIdentity: OwnIdentity, identity: Identity) =
- performRequest(SimpleFieldSetBuilder().put("Message", "GetIdentity").put("Truster", ownIdentity.id).put("Identity", identity.id).get())
- .fields
- .parseTrust()
-
- override fun setTrust(ownIdentity: OwnIdentity, identity: Identity, trust: Int, comment: String) {
- performRequest(SimpleFieldSetBuilder().put("Message", "SetTrust").put("Truster", ownIdentity.id).put("Trustee", identity.id).put("Value", trust.toString()).put("Comment", comment).get())
- }
-
- override fun removeTrust(ownIdentity: OwnIdentity, identity: Identity) {
- performRequest(SimpleFieldSetBuilder().put("Message", "RemoveTrust").put("Truster", ownIdentity.id).put("Trustee", identity.id).get())
- }
-
override fun ping() {
performRequest(SimpleFieldSetBuilder().put("Message", "Ping").get())
}
fun removeProperty(ownIdentity: OwnIdentity, name: String)
/**
- * Returns the trust for the given identity assigned to it by the given own
- * identity.
- *
- * @param ownIdentity The own identity
- * @param identity The identity to get the trust for
- * @return The trust for the given identity
- * @throws PluginException if an error occured talking to the Web of Trust plugin
- */
- @Throws(PluginException::class)
- fun getTrust(ownIdentity: OwnIdentity, identity: Identity): Trust
-
- /**
- * Sets the trust for the given identity.
- *
- * @param ownIdentity The trusting identity
- * @param identity The trusted identity
- * @param trust The amount of trust (-100 thru 100)
- * @param comment The comment or explanation of the trust value
- * @throws PluginException if an error occured talking to the Web of Trust plugin
- */
- @Throws(PluginException::class)
- fun setTrust(ownIdentity: OwnIdentity, identity: Identity, trust: Int, comment: String)
-
- /**
- * Removes any trust assignment of the given own identity for the given
- * identity.
- *
- * @param ownIdentity The own identity
- * @param identity The identity to remove all trust for
- * @throws WebOfTrustException if an error occurs
- */
- @Throws(WebOfTrustException::class)
- fun removeTrust(ownIdentity: OwnIdentity, identity: Identity)
-
- /**
* Pings the Web of Trust plugin. If the plugin can not be reached, a
* [PluginException] is thrown.
*
+++ /dev/null
-package net.pterodactylus.sone.web.ajax
-
-import net.pterodactylus.sone.core.*
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.utils.*
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.sone.web.page.*
-import javax.inject.*
-
-/**
- * AJAX page that lets the user distrust a Sone.
- *
- * @see Core.distrustSone(Sone, Sone)
- */
-@ToadletPath("distrustSone.ajax")
-class DistrustAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) {
-
- override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
- request.parameters["sone"]
- ?.let(core::getSone)
- ?.let { sone ->
- createSuccessJsonObject()
- .put("trustValue", core.preferences.negativeTrust)
- .also {
- core.distrustSone(currentSone, sone)
- }
- } ?: createErrorJsonObject("invalid-sone-id")
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.ajax
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.utils.*
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.sone.web.page.*
-import javax.inject.*
-
-/**
- * AJAX page that lets the user trust a Sone.
- *
- * @see net.pterodactylus.sone.core.Core.trustSone
- */
-@ToadletPath("trustSone.ajax")
-class TrustAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) {
-
- override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
- request.parameters["sone"]
- ?.let(core::getSone)
- ?.let { core.trustSone(currentSone, it) }
- ?.let { createSuccessJsonObject().put("trustValue", core.preferences.positiveTrust) }
- ?: createErrorJsonObject("invalid-sone-id")
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.ajax
-
-import net.pterodactylus.sone.data.Sone
-import net.pterodactylus.sone.utils.parameters
-import net.pterodactylus.sone.web.WebInterface
-import net.pterodactylus.sone.web.page.*
-import javax.inject.Inject
-
-/**
- * AJAX page that lets the user [untrust][net.pterodactylus.sone.core.Core.untrustSone] a [Sone].
- */
-@ToadletPath("untrustSone.ajax")
-class UntrustAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) {
-
- override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
- request.parameters["sone"]
- ?.let(core::getSone)
- ?.also { core.untrustSone(currentSone, it) }
- ?.let { createSuccessJsonObject() }
- ?: createErrorJsonObject("invalid-sone-id")
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.pages
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.main.*
-import net.pterodactylus.sone.utils.*
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.sone.web.page.*
-import net.pterodactylus.util.template.*
-import javax.inject.*
-
-/**
- * Page that lets the user distrust another Sone. This will assign a
- * configurable (negative) amount of trust to an identity.
- *
- * @see net.pterodactylus.sone.core.Core#distrustSone(Sone, Sone)
- */
-@ToadletPath("distrust.html")
-class DistrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
- LoggedInPage("Page.Distrust.Title", webInterface, loaders, templateRenderer) {
-
- override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) {
- if (soneRequest.isPOST) {
- soneRequest.core.getSone(soneRequest.httpRequest.getPartAsStringFailsafe("sone", 44))
- ?.run { soneRequest.core.distrustSone(currentSone, this) }
- redirectTo(soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256))
- }
- }
-
-}
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"
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()
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
}
}
+++ /dev/null
-package net.pterodactylus.sone.web.pages
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.main.*
-import net.pterodactylus.sone.utils.*
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.sone.web.page.*
-import net.pterodactylus.util.template.*
-import javax.inject.*
-
-/**
- * Page that lets the user trust another Sone. This will assign a configurable
- * amount of trust to an identity.
- */
-@ToadletPath("trust.html")
-class TrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
- LoggedInPage("Page.Trust.Title", webInterface, loaders, templateRenderer) {
-
- override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) {
- if (soneRequest.isPOST) {
- soneRequest.core.getSone(soneRequest.parameters["sone"]!!)?.let { sone ->
- soneRequest.core.trustSone(currentSone, sone)
- }
- redirectTo(soneRequest.parameters["returnPage", 256])
- }
- }
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.pages
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.main.*
-import net.pterodactylus.sone.utils.*
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.sone.web.page.*
-import net.pterodactylus.util.template.*
-import javax.inject.*
-
-/**
- * Page that lets the user untrust another Sone. This will remove all trust
- * assignments for an identity.
- */
-@ToadletPath("untrust.html")
-class UntrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
- LoggedInPage("Page.Untrust.Title", webInterface, loaders, templateRenderer) {
-
- override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) {
- if (soneRequest.isPOST) {
- soneRequest.parameters["sone", 44]!!
- .let(soneRequest.core::getSone)
- ?.also { soneRequest.core.untrustSone(currentSone, it) }
- redirectTo(soneRequest.parameters["returnPage", 256])
- }
- }
-
-}
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}).
Page.DeleteAlbum.Button.Yes=Ja, Album löschen.
Page.DeleteAlbum.Button.No=Nein, Album nicht löschen.
-Page.Trust.Title=Sone vertrauen - Sone
-
-Page.Distrust.Title=Sone misstrauen - Sone
-
-Page.Untrust.Title=Sone nicht vertrauen - Sone
-
Page.MarkAsKnown.Title=Als gelesen markieren - Sone
Page.Bookmark.Title=Als Favorit markieren - Sone
View.Sone.Status.Inserting=Diese Sone wird gerade hoch geladen.
View.SoneMenu.Link.AllAlbums=alle Alben
+View.SoneMenu.WebOfTrustLink=„Web of Trust“ Profil
View.Post.UnknownAuthor=(unbekannt)
-View.Post.WebOfTrustLink=„Web of Trust“ Profil
+View.Post.WebOfTrustLink=WoT-Profil
View.Post.Permalink=Nachrichtenlink
View.Post.PermalinkAuthor=Autorenlink
View.Post.Bookmarks.PostIsBookmarked=Nachricht ist ein Favorit, klicken, um Favoritenmarkierung zu entfernen
View.UpdateStatus.Text.ChooseSenderIdentity=Absender wählen
-View.Trust.Tooltip.Trust=Dieser Sone vertrauen
-View.Trust.Tooltip.Distrust=Dieser Sone misstrauen
-View.Trust.Tooltip.Untrust=Dieser Sone kein Vertrauen zuweisen
-
View.CreateAlbum.Title=Album anlegen
View.CreateAlbum.Label.Name=Name:
View.CreateAlbum.Label.Description=Beschreibung:
WebInterface.DefaultText.Option.ImagesPerPage=Anzahl der Bilder pro Seite
WebInterface.DefaultText.Option.CharactersPerPost=Anzahl der Zeichen, die eine Nachricht haben muss, damit er gekürzt wird
WebInterface.DefaultText.Option.PostCutOffLength=Anzahl der Zeichen, die von einer gekürzten Nachricht angezeigt werden
-WebInterface.DefaultText.Option.PositiveTrust=Der positive Vertrauenswert
-WebInterface.DefaultText.Option.NegativeTrust=Der negative Vertrauenswert
-WebInterface.DefaultText.Option.TrustComment=Der Kommentar für die Vertrauenszuweisung
WebInterface.Button.Comment=Antworten
WebInterface.Confirmation.DeletePostButton=Ja, löschen!
WebInterface.Confirmation.DeleteReplyButton=Ja, löschen!
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})
Page.DeleteAlbum.Button.Yes=Yes, delete album.
Page.DeleteAlbum.Button.No=No, don’t delete album.
-Page.Trust.Title=Trust Sone - Sone
-
-Page.Distrust.Title=Distrust Sone - Sone
-
-Page.Untrust.Title=Untrust Sone - Sone
-
Page.MarkAsKnown.Title=Mark as Known - Sone
Page.Bookmark.Title=Bookmark - Sone
View.Sone.Status.Inserting=This Sone is currently being inserted.
View.SoneMenu.Link.AllAlbums=all albums
+View.SoneMenu.WebOfTrustLink=web of trust profile
View.Post.UnknownAuthor=(unknown)
-View.Post.WebOfTrustLink=web of trust profile
+View.Post.WebOfTrustLink=WoT Profile
View.Post.Permalink=link post
View.Post.PermalinkAuthor=link author
View.Post.Bookmarks.PostIsBookmarked=Post is bookmarked, click to remove from bookmarks
View.UpdateStatus.Text.ChooseSenderIdentity=Choose the sender identity
-View.Trust.Tooltip.Trust=Trust this person
-View.Trust.Tooltip.Distrust=Assign negative trust to this person
-View.Trust.Tooltip.Untrust=Remove your trust assignment for this person
-
View.CreateAlbum.Title=Create Album
View.CreateAlbum.Label.Name=Name:
View.CreateAlbum.Label.Description=Description:
WebInterface.DefaultText.Option.ImagesPerPage=Number of images to show on a page
WebInterface.DefaultText.Option.CharactersPerPost=Number of characters a post must have to be shortened
WebInterface.DefaultText.Option.PostCutOffLength=Number of characters for the snippet of the shortened post
-WebInterface.DefaultText.Option.PositiveTrust=The positive trust to assign
-WebInterface.DefaultText.Option.NegativeTrust=The negative trust to assign
-WebInterface.DefaultText.Option.TrustComment=The comment to set in the web of trust
WebInterface.Button.Comment=Comment
WebInterface.Confirmation.DeletePostButton=Yes, delete!
WebInterface.Confirmation.DeleteReplyButton=Yes, delete!
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})
Page.DeleteAlbum.Button.Yes=Si, eliminar álbum.
Page.DeleteAlbum.Button.No=No, no eliminar álbum.
-Page.Trust.Title=Dar veracidad al Sone - Sone
-
-Page.Distrust.Title=Retirar veracidad al Sone - Sone
-
-Page.Untrust.Title=Quitar veracidad al Sone - Sone
-
Page.MarkAsKnown.Title=Marcar como conocido - Sone
Page.Bookmark.Title=Marcar - Sone
View.Sone.Status.Inserting=Este Sone está siendo insertado.
View.SoneMenu.Link.AllAlbums=todos los albumes
+View.SoneMenu.WebOfTrustLink=perfil de web of trust
View.Post.UnknownAuthor=(desconocido)
View.Post.WebOfTrustLink=perfil de web of trust
View.UpdateStatus.Text.ChooseSenderIdentity=Elegir la identidad del emisario
-View.Trust.Tooltip.Trust=Creer a esta persona
-View.Trust.Tooltip.Distrust=Asignar veracidad negativa a esta persona
-View.Trust.Tooltip.Untrust=Eliminar la veracidad asignada a esta persona
-
View.CreateAlbum.Title=Crear Álbum
View.CreateAlbum.Label.Name=Nombre:
View.CreateAlbum.Label.Description=Descripción:
WebInterface.DefaultText.Option.ImagesPerPage=Número de imágenes a mostrar en una página
WebInterface.DefaultText.Option.CharactersPerPost=Número de carácteres de una publicación antes de acortarla
WebInterface.DefaultText.Option.PostCutOffLength=Número de carácteres de los fragmentos de la publicación acortada
-WebInterface.DefaultText.Option.PositiveTrust=Veracidad positiva a asignar
-WebInterface.DefaultText.Option.NegativeTrust=Veracidad negativa a asignar
-WebInterface.DefaultText.Option.TrustComment=Comentario a poner en Web of Trust
WebInterface.Button.Comment=Comentar
WebInterface.Confirmation.DeletePostButton=Si, eliminar!
WebInterface.Confirmation.DeleteReplyButton=Si, eliminar!
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<segundos}.
Notification.SoneInsertAborted.Text=Tu Sone sone://{0} no pudo ser insertado.
-# 55-61, 334–338
+# 55-61, 324–328, 360
Page.Options.Option.CharactersPerPost.Description=Le nombre de caractères à afficher par message avant que le lien proposant de voir l'intégralité ne soit proposé (-1 pour désactiver). La taille du composant est déterminée par l'option ci-dessous.
Page.Options.Option.PostCutOffLength.Description=Le nombre de caractères à afficher si le message est considéré comme trop long (voir option du dessus). Ignoré si "nombre de caractères à afficher" est désactivé (configuré à -1).
Page.Options.Option.RequireFullAccess.Description=Pour refuser l'accès à Sone à tout hôte à qui un accès complet n'a pas été accordé.
-Page.Options.Section.TrustOptions.Title=Réglages de confiance
-Page.Options.Option.PositiveTrust.Description=La quantité de note de confiance positive que vous voulez assigner à d'autres Sones en cochant la case en dessous d'un message ou d'une réponse.
-Page.Options.Option.NegativeTrust.Description=La quantité de note de confiance que vous voulez assigner à d'autres Sones en cliquant le X rouge en dessous d'un message ou d'une réponse. Cette valeur devrait être négative.
-Page.Options.Option.TrustComment.Description=Le commentaire qui sera mis dans le web of trust pour chaque note de confiance que vous assignez de Sone.
Page.Options.Section.FcpOptions.Title=Réglages de l'Interface FCP
Page.Options.Option.FcpInterfaceActive.Description=Activer l'interface FCP afin de permettre à d'autres plugins et clients à distance d'accéder à votre plugin Sone.
Page.Options.Option.FcpFullAccessRequired.Description=Requière une connexion FCP d'hôtes autorisés (Veuillez voir votre {link}configuration du noeud, section “FCP”{/link})
Page.DeleteAlbum.Button.Yes=Oui, supprimer cet album.
Page.DeleteAlbum.Button.No=Non, ne pas supprimer cet album.
-Page.Trust.Title=Faire confiance à Sone - Sone
-
-Page.Distrust.Title=Se méfier de ce Sone - Sone
-
-Page.Untrust.Title=Ne plus faire confiance en ce Sone - Sone
-
Page.MarkAsKnown.Title=Marquer comme connu - Sone
Page.Bookmark.Title=Marque-page - Sone
View.Sone.Status.Inserting=Ce Sone est en train d'être inséré.
View.SoneMenu.Link.AllAlbums=Tous les Albums
+View.SoneMenu.WebOfTrustLink=Profile web of trust
View.Post.UnknownAuthor=(inconnu)
View.Post.WebOfTrustLink=Profile web of trust
View.UpdateStatus.Text.ChooseSenderIdentity=Choisir l'identité de l'expéditeur
-View.Trust.Tooltip.Trust=Faire confiance à cette personne
-View.Trust.Tooltip.Distrust=Assigner une note négative en confiance à cette personne
-View.Trust.Tooltip.Untrust=Retirer votre note de confiance de cette personne
-
View.CreateAlbum.Title=Créer un Album
View.CreateAlbum.Label.Name=Nom:
View.CreateAlbum.Label.Description=Description:
WebInterface.DefaultText.Option.ImagesPerPage=Nombre d'images à afficher par page
WebInterface.DefaultText.Option.CharactersPerPost=Nombre de caractère qu'une publication doit avoir pour être raccourcie
WebInterface.DefaultText.Option.PostCutOffLength=Nombre de caractère du descriptif de la publication raccourcie
-WebInterface.DefaultText.Option.PositiveTrust=La note de confiance positive à assigner
-WebInterface.DefaultText.Option.NegativeTrust=Une note de confiance négative à assigner
-WebInterface.DefaultText.Option.TrustComment=Le commentaire à mettre dans le "Web of Trust"
WebInterface.Button.Comment=Commenter
WebInterface.Confirmation.DeletePostButton=Oui, effacer!
WebInterface.Confirmation.DeleteReplyButton=Oui, effacer!
Notification.SoneIsInserting.Text=Votre Sone sone://{0} va maintenant être inséré.
Notification.SoneIsInserted.Text=votre Sone sone://{0} a été inséré dans {1,number} {1,choice,0#seconds|1#second|1<seconds}.
Notification.SoneInsertAborted.Text=Votre Sone sone://{0} ne peut pas être inséré.
-# 55-61, 334–338
+# 55-61, 324–328, 360
Page.Options.Option.CharactersPerPost.Description=投稿を切って全文を見るリンクが表示されるまでの文字数。(-1で無効になります。)文字数は以下の設定により判定されます。
Page.Options.Option.PostCutOffLength.Description=投稿が長い場合に表示される文字数。(上記の設定も参照してください。)
Page.Options.Option.RequireFullAccess.Description=完全なアクセスが設定されていないホストに対してSoneへのアクセスを拒否する
-Page.Options.Section.TrustOptions.Title=信用設定
-Page.Options.Option.PositiveTrust.Description=返信のリンクの下に表示されるチェックメークのリンクをクリックした際にSoneに設定されるポジティブな信用値。
-Page.Options.Option.NegativeTrust.Description=返信のリンクの下に表示される赤い☓のリンクをクリックした際にSoneに設定されるネガティブな信用値。
-Page.Options.Option.TrustComment.Description=Soneで信用値を設定した場合に設定されるWoTコメント。
Page.Options.Section.FcpOptions.Title=FCPインターフェースの設定
Page.Options.Option.FcpInterfaceActive.Description=FCPインターフェースを有効にし、Soneプラグインに他のプラグインやリモートクライアントからアクセスできるようにする。
Page.Options.Option.FcpFullAccessRequired.Description=許可されたホストのみFCP接続を許可する。({link}ノード設定の「FCP」内の設定{/link}も確認してください。)
Page.DeleteAlbum.Button.Yes=はい、アルバムを削除します。
Page.DeleteAlbum.Button.No=いいえ、アルバムを削除しません。
-Page.Trust.Title=Soneを信用する - Sone
-
-Page.Distrust.Title=Soneを信用しない - Sone
-
-Page.Untrust.Title=Soneの信用を解除する - Sone
-
Page.MarkAsKnown.Title=既知のマークを付ける - Sone
Page.Bookmark.Title=ブックマーク - Sone
View.Sone.Status.Inserting=このSoneは現在インサート中です。
View.SoneMenu.Link.AllAlbums=全てのアルバム
+View.SoneMenu.WebOfTrustLink=Web of Trustプロフィール
View.Post.UnknownAuthor=(不明)
View.Post.WebOfTrustLink=Web of Trustプロフィール
View.UpdateStatus.Text.ChooseSenderIdentity=送信者のプロフィールを選択してください
-View.Trust.Tooltip.Trust=この人を信用する
-View.Trust.Tooltip.Distrust=この人にネガティブな信用を付与する
-View.Trust.Tooltip.Untrust=この人につけた信用を解除する
-
View.CreateAlbum.Title=アルバムを作成
View.CreateAlbum.Label.Name=名称:
View.CreateAlbum.Label.Description=説明:
WebInterface.DefaultText.Option.ImagesPerPage=ページに表示する画像の数
WebInterface.DefaultText.Option.CharactersPerPost=投稿を短く表示する最低の文字数
WebInterface.DefaultText.Option.PostCutOffLength=投稿を短く表示する場合の文字数
-WebInterface.DefaultText.Option.PositiveTrust=割り当てるポジティブな信用値
-WebInterface.DefaultText.Option.NegativeTrust=割り当てるネガティブな信用値
-WebInterface.DefaultText.Option.TrustComment=Web of Trustに設定するコメント
WebInterface.Button.Comment=コメント
WebInterface.Confirmation.DeletePostButton=本当に消去!
WebInterface.Confirmation.DeleteReplyButton=本当に消去!
Notification.SoneIsInserting.Text=あなたのSone sone://{0}は現在インサート中です。
Notification.SoneIsInserted.Text=あなたのSone sone://{0}は{1,number}{1,choice,0#秒|1#秒|1<秒}でインサートされました。
Notification.SoneInsertAborted.Text=あなたのSone sone://{0}のインサートに失敗しました。
-# 55-51, 67, 107, 334–338, 471
+# 55-51, 67, 103, 324–328, 360, 455
Page.Options.Option.CharactersPerPost.Description=Antall tegn å vise fra et innlegg før resten blir skjult og en link blir vist for å utvide til hele innlegget (-1 for å deaktivere). Lengden på den viste teksten kan endres under.
Page.Options.Option.PostCutOffLength.Description=Antallet tegn som blir vist hvis et innlegg er for langt (Se innstilling over).
Page.Options.Option.RequireFullAccess.Description=For å avslå tilgang til Sone fra enhver host som ikke har blitt gitt full tilgang.
-Page.Options.Section.TrustOptions.Title=Tillitsinnstillinger
-Page.Options.Option.PositiveTrust.Description=Mengden positiv tillit du ønsker å gi en annen Sone ved å klikke på hake-merket under et innlegg eller ved å skrive et svar.
-Page.Options.Option.NegativeTrust.Description=Mengden tillit du vil gi til andre Soner ved å klikke på den røde X'en nedenfor et innlegg eller svar. Denne verdien burde være negativ.
-Page.Options.Option.TrustComment.Description=Kommentaren som vil bli satt i 'Web Of Trust' for all tillit gitt via Sone.
Page.Options.Section.FcpOptions.Title=FCP-grensesnitts innstillinger
Page.Options.Option.FcpInterfaceActive.Description=Aktiver FCP-grensesnittet for å tillate andre tillegg og andre klienter til å aksessere dit Sone-tillegg.
Page.Options.Option.FcpFullAccessRequired.Description=Påkrev FCP tilkobling fra tillate hoster (se din {link}nodes konfigurasjon, seksjon «FCP»{/link})
Page.DeleteAlbum.Button.Yes=Ja, slett album.
Page.DeleteAlbum.Button.No=Nei, ikke slett album.
-Page.Trust.Title=Positiv tillit til Sone - Sone
-
-Page.Distrust.Title=Negativ tillit til Sone - Sone
-
-Page.Untrust.Title=Fjern tillit til Sone - Sone
-
Page.MarkAsKnown.Title=Merk som kjent - Sone
Page.Bookmark.Title=Bokmerke - Sone
View.Sone.Status.Inserting=Denne Sonen blir for øyeblikket innsatt.
View.SoneMenu.Link.AllAlbums=alle album
+View.SoneMenu.WebOfTrustLink='web of trust'-profil
View.Post.UnknownAuthor=(ukjent)
View.Post.WebOfTrustLink='web of trust'-profil
View.UpdateStatus.Text.ChooseSenderIdentity=Velg avsender-pseudonym
-View.Trust.Tooltip.Trust=Gi tillit til denne personen
-View.Trust.Tooltip.Distrust=Gi negativ tillit til denne personen
-View.Trust.Tooltip.Untrust=Fjern din tillit gitt til denne personen
-
View.CreateAlbum.Title=Lag album
View.CreateAlbum.Label.Name=Navn:
View.CreateAlbum.Label.Description=Beskrivelse:
WebInterface.DefaultText.Option.ImagesPerPage=Antall bilder å vise per side
WebInterface.DefaultText.Option.CharactersPerPost=Antall tegn et innlegg må ha for å bli skjult.
WebInterface.DefaultText.Option.PostCutOffLength=Antall tegn som vises når et innlegg blir skjult
-WebInterface.DefaultText.Option.PositiveTrust=Positiv tillit å gi
-WebInterface.DefaultText.Option.NegativeTrust=Negativ tillit å gi
-WebInterface.DefaultText.Option.TrustComment=Kommentaren til 'Web Of Trust'
WebInterface.Button.Comment=Kommenter
WebInterface.Confirmation.DeletePostButton=Ja, slett!
WebInterface.Confirmation.DeleteReplyButton=Ja, slett!
Notification.SoneIsInserting.Text=Your Sone sone://{0} is now being inserted.
Notification.SoneIsInserted.Text=Your Sone sone://{0} has been inserted in {1,number} {1,choice,0#seconds|1#second|1<seconds}.
Notification.SoneInsertAborted.Text=Your Sone sone://{0} could not be inserted.
-# 55-61, 67, 107, 127-128, 315-317, 319-321, 334–338, 471, 477-479
+# 55-61, 67, 103, 123-124, 305-307, 309-311, 324–328, 360, 455, 461-463
Page.Options.Option.CharactersPerPost.Description=Ilość znaków pokazywanych w poście zanim zostanie on obcięty i pojawi się link do jego rozszerzenia (-1 powoduje wyłączenie). Długość fragmentu zależy od poniższej opcji.
Page.Options.Option.PostCutOffLength.Description=Ilość znaków które są pokazywane gdy post uznajemy za zbyt długi (zobacz opcję powyżej). Ignorowane jeżeli opcja “ilość znaków do pokazania” jest wyłączona (jest ustawiona na -1).
Page.Options.Option.RequireFullAccess.Description=Opcja odmowy dostępu do Sone hostom bez przyznanego pełnego dostępu.
-Page.Options.Section.TrustOptions.Title=Ustawienia Zaufania
-Page.Options.Option.PositiveTrust.Description=Punkty pozytywnego zaufania, które chcesz przyznać innym użytkownikom Sone klikając na ikonę pod postem lub odpowiedzią.
-Page.Options.Option.NegativeTrust.Description=Punkty zaufania, które chcesz przyznać innym użytkownikom Sone klikając na czerwony krzyżyk pod postem lub odpowiedzią. Wartosć powinna być negatywna.
-Page.Options.Option.TrustComment.Description=Komentarz, który wyświetli się w sieci zaufania w momencie przyznawania punktów zaufania w obrębie Sone.
Page.Options.Section.FcpOptions.Title=Ustawienia Interfejsu FCP
Page.Options.Option.FcpInterfaceActive.Description=Uruchom interfejs FCP, aby umożliwić innym wtyczkom i klientom zdalnym dostęp do twojej wtyczki Sone.
Page.Options.Option.FcpFullAccessRequired.Description=Wymagane połączenie FCP dla hostów z dostępem (patrz twoja {link}konfiguracja Freenet, sekcja “FCP”{/link})
Page.DeleteAlbum.Button.Yes=Tak, usuń album.
Page.DeleteAlbum.Button.No=Nie, nie usuwaj albumu.
-Page.Trust.Title=Zaufaj Sone - Sone
-
-Page.Distrust.Title=Nie ufaj Sone - Sone
-
-Page.Untrust.Title=Przestań ufać Sone - Sone
-
Page.MarkAsKnown.Title=Oznacz jako znany - Sone
Page.Bookmark.Title=Zakładka - Sone
View.Sone.Status.Inserting=Ten Sone jest właśnie ładowany.
View.SoneMenu.Link.AllAlbums=wszystkie albumy
+View.SoneMenu.WebOfTrustLink=Profil sieci zaufania
View.Post.UnknownAuthor=(nieznany)
View.Post.WebOfTrustLink=Profil sieci zaufania
View.UpdateStatus.Text.ChooseSenderIdentity=Wybierz tożsamość nadawcy
-View.Trust.Tooltip.Trust=Zaufaj tej osobie
-View.Trust.Tooltip.Distrust=Przypisz tej osobie nagatywny poziom zaufania
-View.Trust.Tooltip.Untrust=Cofnij swoje zaufanie dla tej osoby
-
View.CreateAlbum.Title=Utwórz Album
View.CreateAlbum.Label.Name=Nazwa:
View.CreateAlbum.Label.Description=Opis:
WebInterface.DefaultText.Option.ImagesPerPage=Ilość obrazków na stronie
WebInterface.DefaultText.Option.CharactersPerPost=Ilość znaków, które ma zawierać post, aby zostać skrócony
WebInterface.DefaultText.Option.PostCutOffLength=Ilość znaków w skróconym poście
-WebInterface.DefaultText.Option.PositiveTrust=Pozytywny poziom zaufania
-WebInterface.DefaultText.Option.NegativeTrust=Negatywny poziom zaufania
-WebInterface.DefaultText.Option.TrustComment=Komentarz, który zostanie ustawiony w Sieci Zaufania
WebInterface.Button.Comment=Komentuj
WebInterface.Confirmation.DeletePostButton=Tak, usuń!
WebInterface.Confirmation.DeleteReplyButton=Tak, usuń!
Notification.SoneIsInserting.Text=Twoje Sone sone://{0} jest w tej chili wysyłane.
Notification.SoneIsInserted.Text=Twoje sone://{0} zostało wysłane w {1,number} {1,choice,0#seconds|1#second|1<seconds}.
Notification.SoneInsertAborted.Text=Twoje Sone sone://{0} nie mogło zostać wysłane.
-# 55-61, 334–338, 471
+# 55-61, 324–328, 360, 455
Page.Options.Option.CharactersPerPost.Description=Количество символов сообщения, которые должны быть показаны до того, как оно будет обрезано и будет показана ссылка для его раскрытия (-1 для отключения). Фактическая длина обрезанного сообщения задается нижеследующей настройкой.
Page.Options.Option.PostCutOffLength.Description=Количество символов, которые показываются, если сообщение посчитано слишком длинным (см. настройку выше).
Page.Options.Option.RequireFullAccess.Description=Запрещать доступ к Sone любому хосту, которому не был дан полный доступ.
-Page.Options.Section.TrustOptions.Title=Настройки доверия
-Page.Options.Option.PositiveTrust.Description=Количество положительного доверия, которое вы хотите назначать другим Sone, нажимая галочку под сообщением или ответом.
-Page.Options.Option.NegativeTrust.Description=Количество доверия, которое вы хотите назначить другим Sone, нажимая красный X под сообщением или ответом. Это значение должно быть отрицательным.
-Page.Options.Option.TrustComment.Description=Комментарий, который будет установлен в web of trust для любого доверия, назначенного из Sone.
Page.Options.Section.FcpOptions.Title=Настройка интерфейса FCP
Page.Options.Option.FcpInterfaceActive.Description=Активировать интерфейс FCP, чтобы позволить другим дополнениям и удаленным клиентам получать доступ к вашему дополнению Sone.
Page.Options.Option.FcpFullAccessRequired.Description=Требовать соединение FCP от разрешенных хостов(см. {link}конфигурацию узла, секция "FCP"{/link}).
Page.DeleteAlbum.Button.Yes=Да, удалить альбом.
Page.DeleteAlbum.Button.No=Нет, не удалять альбом.
-Page.Trust.Title=Доверять Sone - Sone
-
-Page.Distrust.Title=Не доверять Sone - Sone
-
-Page.Untrust.Title=Отменить доверие к Sone - Sone
-
Page.MarkAsKnown.Title=Отметить как известный - Sone
Page.Bookmark.Title=Добавить в закладки - Sone
View.Sone.Status.Inserting=Этот Sone сейчас выгружается.
View.SoneMenu.Link.AllAlbums=все альбомы
+View.SoneMenu.WebOfTrustLink=профиль web of trust
View.Post.UnknownAuthor=(неизвестно)
View.Post.WebOfTrustLink=профиль web of trust
View.UpdateStatus.Text.ChooseSenderIdentity=выбрать личность отправителя
-View.Trust.Tooltip.Trust=Доверять этому человека
-View.Trust.Tooltip.Distrust=Назначить этому человеку отрицательное доверие
-View.Trust.Tooltip.Untrust=Отменить доверие к этому человеку
-
View.CreateAlbum.Title=Создать альбом
View.CreateAlbum.Label.Name=Название:
View.CreateAlbum.Label.Description=Описание:
WebInterface.DefaultText.Option.ImagesPerPage=Количество изображений, показываемых на странице
WebInterface.DefaultText.Option.CharactersPerPost=Количество символов, которое должно быть у сообщения, чтобы оно было сокращено
WebInterface.DefaultText.Option.PostCutOffLength=Количество символов в сокращенном варианте сообщения
-WebInterface.DefaultText.Option.PositiveTrust=Положительное доверие для назначения
-WebInterface.DefaultText.Option.NegativeTrust=Отрицательное доверие для назначения
-WebInterface.DefaultText.Option.TrustComment=Комментарий для установки в web of trust
WebInterface.Button.Comment=Комментировать
WebInterface.Confirmation.DeletePostButton=Да, удалить!
WebInterface.Confirmation.DeleteReplyButton=Да, удалить!
Notification.SoneIsInserting.Text=Your Sone sone://{0} is now being inserted.
Notification.SoneIsInserted.Text=Your Sone sone://{0} has been inserted in {1,number} {1,choice,0#seconds|1#second|1<seconds}.
Notification.SoneInsertAborted.Text=Your Sone sone://{0} could not be inserted.
-# 55-61, 67, 107, 127-128, 315-317, 319-321, 334–338, 471, 477-479
+# 55-61, 67, 103, 123-124, 305-307, 309-311, 324–328, 360, 455, 461-463
color: #666;
}
-#sone .post .delete, #sone .post .likes, #sone .post .like, #sone .post .unlike, #sone .post .trust, #sone .post .distrust, #sone .post .untrust {
+#sone .post .delete, #sone .post .likes, #sone .post .like, #sone .post .unlike, #sone .post .wot-link {
display: inline;
font: inherit;
margin: 0px;
display: none;
}
-#sone .post .like.hidden, #sone .post .unlike.hidden, #sone .post .trust.hidden, #sone .post .distrust.hidden, #sone .post .untrust.hidden, #sone .post .bookmark.hidden, #sone .post .unbookmark.hidden {
+#sone .post .like.hidden, #sone .post .unlike.hidden, #sone .post .bookmark.hidden, #sone .post .unbookmark.hidden {
display: none;
}
-#sone .post .delete button, #sone .post .like button, #sone .post .unlike button, #sone .post .trust button, #sone .post .distrust button, #sone .post .untrust button, #sone .post .bookmark button, #sone .post .unbookmark button {
+#sone .post .delete button, #sone .post .like button, #sone .post .unlike button, #sone .post .bookmark button, #sone .post .unbookmark button {
border: 0px;
background: none;
padding: 0px;
font-weight: bold;
}
-#sone .post .untrust button {
- color: rgb(255, 0, 0);
-}
-
-#sone .post .delete button:hover, #sone .post .like button:hover, #sone .post .unlike button:hover, #sone .post .trust button:hover, #sone .post .distrust button:hover, #sone .post .untrust button:hover, #sone .post .bookmark button:hover, #sone .post .unbookmark button:hover {
+#sone .post .delete button:hover, #sone .post .like button:hover, #sone .post .unlike button:hover, #sone .post .bookmark button:hover, #sone .post .unbookmark button:hover {
border: 0px;
background: none;
padding: 0px;
}
/**
- * Trusts the Sone with the given ID.
- *
- * @param soneId
- * The ID of the Sone to trust
- */
-function trustSone(soneId) {
- ajaxGet("trustSone.ajax", { "formPassword" : getFormPassword(), "sone" : soneId }, function(data) {
- if ((data != null) && data.success) {
- updateTrustControls(soneId, data.trustValue);
- }
- });
-}
-
-/**
- * Distrusts the Sone with the given ID, i.e. assigns a negative trust value.
- *
- * @param soneId
- * The ID of the Sone to distrust
- */
-function distrustSone(soneId) {
- ajaxGet("distrustSone.ajax", { "formPassword" : getFormPassword(), "sone" : soneId }, function(data) {
- if ((data != null) && data.success) {
- updateTrustControls(soneId, data.trustValue);
- }
- });
-}
-
-/**
- * Untrusts the Sone with the given ID, i.e. removes any trust assignment.
- *
- * @param soneId
- * The ID of the Sone to untrust
- */
-function untrustSone(soneId) {
- ajaxGet("untrustSone.ajax", { "formPassword" : getFormPassword(), "sone" : soneId }, function(data) {
- if ((data != null) && data.success) {
- updateTrustControls(soneId, data.trustValue);
- }
- });
-}
-
-/**
- * Updates the trust controls for all posts and replies of the given Sone,
- * according to the given trust value.
- *
- * @param soneId
- * The ID of the Sone to update all trust controls for
- * @param trustValue
- * The trust value for the Sone
- */
-function updateTrustControls(soneId, trustValue) {
- sone.find(".post").each(function() {
- if (getPostAuthor(this) === soneId) {
- getPostElement(this).find(".post-trust").toggleClass("hidden", trustValue != null);
- getPostElement(this).find(".post-distrust").toggleClass("hidden", trustValue != null);
- getPostElement(this).find(".post-untrust").toggleClass("hidden", trustValue == null);
- }
- });
- sone.find(".reply").each(function() {
- if (getReplyAuthor(this) === soneId) {
- getReplyElement(this).find(".reply-trust").toggleClass("hidden", trustValue != null);
- getReplyElement(this).find(".reply-distrust").toggleClass("hidden", trustValue != null);
- getReplyElement(this).find(".reply-untrust").toggleClass("hidden", trustValue == null);
- }
- });
-}
-
-/**
* Bookmarks the post with the given ID.
*
* @param postId
return false;
});
- /* convert trust control buttons to javascript functions. */
- $(postElement).find(".post-trust").submit(function() {
- trustSone(getPostAuthor(this));
- return false;
- });
- $(postElement).find(".post-distrust").submit(function() {
- distrustSone(getPostAuthor(this));
- return false;
- });
- $(postElement).find(".post-untrust").submit(function() {
- untrustSone(getPostAuthor(this));
- return false;
- });
-
/* convert bookmark/unbookmark buttons to javascript functions. */
$(postElement).find(".bookmark").submit(function() {
bookmarkPost(getPostId(this));
$(replyElement).find(".expand-reply-text").each(toggleShowMore);
$(replyElement).find(".shrink-reply-text").each(toggleShowMore);
- /* convert trust control buttons to javascript functions. */
- $(replyElement).find(".reply-trust").submit(function() {
- trustSone(getReplyAuthor(this));
- return false;
- });
- $(replyElement).find(".reply-distrust").submit(function() {
- distrustSone(getReplyAuthor(this));
- return false;
- });
- $(replyElement).find(".reply-untrust").submit(function() {
- untrustSone(getReplyAuthor(this));
- return false;
- });
-
/* show Sone menu when hovering over the avatar. */
$(replyElement).find(".reply-avatar").mouseover(function() {
if (typeof currentSoneMenuTimeoutHandler !== undefined) {
<a class="author" href="viewSone.html?sone=<%sone.id|html>"><%sone.niceName|html></a>
(<%= View.Sone.Stats.Posts|l10n 0=sone.posts.size>, <%= View.Sone.Stats.Replies|l10n 0=sone.replies.size><%if ! sone.allImages.size|match value==0>, <%= View.Sone.Stats.Images|l10n 0=sone.allImages.size><%/if><%if core.debug>, <% sone.client|html><%/if>)
</div>
- <div><a href="/WebOfTrust/ShowIdentity?id=<%sone.id|html>">» <% =View.Post.WebOfTrustLink|l10n|html></a></div>
+ <div><a href="/WebOfTrust/ShowIdentity?id=<%sone.id|html>">» <% =View.SoneMenu.WebOfTrustLink|l10n|html></a></div>
<%foreach sone.albums album>
<%first>
<div><a href="imageBrowser.html?sone=<% sone.id|html>">» <% =View.SoneMenu.Link.AllAlbums|l10n|html></a></div>
<input type="hidden" name="post" value="<% post.id|html>" />
<button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
</form>
- <%if !post.sone.current>
- <%ifnull !post.sone.trust>
- <span class='separator'>·</span>
- <form class="trust post-trust<%if post.sone.trust.assigned> hidden<%/if>" action="trust.html" method="post">
- <input type="hidden" name="formPassword" value="<% formPassword|html>" />
- <input type="hidden" name="returnPage" value="<% request.uri|html>" />
- <input type="hidden" name="sone" value="<% post.sone.id|html>" />
- <button type="submit" title="<%= View.Trust.Tooltip.Trust|l10n|html>">👍</button>
- </form>
- <form class="distrust post-distrust<%if post.sone.trust.assigned> hidden<%/if>" action="distrust.html" method="post">
- <input type="hidden" name="formPassword" value="<% formPassword|html>" />
- <input type="hidden" name="returnPage" value="<% request.uri|html>" />
- <input type="hidden" name="sone" value="<% post.sone.id|html>" />
- <button type="submit" title="<%= View.Trust.Tooltip.Distrust|l10n|html>">👎</button>
- </form>
- <form class="untrust post-untrust<%if !post.sone.trust.assigned> hidden<%/if>" action="untrust.html" method="post">
- <input type="hidden" name="formPassword" value="<% formPassword|html>" />
- <input type="hidden" name="returnPage" value="<% request.uri|html>" />
- <input type="hidden" name="sone" value="<% post.sone.id|html>" />
- <button type="submit" title="<%= View.Trust.Tooltip.Untrust|l10n|html>">✗</button>
- </form>
- <%/if>
- <%/if>
<%/if>
+ <span class='separator'>·</span>
+ <a class="wot-link" href="/WebOfTrust/ShowIdentity?id=<% post.sone.id|html>"><%= View.Post.WebOfTrustLink|l10n|html></a>
<%if post.sone.local>
<span class='separator'>·</span>
<form class="delete delete-post" action="deletePost.html" method="post">
<input type="hidden" name="reply" value="<% reply.id|html>" />
<button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
</form>
- <%if !reply.sone.current>
- <%ifnull !reply.sone.trust>
- <span class='separator'>·</span>
- <form class="trust reply-trust<%if reply.sone.trust.assigned> hidden<%/if>" action="trust.html" method="post">
- <input type="hidden" name="formPassword" value="<% formPassword|html>" />
- <input type="hidden" name="returnPage" value="<% request.uri|html>" />
- <input type="hidden" name="sone" value="<% reply.sone.id|html>" />
- <button type="submit" title="<%= View.Trust.Tooltip.Trust|l10n|html>">👍</button>
- </form>
- <form class="distrust reply-distrust<%if reply.sone.trust.assigned> hidden<%/if>" action="distrust.html" method="post">
- <input type="hidden" name="formPassword" value="<% formPassword|html>" />
- <input type="hidden" name="returnPage" value="<% request.uri|html>" />
- <input type="hidden" name="sone" value="<% reply.sone.id|html>" />
- <button type="submit" title="<%= View.Trust.Tooltip.Distrust|l10n|html>">👎</button>
- </form>
- <form class="untrust reply-untrust<%if !reply.sone.trust.assigned> hidden<%/if>" action="untrust.html" method="post">
- <input type="hidden" name="formPassword" value="<% formPassword|html>" />
- <input type="hidden" name="returnPage" value="<% request.uri|html>" />
- <input type="hidden" name="sone" value="<% reply.sone.id|html>" />
- <button type="submit" title="<%= View.Trust.Tooltip.Untrust|l10n|html>">✗</button>
- </form>
- <%/if>
- <%/if>
<%/if>
+ <span class='separator'>·</span>
+ <a class="wot-link" href="/WebOfTrust/ShowIdentity?id=<% reply.sone.id|html>"><%= View.Post.WebOfTrustLink|l10n|html></a>
<%if reply.sone.local>
<span class='separator'>·</span>
<form class="delete delete-reply" action="deleteReply.html" method="post">
getTranslation("WebInterface.DefaultText.Option.PostCutOffLength", function(postCutOffLengthText) {
registerInputTextareaSwap("#sone #options input[name=post-cut-off-length]", postCutOffLengthText, "post-cut-off-length", true, true);
});
- getTranslation("WebInterface.DefaultText.Option.PositiveTrust", function(positiveTrustText) {
- registerInputTextareaSwap("#sone #options input[name=positive-trust]", positiveTrustText, "positive-trust", true, true);
- });
- getTranslation("WebInterface.DefaultText.Option.NegativeTrust", function(negativeTrustText) {
- registerInputTextareaSwap("#sone #options input[name=negative-trust]", negativeTrustText, "negative-trust", true, true);
- });
- getTranslation("WebInterface.DefaultText.Option.TrustComment", function(trustCommentText) {
- registerInputTextareaSwap("#sone #options input[name=trust-comment]", trustCommentText, "trust-comment", true, true);
- });
});
</script>
<%= Page.Options.Option.RequireFullAccess.Description|l10n|html></p>
</p>
- <h2><%= Page.Options.Section.TrustOptions.Title|l10n|html></h2>
-
- <p><%= Page.Options.Option.PositiveTrust.Description|l10n|html></p>
- <%if =positive-trust|in collection=fieldErrors>
- <p class="warning"><%= Page.Options.Warnings.ValueNotChanged|l10n|html></p>
- <%/if>
- <p><input type="text" name="positive-trust" value="<% positive-trust|html>" /></p>
-
- <p><%= Page.Options.Option.NegativeTrust.Description|l10n|html></p>
- <%if =negative-trust|in collection=fieldErrors>
- <p class="warning"><%= Page.Options.Warnings.ValueNotChanged|l10n|html></p>
- <%/if>
- <p><input type="text" name="negative-trust" value="<% negative-trust|html>" /></p>
-
- <p><%= Page.Options.Option.TrustComment.Description|l10n|html></p>
- <p><input type="text" name="trust-comment" value="<% trust-comment|html>" /></p>
-
<h2><%= Page.Options.Section.FcpOptions.Title|l10n|html></h2>
<p><input type="checkbox" name="fcp-interface-active"<%if fcp-interface-active> checked="checked"<%/if> /> <%= Page.Options.Option.FcpInterfaceActive.Description|l10n|html></p>
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);
}
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));
}
import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.AddContextJob;
import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.RemoveContextJob;
import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.SetPropertyJob;
-import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.SetTrustJob;
import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.WebOfTrustContextUpdateJob;
import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.WebOfTrustUpdateJob;
import net.pterodactylus.sone.freenet.plugin.PluginException;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
-import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.freenet.wot.WebOfTrustConnector;
-import net.pterodactylus.sone.freenet.wot.WebOfTrustException;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
public class WebOfTrustUpdaterTest {
private static final String CONTEXT = "test-context";
- private static final Integer SCORE = 50;
- private static final Integer OTHER_SCORE = 25;
- private static final String TRUST_COMMENT = "set in a test";
private static final String PROPERTY_NAME = "test-property";
private final WebOfTrustConnector webOfTrustConnector = mock(WebOfTrustConnector.class);
private final WebOfTrustUpdaterImpl webOfTrustUpdater = new WebOfTrustUpdaterImpl(webOfTrustConnector);
private final WebOfTrustContextUpdateJob contextUpdateJob = webOfTrustUpdater.new WebOfTrustContextUpdateJob(ownIdentity, CONTEXT);
private final AddContextJob addContextJob = webOfTrustUpdater.new AddContextJob(ownIdentity, CONTEXT);
private final RemoveContextJob removeContextJob = webOfTrustUpdater.new RemoveContextJob(ownIdentity, CONTEXT);
- private final Identity trustee = when(mock(Identity.class).getId()).thenReturn("trustee-id").getMock();
private WebOfTrustUpdateJob createWebOfTrustUpdateJob(final boolean success) {
return webOfTrustUpdater.new WebOfTrustUpdateJob() {
}
@Test
- public void setTrustJobSetsTrust() throws PluginException {
- SetTrustJob setTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- setTrustJob.run();
- verify(webOfTrustConnector).setTrust(eq(ownIdentity), eq(trustee), eq(SCORE), eq(TRUST_COMMENT));
- verify(trustee).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- assertThat(setTrustJob.waitForCompletion(), is(true));
- }
-
- @Test
- public void settingNullTrustRemovesTrust() throws WebOfTrustException {
- SetTrustJob setTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, null, TRUST_COMMENT);
- setTrustJob.run();
- verify(webOfTrustConnector).removeTrust(eq(ownIdentity), eq(trustee));
- verify(trustee).removeTrust(eq(ownIdentity));
- assertThat(setTrustJob.waitForCompletion(), is(true));
- }
-
- @Test
- public void exceptionWhileSettingTrustIsCaught() throws PluginException {
- doThrow(PluginException.class).when(webOfTrustConnector).setTrust(eq(ownIdentity), eq(trustee), eq(SCORE), eq(TRUST_COMMENT));
- SetTrustJob setTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- setTrustJob.run();
- verify(webOfTrustConnector).setTrust(eq(ownIdentity), eq(trustee), eq(SCORE), eq(TRUST_COMMENT));
- verify(trustee, never()).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- assertThat(setTrustJob.waitForCompletion(), is(false));
- }
-
- @Test
- public void setTrustJobsWithDifferentClassesAreNotEqual() {
- SetTrustJob firstSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- SetTrustJob secondSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT) {
- };
- assertThat(firstSetTrustJob, not(is(secondSetTrustJob)));
- assertThat(secondSetTrustJob, not(is(firstSetTrustJob)));
- }
-
- @Test
- public void setTrustJobsWithDifferentTrustersAreNotEqual() {
- SetTrustJob firstSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- SetTrustJob secondSetTrustJob = webOfTrustUpdater.new SetTrustJob(mock(OwnIdentity.class), trustee, SCORE, TRUST_COMMENT);
- assertThat(firstSetTrustJob, not(is(secondSetTrustJob)));
- assertThat(secondSetTrustJob, not(is(firstSetTrustJob)));
- }
-
- @Test
- public void setTrustJobsWithDifferentTrusteesAreNotEqual() {
- SetTrustJob firstSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- SetTrustJob secondSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, mock(Identity.class), SCORE, TRUST_COMMENT);
- assertThat(firstSetTrustJob, not(is(secondSetTrustJob)));
- assertThat(secondSetTrustJob, not(is(firstSetTrustJob)));
- }
-
- @Test
- public void setTrustJobsWithDifferentScoreAreEqual() {
- SetTrustJob firstSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- SetTrustJob secondSetTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, OTHER_SCORE, TRUST_COMMENT);
- assertThat(firstSetTrustJob, is(secondSetTrustJob));
- assertThat(secondSetTrustJob, is(firstSetTrustJob));
- assertThat(firstSetTrustJob.hashCode(), is(secondSetTrustJob.hashCode()));
- }
-
- @Test
- public void setTrustJobDoesNotEqualNull() {
- SetTrustJob setTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- assertThat(setTrustJob, not(is((Object) null)));
- }
-
- @Test
- public void toStringOfSetTrustJobContainsIdsOfTrusterAndTrustee() {
- SetTrustJob setTrustJob = webOfTrustUpdater.new SetTrustJob(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- assertThat(setTrustJob.toString(), containsString(ownIdentity.getId()));
- assertThat(setTrustJob.toString(), containsString(trustee.getId()));
- }
-
- @Test
public void webOfTrustUpdaterStopsWhenItShould() {
webOfTrustUpdater.stop();
webOfTrustUpdater.serviceRun();
verify(ownIdentity).removeContext(eq(CONTEXT));
}
- @Test
- public void setTrustSetsTrust() throws InterruptedException, PluginException {
- final CountDownLatch trustSetTrigger = new CountDownLatch(1);
- doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- trustSetTrigger.countDown();
- return null;
- }
- }).when(trustee).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- webOfTrustUpdater.start();
- webOfTrustUpdater.setTrust(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- assertThat(trustSetTrigger.await(1, SECONDS), is(true));
- verify(trustee).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- verify(webOfTrustConnector).setTrust(eq(ownIdentity), eq(trustee), eq(SCORE), eq(TRUST_COMMENT));
- }
-
- @Test
- public void setTrustRequestsAreCoalesced() throws InterruptedException, PluginException {
- final CountDownLatch firstTrigger = new CountDownLatch(1);
- doAnswer((Answer<Void>) invocation -> {
- firstTrigger.countDown();
- return null;
- }).when(trustee).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- Identity secondTrustee = when(mock(Identity.class).getId()).thenReturn("trustee-id2").getMock();
- final CountDownLatch secondTrigger = new CountDownLatch(1);
- doAnswer((Answer<Void>) invocation -> {
- secondTrigger.countDown();
- return null;
- }).when(secondTrustee).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- webOfTrustUpdater.setTrust(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- webOfTrustUpdater.setTrust(ownIdentity, secondTrustee, SCORE, TRUST_COMMENT);
- webOfTrustUpdater.setTrust(ownIdentity, trustee, SCORE, TRUST_COMMENT);
- webOfTrustUpdater.start();
- assertThat(firstTrigger.await(1, SECONDS), is(true));
- assertThat(secondTrigger.await(1, SECONDS), is(true));
- verify(trustee, times(1)).setTrust(eq(ownIdentity), eq(new Trust(SCORE, null, 0)));
- verify(webOfTrustConnector).setTrust(eq(ownIdentity), eq(trustee), eq(SCORE), eq(TRUST_COMMENT));
- }
-
}
}
@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))
override fun removeContext(ownIdentity: OwnIdentity, context: String) = Unit
override fun setProperty(ownIdentity: OwnIdentity, name: String, value: String) = Unit
override fun removeProperty(ownIdentity: OwnIdentity, name: String) = Unit
- override fun getTrust(ownIdentity: OwnIdentity, identity: Identity) = Trust(null, null, null)
- override fun setTrust(ownIdentity: OwnIdentity, identity: Identity, trust: Int, comment: String) = Unit
- override fun removeTrust(ownIdentity: OwnIdentity, identity: Identity) = Unit
override fun ping() = Unit
}
class PluginWebOfTrustConnectorTest {
private val ownIdentity = DefaultOwnIdentity("id", "nickname", "requestUri", "insertUri")
- private val identity = DefaultIdentity("id-a", "alpha", "url://alpha")
@Test
fun `wot plugin can be pinged`() {
.connect { removeProperty(ownIdentity, "TestProperty") }
}
- @Test
- fun `getting trust sends correct own identity id`() {
- createPluginConnector("GetIdentity", hasField("Truster", equalTo(ownIdentity.id)))
- .connect { getTrust(ownIdentity, identity) }
- }
-
- @Test
- fun `getting trust sends correct identity id`() {
- createPluginConnector("GetIdentity", hasField("Identity", equalTo(identity.id)))
- .connect { getTrust(ownIdentity, identity) }
- }
-
- @Test
- fun `getting trust returns correct trust values`() {
- val trust = createPluginConnector("GetIdentity", hasField("Identity", equalTo(identity.id))) {
- put("Trust", "12")
- put("Score", "34")
- put("Rank", "56")
- }.connect { getTrust(ownIdentity, identity) }
- assertThat(trust, isTrust(12, 34, 56))
- }
-
- @Test
- fun `getting trust reads incorrect numbers for trust as null`() {
- val trust = createPluginConnector("GetIdentity", hasField("Identity", equalTo(identity.id))) {
- put("Trust", "incorrect")
- put("Score", "34")
- put("Rank", "56")
- }.connect { getTrust(ownIdentity, identity) }
- assertThat(trust, isTrust(null, 34, 56))
- }
-
- @Test
- fun `getting trust reads incorrect numbers for score as null`() {
- val trust = createPluginConnector("GetIdentity", hasField("Identity", equalTo(identity.id))) {
- put("Trust", "12")
- put("Score", "incorrect")
- put("Rank", "56")
- }.connect { getTrust(ownIdentity, identity) }
- assertThat(trust, isTrust(12, null, 56))
- }
-
- @Test
- fun `getting trust reads incorrect numbers for rank as null`() {
- val trust = createPluginConnector("GetIdentity", hasField("Identity", equalTo(identity.id))) {
- put("Trust", "12")
- put("Score", "34")
- put("Rank", "incorrect")
- }.connect { getTrust(ownIdentity, identity) }
- assertThat(trust, isTrust(12, 34, null))
- }
-
- @Test
- fun `setting trust sends correct own identity id`() {
- createPluginConnector("SetTrust", hasField("Truster", equalTo(ownIdentity.id)))
- .connect { setTrust(ownIdentity, identity, 123, "Test Trust") }
- }
-
- @Test
- fun `setting trust sends correct identity id`() {
- createPluginConnector("SetTrust", hasField("Trustee", equalTo(identity.id)))
- .connect { setTrust(ownIdentity, identity, 123, "Test Trust") }
- }
-
- @Test
- fun `setting trust sends correct trust value`() {
- createPluginConnector("SetTrust", hasField("Value", equalTo("123")))
- .connect { setTrust(ownIdentity, identity, 123, "Test Trust") }
- }
-
- @Test
- fun `setting trust sends correct comment`() {
- createPluginConnector("SetTrust", hasField("Comment", equalTo("Test Trust")))
- .connect { setTrust(ownIdentity, identity, 123, "Test Trust") }
- }
-
- @Test
- fun `removing trust sends correct own identity id`() {
- createPluginConnector("RemoveTrust", hasField("Truster", equalTo(ownIdentity.id)))
- .connect { removeTrust(ownIdentity, identity) }
- }
-
- @Test
- fun `removing trust sends correct identity id`() {
- createPluginConnector("RemoveTrust", hasField("Trustee", equalTo(identity.id)))
- .connect { removeTrust(ownIdentity, identity) }
- }
-
}
private fun <R> PluginConnector.connect(block: PluginWebOfTrustConnector.() -> R) =
}
@Test
- fun `distrust page can be injected`() {
- assertThat(allPages.distrustPage, instanceOf<DistrustPage>())
- }
-
- @Test
fun `edit album page can be injected`() {
assertThat(allPages.editAlbumPage, instanceOf<EditAlbumPage>())
}
}
@Test
- fun `trust page can be injected`() {
- assertThat(allPages.trustPage, instanceOf<TrustPage>())
- }
-
- @Test
fun `unbookmark page can be injected`() {
assertThat(allPages.unbookmarkPage, instanceOf<UnbookmarkPage>())
}
}
@Test
- fun `untrust page can be injected`() {
- assertThat(allPages.untrustPage, instanceOf<UntrustPage>())
- }
-
- @Test
fun `upload image page can be injected`() {
assertThat(allPages.uploadImagePage, instanceOf<UploadImagePage>())
}
+++ /dev/null
-package net.pterodactylus.sone.web.ajax
-
-import net.pterodactylus.sone.data.Sone
-import net.pterodactylus.sone.test.getInstance
-import net.pterodactylus.sone.test.mock
-import net.pterodactylus.sone.web.baseInjector
-import org.hamcrest.MatcherAssert.assertThat
-import org.hamcrest.Matchers.equalTo
-import org.hamcrest.Matchers.notNullValue
-import org.junit.Test
-import org.mockito.Mockito.verify
-
-/**
- * Unit test for [DistrustAjaxPage].
- */
-class DistrustAjaxPageTest : JsonPageTest("distrustSone.ajax", pageSupplier = ::DistrustAjaxPage) {
-
- @Test
- fun `request with missing sone results in invalid-sone-id`() {
- assertThatJsonFailed("invalid-sone-id")
- }
-
- @Test
- fun `request with invalid sone results in invalid-sone-id`() {
- addRequestParameter("sone", "invalid-sone")
- assertThatJsonFailed("invalid-sone-id")
- }
-
- @Test
- fun `request with valid sone results in distrusted sone`() {
- val sone = mock<Sone>()
- addSone(sone, "sone-id")
- addRequestParameter("sone", "sone-id")
- assertThatJsonIsSuccessful()
- verify(core).distrustSone(currentSone, sone)
- }
-
- @Test
- fun `request with valid sone results in correct trust value being sent back`() {
- core.preferences.newNegativeTrust = -33
- val sone = mock<Sone>()
- addSone(sone, "sone-id")
- addRequestParameter("sone", "sone-id")
- assertThatJsonIsSuccessful()
- assertThat(json["trustValue"]?.asInt(), equalTo(-33))
- }
-
- @Test
- fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<DistrustAjaxPage>(), notNullValue())
- }
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.ajax
-
-import net.pterodactylus.sone.data.Sone
-import net.pterodactylus.sone.test.getInstance
-import net.pterodactylus.sone.test.mock
-import net.pterodactylus.sone.web.baseInjector
-import org.hamcrest.MatcherAssert.assertThat
-import org.hamcrest.Matchers.equalTo
-import org.hamcrest.Matchers.notNullValue
-import org.junit.Test
-import org.mockito.Mockito.verify
-
-/**
- * Unit test for [TrustAjaxPage].
- */
-class TrustAjaxPageTest : JsonPageTest("trustSone.ajax", requiresLogin = true, needsFormPassword = true, pageSupplier = ::TrustAjaxPage) {
-
- private val sone = mock<Sone>()
-
- @Test
- fun `request with invalid sone results in invalid-sone-id`() {
- assertThatJsonFailed("invalid-sone-id")
- }
-
- @Test
- fun `request with valid sone trust sone`() {
- addSone(sone, "sone-id")
- addRequestParameter("sone", "sone-id")
- assertThatJsonIsSuccessful()
- verify(core).trustSone(currentSone, sone)
- }
-
- @Test
- fun `request with valid sone returns positive trust value`() {
- addSone(sone, "sone-id")
- addRequestParameter("sone", "sone-id")
- core.preferences.newPositiveTrust = 31
- assertThatJsonIsSuccessful()
- assertThat(json["trustValue"]?.asInt(), equalTo(31))
- }
-
- @Test
- fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<TrustAjaxPage>(), notNullValue())
- }
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.ajax
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.test.*
-import net.pterodactylus.sone.web.*
-import org.hamcrest.MatcherAssert.*
-import org.hamcrest.Matchers.*
-import org.junit.*
-import org.mockito.Mockito.*
-
-/**
- * Unit test for [UntrustAjaxPage].
- */
-class UntrustAjaxPageTest : JsonPageTest("untrustSone.ajax", pageSupplier = ::UntrustAjaxPage) {
-
- @Test
- fun `request without sone results in invalid-sone-id`() {
- assertThatJsonFailed("invalid-sone-id")
- }
-
- @Test
- fun `request with invalid sone results in invalid-sone-id`() {
- addRequestParameter("sone", "invalid")
- assertThatJsonFailed("invalid-sone-id")
- }
-
- @Test
- fun `request with valid sone results in sone being untrusted`() {
- val sone = mock<Sone>()
- addSone(sone, "sone-id")
- addRequestParameter("sone", "sone-id")
- assertThatJsonIsSuccessful()
- verify(core).untrustSone(currentSone, sone)
- }
-
- @Test
- fun `request with valid sone results in null trust value being returned`() {
- val sone = mock<Sone>()
- addSone(sone, "sone-id")
- addRequestParameter("sone", "sone-id")
- assertThatJsonIsSuccessful()
- assertThat(json["trustValue"], nullValue())
- }
-
- @Test
- fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<UntrustAjaxPage>(), notNullValue())
- }
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.pages
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.test.*
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.util.web.Method.*
-import org.hamcrest.MatcherAssert.*
-import org.hamcrest.Matchers.*
-import org.junit.*
-import org.mockito.Mockito.*
-
-/**
- * Unit test for [DistrustPage].
- */
-class DistrustPageTest : WebPageTest(::DistrustPage) {
-
- @Test
- fun `page returns correct path`() {
- assertThat(page.path, equalTo("distrust.html"))
- }
-
- @Test
- fun `page requires login`() {
- assertThat(page.requiresLogin(), equalTo(true))
- }
-
- @Test
- fun `page returns correct title`() {
- addTranslation("Page.Distrust.Title", "distrust page title")
- assertThat(page.getPageTitle(soneRequest), equalTo("distrust page title"))
- }
-
- @Test
- fun `get request does not redirect`() {
- page.processTemplate(freenetRequest, templateContext)
- }
-
- @Test
- fun `post request with invalid sone redirects to return page`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- verifyRedirect("return.html")
- }
-
- @Test
- fun `post request with valid sone distrusts sone and redirects to return page`() {
- setMethod(POST)
- val remoteSone = mock<Sone>()
- addSone("remote-sone-id", remoteSone)
- addHttpRequestPart("returnPage", "return.html")
- addHttpRequestPart("sone", "remote-sone-id")
- verifyRedirect("return.html") {
- verify(core).distrustSone(currentSone, remoteSone)
- }
- }
-
- @Test
- fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<DistrustPage>(), notNullValue())
- }
-
-}
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
assertThat(templateContext["images-per-page"], equalTo<Any>(4))
assertThat(templateContext["fcp-interface-active"], equalTo<Any>(true))
assertThat(templateContext["require-full-access"], equalTo<Any>(true))
- assertThat(templateContext["negative-trust"], equalTo<Any>(7))
- assertThat(templateContext["positive-trust"], equalTo<Any>(8))
assertThat(templateContext["post-cut-off-length"], equalTo<Any>(51))
assertThat(templateContext["posts-per-page"], equalTo<Any>(10))
- assertThat(templateContext["trust-comment"], equalTo<Any>("11"))
}
}
}
@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")
}
}
@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<OptionsPage>(), notNullValue())
}
+++ /dev/null
-package net.pterodactylus.sone.web.pages
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.test.getInstance
-import net.pterodactylus.sone.test.mock
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.util.web.Method.*
-import org.hamcrest.MatcherAssert.*
-import org.hamcrest.Matchers.*
-import org.junit.*
-import org.mockito.ArgumentMatchers.any
-import org.mockito.ArgumentMatchers.eq
-import org.mockito.Mockito.never
-import org.mockito.Mockito.verify
-
-/**
- * Unit test for [TrustPage].
- */
-class TrustPageTest : WebPageTest(::TrustPage) {
-
- @Test
- fun `page returns correct path`() {
- assertThat(page.path, equalTo("trust.html"))
- }
-
- @Test
- fun `page requires login`() {
- assertThat(page.requiresLogin(), equalTo(true))
- }
-
- @Test
- fun `page returns correct title`() {
- addTranslation("Page.Trust.Title", "title trust page")
- assertThat(page.getPageTitle(soneRequest), equalTo("title trust page"))
- }
-
- @Test
- fun `get method does not redirect`() {
- verifyNoRedirect { }
- }
-
- @Test
- fun `post request without sone redirects to return page`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- verifyRedirect("return.html") {
- verify(core, never()).trustSone(eq(currentSone), any())
- }
- }
-
- @Test
- fun `post request with missing sone redirects to return page`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- addHttpRequestPart("sone", "sone-id")
- verifyRedirect("return.html") {
- verify(core, never()).trustSone(eq(currentSone), any())
- }
- }
-
- @Test
- fun `post request with existing sone trusts the identity and redirects to return page`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- addHttpRequestPart("sone", "sone-id")
- val sone = mock<Sone>()
- addSone("sone-id", sone)
- verifyRedirect("return.html") {
- verify(core).trustSone(eq(currentSone), eq(sone))
- }
- }
-
- @Test
- fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<TrustPage>(), notNullValue())
- }
-
-}
+++ /dev/null
-package net.pterodactylus.sone.web.pages
-
-import net.pterodactylus.sone.data.*
-import net.pterodactylus.sone.test.getInstance
-import net.pterodactylus.sone.test.mock
-import net.pterodactylus.sone.web.*
-import net.pterodactylus.util.web.Method.*
-import org.hamcrest.MatcherAssert.*
-import org.hamcrest.Matchers.*
-import org.junit.*
-import org.mockito.ArgumentMatchers.any
-import org.mockito.ArgumentMatchers.eq
-import org.mockito.Mockito.never
-import org.mockito.Mockito.verify
-
-/**
- * Unit test for [UntrustPage].
- */
-class UntrustPageTest : WebPageTest(::UntrustPage) {
-
- @Test
- fun `page returns correct path`() {
- assertThat(page.path, equalTo("untrust.html"))
- }
-
- @Test
- fun `page requires login`() {
- assertThat(page.requiresLogin(), equalTo(true))
- }
-
- @Test
- fun `page returns correct title`() {
- addTranslation("Page.Untrust.Title", "untrust page title")
- assertThat(page.getPageTitle(soneRequest), equalTo("untrust page title"))
- }
-
- @Test
- fun `get request does not redirect`() {
- verifyNoRedirect {
- verify(core, never()).untrustSone(eq(currentSone), any())
- }
- }
-
- @Test
- fun `post request without sone parameter does not untrust but redirects`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- verifyRedirect("return.html") {
- verify(core, never()).untrustSone(eq(currentSone), any())
- }
- }
-
- @Test
- fun `post request with invalid sone parameter does not untrust but redirects`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- addHttpRequestPart("sone", "no-sone")
- verifyRedirect("return.html") {
- verify(core, never()).untrustSone(eq(currentSone), any())
- }
- }
-
- @Test
- fun `post request with valid sone parameter untrusts and redirects`() {
- setMethod(POST)
- addHttpRequestPart("returnPage", "return.html")
- addHttpRequestPart("sone", "sone-id")
- val sone = mock<Sone>()
- addSone("sone-id", sone)
- verifyRedirect("return.html") {
- verify(core).untrustSone(currentSone, sone)
- }
- }
-
- @Test
- fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<UntrustPage>(), notNullValue())
- }
-
-}