Only warn about bad clear_config usage if warned usage is met
This commit is contained in:
parent
0393f0f92d
commit
3790e6786c
1 changed files with 2 additions and 1 deletions
|
|
@ -73,7 +73,8 @@ defmodule Pleroma.Tests.Helpers do
|
||||||
defmacro clear_config(config_path, temp_setting) do
|
defmacro clear_config(config_path, temp_setting) do
|
||||||
# NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!)
|
# NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!)
|
||||||
# Displaying a warning to prevent unintentional clearing of all but one keys in section
|
# Displaying a warning to prevent unintentional clearing of all but one keys in section
|
||||||
if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do
|
if is_list(config_path) and length(config_path) == 1 and Keyword.keyword?(temp_setting) and
|
||||||
|
Keyword.keys(temp_setting) == [:key] do
|
||||||
Logger.warning(
|
Logger.warning(
|
||||||
"Please change `clear_config([section], key: value)` to `clear_config([section, key], value)`"
|
"Please change `clear_config([section], key: value)` to `clear_config([section, key], value)`"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue