diff options
author | lain <lain@soykaf.club> | 2020-07-21 22:17:34 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-21 22:17:34 +0000 |
commit | 696c13ce54aff25737f8f753a94747d79b9c54b0 (patch) | |
tree | 99d52ee68fdaef14d5fc3e63ec90e6f241ea56c5 /priv/repo/migrations/20200716195806_autolinker_to_linkify.exs | |
parent | 2b5d9eb10529325aef1b4aab980bd901ba6b0c70 (diff) | |
download | pleroma-696c13ce54aff25737f8f753a94747d79b9c54b0.tar.gz pleroma-696c13ce54aff25737f8f753a94747d79b9c54b0.zip |
Revert "Merge branch 'linkify' into 'develop'"
This reverts merge request !2677
Diffstat (limited to 'priv/repo/migrations/20200716195806_autolinker_to_linkify.exs')
-rw-r--r-- | priv/repo/migrations/20200716195806_autolinker_to_linkify.exs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/priv/repo/migrations/20200716195806_autolinker_to_linkify.exs b/priv/repo/migrations/20200716195806_autolinker_to_linkify.exs deleted file mode 100644 index 9ec4203eb..000000000 --- a/priv/repo/migrations/20200716195806_autolinker_to_linkify.exs +++ /dev/null @@ -1,37 +0,0 @@ -defmodule Pleroma.Repo.Migrations.AutolinkerToLinkify do - use Ecto.Migration - - alias Pleroma.Repo - alias Pleroma.ConfigDB - - @autolinker_path %{group: :auto_linker, key: :opts} - @linkify_path %{group: :pleroma, key: Pleroma.Formatter} - - @compat_opts [:class, :rel, :new_window, :truncate, :strip_prefix, :extra] - - def change do - with {:ok, {old, new}} <- maybe_get_params() do - move_config(old, new) - end - end - - defp move_config(%{} = old, %{} = new) do - {:ok, _} = ConfigDB.update_or_create(new) - {:ok, _} = ConfigDB.delete(old) - :ok - end - - defp maybe_get_params() do - with %ConfigDB{value: opts} <- ConfigDB.get_by_params(@autolinker_path), - %{} = opts <- transform_opts(opts), - %{} = linkify_params <- Map.put(@linkify_path, :value, opts) do - {:ok, {@autolinker_path, linkify_params}} - end - end - - defp transform_opts(opts) when is_list(opts) do - opts - |> Enum.into(%{}) - |> Map.take(@compat_opts) - end -end |