fix for db key
This commit is contained in:
parent
8023fa48db
commit
dcae5914d1
3 changed files with 23 additions and 2 deletions
|
|
@ -205,9 +205,14 @@ defmodule Pleroma.ConfigDB do
|
|||
{config, sub_keys} when is_list(sub_keys) <- {config, params[:subkeys]},
|
||||
old_value <- from_binary(config.value),
|
||||
keys <- Enum.map(sub_keys, &do_transform_string(&1)),
|
||||
new_value <- Keyword.drop(old_value, keys) do
|
||||
{:partial_remove, config, new_value} when new_value != [] <-
|
||||
{:partial_remove, config, Keyword.drop(old_value, keys)} do
|
||||
ConfigDB.update(config, %{value: new_value})
|
||||
else
|
||||
{:partial_remove, config, []} ->
|
||||
Repo.delete(config)
|
||||
{:ok, nil}
|
||||
|
||||
{config, nil} ->
|
||||
Repo.delete(config)
|
||||
{:ok, nil}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue