Rename enum to better match its purpose
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 13 Nov 2016 10:57:23 +0000 (11:57 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 13 Nov 2016 10:57:23 +0000 (11:57 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/data/SoneOptions.java
src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java
src/main/java/net/pterodactylus/sone/web/OptionsPage.java

index 42542c0..8c4264a 100644 (file)
@@ -69,7 +69,7 @@ import net.pterodactylus.sone.data.Profile.Field;
 import net.pterodactylus.sone.data.Reply;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.data.Sone.SoneStatus;
-import net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars;
+import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent;
 import net.pterodactylus.sone.data.TemporaryImage;
 import net.pterodactylus.sone.database.AlbumBuilder;
 import net.pterodactylus.sone.database.Database;
@@ -1070,7 +1070,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                sone.getOptions().setShowNewSoneNotifications(configuration.getBooleanValue(sonePrefix + "/Options/ShowNotification/NewSones").getValue(true));
                sone.getOptions().setShowNewPostNotifications(configuration.getBooleanValue(sonePrefix + "/Options/ShowNotification/NewPosts").getValue(true));
                sone.getOptions().setShowNewReplyNotifications(configuration.getBooleanValue(sonePrefix + "/Options/ShowNotification/NewReplies").getValue(true));
-               sone.getOptions().setShowCustomAvatars(ShowCustomAvatars.valueOf(configuration.getStringValue(sonePrefix + "/Options/ShowCustomAvatars").getValue(ShowCustomAvatars.NEVER.name())));
+               sone.getOptions().setShowCustomAvatars(LoadExternalContent.valueOf(configuration.getStringValue(sonePrefix + "/Options/ShowCustomAvatars").getValue(LoadExternalContent.NEVER.name())));
 
                /* if we’re still here, Sone was loaded successfully. */
                synchronized (sone) {
index 4abf16f..b5e42ee 100644 (file)
@@ -1,6 +1,6 @@
 package net.pterodactylus.sone.data;
 
-import static net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars.NEVER;
+import static net.pterodactylus.sone.data.SoneOptions.LoadExternalContent.NEVER;
 
 /**
  * All Sone-specific options.
@@ -24,15 +24,15 @@ public interface SoneOptions {
        boolean isShowNewReplyNotifications();
        void setShowNewReplyNotifications(boolean showNewReplyNotifications);
 
-       ShowCustomAvatars getShowCustomAvatars();
-       void setShowCustomAvatars(ShowCustomAvatars showCustomAvatars);
+       LoadExternalContent getShowCustomAvatars();
+       void setShowCustomAvatars(LoadExternalContent showCustomAvatars);
 
        /**
-        * The possible values for the “show custom avatars” option.
+        * Possible values for all options that are related to loading external content.
         *
         * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
         */
-       enum ShowCustomAvatars {
+       enum LoadExternalContent {
 
                /** Never show custom avatars. */
                NEVER,
@@ -63,7 +63,7 @@ public interface SoneOptions {
                private boolean showNewSoneNotifications = true;
                private boolean showNewPostNotifications = true;
                private boolean showNewReplyNotifications = true;
-               private ShowCustomAvatars showCustomAvatars = NEVER;
+               private LoadExternalContent showCustomAvatars = NEVER;
 
                @Override
                public boolean isAutoFollow() {
@@ -116,12 +116,12 @@ public interface SoneOptions {
                }
 
                @Override
-               public ShowCustomAvatars getShowCustomAvatars() {
+               public LoadExternalContent getShowCustomAvatars() {
                        return showCustomAvatars;
                }
 
                @Override
-               public void setShowCustomAvatars(ShowCustomAvatars showCustomAvatars) {
+               public void setShowCustomAvatars(LoadExternalContent showCustomAvatars) {
                        this.showCustomAvatars = showCustomAvatars;
                }
 
index 7362179..fafba86 100644 (file)
@@ -20,7 +20,7 @@ package net.pterodactylus.sone.template;
 import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.data.Profile;
 import net.pterodactylus.sone.data.Sone;
-import net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars;
+import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent;
 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
 import net.pterodactylus.sone.freenet.wot.Trust;
 import net.pterodactylus.util.template.Accessor;
@@ -74,24 +74,24 @@ public class ProfileAccessor extends ReflectionAccessor {
                                /* always show your own avatars. */
                                return avatarId;
                        }
-                       ShowCustomAvatars showCustomAvatars = currentSone.getOptions().getShowCustomAvatars();
-                       if (showCustomAvatars == ShowCustomAvatars.NEVER) {
+                       LoadExternalContent showCustomAvatars = currentSone.getOptions().getShowCustomAvatars();
+                       if (showCustomAvatars == LoadExternalContent.NEVER) {
                                return null;
                        }
-                       if (showCustomAvatars == ShowCustomAvatars.ALWAYS) {
+                       if (showCustomAvatars == LoadExternalContent.ALWAYS) {
                                return avatarId;
                        }
-                       if (showCustomAvatars == ShowCustomAvatars.FOLLOWED) {
+                       if (showCustomAvatars == LoadExternalContent.FOLLOWED) {
                                return currentSone.hasFriend(remoteSone.getId()) ? avatarId : null;
                        }
                        Trust trust = remoteSone.getIdentity().getTrust((OwnIdentity) currentSone.getIdentity());
                        if (trust == null) {
                                return null;
                        }
-                       if ((showCustomAvatars == ShowCustomAvatars.MANUALLY_TRUSTED) && (trust.getExplicit() != null) && (trust.getExplicit() > 0)) {
+                       if ((showCustomAvatars == LoadExternalContent.MANUALLY_TRUSTED) && (trust.getExplicit() != null) && (trust.getExplicit() > 0)) {
                                return avatarId;
                        }
-                       if ((showCustomAvatars == ShowCustomAvatars.TRUSTED) && (((trust.getExplicit() != null) && (trust.getExplicit() > 0)) || ((trust.getImplicit() != null) && (trust.getImplicit() > 0)))) {
+                       if ((showCustomAvatars == LoadExternalContent.TRUSTED) && (((trust.getExplicit() != null) && (trust.getExplicit() > 0)) || ((trust.getImplicit() != null) && (trust.getImplicit() > 0)))) {
                                return avatarId;
                        }
                        return null;
index ae1dcc3..4aaf232 100644 (file)
@@ -24,7 +24,7 @@ import java.util.List;
 
 import net.pterodactylus.sone.core.Preferences;
 import net.pterodactylus.sone.data.Sone;
-import net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars;
+import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent;
 import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired;
 import net.pterodactylus.sone.web.page.FreenetRequest;
 import net.pterodactylus.util.template.Template;
@@ -75,7 +75,7 @@ public class OptionsPage extends SoneTemplatePage {
                                boolean showNotificationNewReplies = request.getHttpRequest().isPartSet("show-notification-new-replies");
                                currentSone.getOptions().setShowNewReplyNotifications(showNotificationNewReplies);
                                String showCustomAvatars = request.getHttpRequest().getPartAsStringFailsafe("show-custom-avatars", 32);
-                               currentSone.getOptions().setShowCustomAvatars(ShowCustomAvatars.valueOf(showCustomAvatars));
+                               currentSone.getOptions().setShowCustomAvatars(LoadExternalContent.valueOf(showCustomAvatars));
                                webInterface.getCore().touchConfiguration();
                        }
                        Integer insertionDelay = parseInt(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16), null);