--- /dev/null
+package net.pterodactylus.sone.core;
+
+import net.pterodactylus.sone.data.Post;
+
+/**
+ * Sone compatibility modes.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public enum CompatibilityMode {
+
+ /**
+ * This mode causes Sone to use a post’s {@link Post#getInternalId() internal ID} to locate posts when parsing links.
+ */
+ oldElementIds,
+
+}
import java.util.ArrayList;
import java.util.Collection;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
/** The trust updater. */
private final WebOfTrustUpdater webOfTrustUpdater;
+ private final Set<CompatibilityMode> compatibilityModes = EnumSet.noneOf(CompatibilityMode.class);
+
/** The times Sones were followed. */
private final Map<String, Long> soneFollowingTimes = new HashMap<String, Long>();
return updateChecker;
}
+ public boolean isCompatibilityMode(CompatibilityMode compatibilityMode) {
+ return compatibilityModes.contains(compatibilityMode);
+ }
+
+ public void setCompatibilityMode(CompatibilityMode compatibilityMode) {
+ compatibilityModes.add(compatibilityMode);
+ }
+
+ public void clearCompatibilityMod(CompatibilityMode compatibilityMode) {
+ compatibilityModes.remove(compatibilityMode);
+ }
+
/**
* Returns the Sone rescuer for the given local Sone.
*
import java.util.ArrayList;
import java.util.List;
+import net.pterodactylus.sone.core.CompatibilityMode;
import net.pterodactylus.sone.core.Preferences;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Sone.ShowCustomAvatars;
Integer fcpFullAccessRequiredInteger = parseInt(request.getHttpRequest().getPartAsStringFailsafe("fcp-full-access-required", 1), preferences.getFcpFullAccessRequired().ordinal());
FullAccessRequired fcpFullAccessRequired = FullAccessRequired.values()[fcpFullAccessRequiredInteger];
preferences.setFcpFullAccessRequired(fcpFullAccessRequired);
+
+ boolean compatOldElementIds = request.getHttpRequest().isPartSet("compat-old-element-ids");
+ if (compatOldElementIds) {
+ webInterface.getCore().setCompatibilityMode(CompatibilityMode.oldElementIds);
+ } else {
+ webInterface.getCore().clearCompatibilityMod(CompatibilityMode.oldElementIds);
+ }
+
webInterface.getCore().touchConfiguration();
if (fieldErrors.isEmpty()) {
throw new RedirectException(getPath());
templateContext.set("trust-comment", preferences.getTrustComment());
templateContext.set("fcp-interface-active", preferences.isFcpInterfaceActive());
templateContext.set("fcp-full-access-required", preferences.getFcpFullAccessRequired().ordinal());
+ templateContext.set("compat-old-element-ids", webInterface.getCore().isCompatibilityMode(CompatibilityMode.oldElementIds));
}
}
Page.Options.Option.FcpFullAccessRequired.Value.No=No
Page.Options.Option.FcpFullAccessRequired.Value.Writing=For Write Access
Page.Options.Option.FcpFullAccessRequired.Value.Always=Always
+Page.Options.Section.CompatibilityOptions.Title=Compatibility Options
+Page.Options.Section.CompatibilityOptions.Description=These options control how much deprecated functionality Sone will support.
+Page.Options.Option.CompatibilityOptions.OldElementIds.Description=Support old post IDs in links. Activating this will try to locate a post linked to by an old ID even though it can not be guaranteed that it is the post that was originally linked to.
Page.Options.Section.Cleaning.Title=Clean Up
Page.Options.Option.ClearOnNextRestart.Description=Resets the configuration of the Sone plugin at the next restart. Warning! {strong}This will destroy all of your Sones{/strong} so make sure you have backed up everyhing you still need! Also, you need to set the next option to true to actually do it.
Page.Options.Option.ReallyClearOnNextRestart.Description=This option needs to be set to “yes” if you really, {strong}really{/strong} want to clear the plugin configuration on the next restart.
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.
+# 72-74
</select>
</p>
+ <h2><%= Page.Options.Section.CompatibilityOptions.Title|l10n|html></h2>
+
+ <p><%= Page.Options.Section.CompatibilityOptions.Description|l10n|html></p>
+
+ <p>
+ <input type="checkbox" name="compat-old-element-ids"<%if compat-old-element-ids> checked="checked"<%/if> />
+ <%= Page.Options.Option.CompatibilityOptions.OldElementIds.Description|l10n|html>
+ </p>
+
<p><button type="submit"><%= Page.Options.Button.Save|l10n|html></button></p>
</form>