From 762d8a7fe9ef6a805fa5eed23991da2d434c2410 Mon Sep 17 00:00:00 2001
From: Tung Huynh <31434093+huynhsontung@users.noreply.github.com>
Date: Tue, 21 Apr 2020 23:48:00 -0700
Subject: [PATCH] Upgrade Wagtail to v2.7.2 (#4)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Adds Collections section to editor's guide
* Add form media to users/edit.html (#5390)
* Adds screen-reader-only text to the close button for modals (#5274, #5377)
* Adds clearer text to the close button for modals
* Use existing wagtailConfig.STRINGS to store the new translatable string for JS, rather than introducing a new library.
* Update list of string constants for translation in the tests file
* Remove aria-hidden on modal dialog close button
* Ensure the 'add child page' button displays when focused (#5274, #5382)
* Fix elasticsearch search backend tests broken by #5208
* Remove buggy tab order customisations in CMS admin (#5383, #5351)
* Fix spelling (#5393)
* Add labels to permission checkboxes for screen reader users (#5329, #5395)
- adds a fieldset around checkboxes with the same name
- add correct labels for object permissions table
- Ensure that image and document permissions labels display correctly, and ensure that labels for the dropdowns for document and image collections are not display:none
- Hide labels from sighted users in group edit / group add pages
* Optimization of UserPagePermissionsProxy.revisions_for_moderation (#5311)
revisions_for_moderation() was iterating over Page instances only
to use their path attribute. The optimization uses values_list()
over the GroupPagePermission queryset to retrieve only the page
paths without having to create the model instances in memory. This
saves roughly 50% of the runtime.
* Re-add loading of Wagtail icon font for userbar. Fix #5397 (#5398)
* Refactor submenu JS to remove jquery dep and move to wagtail-client (#5254)
* Add more contextual information for screen readers in the explorer menu’s links (#5335, #5386)
* Add dedicated accessibility section to v2.6 release notes (#5402)
* Add process_child_object method to Page.copy
* Add "exclude_fields" parameter to Page.copy
Also, make the excluded fields take effect on child relations as well
* Provide the original and copied pages to process_child_object()
* Add tests for Page.copy() process_child_object and exclude_fields
* Release notes for #5183
* Implement Page.with_content_json and add to docs (fixes #5199)
* Tests for #5203
* Release notes for #5203
* Improve screen-reader labels for action links in page listing (#5274, #5380)
* Move focus to the pages explorer menu when open (#5336, #5394)
* Ensure that when you open the explorer the focus moves to the first link of the menu, and add a label for the explorer navigation
* Add dialog role to pages explorer popup, and ensure that there is an option to close the dialog window when tabbing by making the close button visually hidden rather than display none
* Added CI config to generate nightly builds from master (#5320)
* Added CI config to generate nightly builds from master
* Fix typo
* Don't write __init__.py directly
We need to import the original in the script
* Update wagtail.utils.version
This is based off a copy from Django master made just now and adds
support for 'dev' versions.
* Try pip install --user
* Add screen-reader labels across multiple parts of the UI (#5274, #5339, #5372)
* Rename _utilities.hidden.legacy.scss to _utilities.visuallyhidden.scss (#5404)
We will always need visuallyhidden styles for screen readers.
* Update CONTRIBUTORS.rst
* added construction_hook_name to settings_menu (#5384)
* Clarify new three month release policy
* Adjust link label
* Update third_party_tutorials.rst
Add a detailed article about using GraphQL in Wagtail
* Nightly: Upload builds to 'dist' subfolder
* Nightly: Upload builds to 'dist' subfolder
* Nightly: Keep latest.json public when updating
* Nightly: Add script for testing nightly builds
* Document the workaround for broken wagtailimages.Filter references in custom image migrations
* Added missing is_stored_locally() to AbstractDocument
* Datetime picker dispatches 'change' event
* Also add change event to timepicker and datepicker
* Search query normalisation no longer removes punctuation #5416
* Don't make assumptions about the username field
The USERNAME_FIELD exists to allow customisation. Therefore we should make an assumption that `.username` exists on the model. Instead, we need to pull the required value from the USERNAME_FIELD and add in a fallback default.
* Optimize admin.navigation.get_explorable_root_page
Testing the queryset in the if clause was causing the whole queryset
to be retrieved and populated from DB, all to check whether it was empty
or not.
The optimization is to rely on the strict behavior of
first_common_ancestor, which raises an exception if the queryset is
empty.
* Fetch new translations from Transifex
* Generate new strings for translation
* Version bump to start work on 2.7
* Add 2.7 section to changelog and release notes
* Fix update docs typo
Only two Ss in accessor. Also make quotes consistent.
* Remove features deprecated in 2.7
* Rotate deprecation warnings for 2.7
* Pin Squash docker image to a specific version (#5441)
Recent builds have been breaking due to the following error: `/post_build.sh: line 2: npm: command not found`. I’m not entirely sure this is the fix, but it looks like this `latest` tag is now resolving to `3.7.4-buster` (https://hub.docker.com/_/python). Debian Buster got released 2 weeks ago. It feels safer to have a pinned dependency, and Stretch is probably what it was resolving to before.
* Add a `construct_page_listing_buttons` hook
This hook mimics the functiolity provided by `construct_page_action_menu`
in that it constructs the final list of buttons to be shown in the wagtail
admin interface. This means that within this function button's can be
removed, added or re-ordered.
See #4925
* Updated feature detection notes
* Fix broken pipenv/docutils dependency on CircleCI
* Break long file titles on multi file upload listing
* Fix docs title to break for long filenames
* Release note for #5431
* Add https support for scribd oembed provider (#739)
Currently scribd defaults to https for their sharing links - http still works but if you copy&paste quickly you may think it's broken
* Fix the required styles on title fields (#5440)
* Change StreamField group labels color so labels are visible. Fix #5455 (#5462)
* use lighter grey for streamfield group label for accessible contrast
* Fix jcrop holder image having no alt tag
* Pass down process_child_object when copying recursively
* Delay dirty form check data snapshot to avoid race conditions. Fix #4978 (#5469)
User interaction with the form within the 10s delay also won’t trigger the confirmation message. There will still be race condition issues if form widgets like rich text take 10+ seconds to initialise – but that doesn’t seem likely.
* Add release notes for 2.5.2
* Fetch new translations from Transifex
* Fill in release date for 2.5.2
* Fill in release date for 2.6
* Make image fallback work for images with big/small aspect ratios. Fix #5472 (#5474)
* Add support for phone links in rich text
This is mainly copy paste of Liam Brenner work (#3776) but with
a few fixes to make it work with Draftail. Since mailto:-links
is supported i think it is reasonable to support tel:-links as
well
* Apply escaping to JS translation strings. Fixes #5477
* Add release notes for 2.6.1
* Prevent exception when attempting to delete a model with a protected 1-to-1 relation
Modeladmin handles notification to the user if a model instance has protected ForeignKey
relationships. However, if the protected relation is a OneToOneField it raises an exception:
File ".../wagtail/wagtail/contrib/modeladmin/views.py", line 742, in post
for obj in qs.all():
AttributeError: 'MyRelatedModel' object has no attribute 'all'
because qs in this case is the related instance rather than a queryset of related instances
(as is the case for a ForeignKey).
This commit handles the OneToOneField case as well.
* Move and refactor upgrade notification JS
* Clarify CHANGELOG instructions in "Committing code" docs (#5483)
* Fill in release date for 2.6.1
* Add labels to snippet bulk edit checkboxes for screen reader users. Fix #5328 (#5463)
* Resolve DeprecationWarning (#5485)
Resolves "DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working" - see #5484
* Use xenial for all travis builds
* Test against Python 3.8 dev build
* Add (failing) test for middleware responses during preview
Responses returned by middleware (e.g. authentication failure) while creating the dummy request for a page preview. However, the current (broken) behaviour is to ignore the response, and attempt to serve the preview using the resulting request - which is likely to have incompletely-applied middleware, leading to hard-to-debug issues (usually involving a missing request.site).
* Introduce make_preview_request method to supersede dummy_request
Django-1.10-style middleware inherently doesn't support applying middleware to the request independently of running the view function, as the design of dummy_request requires. The current implementation of dummy_request unwittingly works around this by running the entire request/response cycle on the page's live URL (regardless of whether the page actually exists there at that moment), throwing away the response, and returning the request object to be used a second time (at which point it will be hopefully be populated with middleware-supplied attributes such as request.user and request.site - unless something caused the middleware to abort).
The new make_preview_request method wraps the call to serve_preview inside the middleware processing, so there is no longer a bogus 'background' request and no response has to be thrown away (meaning that any response returned by middleware will be correctly returned).
Fixes #3546
* Update dummy_request tests to use make_preview_request
* Deprecation note for dummy_request
* Release note for #5427
* Don't use page admin title when editing rich text (#5491)
When editing a rich text field and entering a link to a page whose Page
type overrides get_admin_display_title, the custom admin display title
is used both when browsing to select the page to link to and also when
viewing the rich text editor.
The first behavior is consistent with how custom admin display titles
are used throughout the admin, but the second behavior is not. The
Wagtail user should be able to use the rich text field as a reasonable
preview of what the rendered content will look like for the end user. To
do this, the "real" page title should be used, not the admin one.
This commit alters the data that gets passed to the rich text editor so
that its title is the real page title and not the admin one.
Fixes issue 5131.
* Properly check permissions when viewing revisions (#5490)
Currently any user with any page permission can view any page revision.
This commit fixes that, and ensures that the user has publish or edit
permission on the page before showing a page revision. If not, the user
is presented with a 403.
This maintains the current behavior if the user has no page permissions,
which is to redirect to the admin home page.
New tests have been added to cover these changes.
Fixes issue 5426.
* Fix pageurl and slugurl handling of situations where request.site is null (#5501)
* Add caption field to TableBlock
* Create caption field added to table block widget
Caption allows for users users with screen readers to be
able to understand the contents of a table.
* Fixed bugs in javascript and typos
* Updated documentation and change log
* Fixed table caption bug and requested pr edits
* Fixed table caption bug and request pr edits
* Removed changes in changelog.txt
* Fixed bug and requested PR edits
* Output form media on add/edit/chooser image forms with custom models
* Add tests for custom image on multiple image uploader
* Output form media on image add/edit views
* Output form media for 'add image' form within image chooser modal
Note: this won't work reliably if the media is hosted on a CDN, because script tags inserted as part of a jQuery DOM insertion (as modals are) are loaded asynchronously and not guaranteed to complete loading before inline scripts are run. It's better than not having the includes there at all though...
* Upgrade minimum 6.x release for Elasticsearch to 6.4.0
Fix doc and test on ES6 python client compat
This commit changes the statement that version < 6.3.1 of the
elasticsearch python client should be used to instead state
that 6.4.0 is fine.
It also update the tests to reflect the statement.
Initially the `update_all_types` argument has been used to work
around an issue described in:
https://github.com/wagtail/wagtail/issues/2968
This argument was removed in elasticsearch-py 6.3.1 and making
use of it was raising an error.
With 6.4.0 nothing is raising anymore.
* Add ability to create anchor link tab within rich text link
- add tests
- Update changelog & release notes
* Update Changelog
* Upgrade django-taggit to 1.x
django-taggit 1.x drops Python 2.x support and thus the dependency on django.utils.six; this is a prerequisite for supporting Django 3.0.
The signature of TaggableManager.value_from_object has changed to return a list of Tags (previously it was a QuerySet of TaggedItems) and so search indexing and comparison need to be updated accordingly. There is a corresponding fix to ClusterTaggableManager in django-modelcluster 5.0.
* Fix failing tests due to different HTML escaping in Django 3.0
- Fix password reset tests
- Fix test for invalid-slug message
- Update changelog/release notes
* Fixes layout for the FileField
* Allow users to change their first and last name
* Move locale-related functions from wagtail.admin.utils to wagtail.admin.locale
* Move model-related functions from wagtail.admin.utils to wagtail.admin.models
* Move authentication-related functions from wagtail.admin.utils to wagtail.admin.auth
* Move authentication-related functions from wagtail.admin.decorators to wagtail.admin.auth
* Move email functions from wagtail.admin.utils to wagtail.admin.mail
* Move get_site_for_user to wagtail.admin.navigation
* Update docs with new locations of wagtail.admin.utils definitions
* Fix MovedDefinitionHandler deprecation warnings to point to the import location
* Update wagtail.admin.utils and wagtail.admin.decorators imports to new locations. Fixes #5507
* Make try/catch AttributeError less all-encompassing
* Update references to wagtailadmin in comment
* Fix mention of non-existing PageLinkHandler.get_identifier
Refs #5184
* fix(docs/customization): Add models import to fix example (#5520)
* Remove Unidecode from postgres_search. Fix #5001 (#5514)
* Updated contributors & changelog
* Add telephone number links to release notes
* Replace streamfield CSS with react-streamfield CSS
* Update list / struct / stream block markup to match react-streamfield CSS
* Fix streamfield tests for updated markup
* Updates broken JS tests.
* Updates to react-streamfield 0.9.5.
* Release note for StreamField design update (#5476)
* Update release schedule info and move dates table to the wiki
Document release schedule in readme
* update docs for TabbedInterface (#5374)
* Allow content to define the tab width on xs screens to stop cutting off text (#5392)
* Break listing titles by word so action buttons are visible on smaller screens (#5429)
* Changed Snippet Chooser AJAX delay from 50ms to 200ms, to remove laggy typing. (#5439)
50ms is the equivalent of about 200 words per minute, so typing slower than that
meant that the javascript would send an AJAX request between every single
keystroke. This change makes the javascript wait for 200ms between keystrokes,
which lets you finish typing the word you're looking for before it sends an AJAX
request.
* Update CONTRIBUTORS.rst
Correction to contributor's name per request by email
* Add wagtail nightly to readme
* Add note about CurrentSiteMiddleware incompatibility
As per https://github.com/wagtail/wagtail/issues/2840#issuecomment-522697801
* fix: Language chosen in user preferences persists on subsequent requests (#4310)
* Add SECURITY.md (#5536)
Adds security.md to be consistent with github's interface
* Fix compatibility with pylint-django (#5538)
It's not possible to use wagtail in a project with pylint and the
pylint-django plugin.
Pylint-django does not work with foreign keys that are referenced by
their string names. See: https://github.com/PyCQA/pylint-django#known-issues
If we simply replace the string name with the foreign-key class, linting
on wagtail projects is fixed.
Also see:
https://github.com/PyCQA/pylint/issues/2995
https://github.com/PyCQA/pylint-django/issues/241
* Add setting to disable email management
This commit adds WAGTAIL_EMAIL_MANAGEMENT_ENABLED setting that defaults
to True, but when disabled, hides the 'Change email' button in account
management view, and disables the associated route. This is useful when
using external authentication method like LDAP or OpenID Connect where
email management is handled elsewhere.
Wagtail already includes WAGTAIL_PASSWORD_MANAGEMENT_ENABLED setting.
This is almost exact copy of that implementation.
* Replaced SafeText with SafeString.
* Replaced use of force_text with force_str.
* Updated the block id initialization (#5552)
The current block id generation only sets the id as the block is serialized for storage in the database, which means that the id is unavailable in the block until it is pulled back from the database. In my debugging this caused the id to be set to new values up to 3 times when saving a brand new page (each time with a new id).
This updated logic applies the new id to the actual block which makes it available right away and prevents the id from being regenerated.
* Stopped inheriting from object.
* Fixed broken email header when hosting static files remotely (#5543)
Fixes #5525
* Split up wagtail.admin.tests.test_pages_views
* Fix Postgres search indexing on Postgres 9.4 and Django >=2.2.1
Fixes #5547
As of Django 2.2.1, Value expressions within a SearchVector must specify an output_field: https://code.djangoproject.com/ticket/30446
* Release note for #5559
* Fix soundcloud embed regex
* Update core team list in CONTRIBUTORS.rst
* Fill in release date for 2.6.2
* Fetch new translations from Transifex
* Add translator credits
* Add core team alumni section to contributors
* Marks preview models for translation
* Fix class selector mapping (#5571)
The markup is wrong which results in code not working properly.
* add WAGTAILDOCS_SERVE_METHOD setting to allow serving files from underlying storage
* Documentation tweaks for WAGTAILDOCS_SERVE_METHOD
As suggested by @chosak - https://github.com/wagtail/wagtail/pull/5296#discussion_r324252497 , https://github.com/wagtail/wagtail/pull/5296#discussion_r324257167
* Additional tests for document.url and serve view behaviour
* Release note for #5296
* Update configuration.rst (#5576)
* Add ability to hide 'Submit for Moderation' in action menu using setting WAGTAIL_MODERATION_ENABLED. When set to false, SubmitForModerationMenuItem method is_shown returns false (#5574)
* allow image page sizes to be configurable (#5568)
* Updating FieldDoesNotExist imports to all be django.core.exceptions. (#5581)
* Test Django master against django-modelcluster master
* Eliminate dependency on default User model from style guide
Fixes #5442. Building a User object for david@torchbox.com may cause problems if a custom user model is in use, and is redundant anyhow because there's no longer a registered gravatar for that email - we should just hard-code the default blank avatar instead.
* Update more FieldDoesNotExist imports as per #5581
* Add role="table" to TableBlock output
As per https://twitter.com/SaraSoueidan/status/1177622630763028480, certain browsers apply heuristics to decide whether `
` elements exist for layout or data purposes, and adjust the behaviour of their accessibility features accordingly. Given that TableBlock intentionally doesn't allow markup within cells, we can be reasonably sure that any tables created with it are genuine data tables, and should therefore indicate that using `role="table"`.
* Make DraftailRichTextArea be considered as visible (#5583)
* Make it possible to override the url used by Page._get_dummy_headers()
* Changed height's description to match width's. (#5593)
* Add a note on 'Previewing and Submitting for Moderation' page about potential disabled moderation
* Add new docs page 'Changing rich text representation' (#5579)
* Add new docs page 'Changing rich text representation' describing how to subclass Format to provide a custom image html representation in rich text
* Output form media on add/edit/chooser document forms with custom models
Similar to eaad01308142337739d7edd9f08bd8e714be23f0, but for Document
* Deduplicate creation of fake file in document tests
* Add separate GitHub issue templates for feature requests and bugs. Fix #5560 (#5594)
* Add cache-busting parameter to admin static files
Fixes #5493
* Disable querystrings if a storage backend with hashed filenames is active
* Added upgrade note about disabling version strings
* Release note for #5527
* Implements ES7 support (#5611)
* Implements ES7 support
* Linter fix
* Adds docs
* isort fix
* Fixes typo
* Release notes for #5611
* Allow default item in action menu to be overridden with construct_page_action_menu hook
Fixes #5438
* Add 'Page locked' as a distinct menu item
* Revise action menu ordering so that the first (not last) item is picked as the default
Addresses backwards compatibility of existing action menu hooks, as per https://github.com/wagtail/wagtail/pull/5500#pullrequestreview-286868977
* Update construct_page_action_menu example
Now avoids redefining the whole list, and reflects the fact that the first (rather than last) item is picked as the default.
* Add release note about template change for action menu items
* Clarify that menu item order attribute is ignored in construct_page_action_menu
* Release note for #5500 / #5612
* Add acknowledgement to The Motley Fool
* Remove mentions of Django 3.0 compatibility from release notes
Work on compatibility is ongoing while Django 3.0 is still in development; we don't want this to be misinterpreted as a statement of formal Django 3.0 support (which we can't promise until the final release)
* Add example of template rendering to TableBlock docs
Addresses #5540
* Added 'image uploads in forms' to third party tutorials
* Fix multiple minor documentation issues
- Typo in readme (verb did not agree with the subject)
- Grammatical error in topics/pages
- #5364 - Update URL config code block in getting-started/integrating-into-django
* Replace format() placeholders in translatable strings with % formatting
Fixes #5539. Transifex and Django's makemessages command have validation to catch invalid placeholder variables within translated strings - for example, where the translator has translated the variable name - but these only recognise old-style `%` formatting, not the `format` method, and so it's better for us to standardise on % formatting.
To reduce the burden on translators having to re-translate these strings, only the ones using named placeholders (`"Edited page {title}"`) rather than numeric ones (`"Edited page {0}"`) have been changed - hopefully the latter give less room for error.
Also fixed some incorrect use of plurals (verbose_name vs verbose_name_plural) in snippet confirmation messages.
* Docs - Add AbstractUser import to custom user model
- `from django.contrib.auth.models import AbstractUser`
- revise a previous changelog entry to clarify 'clean up' vs 'fix'
* Recommend signals rather than hooks for model-level customisations
As per #5620 - signals are often overlooked as a way of customising model-level behaviour. We should recommend them over admin hooks where possible, as they aren't reliant on users taking one particular path through the admin - for example, an 'add document' signal will be triggered regardless of whether a document is created through the single uploader, multiple uploader, chooser model or a scripted task, whereas a hook would not catch all of these cases.
* Formalise Python 3.8 support
* Make copy of ES6 settings before setting max_ngram_diff (#5625)
* Change string based reference to class based
* Add model to PersonAdmin in documentation
* Replace rawgit.com links with jsdelivr
rawgit will be shut down soon
* Add thanks to squash.io
* [5225] Take number of frames into account when limiting image size
* Revert "Formalise Python 3.8 support"
This reverts commit ddbbaea288361efb6be537932d5f609e75e2f3c7.
* Add webp support
* Support format-webp and allow changing default formatting
* Add tests for webp format conversion
* Release note for #5249 / #5629
* Add documentation for how to use alternative image tags
This adds documentation for alternative image tags such as `