Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,30 @@ jobs:
- name: "Run checks"
run: hatch run lint

test:
runs-on: ubuntu-latest
needs:
- config
steps:
- name: Checkout codebase
uses: actions/checkout@v4

- name: Install hatch
run: pipx install hatch

- name: Generate Constraints file
run: pipx run mxdev -c mx.ini

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: "Install Environment"
run: hatch env create

- name: "Test Codebase"
run: hatch run test
# test:
# runs-on: ubuntu-latest
# needs:
# - config
# steps:
# - name: Checkout codebase
# uses: actions/checkout@v4

# - name: Install hatch
# run: pipx install hatch

# - name: Generate Constraints file
# run: pipx run mxdev -c mx.ini

# - uses: actions/setup-python@v5
# with:
# python-version: ${{ env.PYTHON_VERSION }}
# cache: 'pip'

# - name: "Install Environment"
# run: hatch env create

# - name: "Test Codebase"
# run: hatch run test

release:
runs-on: ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,9 @@ dependencies = [
"plone.restapi[test]",
"Products.MailHost",
"Products.PrintingMailHost",
"pytest-cov==5.0.0",
"pytest-plone>=0.5.0",
"pytest",
"ruff",
"towncrier==23.11.0",
"zpretty",
]

Expand Down
2 changes: 1 addition & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-c https://dist.plone.org/release/6.0.11/constraints.txt
-c https://dist.plone.org/release/6.1.2/constraints.txt
9 changes: 4 additions & 5 deletions backend/src/collective/volto/formsupport/processors/email.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from bs4 import BeautifulSoup
from collective.volto.formsupport import _
from collective.volto.formsupport.interfaces import FormSubmissionContext
from collective.volto.formsupport.interfaces import IFormSubmissionProcessor
Expand Down Expand Up @@ -108,7 +107,7 @@ def __call__(self):
msg.add_alternative(message, subtype="html", cte=CTE)
self.attachments = {}

if "fixed_attachment" in self.block and self.block["fixed_attachment"]:
if self.block.get("fixed_attachment"):
self.attachments["fixed_attachment"] = self.block[
"fixed_attachment"
]
Expand Down Expand Up @@ -163,7 +162,7 @@ def get_confirmation_recipients(self) -> str:
confirmation_recipients = self.substitute_variables(confirmation_recipients)
return confirmation_recipients

def prepare_message(self, admin=False):
def prepare_message(self, admin=False): # noqa: C901
templates = api.portal.get_registry_record("schemaform.mail_templates")
template_name = self.block.get("email_template", "default")
admin_info = self.block.get("admin_info", "")
Expand All @@ -184,7 +183,7 @@ def prepare_message(self, admin=False):

