Merge branch 'feature/update-welcome-setting-in-description' into 'develop'
Update :welcome settings in description.exs Closes #2024 See merge request pleroma/pleroma!2843
This commit is contained in:
commit
dfc56de167
|
@ -194,7 +194,7 @@
|
||||||
type: [:string, {:list, :string}, {:list, :tuple}],
|
type: [:string, {:list, :string}, {:list, :tuple}],
|
||||||
description:
|
description:
|
||||||
"List of actions for the mogrify command. It's possible to add self-written settings as string. " <>
|
"List of actions for the mogrify command. It's possible to add self-written settings as string. " <>
|
||||||
"For example `[\"auto-orient\", \"strip\", {\"resize\", \"3840x1080>\"}]` string will be parsed into list of the settings.",
|
"For example `auto-orient, strip, {\"resize\", \"3840x1080>\"}` value will be parsed into valid list of the settings.",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
"strip",
|
"strip",
|
||||||
"auto-orient",
|
"auto-orient",
|
||||||
|
@ -951,7 +951,7 @@
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :instance_thumbnail,
|
key: :instance_thumbnail,
|
||||||
type: :string,
|
type: {:string, :image},
|
||||||
description:
|
description:
|
||||||
"The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.",
|
"The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.",
|
||||||
suggestions: ["/instance/thumbnail.jpeg"]
|
suggestions: ["/instance/thumbnail.jpeg"]
|
||||||
|
@ -964,25 +964,25 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :welcome,
|
group: :pleroma,
|
||||||
|
key: :welcome,
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Welcome messages settings",
|
description: "Welcome messages settings",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
group: :direct_message,
|
key: :direct_message,
|
||||||
type: :group,
|
type: :keyword,
|
||||||
descpiption: "Direct message settings",
|
descpiption: "Direct message settings",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :enabled,
|
key: :enabled,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Enables sends direct message for new user after registration"
|
description: "Enables sending a direct message to newly registered users"
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :message,
|
key: :message,
|
||||||
type: :string,
|
type: :string,
|
||||||
description:
|
description: "A message that will be sent to newly registered users",
|
||||||
"A message that will be sent to a newly registered users as a direct message",
|
|
||||||
suggestions: [
|
suggestions: [
|
||||||
"Hi, @username! Welcome on board!"
|
"Hi, @username! Welcome on board!"
|
||||||
]
|
]
|
||||||
|
@ -990,7 +990,7 @@
|
||||||
%{
|
%{
|
||||||
key: :sender_nickname,
|
key: :sender_nickname,
|
||||||
type: :string,
|
type: :string,
|
||||||
description: "The nickname of the local user that sends the welcome message",
|
description: "The nickname of the local user that sends a welcome message",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
"lain"
|
"lain"
|
||||||
]
|
]
|
||||||
|
@ -998,20 +998,20 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :chat_message,
|
key: :chat_message,
|
||||||
type: :group,
|
type: :keyword,
|
||||||
descpiption: "Chat message settings",
|
descpiption: "Chat message settings",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :enabled,
|
key: :enabled,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Enables sends chat message for new user after registration"
|
description: "Enables sending a chat message to newly registered users"
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :message,
|
key: :message,
|
||||||
type: :string,
|
type: :string,
|
||||||
description:
|
description:
|
||||||
"A message that will be sent to a newly registered users as a chat message",
|
"A message that will be sent to newly registered users as a chat message",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
"Hello, welcome on board!"
|
"Hello, welcome on board!"
|
||||||
]
|
]
|
||||||
|
@ -1019,7 +1019,7 @@
|
||||||
%{
|
%{
|
||||||
key: :sender_nickname,
|
key: :sender_nickname,
|
||||||
type: :string,
|
type: :string,
|
||||||
description: "The nickname of the local user that sends the welcome message",
|
description: "The nickname of the local user that sends a welcome chat message",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
"lain"
|
"lain"
|
||||||
]
|
]
|
||||||
|
@ -1027,20 +1027,20 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :email,
|
key: :email,
|
||||||
type: :group,
|
type: :keyword,
|
||||||
descpiption: "Email message settings",
|
descpiption: "Email message settings",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :enabled,
|
key: :enabled,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Enables sends direct message for new user after registration"
|
description: "Enables sending an email to newly registered users"
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :sender,
|
key: :sender,
|
||||||
type: [:string, :tuple],
|
type: [:string, :tuple],
|
||||||
description:
|
description:
|
||||||
"The email address or tuple with `{nickname, email}` that will use as sender to the welcome email.",
|
"Email address and/or nickname that will be used to send the welcome email.",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
{"Pleroma App", "welcome@pleroma.app"}
|
{"Pleroma App", "welcome@pleroma.app"}
|
||||||
]
|
]
|
||||||
|
@ -1049,21 +1049,21 @@
|
||||||
key: :subject,
|
key: :subject,
|
||||||
type: :string,
|
type: :string,
|
||||||
description:
|
description:
|
||||||
"The subject of welcome email. Can be use EEX template with `user` and `instance_name` variables.",
|
"Subject of the welcome email. EEX template with user and instance_name variables can be used.",
|
||||||
suggestions: ["Welcome to <%= instance_name%>"]
|
suggestions: ["Welcome to <%= instance_name%>"]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :html,
|
key: :html,
|
||||||
type: :string,
|
type: :string,
|
||||||
description:
|
description:
|
||||||
"The html content of welcome email. Can be use EEX template with `user` and `instance_name` variables.",
|
"HTML content of the welcome email. EEX template with user and instance_name variables can be used.",
|
||||||
suggestions: ["<h1>Hello <%= user.name%>. Welcome to <%= instance_name%></h1>"]
|
suggestions: ["<h1>Hello <%= user.name%>. Welcome to <%= instance_name%></h1>"]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :text,
|
key: :text,
|
||||||
type: :string,
|
type: :string,
|
||||||
description:
|
description:
|
||||||
"The text content of welcome email. Can be use EEX template with `user` and `instance_name` variables.",
|
"Text content of the welcome email. EEX template with user and instance_name variables can be used.",
|
||||||
suggestions: ["Hello <%= user.name%>. \n Welcome to <%= instance_name%>\n"]
|
suggestions: ["Hello <%= user.name%>. \n Welcome to <%= instance_name%>\n"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1236,7 +1236,7 @@
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :background,
|
key: :background,
|
||||||
type: :string,
|
type: {:string, :image},
|
||||||
description:
|
description:
|
||||||
"URL of the background, unless viewing a user profile with a background that is set",
|
"URL of the background, unless viewing a user profile with a background that is set",
|
||||||
suggestions: ["/images/city.jpg"]
|
suggestions: ["/images/city.jpg"]
|
||||||
|
@ -1293,7 +1293,7 @@
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :logo,
|
key: :logo,
|
||||||
type: :string,
|
type: {:string, :image},
|
||||||
description: "URL of the logo, defaults to Pleroma's logo",
|
description: "URL of the logo, defaults to Pleroma's logo",
|
||||||
suggestions: ["/static/logo.png"]
|
suggestions: ["/static/logo.png"]
|
||||||
},
|
},
|
||||||
|
@ -1325,7 +1325,7 @@
|
||||||
%{
|
%{
|
||||||
key: :nsfwCensorImage,
|
key: :nsfwCensorImage,
|
||||||
label: "NSFW Censor Image",
|
label: "NSFW Censor Image",
|
||||||
type: :string,
|
type: {:string, :image},
|
||||||
description:
|
description:
|
||||||
"URL of the image to use for hiding NSFW media attachments in the timeline",
|
"URL of the image to use for hiding NSFW media attachments in the timeline",
|
||||||
suggestions: ["/static/img/nsfw.74818f9.png"]
|
suggestions: ["/static/img/nsfw.74818f9.png"]
|
||||||
|
@ -1451,7 +1451,7 @@
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :default_user_avatar,
|
key: :default_user_avatar,
|
||||||
type: :string,
|
type: {:string, :image},
|
||||||
description: "URL of the default user avatar",
|
description: "URL of the default user avatar",
|
||||||
suggestions: ["/images/avi.png"]
|
suggestions: ["/images/avi.png"]
|
||||||
}
|
}
|
||||||
|
@ -2642,7 +2642,7 @@
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :logo,
|
key: :logo,
|
||||||
type: :string,
|
type: {:string, :image},
|
||||||
description: "A path to a custom logo. Set it to `nil` to use the default Pleroma logo.",
|
description: "A path to a custom logo. Set it to `nil` to use the default Pleroma logo.",
|
||||||
suggestions: ["some/path/logo.png"]
|
suggestions: ["some/path/logo.png"]
|
||||||
},
|
},
|
||||||
|
@ -3299,13 +3299,13 @@
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :connections_pool,
|
key: :connections_pool,
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Advanced settings for `gun` connections pool",
|
description: "Advanced settings for `Gun` connections pool",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :connection_acquisition_wait,
|
key: :connection_acquisition_wait,
|
||||||
type: :integer,
|
type: :integer,
|
||||||
description:
|
description:
|
||||||
"Timeout to acquire a connection from pool.The total max time is this value multiplied by the number of retries. Default: 250ms.",
|
"Timeout to acquire a connection from pool. The total max time is this value multiplied by the number of retries. Default: 250ms.",
|
||||||
suggestions: [250]
|
suggestions: [250]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
|
@ -3340,7 +3340,7 @@
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :pools,
|
key: :pools,
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Advanced settings for `gun` workers pools",
|
description: "Advanced settings for `Gun` workers pools",
|
||||||
children:
|
children:
|
||||||
Enum.map([:federation, :media, :upload, :default], fn pool_name ->
|
Enum.map([:federation, :media, :upload, :default], fn pool_name ->
|
||||||
%{
|
%{
|
||||||
|
@ -3369,7 +3369,7 @@
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :hackney_pools,
|
key: :hackney_pools,
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Advanced settings for `hackney` connections pools",
|
description: "Advanced settings for `Hackney` connections pools",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :federation,
|
key: :federation,
|
||||||
|
@ -3433,6 +3433,7 @@
|
||||||
%{
|
%{
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :restrict_unauthenticated,
|
key: :restrict_unauthenticated,
|
||||||
|
label: "Restrict Unauthenticated",
|
||||||
type: :group,
|
type: :group,
|
||||||
description:
|
description:
|
||||||
"Disallow viewing timelines, user profiles and statuses for unauthenticated users.",
|
"Disallow viewing timelines, user profiles and statuses for unauthenticated users.",
|
||||||
|
@ -3555,13 +3556,17 @@
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: "name",
|
key: "name",
|
||||||
|
label: "Name",
|
||||||
type: :string,
|
type: :string,
|
||||||
description: "Name of the installed primary frontend"
|
description:
|
||||||
|
"Name of the installed primary frontend. Valid config must include both `Name` and `Reference` values."
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: "ref",
|
key: "ref",
|
||||||
|
label: "Reference",
|
||||||
type: :string,
|
type: :string,
|
||||||
description: "reference of the installed primary frontend to be used"
|
description:
|
||||||
|
"Reference of the installed primary frontend to be used. Valid config must include both `Name` and `Reference` values."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1342,6 +1342,75 @@ test "args for Pleroma.Upload.Filter.Mogrify with custom tuples", %{conn: conn}
|
||||||
args: ["auto-orient", "strip", {"implode", "1"}, {"resize", "3840x1080>"}]
|
args: ["auto-orient", "strip", {"implode", "1"}, {"resize", "3840x1080>"}]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "enables the welcome messages", %{conn: conn} do
|
||||||
|
clear_config([:welcome])
|
||||||
|
|
||||||
|
params = %{
|
||||||
|
"group" => ":pleroma",
|
||||||
|
"key" => ":welcome",
|
||||||
|
"value" => [
|
||||||
|
%{
|
||||||
|
"tuple" => [
|
||||||
|
":direct_message",
|
||||||
|
[
|
||||||
|
%{"tuple" => [":enabled", true]},
|
||||||
|
%{"tuple" => [":message", "Welcome to Pleroma!"]},
|
||||||
|
%{"tuple" => [":sender_nickname", "pleroma"]}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
"tuple" => [
|
||||||
|
":chat_message",
|
||||||
|
[
|
||||||
|
%{"tuple" => [":enabled", true]},
|
||||||
|
%{"tuple" => [":message", "Welcome to Pleroma!"]},
|
||||||
|
%{"tuple" => [":sender_nickname", "pleroma"]}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
"tuple" => [
|
||||||
|
":email",
|
||||||
|
[
|
||||||
|
%{"tuple" => [":enabled", true]},
|
||||||
|
%{"tuple" => [":sender", %{"tuple" => ["pleroma@dev.dev", "Pleroma"]}]},
|
||||||
|
%{"tuple" => [":subject", "Welcome to <%= instance_name %>!"]},
|
||||||
|
%{"tuple" => [":html", "Welcome to <%= instance_name %>!"]},
|
||||||
|
%{"tuple" => [":text", "Welcome to <%= instance_name %>!"]}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
refute Pleroma.User.WelcomeEmail.enabled?()
|
||||||
|
refute Pleroma.User.WelcomeMessage.enabled?()
|
||||||
|
refute Pleroma.User.WelcomeChatMessage.enabled?()
|
||||||
|
|
||||||
|
res =
|
||||||
|
assert conn
|
||||||
|
|> put_req_header("content-type", "application/json")
|
||||||
|
|> post("/api/pleroma/admin/config", %{"configs" => [params]})
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert Pleroma.User.WelcomeEmail.enabled?()
|
||||||
|
assert Pleroma.User.WelcomeMessage.enabled?()
|
||||||
|
assert Pleroma.User.WelcomeChatMessage.enabled?()
|
||||||
|
|
||||||
|
assert res == %{
|
||||||
|
"configs" => [
|
||||||
|
%{
|
||||||
|
"db" => [":direct_message", ":chat_message", ":email"],
|
||||||
|
"group" => ":pleroma",
|
||||||
|
"key" => ":welcome",
|
||||||
|
"value" => params["value"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"need_reboot" => false
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/config/descriptions" do
|
describe "GET /api/pleroma/admin/config/descriptions" do
|
||||||
|
|
Loading…
Reference in New Issue