Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wagtail 6 support + extra way to create a sharing link #1

Merged
merged 29 commits into from
Oct 9, 2024

Commits on Oct 1, 2024

  1. Configuration menu
    Copy the full SHA
    f933896 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b1af63 View commit details
    Browse the repository at this point in the history
  3. Change menu icon

    stevejalim committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    819fffa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f075a9d View commit details
    Browse the repository at this point in the history
  5. Support current draftsharing behaviour in Wagtail 6

    This commit mirrors the current functionality for Wagtail 5 in Wagtail 6 by
    creating a Stimulus JS controller and hooking it into Wagtail in a similar
    way as for Wagtail 5.
    
    For the page history view, the HTML templating is different, so the previous
    approach overrode wagtailadmin/pages/revisions/_actions.html to slot in custom
    markup that the JS could hook into. For Wagtail 6 we do something similar,
    extending wagtailadmin/generic/history/action_cell.html to slot in a bit of
    custom markup.
    
    For snippet-list view, we update the HTML output for the share_url method
    to hook in the Stimulus controller used above.
    
    The JS in the Stimulus controller is deliberately very similar to the
    original JS. I wondered about refactoring out the main duplicated code
    (the main function which triggers the creation of new links via a POST
    to the backend, and the function which upgrades the View button on the
    list view of existing sharing links to be a clipboard link). However,
    for now - and with a view potentially to deprecating pre-Wagtail 6 behaviour
    - I've gone with some repetition rather than DRY code.
    
    Note that we don't load both JS files into the browser - we only load
    the appropriate one based on the version of Wagtail in use
    stevejalim committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    c22b58b View commit details
    Browse the repository at this point in the history
  6. Add an option in the main Page menu to create a draftsharing link

    ...if there is an unpublished draft that can be shared
    stevejalim committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    49af612 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5619783 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7b1a34a View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2024

  1. Configuration menu
    Copy the full SHA
    003f678 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c133b19 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6c8bf77 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6d395e8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ff0b469 View commit details
    Browse the repository at this point in the history
  6. Rename snippet class to improve code comprehension a tiny bit

    Bit of a nitpick here, I know - sorry!
    stevejalim committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    127802d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d4381d8 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2024

  1. Naming and formatting tweaks

    incl datetime_now -> timezone_now to avoid mis-assumption about which library it's from
    stevejalim committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    9f1ffa6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9e9e444 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cf7dfa3 View commit details
    Browse the repository at this point in the history
  4. Add tests for wagtail_hooks

    Brings coverage up to 98%, and effectively all code that needs coverage
    stevejalim committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    3172d68 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    828b0f1 View commit details
    Browse the repository at this point in the history
  6. Address outlier case where, with Wagtail 5.1, the active_until field …

    …was coming back as a naive datetime
    
    So we patch it in the tests and warn about it
    stevejalim committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    897adee View commit details
    Browse the repository at this point in the history
  7. Update tox to cover more versions of Python, Wagtail and Django

    Note the tolerance of a should-not-build version python3.12-django3.2-wagtail6.1 - may be there are better ways around that
    stevejalim committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    b677cb9 View commit details
    Browse the repository at this point in the history
  8. Fix unused import

    stevejalim committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    33035b9 View commit details
    Browse the repository at this point in the history
  9. Switch to only using ruff, not black + isort + ruff

    No need to have three things going when ruff does the lot
    stevejalim committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    8cbe7bc View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    56f5db0 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    d61c5bb View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    bf09190 View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2024

  1. Stabilise tests across Python 3.9 and/or Wagtail 5.1 by enforcing UTC…

    … expiry timestamps
    
    Note the addition to the README, requiring the use of settings.USE_TZ=True
    stevejalim committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    91f78be View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    99a2e7a View commit details
    Browse the repository at this point in the history