Skip to content

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Oct 29, 2022

Description

This pr adds the capability to monkey patch the page trees indicator menu allowing to publish, unpublish, and revert from the page tree.

indicator-menus

This PR is draft and open points remain to be done

  • Manage redirections after publish/unpublish correctly
  • Decide on additional state (draft, ring primary color). In v3 unpublished and draft were the same. In v4, reverting an unpublished version leads to a new draft.
  • Disable edit pageconsent if not a draft
  • Decide on immediate unpublish/revert (and not first ask for confirmation).
  • Keep an open side frame open when publishing/unpublishing (currently unclear why it closes)
  • Add tests

Related resources

Review guide

  • monkeypatch/indicators.py: Indicator logic, patching into classy template tags. Since template tags are called multiple times, versioning results are cached
  • monkeypatch/templatetags.py: Backward compatibility: Patches function-based tags (v4.0....) or class-based tags (v4.1....)
  • cms_toolbar.py: Show edit button only if edit is possible (otherwise clicking produces an error), show revert button if viewing archive or unpublished version
  • Tests are commented

Checklist

  • I have opened this pull request against master
  • I have added or modified the tests when changing logic
  • I have followed the conventional commits guidelines to add meaningful information into the changelog
  • I have read the contribution guidelines and I have joined #workgroup-pr-review on
    Slack to find a “pr review buddy” who is going to review my pull request.

@fsbraun fsbraun marked this pull request as draft October 29, 2022 14:28
@codecov
Copy link

codecov bot commented Oct 29, 2022

Codecov Report

Merging #295 (ed3e907) into master (fedd956) will increase coverage by 0.00%.
The diff coverage is 82.00%.

❗ Current head ed3e907 differs from pull request most recent head 58222a9. Consider uploading reports for the commit 58222a9 to get more accurate results

@@           Coverage Diff           @@
##           master     #295   +/-   ##
=======================================
  Coverage   85.17%   85.17%           
=======================================
  Files          23       24    +1     
  Lines         843      931   +88     
  Branches      118      141   +23     
=======================================
+ Hits          718      793   +75     
- Misses        100      108    +8     
- Partials       25       30    +5     
Impacted Files Coverage Δ
djangocms_versioning/monkeypatch/templatetags.py 58.82% <50.00%> (+5.88%) ⬆️
djangocms_versioning/indicators.py 80.00% <80.00%> (ø)
djangocms_versioning/cms_toolbars.py 95.70% <93.10%> (-0.01%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 30, 2022

This pull request introduces 1 alert when merging 500f79f into e6a33ea - view on LGTM.com

new alerts:

  • 1 for Unused import

@fsbraun fsbraun marked this pull request as ready for review October 31, 2022 18:04
@marksweb
Copy link
Member

Like the look of this. Will have to try it out 👍

@fsbraun
Copy link
Member Author

fsbraun commented Oct 31, 2022

@marksweb Only works together with django-cms/django-cms#7426 (gulp sass && gulp bundle for the full experience...)

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 3, 2022

This pull request introduces 1 alert when merging bfcb5d9 into 84c063d - view on LGTM.com

new alerts:

  • 1 for Information exposure through an exception

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

version.check_modify(request.user)
except ConditionFailed as e:
self.message_user(request, force_str(e), messages.ERROR)
return HttpResponseForbidden(force_str(e))

Check warning

Code scanning / CodeQL

Information exposure through an exception

[Stack trace information](1) flows to this location and may be exposed to an external user.
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 3, 2022

This pull request introduces 2 alerts when merging 1311e81 into 84c063d - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Information exposure through an exception

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 4, 2022

This pull request introduces 1 alert when merging 4a029e2 into 84c063d - view on LGTM.com

new alerts:

  • 1 for Information exposure through an exception

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 4, 2022

This pull request introduces 1 alert when merging ed3e907 into 84c063d - view on LGTM.com

new alerts:

  • 1 for Information exposure through an exception

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 7, 2022

This pull request introduces 1 alert when merging 58222a9 into fedd956 - view on LGTM.com

new alerts:

  • 1 for Information exposure through an exception

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@fsbraun fsbraun changed the title Add: Ability to patch new page tree indicator drop down menus Add: Allow simple version management commands from the page tree indicator drop down menus Dec 7, 2022
@fsbraun fsbraun merged commit 4e5b1c4 into django-cms:master Dec 8, 2022
@fsbraun fsbraun deleted the feat/stateIndicators branch January 23, 2023 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants