10000 chore: Backport the delete translations fix for #8111 to django CMS 4.1 by fsbraun · Pull Request #8112 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

chore: Backport the delete translations fix for #8111 to django CMS 4.1 #8112

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

Merged
merged 5 commits into from
Jan 22, 2025

Conversation

fsbraun
Copy link
Member
@fsbraun fsbraun commented Jan 16, 2025

Description

This backports parts of #8111:

  • Deleting a language for a page needs to remove all of the page's content objects for that language
  • The updated delete message is not backported for consistency reasons.

Related resources

Checklist

  • I have opened this pull request against develop-4
  • 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 the channel #pr-reviews on our Discord Server to find a “pr review buddy” who is going to review my pull request.

Summary by Sourcery

Delete all page content objects for a given language when deleting a page content object.

Bug Fixes:

  • Fixed a bug where deleting a language for a page did not remove all of the page's content objects for that language.

Chores:

  • Backported the fix for deleting translations to django CMS 4.1.

Copy link
Contributor
sourcery-ai bot commented Jan 16, 2025

Reviewer's Guide by Sourcery

This PR backports a fix from #8111 to the django CMS 4.1 branch. The fix ensures that when a language is deleted for a page, all of the page's content objects for that language are also deleted. It also updates the objects passed to the get_deleted_objects function to include all page content objects for the given language.

Sequence diagram for improved page language deletion process

sequenceDiagram
    actor Admin
    participant PA as PageAdmin
    participant PC as PageContent
    participant PU as PageURL
    participant P as Plugins

    Admin->>PA: Delete page language
    PA->>PC: Get all page contents for language
    PA->>PA: Get deleted objects list
    alt Deletion confirmed
        PA->>PU: Delete page URL
        PA->>PC: Delete all page contents
        PA->>P: Delete associated plugins
    end
Loading

Class diagram showing the relationship between Page and PageContent

classDiagram
    class Page {
        +urls
        +node
    }
    class PageContent {
        +page
        +language
    }
    class PageURL {
        +language
    }
    Page "1" -- "*" PageContent : has
    Page "1" -- "*" PageURL : has
    note for PageContent "Multiple contents per language are now properly handled during deletion"
Loading

File-Level Changes

Change Details Files
Delete all page content objects when deleting a language for a page
  • Added a filter to select all page content objects matching the page and language being deleted.
  • Updated the delete_view to delete all selected page content objects.
  • Updated the call to get_deleted_objects to include all page content objects for the given language
cms/admin/pageadmin.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor
@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @fsbraun - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@fsbraun fsbraun merged commit 0be6bbb into django-cms:release/4.1.x Jan 22, 2025
90 of 91 checks passed
@fsbraun fsbraun deleted the backport/translation-delete branch January 22, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0