Skip to content

Commit 91d47c3

Browse files
committed
Merge remote-tracking branch 'origin/feature/modernize-python-django-support' into feature/modernize-python-django-support
2 parents 585abe8 + a6be073 commit 91d47c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+10375
-10229
lines changed

.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"presets": [
3-
["env", {
3+
["@babel/preset-env", {
44
"modules": false
55
}]
66
],
7-
"plugins": ["transform-runtime", "syntax-dynamic-import"]
7+
"plugins": ["@babel/plugin-syntax-dynamic-import"]
88
}

.eslintrc.js

Lines changed: 0 additions & 225 deletions
This file was deleted.

.github/workflows/frontend.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Frontend E2E Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'release/**'
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
e2e:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '24'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Install Playwright Chromium browser
31+
run: npx playwright install --with-deps chromium
32+
33+
- name: Run linter
34+
run: npx gulp lint
35+
36+
- name: Run E2E tests with coverage
37+
run: |
38+
npm run e2e
39+
npm run e2e:coverage:report

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ htmlcov/
1616
!djangocms_versioning/static/djangocms_versioning/js/dist
1717
docs/_build/
1818
node_modules
19+
coverage-e2e/
20+
.nyc_output/
21+
playwright-report/
22+
test-results/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
24

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ Testing
5353
To run all the tests the only thing you need to do is run::
5454

5555
pip install -r tests/requirements.txt
56-
python setup.py test
56+
python test_settings.py
5757

5858

5959
Documentation
6060
=============
6161

62-
We maintain documentation under the ``docs`` folder using rst format.
62+
The documentation is online on `readthedocs <https://djangocms-versioning.readthedocs.io>`_.
63+
64+
We maintain documentation in this repository under the ``docs`` folder using rst format.
6365

6466
To generate the HTML documentation you will need to install ``sphinx`` (``pip install sphinx``) and ``graphviz`` (as per your operating system's package management system). You can then generate the docs using the following command:
6567

babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', {
4+
targets: {
5+
browsers: ['last 2 versions', '> 1%']
6+
}
7+
}]
8+
],
9+
plugins: [
10+
'@babel/plugin-syntax-dynamic-import'
11+
]
12+
};

djangocms_versioning/admin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import json
24
import warnings
35
from collections import OrderedDict
@@ -1365,7 +1367,7 @@ def unlock_view(self, request, object_id):
13651367
raise Http404
13661368

13671369
# Check that the user has unlock permission
1368-
if not request.user.has_perm("djangocms_versioning.delete_versionlock"):
1370+
if not request.user.has_perm(f"{self.model._meta.app_label}.delete_versionlock"):
13691371
return HttpResponseForbidden(force_str(_("You do not have permission to remove the version lock")))
13701372

13711373
# Unlock the version

djangocms_versioning/cms_toolbars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _add_unlock_button(self):
136136
f"admin:{proxy_model._meta.app_label}_{proxy_model.__name__.lower()}_unlock",
137137
args=(version.pk,),
138138
)
139-
can_unlock = self.request.user.has_perm("djangocms_versioning.delete_versionlock")
139+
can_unlock = self.request.user.has_perm(f"{version._meta.app_label}.delete_versionlock")
140140
if can_unlock:
141141
extra_classes = [
142142
"cms-btn-action",

djangocms_versioning/conditions.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ def inner(version, user):
7979

8080
def user_can_unlock(message: str) -> callable:
8181
def inner(version, user):
82-
if not user.has_perm("djangocms_versioning.delete_versionlock"):
82+
if conf.LOCK_VERSIONS:
83+
if user.has_perm(f"{version._meta.app_label}.delete_versionlock"):
84+
return
85+
draft_version = get_latest_draft_version(version)
86+
if draft_version and (draft_version.locked_by == user or draft_version.locked_by is None):
87+
return
8388
raise ConditionFailed(message)
8489
return inner
8590

0 commit comments

Comments
 (0)