forked from AkkomaGang/akkoma
Ensure deleting entire group prints out settings that will be removed before actually removing them
This commit is contained in:
parent
696d39c3dc
commit
3bf5c5b015
1 changed files with 22 additions and 16 deletions
|
@ -142,7 +142,13 @@ def run(["delete", "--force", group]) do
|
||||||
|
|
||||||
group = maybe_atomize(group)
|
group = maybe_atomize(group)
|
||||||
|
|
||||||
|
with true <- group_exists?(group) do
|
||||||
|
shell_info("The following settings will be removed from ConfigDB:\n")
|
||||||
|
dump_group(group)
|
||||||
delete_group(group)
|
delete_group(group)
|
||||||
|
else
|
||||||
|
_ -> shell_error("No settings in ConfigDB for #{inspect(group)}. Aborting.")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["delete", group, key]) do
|
def run(["delete", group, key]) do
|
||||||
|
@ -163,11 +169,18 @@ def run(["delete", group]) do
|
||||||
|
|
||||||
group = maybe_atomize(group)
|
group = maybe_atomize(group)
|
||||||
|
|
||||||
|
with true <- group_exists?(group) do
|
||||||
|
shell_info("The following settings will be removed from ConfigDB:\n")
|
||||||
|
dump_group(group)
|
||||||
|
|
||||||
if shell_prompt("Are you sure you want to continue?", "n") in ~w(Yn Y y) do
|
if shell_prompt("Are you sure you want to continue?", "n") in ~w(Yn Y y) do
|
||||||
delete_group(group)
|
delete_group(group)
|
||||||
else
|
else
|
||||||
shell_error("No changes made.")
|
shell_error("No changes made.")
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
_ -> shell_error("No settings in ConfigDB for #{inspect(group)}. Aborting.")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec migrate_to_db(Path.t() | nil) :: any()
|
@spec migrate_to_db(Path.t() | nil) :: any()
|
||||||
|
@ -329,18 +342,11 @@ defp delete_key(group, key) do
|
||||||
|
|
||||||
defp delete_group(group) do
|
defp delete_group(group) do
|
||||||
check_configdb(fn ->
|
check_configdb(fn ->
|
||||||
with true <- group_exists?(group) do
|
|
||||||
shell_info("The following settings will be removed from ConfigDB:\n")
|
|
||||||
dump_group(group)
|
|
||||||
|
|
||||||
group
|
group
|
||||||
|> Pleroma.ConfigDB.get_all_by_group()
|
|> Pleroma.ConfigDB.get_all_by_group()
|
||||||
|> Enum.each(fn config ->
|
|> Enum.each(fn config ->
|
||||||
Pleroma.ConfigDB.delete(%{group: config.group, key: config.key})
|
Pleroma.ConfigDB.delete(%{group: config.group, key: config.key})
|
||||||
end)
|
end)
|
||||||
else
|
|
||||||
_ -> shell_error("No settings in ConfigDB for #{inspect(group)}. Aborting.")
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue