Skip to content

Handle can_publish seperately from the wagtail CopyForm - #4985

Merged
frjo merged 3 commits into
mainfrom
fix/copy-round-failure-can-publish
Sep 18, 2026
Merged

frjo merged 3 commits into
mainfrom
fix/copy-round-failure-can-publish

Conversation

@wes-otf

@wes-otf wes-otf commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Quick fix for copying rounds directly in wagtail - currently it will error out if copied due to wagtail not accepting can_publish as an argument

Test Steps

  • Ensure rounds can be directly copied

@wes-otf wes-otf added Type: Bug Bugs! Things that are broken :-/ Type: Patch Mini change, used in release drafter labels Sep 15, 2026
@wes-otf

wes-otf commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

@frjo print statements removed 🤦

Comment thread hypha/apply/funds/admin_views.py Outdated
can_publish = parent_page.permissions_for_user(request.user).can_publish_subpage()
if not can_publish:
raise PermissionDenied(_("You do not have permission to publish this round."))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this part needed at all? I tried removing it with no apparent ill effect.

# Parent page defaults to parent of source page
parent_page = page.get_parent()

# Check if the user has permission to publish subpages on the parent
can_publish = parent_page.permissions_for_user(request.user).can_publish_subpage()
if not can_publish:
    raise PermissionDenied(_("You do not have permission to publish this round."))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure - I also didn't see anything nasty happen when I removed them as well but wasn't sure if there was an edge case or reason that logic was there in the first place? happy to remove it though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suspect it is code to handle old Wagtail behaviour.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should be set now!

@frjo
frjo merged commit bec5e99 into main Sep 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Bugs! Things that are broken :-/ Type: Patch Mini change, used in release drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants