From f90c5b25810f209cfdc14f83964338793c8d0c7c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 23 Jan 2024 11:54:11 +0000
Subject: [PATCH 1/7] build(deps): bump actions/cache from 3.3.3 to 4.0.0
(#375)
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.3 to 4.0.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.3.3...v4.0.0)
---
updated-dependencies:
- dependency-name: actions/cache
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/docs.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 7c1ec0a7..8fa38e54 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -19,7 +19,7 @@ jobs:
python-version: '3.11'
cache: 'pip'
- name: Cache dependencies
- uses: actions/cache@v3.3.3
+ uses: actions/cache@v4.0.0
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
@@ -44,7 +44,7 @@ jobs:
python-version: '3.11'
cache: 'pip'
- name: Cache dependencies
- uses: actions/cache@v3.3.3
+ uses: actions/cache@v4.0.0
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
From cf7c3de562355a9ca07b4698cce914086c045caa Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 6 Feb 2024 00:44:55 +0000
Subject: [PATCH 2/7] build(deps): bump codecov/codecov-action from 3 to 4
(#377)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)
---
updated-dependencies:
- dependency-name: codecov/codecov-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/test.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 8c69a445..ff49a8aa 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -37,7 +37,7 @@ jobs:
run: coverage run setup.py test
- name: Upload Coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
postgres:
runs-on: ubuntu-latest
@@ -83,7 +83,7 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@127.0.0.1/postgres
- name: Upload Coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
mysql:
runs-on: ubuntu-latest
@@ -127,7 +127,7 @@ jobs:
DATABASE_URL: mysql://root@127.0.0.1/djangocms_test
- name: Upload Coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
cms-develop-sqlite:
runs-on: ${{ matrix.os }}
@@ -161,7 +161,7 @@ jobs:
run: coverage run setup.py test
- name: Upload Coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
sqlite-django-main:
runs-on: ubuntu-latest
@@ -197,4 +197,4 @@ jobs:
run: coverage run setup.py test
- name: Upload Coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
From 8f5c0aef531dec37d191ff2642e95db46815fa53 Mon Sep 17 00:00:00 2001
From: Mark Walker
Date: Tue, 6 Feb 2024 20:06:15 +0000
Subject: [PATCH 3/7] ci: Improve efficiency of ruff workflow (#378)
---
.github/workflows/lint.yml | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 6d465993..da24e88e 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,26 +1,17 @@
-name: Lint
+name: Ruff
-on: [push, pull_request]
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
+on:
+ push:
+ pull_request:
jobs:
ruff:
- name: ruff
runs-on: ubuntu-latest
+
steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Set up Python
- uses: actions/setup-python@v5
- with:
- python-version: "3.11"
- cache: 'pip'
- - run: |
- python -m pip install --upgrade pip
- pip install ruff
- - name: Run Ruff
- run: |
- ruff djangocms_versioning tests
+ - uses: actions/checkout@v4
+
+ - run: python -Im pip install --user ruff
+
+ - name: Run ruff
+ run: ruff --output-format=github djangocms_versioning tests
From a70c194c27c5aadb58f07e42309613ca7952daa8 Mon Sep 17 00:00:00 2001
From: Raffaella <45825990+raffaellasuardini@users.noreply.github.com>
Date: Sun, 18 Feb 2024 17:10:43 +0100
Subject: [PATCH 4/7] Chore: update ruff and pre-commit hook (#381)
* chore: updated pyproject.toml to solve warnings
* ci: updated ruff-pre-commit version hook
---
.pre-commit-config.yaml | 4 ++--
pyproject.toml | 31 ++++++++++++++++---------------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ed8a6403..6922db3d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,8 +14,8 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending
- - repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: "v0.0.264"
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.2.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
diff --git a/pyproject.toml b/pyproject.toml
index c6a1005d..43360176 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,19 @@
[tool.ruff]
-# https://beta.ruff.rs/docs/configuration/
+exclude = [
+ ".eggs",
+ ".git",
+ ".mypy_cache",
+ ".ruff_cache",
+ ".env",
+ ".venv",
+ "**migrations/**",
+ "node_modules",
+ "venv",
+]
line-length = 120
+
+[tool.ruff.lint]
+# https://beta.ruff.rs/docs/configuration/
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
@@ -15,18 +28,6 @@ select = [
"UP", # pyupgrade
]
-exclude = [
- ".eggs",
- ".git",
- ".mypy_cache",
- ".ruff_cache",
- ".env",
- ".venv",
- "**migrations/**",
- "node_modules",
- "venv",
-]
-
ignore = [
"B006", # Do not use mutable data structures for argument defaults
"B011", # tests use assert False
@@ -43,12 +44,12 @@ ignore = [
"UP007", # Use `X | Y` for type annotations
]
-[tool.ruff.per-file-ignores]
+[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401" # unused-import
]
-[tool.ruff.isort]
+[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = [
"djangocms_versioning",
From 8a4e6c99e1cd2540172abed12b20e1d6e1e90dc8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 4 Mar 2024 23:38:01 +0000
Subject: [PATCH 5/7] build(deps): bump actions/cache from 4.0.0 to 4.0.1
(#385)
Bumps [actions/cache](https://github.com/actions/cache) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4.0.0...v4.0.1)
---
updated-dependencies:
- dependency-name: actions/cache
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/docs.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 8fa38e54..c393f081 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -19,7 +19,7 @@ jobs:
python-version: '3.11'
cache: 'pip'
- name: Cache dependencies
- uses: actions/cache@v4.0.0
+ uses: actions/cache@v4.0.1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
@@ -44,7 +44,7 @@ jobs:
python-version: '3.11'
cache: 'pip'
- name: Cache dependencies
- uses: actions/cache@v4.0.0
+ uses: actions/cache@v4.0.1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
From 93a3e52c3435e40882f69835b599b509e0b275dc Mon Sep 17 00:00:00 2001
From: Jacob Rief
Date: Tue, 5 Mar 2024 16:30:28 +0100
Subject: [PATCH 6/7] fix #363: Better UX in versioning listview (#364)
Co-authored-by: Fabian Braun
---
djangocms_versioning/admin.py | 3 ++
.../djangocms_versioning/js/versioning.js | 37 +++++++++++++++++++
2 files changed, 40 insertions(+)
create mode 100644 djangocms_versioning/static/djangocms_versioning/js/versioning.js
diff --git a/djangocms_versioning/admin.py b/djangocms_versioning/admin.py
index 16008576..bc73d4dc 100644
--- a/djangocms_versioning/admin.py
+++ b/djangocms_versioning/admin.py
@@ -608,6 +608,9 @@ class VersionAdmin(ChangeListActionsMixin, admin.ModelAdmin, metaclass=MediaDefi
# def get_queryset(self, request):
# return super().get_queryset(request).prefetch_related('content')
+ class Media:
+ js = ["djangocms_versioning/js/versioning.js"]
+
def get_changelist(self, request, **kwargs):
return VersionChangeList
diff --git a/djangocms_versioning/static/djangocms_versioning/js/versioning.js b/djangocms_versioning/static/djangocms_versioning/js/versioning.js
new file mode 100644
index 00000000..0704f537
--- /dev/null
+++ b/djangocms_versioning/static/djangocms_versioning/js/versioning.js
@@ -0,0 +1,37 @@
+(function() {
+ var firstChecked, lastChecked;
+
+ function handleVersionSelection(event) {
+ if (firstChecked instanceof HTMLInputElement && firstChecked.checked) {
+ firstChecked.checked = false;
+ firstChecked.closest('tr').classList.remove('selected');
+ firstChecked = lastChecked;
+ }
+ if (event.target instanceof HTMLInputElement) {
+ if (event.target.checked) {
+ firstChecked = lastChecked;
+ lastChecked = event.target;
+ } else if (firstChecked === event.target) {
+ firstChecked = null;
+ } else {
+ lastChecked = null;
+ }
+ }
+ }
+
+ document.addEventListener('DOMContentLoaded', function(){
+ var selectedVersions = document.querySelectorAll('#result_list input[type="checkbox"].action-select');
+ var selectElement = document.querySelector('#changelist-form select[name="action"]');
+ if (selectElement instanceof HTMLSelectElement) {
+ for (var i = 0; i < selectElement.options.length; i++) {
+ if (selectElement.options[i].value && selectElement.options[i].value !== 'compare_versions') {
+ // for future safety: do not restrict on two selected versions, since there might be other actions
+ return;
+ }
+ }
+ }
+ selectedVersions.forEach(function(selectedVersion){
+ selectedVersion.addEventListener('change', handleVersionSelection);
+ });
+ });
+ })();
From 2d22c0d0f981d0680c6c8ca8f504079ec5b6886f Mon Sep 17 00:00:00 2001
From: Fabian Braun
Date: Tue, 5 Mar 2024 16:41:27 +0100
Subject: [PATCH 7/7] fix: Several fixes for the versioning forms: #382, #383,
#384 (#386)
* fix #384: Unlock button in toolbar points onto DRAFT version
* Fix #382, #383
---------
Co-authored-by: Jacob Rief
---
djangocms_versioning/admin.py | 1 -
djangocms_versioning/cms_toolbars.py | 4 ++--
.../djangocms_versioning/css/versioning.css | 3 ---
.../js/admin/versioning-actions.js | 21 +++++++++++++++++++
.../admin/archive_confirmation.html | 21 +++++++++++--------
.../admin/revert_confirmation.html | 9 ++++----
.../admin/unpublish_confirmation.html | 5 +++--
7 files changed, 43 insertions(+), 21 deletions(-)
create mode 100644 djangocms_versioning/static/djangocms_versioning/js/admin/versioning-actions.js
diff --git a/djangocms_versioning/admin.py b/djangocms_versioning/admin.py
index bc73d4dc..834a247d 100644
--- a/djangocms_versioning/admin.py
+++ b/djangocms_versioning/admin.py
@@ -972,7 +972,6 @@ def publish_view(self, request, object_id):
# Redirect to published?
if conf.ON_PUBLISH_REDIRECT == "published":
- redirect_url = None
if hasattr(version.content, "get_absolute_url"):
redirect_url = version.content.get_absolute_url() or redirect_url
diff --git a/djangocms_versioning/cms_toolbars.py b/djangocms_versioning/cms_toolbars.py
index c9d3838a..153f43ba 100644
--- a/djangocms_versioning/cms_toolbars.py
+++ b/djangocms_versioning/cms_toolbars.py
@@ -125,8 +125,8 @@ def _add_unlock_button(self):
if LOCK_VERSIONS and self._is_versioned():
item = ButtonList(side=self.toolbar.RIGHT)
proxy_model = self._get_proxy_model()
- version = Version.objects.get_for_content(self.toolbar.obj)
- if version.check_unlock.as_bool(self.request.user):
+ version = Version.objects.filter_by_content_grouping_values(self.toolbar.obj).filter(state=DRAFT).first()
+ if version and version.check_unlock.as_bool(self.request.user):
unlock_url = reverse(
f"admin:{proxy_model._meta.app_label}_{proxy_model.__name__.lower()}_unlock",
args=(version.pk,),
diff --git a/djangocms_versioning/static/djangocms_versioning/css/versioning.css b/djangocms_versioning/static/djangocms_versioning/css/versioning.css
index f66b94a0..bc19b68b 100644
--- a/djangocms_versioning/static/djangocms_versioning/css/versioning.css
+++ b/djangocms_versioning/static/djangocms_versioning/css/versioning.css
@@ -207,6 +207,3 @@ ins.cms-diff img {
.cms-select::-ms-expand {
opacity: 0;
}
-input.button.revert-button {
- margin: 5px;
-}
diff --git a/djangocms_versioning/static/djangocms_versioning/js/admin/versioning-actions.js b/djangocms_versioning/static/djangocms_versioning/js/admin/versioning-actions.js
new file mode 100644
index 00000000..50edfa4c
--- /dev/null
+++ b/djangocms_versioning/static/djangocms_versioning/js/admin/versioning-actions.js
@@ -0,0 +1,21 @@
+(function () {
+ "use strict";
+
+ function closeSideFrame() {
+ try {
+ window.top.CMS.API.Sideframe.close();
+ } catch (err) {}
+ }
+
+ document.addEventListener('DOMContentLoaded', function () {
+ document.querySelectorAll('form.js-close-sideframe').forEach(el => {
+ el.addEventListener("submit", (ev) => {
+ ev.preventDefault();
+ closeSideFrame();
+ const form = window.top.document.body.appendChild(ev.target);
+ form.style.display = 'none';
+ form.submit();
+ });
+ });
+ });
+})();
diff --git a/djangocms_versioning/templates/djangocms_versioning/admin/archive_confirmation.html b/djangocms_versioning/templates/djangocms_versioning/admin/archive_confirmation.html
index 40ab5cd3..4a70749c 100644
--- a/djangocms_versioning/templates/djangocms_versioning/admin/archive_confirmation.html
+++ b/djangocms_versioning/templates/djangocms_versioning/admin/archive_confirmation.html
@@ -6,6 +6,7 @@
{{ block.super }}
{{ media }}
+
{% endblock %}
{% block breadcrumbs %}{% endblock %}
@@ -15,15 +16,17 @@
{% translate "Are you sure you want to archive the following version?" %}
{{ object_name }}
{% blocktrans %} Version number: {{ version_number }}{% endblocktrans %}
-
{% endblock %}
diff --git a/djangocms_versioning/templates/djangocms_versioning/admin/revert_confirmation.html b/djangocms_versioning/templates/djangocms_versioning/admin/revert_confirmation.html
index 3de7d687..7bbbb168 100644
--- a/djangocms_versioning/templates/djangocms_versioning/admin/revert_confirmation.html
+++ b/djangocms_versioning/templates/djangocms_versioning/admin/revert_confirmation.html
@@ -6,6 +6,7 @@
{{ media }}
+
{% endblock %}
{% block breadcrumbs %}{% endblock %}
@@ -22,20 +23,20 @@ {% block title %}{% translate "Revert Confirmation" %}{% endblock %}
{{ object_name }}
{% blocktrans %}Version number: {{ version_number }}{% endblocktrans %}
-