0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 13:10:14 +01:00
Commit Graph

17024 Commits

Author SHA1 Message Date
elhussein almasri
da88ec81f1 Adopt entity chooserUrls for Draftail richtext links
Avoid the need to load window.chooserUrls globally in the shared _editor_js.html include.

Instead pass in the lazy URLs to the link chooser entity options.
2024-02-28 21:36:49 +10:00
elhussein almasri
6a532d8fe0 Add support for lazy strings in Draftail widget options
Ensure that the JSON encoder can correctly handle lazy strings (such as reverse_lazy and gettext_lazy) so that there is better support for admin URLs and translations that may not be able to resolved when the application starts.
2024-02-28 21:36:49 +10:00
elhussein almasri
69e32660db Add support for Draftail ModalWorkflow JS to use chooserUrls supplied
Instead of relying on global window.chooserUrls, add the support for also passing in entityType config objects that serve the same purpose.

Update JS unit tests to reflect that the future will no longer support the window.chooserUrls
2024-02-28 21:36:49 +10:00
elhussein almasri
266faf63c2 Move modal-workflow.js script to admin_base.html
The modal-workflow.js script is used across a wide range of views in the admin, it's simpler to include it globally instead of having to consider all places it may be used.

Also unblocks use cases that are outside of the core admin such as custom documents/user/image models that may want to leverage this functionality.
2024-02-28 21:36:49 +10:00
Sage Abdullah
bded2cb98b Allow displaying permissions linked to the Admin model's content type (#11668) 2024-02-27 22:16:51 +00:00
Sage Abdullah
2594be387d Add tests for w-dropdown-keep-mounted-value 2024-02-27 09:43:14 +00:00
Sage Abdullah
71a8853365 Add tests for w-link 2024-02-27 09:43:14 +00:00
Sage Abdullah
1b3e54e267 Add tests for w-teleport-reset-value 2024-02-27 09:43:14 +00:00
Buraah
e30c25c3b1 Changed all British spellings to American spellings, in the changelog.txt file 2024-02-24 16:59:29 +10:00
Sage Abdullah
3b87644e07 Prevent shadowing of permissions with the same codename action (#11667)
This can cause issues where e.g. stale permissions become the ones used
to render the checkboxes after a RenameModel operation (changing the
Python class name, not just the verbose_name).

A similar issue can also be triggered with custom permissions that share
the same codename action (first part of the codename before _) as the
built-in permissions.
2024-02-23 21:22:35 +00:00
Matt Westcott
e418cd6e5b Add Viktor Szépe to contributors 2024-02-22 17:40:11 +00:00
Viktor Szépe
5679b30d1b
Fix typos (#11687) 2024-02-22 17:39:16 +00:00
Sage Abdullah
cadc40e6a2
Release note for #11666 2024-02-22 09:58:05 +00:00
Sage Abdullah
b73e34f55e
Add tests for custom default_permissions 2024-02-22 09:27:04 +00:00
Sage Abdullah
6596efc0d6
Normalise custom permission labels on a best-effort basis 2024-02-21 14:49:56 +00:00
Sage Abdullah
c4335d35de
Revert "Fix inconsistent use of model verbose_name in permissions UI"
This reverts commit e03c412507.
2024-02-21 14:49:55 +00:00
Matt Westcott
c11db31a78 Release note for #11665 2024-02-21 14:17:53 +00:00
Sage Abdullah
8058082ba3 Optimise queries in group create/edit view
Add missing select_related for content_type and batch the permission
queries for all content types instead of doing one query per model,
which can be a lot.

There are still duplicated queries due to the use of formsets, but there
isn't much we can do about it without some nasty hacks:

https://stackoverflow.com/questions/32082945
2024-02-21 14:17:13 +00:00
Sage Abdullah
1bc82a65e9 Add test for number of queries to load the group create/edit view 2024-02-21 14:17:13 +00:00
Matt Westcott
ff3b41c1f0 Update Damian Borneman in CONTRIBUTORS.md 2024-02-21 12:59:36 +00:00
dependabot[bot]
fca9993f5b Bump ip from 2.0.0 to 2.0.1
Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1.
- [Commits](https://github.com/indutny/node-ip/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 12:18:27 +00:00
dambor05
952416cfbc Fix typos of base/models.py (#11682) 2024-02-21 11:57:01 +00:00
Matt Westcott
9c34b60fb2 Update versions of eslint plugins to match package.json 2024-02-20 17:11:20 +00:00
LB Johnston
722d3b2b3c Upgrade build tooling to latest major versions (npm)
- Babel loader v9 (Node version, drop support for Webpack 4) https://github.com/babel/babel-loader/releases/tag/v9.0.0
- Copy webpack plugin (Node version only) https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v11.0.0 & https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v12.0.0
- Expose loader (Node version only) https://github.com/webpack-contrib/expose-loader/blob/master/CHANGELOG.md
- Postcss loader (Node version only) https://github.com/webpack-contrib/postcss-loader/releases/tag/v7.0.0 & https://github.com/webpack-contrib/postcss-loader/releases/tag/v8.0.0
- Sass loader (Node version, emits warnings by default) https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md
- Webpack CLI (Node version, some other breaking changes, dropping Webpack 4 support) https://github.com/webpack/webpack-cli/releases/tag/webpack-cli%405.0.0
2024-02-20 17:01:02 +00:00
LB Johnston
ba516ef492 a11y results - coerce CrossTreeSelector into a string
- Ensures that TypeScript will allow these values to be passed into querySelector
2024-02-20 16:54:35 +00:00
LB Johnston
7dff7ff364 Update npm dependencies (non-major)
- Includes updates to update-browserslist-db@latest
2024-02-20 16:54:26 +00:00
Matt Westcott
98da2e161a Fix pre-commit versions for prettier and eslint
Ensure that versions are consistent between 1) what we specify in package.json; 2) the tag specified on the pre-commit mirror; 3) the package dependency line in the pre-commit config.
2024-02-20 16:54:07 +00:00
Matt Westcott
c54d9aa64f Release note for #11637 2024-02-20 02:00:08 +00:00
Sage Abdullah
ac02f64449 Check for superuser before groups in GroupApprovalTask
Short-circuit the logic to skip db query for superusers
2024-02-20 01:58:39 +00:00
Sage Abdullah
9b68cf76f7 Move test_dashboard to wagtail.admin.tests
It's no longer specific to pages
2024-02-20 01:58:39 +00:00
Sage Abdullah
4ad514a7dd Annotate previous_revision_id for comparison links in dashboard
Avoid N+1 queries that were done by using .get_previous() on each revision
2024-02-20 01:58:39 +00:00
Sage Abdullah
f28a03a911 Cache 'user in groups' check in GroupApprovalTask 2024-02-20 01:58:39 +00:00
Sage Abdullah
93392c6a16 Use live_revision_id in WorkflowObjectsToModeratePanel
We only need the id to generate the links, avoid fetching the full revision object
2024-02-20 01:58:39 +00:00
Sage Abdullah
9260297a65 Fetch specific tasks in bulk in WorkflowObjectsToModeratePanel
Change BaseTaskStateManager.reviewable_by() so that the specific tasks
are queried in bulk.

In GroupApprovalTask.get_task_states_user_can_moderate(), use
self.task_states reverse related manager so the resulting TaskStates
already have their task ForeignKey set to the current GroupApprovalTask
instance.

Remove 'task' from select_related as the reviewable_by() already fetches
the specific task in bulk.
2024-02-20 01:58:39 +00:00
Sage Abdullah
8d49c789b2 Select workflow_state__workflow in WorkflowObjectsToModeratePanel query 2024-02-20 01:58:39 +00:00
Sage Abdullah
fb6d5d0d14 Annotate approved_schedule in RecentEditsPanel
Prevent N+1 queries when rendering the status tag
2024-02-20 01:58:39 +00:00
Sage Abdullah
66cf63fce1 Prefetch workflow states in RecentEditsPanel
Prevent N+1 queries when rendering the status tag
2024-02-20 01:58:39 +00:00
Sage Abdullah
606f8607c2 Compare locked_by_id to avoid fetching user object in _locked_indicator.html 2024-02-20 01:58:39 +00:00
Sage Abdullah
9f5e115355 Use .specific(defer=True) and order_by(-locked_at) for LockedPagesPanel 2024-02-20 01:58:39 +00:00
Sage Abdullah
24e6024506 Add tests for WorkflowObjectsToModeratePanel query count 2024-02-20 01:58:39 +00:00
Sage Abdullah
8870c9c52c Add tests for UserObjectsInWorkflowModerationPanel query count 2024-02-20 01:58:39 +00:00
Sage Abdullah
2b9776faa4 Add tests for LockedPagesPanel query count 2024-02-20 01:58:39 +00:00
Sage Abdullah
8de381cfca Add different page states in TestRecentEditsQueryCount
Simulate pages that are in workflow, locked, or scheduled
2024-02-20 01:58:39 +00:00
Sage Abdullah
add9df4738 Update TestRecentEditsQueryCount to count queries when rendering
The N+1 query may not happen during get_context_data() and instead happens during the rendering of the templates due to traversal of related fields.

This change to the test case makes it apparent that there are indeed N+1 queries.
2024-02-20 01:58:39 +00:00
Buraah
46cb06a860 Docs: Update British spellings to American spellings (Releases) 2024-02-18 14:24:32 +10:00
EK303
bd065c17cd Docs - Update and fix broken links
Fixes #11635
2024-02-16 17:23:53 +10:00
Matt Westcott
54eb76a001 Update latest.txt for 6.0.1 2024-02-15 14:28:26 +00:00
Matt Westcott
bb5d21d3c7 Fill in release date for 6.0.1 2024-02-15 13:59:37 +00:00
Maikel Martens
ef06e48c7f Fix #11600 Eleasticsearch7 empty admin search gives 500 (#11626) 2024-02-15 12:33:02 +00:00
Sage Abdullah
d93588fb5b Add 127.0.0.1 and 0.0.0.0 to test settings' ALLOWED_HOSTS 2024-02-15 12:19:02 +00:00