fix for migrate task
authorAlexander <alex.strizhakov@gmail.com>
Sun, 10 Nov 2019 19:54:37 +0000 (22:54 +0300)
committerAlexander <alex.strizhakov@gmail.com>
Sun, 10 Nov 2019 19:54:37 +0000 (22:54 +0300)
lib/mix/tasks/pleroma/config.ex
lib/pleroma/docs/json.ex
test/web/admin_api/admin_api_controller_test.exs

index 11e4fde43eaa7932c817461a61a5b8231d6b87cb..0e21408b2b8b315cde8248fff16aeb9540c077b1 100644 (file)
@@ -45,7 +45,7 @@ defmodule Mix.Tasks.Pleroma.Config do
     if Pleroma.Config.get([:instance, :dynamic_configuration]) do
       config_path = "config/#{env}.exported_from_db.secret.exs"
 
-      {:ok, file} = File.open(config_path, [:write])
+      {:ok, file} = File.open(config_path, [:write, :utf8])
       IO.write(file, "use Mix.Config\r\n")
 
       Repo.all(Config)
index 18ba01d58aca56bb58b5edd38bdc738bb10d87c6..f2a56d845e594752db66cd24d67483be0f9f6221 100644 (file)
@@ -5,7 +5,7 @@ defmodule Pleroma.Docs.JSON do
   def process(descriptions) do
     config_path = "docs/generate_config.json"
 
-    with {:ok, file} <- File.open(config_path, [:write]),
+    with {:ok, file} <- File.open(config_path, [:write, :utf8]),
          json <- generate_json(descriptions),
          :ok <- IO.write(file, json),
          :ok <- File.close(file) do
index 2a9e4f5a01783a774f20573015702cb2078d18b3..bc92353091fed0216a4da9ca348ed326ac14b7c0 100644 (file)
@@ -2269,6 +2269,10 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
       Pleroma.Config.put([:instance, :dynamic_configuration], true)
     end
 
+    clear_config([:feed, :post_title]) do
+      Pleroma.Config.put([:feed, :post_title], %{max_length: 100, omission: "…"})
+    end
+
     test "transfer settings to DB and to file", %{conn: conn, admin: admin} do
       assert Pleroma.Repo.all(Pleroma.Web.AdminAPI.Config) == []
       conn = get(conn, "/api/pleroma/admin/config/migrate_to_db")