8000 fix: added redirect message when in editing a redirect toolbar object by theShinigami · Pull Request #8056 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: added redirect message when in editing a redirect toolbar object #8056

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 4 commits into from
Nov 3, 2024

Conversation

theShinigami
Copy link
Contributor
@theShinigami theShinigami commented Nov 1, 2024

Description

When in edit mode, if the page is set to redirect to another, it shows the link to which it is redirecting.

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.

@theShinigami theShinigami changed the title fix: add redirect notification page when in edit mode fix: add redirect preview page when in edit mode Nov 1, 2024
@fsbraun
Copy link
Member
fsbraun commented Nov 1, 2024

@theShinigami Great work! Thank you. Two things:

  • Can this go away? In the details view edit mode cannot be on.

    django-cms/cms/views.py

    Lines 192 to 201 in 565d4cc

    if redirect_url:
    if request.user.is_staff and toolbar.edit_mode_active:
    toolbar.redirect_url = redirect_url
    elif redirect_url not in own_urls:
    if get_cms_setting('REDIRECT_PRESERVE_QUERY_PARAMS'):
    query_string = request.META.get('QUERY_STRING')
    if query_string:
    redirect_url += "?" + query_string
    # prevent redirect to self
    return HttpResponseRedirect(redirect_url)
  • Can you add a test? I could imagine creating a PageContent object with redirect set. You could call the edit endpoint and make sure that the redirect message is in the response.

@fsbraun fsbraun changed the title fix: add redirect preview page when in edit mode fix: added redirect warning when in editing a redirect toolbar object Nov 2, 2024
Copy link
Member
@fsbraun fsbraun left a comment

Choose a reason for hiding this comment

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

Excellent! 🚀

@fsbraun fsbraun added the needs to be backported Commits need to be backported label Nov 2, 2024
@fsbraun fsbraun changed the title fix: added redirect warning when in editing a redirect toolbar object fix: added redirect message when in editing a redirect toolbar object Nov 3, 2024
@fsbraun fsbraun merged commit 835938c into django-cms:develop-4 Nov 3, 2024
54 checks passed
fsbraun pushed a commit that referenced this pull request Nov 3, 2024
…#8056)

* fix: add redirect notification page when in edit mode

* refactor(details): remove setting of redirect_url

* test: add test to verify message display when redirect is set

* refactor: remove unused variable from details view
@fsbraun fsbraun added 4.1 5.0 and removed needs to be backported Commits need to be backported labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0