Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add support for multiline (#6841)

Maciej Korycinskic452c9677a5d
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 34169c65bf..73fb9570c7 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -1258,6 +1258,7 @@ input ConfigurationItemInput {
enum ConfigurationTypeFieldEnum {
STRING
+ MULTILINE
BOOLEAN
SECRET
PASSWORD
diff --git a/saleor/plugins/admin_email/plugin.py b/saleor/plugins/admin_email/plugin.py
index 97c8fdde58..519fd65662 100644
--- a/saleor/plugins/admin_email/plugin.py
+++ b/saleor/plugins/admin_email/plugin.py
@@ -103,7 +103,7 @@ class AdminEmailPlugin(BasePlugin):
"label": "Staff order confirmation subject",
},
constants.STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Staff order confirmation template",
},
@@ -113,7 +113,7 @@ class AdminEmailPlugin(BasePlugin):
"label": "Set staff password subject",
},
constants.SET_STAFF_PASSWORD_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Set staff password email template",
},
@@ -123,7 +123,7 @@ class AdminEmailPlugin(BasePlugin):
"label": "CSV product export success subject",
},
constants.CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "CSV product export success template",
},
@@ -133,7 +133,7 @@ class AdminEmailPlugin(BasePlugin):
"label": "CSV export failed template",
},
constants.CSV_EXPORT_FAILED_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "CSV export failed template",
},
diff --git a/saleor/plugins/base_plugin.py b/saleor/plugins/base_plugin.py
index 271bddebd9..6da47cd005 100644
--- a/saleor/plugins/base_plugin.py
+++ b/saleor/plugins/base_plugin.py
@@ -43,12 +43,14 @@ PluginConfigurationType = List[dict]
class ConfigurationTypeField:
STRING = "String"
+ MULTILINE = "Multiline"
BOOLEAN = "Boolean"
SECRET = "Secret"
SECRET_MULTILINE = "SecretMultiline"
PASSWORD = "Password"
CHOICES = [
(STRING, "Field is a String"),
+ (MULTILINE, "Field is a Multiline"),
(BOOLEAN, "Field is a Boolean"),
(SECRET, "Field is a Secret"),
(PASSWORD, "Field is a Password"),
diff --git a/saleor/plugins/user_email/plugin.py b/saleor/plugins/user_email/plugin.py
index 155216708f..9988b6785d 100644
--- a/saleor/plugins/user_email/plugin.py
+++ b/saleor/plugins/user_email/plugin.py
@@ -223,7 +223,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Account confirmation - subject",
},
constants.ACCOUNT_CONFIRMATION_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Account confirmation - template",
},
@@ -233,7 +233,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Set customer password - subject",
},
constants.ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Set customer password - template",
},
@@ -243,7 +243,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Account delete - subject",
},
constants.ACCOUNT_DELETE_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Account delete - template",
},
@@ -253,7 +253,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Account change email confirm - subject",
},
constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Account change email confirm - template",
},
@@ -263,7 +263,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Account change email request - subject",
},
constants.ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Account change email request - template",
},
@@ -273,7 +273,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Account password reset - subject",
},
constants.ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Account password reset - template",
},
@@ -283,7 +283,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Invoice ready - subject",
},
constants.INVOICE_READY_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Invoice ready - template",
},
@@ -293,7 +293,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Order confirmation - subject",
},
constants.ORDER_CONFIRMATION_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Order confirmation - template",
},
@@ -303,7 +303,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Order confirmed - subject",
},
constants.ORDER_CONFIRMED_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Order confirmed - template",
},
@@ -313,7 +313,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Order fulfillment confirmation - subject",
},
constants.ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Order fulfillment confirmation - template",
},
@@ -323,7 +323,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Order fulfillment update - subject",
},
constants.ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Order fulfillment update - template",
},
@@ -333,7 +333,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Payment confirmation - subject",
},
constants.ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Payment confirmation - template",
},
@@ -343,7 +343,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Order canceled - subject",
},
constants.ORDER_CANCELED_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Order canceled - template",
},
@@ -353,7 +353,7 @@ class UserEmailPlugin(BasePlugin):
"label": "Order refund - subject",
},
constants.ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD: {
- "type": ConfigurationTypeField.STRING,
+ "type": ConfigurationTypeField.MULTILINE,
"help_text": DEFAULT_TEMPLATE_HELP_TEXT,
"label": "Order refund - template",
},