def format_property(factory, value):
if factory == "label_boolean_field" or factory == "termsAccepted":
if value == True:
if value == True: # noqa: E712
return self.context.translate(
_("Yes"),
context=self.request,
Expand Down Expand Up @@ -218,7 +217,7 @@ def format_property(factory, value):
continue

form_fields += (
f"<tr><th align=\"left\">{record['label']}</th><td>{value}</td></tr>"
f'<tr><th align="left">{record["label"]}</th><td>{value}</td></tr>'
)
form_fields += "\n</table>\n"
template_vars["form_fields"] = form_fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def form_block(self):
def show_component(self):
if not api.user.has_permission("Modify portal content", obj=self.context):
return False
return self.form_block and True or False
return (self.form_block and True) or False

def expand_records(self, record):
fields_labels = record.attrs.get("fields_labels", {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def validate_attachments(self):
attachments_len += (len(data) * 3) / 4 - data.count("=", -2)
if attachments_len > float(attachments_limit) * pow(1024, 2):
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(attachments_len, 1024)))
i = int(math.floor(math.log(attachments_len, 1024))) # noqa: RUF046
p = math.pow(1024, i)
s = round(attachments_len / p, 2)
uploaded_str = f"{s} {size_name[i]}"
Expand Down
18 changes: 6 additions & 12 deletions backend/tests/functional/test_captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@ def test_recaptcha_no_settings(self, submit_form, set_captcha_settings):
)
transaction.commit()
assert response.status_code == 500
assert (
response.json()["message"]
== (
"No recaptcha private key configured. Go to path/to/site/@@recaptcha-settings " # noqa: E501
"to configure."
)
assert response.json()["message"] == (
"No recaptcha private key configured. Go to path/to/site/@@recaptcha-settings " # noqa: E501
"to configure."
)

def test_recaptcha_no_captcha(self, submit_form, set_captcha_settings):
Expand Down Expand Up @@ -199,12 +196,9 @@ def test_hcaptcha_no_settings(self, submit_form, set_captcha_settings):
)
transaction.commit()
assert response.status_code == 500
assert (
response.json()["message"]
== (
"No hcaptcha private key configured. Go to path/to/site/@@hcaptcha-settings " # noqa: E501
"to configure."
)
assert response.json()["message"] == (
"No hcaptcha private key configured. Go to path/to/site/@@hcaptcha-settings " # noqa: E501
"to configure."
)

def test_hcaptcha_no_captcha(self, submit_form, set_captcha_settings):
Expand Down
1 change: 0 additions & 1 deletion backend/tests/functional/test_email_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import base64
import email
import pytest
import re
import transaction


Expand Down
2 changes: 1 addition & 1 deletion backend/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.11
6.1.2
29 changes: 24 additions & 5 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
const fs = require('fs');
const projectRootPath = __dirname;
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const { AddonRegistry } = require('@plone/registry/addon-registry');

let coreLocation;
if (fs.existsSync(`${projectRootPath}/core`))
coreLocation = `${projectRootPath}/core`;
else if (fs.existsSync(`${projectRootPath}/../../core`))
coreLocation = `${projectRootPath}/../../core`;

const registry = new AddonConfigurationRegistry(
`${coreLocation}/packages/volto`,
);
const { registry } = AddonRegistry.init(`${coreLocation}/packages/volto`);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(registry.packages).map((o) => [
Expand All @@ -22,6 +20,27 @@ module.exports = {
extends: `${coreLocation}/packages/volto/.eslintrc`,
rules: {
'import/no-unresolved': 1,
'import/named': 'error',
'react/jsx-filename-extension': 'error',
'no-restricted-imports': [
'error',
{
name: '@plone/volto/components',
message:
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
},
{
name: '@plone/volto/helpers',
message:
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
},
{
name: '@plone/volto/actions',
message:
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
},
],
'react/jsx-key': [2, { checkFragmentShorthand: true }],
},
settings: {
'import/resolver': {
Expand All @@ -32,7 +51,7 @@ module.exports = {
['@plone/registry', `${coreLocation}/packages/registry/src`],
[
'volto-form-block',
'./packages/volto-form-block/src',
`${projectRootPath}/packages/volto-form-block/src`,
],
...addonAliases,
],
Expand Down
2 changes: 1 addition & 1 deletion frontend/mrs.developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"package": "@plone/volto",
"url": "[email protected]:plone/volto.git",
"https": "https://github.com/plone/volto.git",
"branch": "volto-form-block-fixes"
"branch": "18.23.0"
}
}
20 changes: 0 additions & 20 deletions frontend/packages/volto-form-block/locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,6 @@ msgstr "E-Mail senden"
msgid "fixed_attachment"
msgstr "Fixer Anhang"

#. Default: "Insert here the OTP code received at {email}"
#: components/Widgets/OTPWidget
msgid "form_insert_otp"
msgstr "Geben Sie hier den OTP-Code ein, den Sie über {email} erhalten haben."

#. Default: "You can send a new OTP code in"
#: components/Widgets/OTPWidget
msgid "form_otp_countdown"
msgstr "Sie können einen neuen OTP-Code senden in"

#. Default: "OTP code was sent to {email}. Check your email and insert the received OTP code into the field above."
#: components/Widgets/OTPWidget
msgid "form_otp_send"
msgstr "OTP-Code wurde an {email} gesendet. Prüfen Sie Ihre E-Mail und geben Sie den erhaltenen OTP-Code in das obige Feld ein."

#. Default: "Required"
#: components/Wrappers/CheckboxGroupWrapper
#: components/Wrappers/CheckboxWrapper
Expand All @@ -271,11 +256,6 @@ msgstr "OTP-Code wurde an {email} gesendet. Prüfen Sie Ihre E-Mail und geben Si
msgid "form_required"
msgstr "Pflichtfeld"

#. Default: "Send OTP code to {email}"
#: components/Widgets/OTPWidget
msgid "form_send_otp_to"
msgstr "Sende OTP-Code an {email}"

#. Default: "Forward user to"
#: components/schema
msgid "forward_user_to"
Expand Down
20 changes: 0 additions & 20 deletions frontend/packages/volto-form-block/locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,6 @@ msgstr ""
msgid "fixed_attachment"
msgstr ""

#. Default: "Insert here the OTP code received at {email}"
#: components/Widgets/OTPWidget
msgid "form_insert_otp"
msgstr ""

#. Default: "You can send a new OTP code in"
#: components/Widgets/OTPWidget
msgid "form_otp_countdown"
msgstr ""

#. Default: "OTP code was sent to {email}. Check your email and insert the received OTP code into the field above."
#: components/Widgets/OTPWidget
msgid "form_otp_send"
msgstr ""

#. Default: "Required"
#: components/Wrappers/CheckboxGroupWrapper
#: components/Wrappers/CheckboxWrapper
Expand All @@ -271,11 +256,6 @@ msgstr ""
msgid "form_required"
msgstr ""

#. Default: "Send OTP code to {email}"
#: components/Widgets/OTPWidget
msgid "form_send_otp_to"
msgstr ""

#. Default: "Forward user to"
#: components/schema
msgid "forward_user_to"
Expand Down
20 changes: 0 additions & 20 deletions frontend/packages/volto-form-block/locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,21 +246,6 @@ msgstr ""
msgid "fixed_attachment"
msgstr ""

#. Default: "Insert here the OTP code received at {email}"
#: components/Widgets/OTPWidget
msgid "form_insert_otp"
msgstr "Inserte el código OTP recibido en {email}"

#. Default: "You can send a new OTP code in"
#: components/Widgets/OTPWidget
msgid "form_otp_countdown"
msgstr "Puedes enviar un nuevo código OTP en"

#. Default: "OTP code was sent to {email}. Check your email and insert the received OTP code into the field above."
#: components/Widgets/OTPWidget
msgid "form_otp_send"
msgstr "El código OTP se ha enviado a {email}. Revise su correo electrónico e introduzca el código recibido."

#. Default: "Required"
#: components/Wrappers/CheckboxGroupWrapper
#: components/Wrappers/CheckboxWrapper
Expand All @@ -277,11 +262,6 @@ msgstr "El código OTP se ha enviado a {email}. Revise su correo electrónico e
msgid "form_required"
msgstr ""

#. Default: "Send OTP code to {email}"
#: components/Widgets/OTPWidget
msgid "form_send_otp_to"
msgstr "Envíe el código OTP a {email}"

#. Default: "Forward user to"
#: components/schema
msgid "forward_user_to"
Expand Down
20 changes: 0 additions & 20 deletions frontend/packages/volto-form-block/locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,6 @@ msgstr ""
msgid "fixed_attachment"
msgstr ""

#. Default: "Insert here the OTP code received at {email}"
#: components/Widgets/OTPWidget
msgid "form_insert_otp"
msgstr "Sartu {email} helbidean jasoko den OPT kodea"

#. Default: "You can send a new OTP code in"
#: components/Widgets/OTPWidget
msgid "form_otp_countdown"
msgstr "OPT kode berria bidali dezakezu"

#. Default: "OTP code was sent to {email}. Check your email and insert the received OTP code into the field above."
#: components/Widgets/OTPWidget
msgid "form_otp_send"
msgstr "OPT kodea {email} helbidera bidali da. Egiaztatu zure posta elektronikoa eta sartu jasotako OTP kodea goiko eremuan"

#. Default: "Required"
#: components/Wrappers/CheckboxGroupWrapper
#: components/Wrappers/CheckboxWrapper
Expand All @@ -273,11 +258,6 @@ msgstr "OPT kodea {email} helbidera bidali da. Egiaztatu zure posta elektronikoa
msgid "form_required"
msgstr ""

#. Default: "Send OTP code to {email}"
#: components/Widgets/OTPWidget
msgid "form_send_otp_to"
msgstr "Bidali OPT kodea {email} helbidera"

#. Default: "Forward user to"
#: components/schema
msgid "forward_user_to"
Expand Down
Loading