Merge branch 'legacy-fe-config' into 'develop'
authorrinpatch <rinpatch@sdf.org>
Wed, 15 May 2019 10:56:19 +0000 (10:56 +0000)
committerrinpatch <rinpatch@sdf.org>
Wed, 15 May 2019 10:56:19 +0000 (10:56 +0000)
remove deprecated PleromaFE configuration

See merge request pleroma/pleroma!1152

CHANGELOG.md
config/config.exs
lib/pleroma/config/deprecation_warnings.ex
lib/pleroma/web/twitter_api/controllers/util_controller.ex
test/web/twitter_api/util_controller_test.exs

index c563c39da2512ffe0eb07d7686c84c6098661e38..b0e8492857fae3d1d5e92eed816db9cd557bb8a7 100644 (file)
@@ -97,6 +97,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Mastodon API: Exposing default scope of the user to anyone
 - Mastodon API: Make `irreversible` field default to `false` [`POST /api/v1/filters`]
 
+## Removed
+- Configuration: `config :pleroma, :fe` in favor of the more flexible `config :pleroma, :frontend_configurations` 
+
 ## [0.9.9999] - 2019-04-05
 ### Security
 - Mastodon API: Fix content warnings skipping HTML sanitization
index 32c7fecb8403ba0d1343a4d081b373f2914d7e4a..3d11c3a8740460e3dfea2753dcaaf8981b7b8d93 100644 (file)
@@ -253,25 +253,6 @@ config :pleroma, :markup,
     Pleroma.HTML.Scrubber.Default
   ]
 
-# Deprecated, will be gone in 1.0
-config :pleroma, :fe,
-  theme: "pleroma-dark",
-  logo: "/static/logo.png",
-  logo_mask: true,
-  logo_margin: "0.1em",
-  background: "/static/aurora_borealis.jpg",
-  redirect_root_no_login: "/main/all",
-  redirect_root_login: "/main/friends",
-  show_instance_panel: true,
-  scope_options_enabled: false,
-  formatting_options_enabled: false,
-  collapse_message_with_subject: false,
-  hide_post_stats: false,
-  hide_user_stats: false,
-  scope_copy: true,
-  subject_line_behavior: "email",
-  always_show_subject_input: true
-
 config :pleroma, :frontend_configurations,
   pleroma_fe: %{
     theme: "pleroma-dark",
index 0345ac19cbf31a902ec95704b1eaa2e3b10ee805..240fb1c371a0256c1106daf2cd269cff08b45251 100644 (file)
@@ -5,15 +5,6 @@
 defmodule Pleroma.Config.DeprecationWarnings do
   require Logger
 
-  def check_frontend_config_mechanism do
-    if Pleroma.Config.get(:fe) do
-      Logger.warn("""
-      !!!DEPRECATION WARNING!!!
-      You are using the old configuration mechanism for the frontend. Please check config.md.
-      """)
-    end
-  end
-
   def check_hellthread_threshold do
     if Pleroma.Config.get([:mrf_hellthread, :threshold]) do
       Logger.warn("""
@@ -24,7 +15,6 @@ defmodule Pleroma.Config.DeprecationWarnings do
   end
 
   def warn do
-    check_frontend_config_mechanism()
     check_hellthread_threshold()
   end
 end
index 89c55ef0e050bf0fbf4385ac681fba9af22351ab..489170d80b98e48c4f6934c95106d99c5aeb1c97 100644 (file)
@@ -173,8 +173,6 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
 
   def config(conn, _params) do
     instance = Pleroma.Config.get(:instance)
-    instance_fe = Pleroma.Config.get(:fe)
-    instance_chat = Pleroma.Config.get(:chat)
 
     case get_format(conn) do
       "xml" ->
@@ -219,31 +217,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
             if(Pleroma.Config.get([:instance, :safe_dm_mentions]), do: "1", else: "0")
         }
 
-        pleroma_fe =
-          if instance_fe do
-            %{
-              theme: Keyword.get(instance_fe, :theme),
-              background: Keyword.get(instance_fe, :background),
-              logo: Keyword.get(instance_fe, :logo),
-              logoMask: Keyword.get(instance_fe, :logo_mask),
-              logoMargin: Keyword.get(instance_fe, :logo_margin),
-              redirectRootNoLogin: Keyword.get(instance_fe, :redirect_root_no_login),
-              redirectRootLogin: Keyword.get(instance_fe, :redirect_root_login),
-              chatDisabled: !Keyword.get(instance_chat, :enabled),
-              showInstanceSpecificPanel: Keyword.get(instance_fe, :show_instance_panel),
-              scopeOptionsEnabled: Keyword.get(instance_fe, :scope_options_enabled),
-              formattingOptionsEnabled: Keyword.get(instance_fe, :formatting_options_enabled),
-              collapseMessageWithSubject:
-                Keyword.get(instance_fe, :collapse_message_with_subject),
-              hidePostStats: Keyword.get(instance_fe, :hide_post_stats),
-              hideUserStats: Keyword.get(instance_fe, :hide_user_stats),
-              scopeCopy: Keyword.get(instance_fe, :scope_copy),
-              subjectLineBehavior: Keyword.get(instance_fe, :subject_line_behavior),
-              alwaysShowSubjectInput: Keyword.get(instance_fe, :always_show_subject_input)
-            }
-          else
-            Pleroma.Config.get([:frontend_configurations, :pleroma_fe])
-          end
+        pleroma_fe = Pleroma.Config.get([:frontend_configurations, :pleroma_fe])
 
         managed_config = Keyword.get(instance, :managed_config)
 
index 14a8225f097caac84a6c9de636e77357930fa36f..2cd82b3e77839a2d9774030d0ca58db074304e8a 100644 (file)
@@ -141,7 +141,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
 
     test "it returns the managed config", %{conn: conn} do
       Pleroma.Config.put([:instance, :managed_config], false)
-      Pleroma.Config.put([:fe], theme: "rei-ayanami-towel")
+      Pleroma.Config.put([:frontend_configurations, :pleroma_fe], %{theme: "asuka-hospital"})
 
       response =
         conn
@@ -157,29 +157,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
         |> get("/api/statusnet/config.json")
         |> json_response(:ok)
 
-      assert response["site"]["pleromafe"]
-    end
-
-    test "if :pleroma, :fe is false, it returns the new style config settings", %{conn: conn} do
-      Pleroma.Config.put([:instance, :managed_config], true)
-      Pleroma.Config.put([:fe, :theme], "rei-ayanami-towel")
-      Pleroma.Config.put([:frontend_configurations, :pleroma_fe], %{theme: "asuka-hospital"})
-
-      response =
-        conn
-        |> get("/api/statusnet/config.json")
-        |> json_response(:ok)
-
-      assert response["site"]["pleromafe"]["theme"] == "rei-ayanami-towel"
-
-      Pleroma.Config.put([:fe], false)
-
-      response =
-        conn
-        |> get("/api/statusnet/config.json")
-        |> json_response(:ok)
-
-      assert response["site"]["pleromafe"]["theme"] == "asuka-hospital"
+      assert response["site"]["pleromafe"] == %{"theme" => "asuka-hospital"}
     end
   end