Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#48431 closed defect (bug) (fixed)

Privacy policy notice should not be visible on Draft Admin List page.

Reported by: chetan200891's profile chetan200891 Owned by: garrett-eclipse's profile garrett-eclipse
Milestone: 5.4 Priority: normal
Severity: normal Version: 4.9.6
Component: Privacy Keywords: has-screenshots has-patch commit
Focuses: ui, administration Cc:

Description

On fresh install, When privacy policy page in draft mode and if you see draft pages from admin list page. Privacy policy notice is visible on Draft Admin List page. It should not be there, it should be only on edit page. Also that is overriding on help tab.

Attachments (3)

Privacy-Policy-Notice.png (93.4 KB) - added by chetan200891 5 years ago.
48431.diff (617 bytes) - added by chetan200891 5 years ago.
Created patch.
48431.1.diff (2.5 KB) - added by chetan200891 5 years ago.
Updated patch.

Download all attachments as: .zip

Change History (16)

@chetan200891
5 years ago

Created patch.

#1 @SergeyBiryukov
5 years ago

  • Focuses privacy added

#2 @garrett-eclipse
5 years ago

  • Component changed from Administration to Privacy
  • Focuses privacy removed
  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 5.4
  • Owner set to garrett-eclipse
  • Status changed from new to accepted
  • Version set to 4.9.6

Thanks for the patch @chetan200891 and good eye.

Testing this seems to only occur when the Privacy Policy page is in draft and the only page listed on the draft listing.

Your patch applies cleanly and addresses the issue nicely, thank you marking for commit and moving to 5.4.

#3 @xkon
5 years ago

  • Keywords needs-refresh added; commit removed

Hey @chetan200891 ! Thanks for pointing this out and the patch. I'm removing the commit for now for a bit of extra discussion first.

The current 48431.diff works fine (could have used strict comparison but that's easily changed).

Since there can only be 1 Privacy Policy page at a time and we always keep its ID at the wp_page_for_privacy_policy option I believe it would be better to bind this notice only to that ID + editing (post.php) page if that's possible.

This way the notice will only show up under these specific circumstances instead of excluding unwanted side-effects like the Draft list view.

Would you like to see if that would work and come up with an new patch?

#4 @chetan200891
5 years ago

@xkon Thanks for suggestions. Sure! I will add new patch soon.

@chetan200891
5 years ago

Updated patch.

#5 @chetan200891
5 years ago

  • Keywords needs-refresh removed

@xkon I have updated patch.

#6 @xkon
5 years ago

Thanks for the refresh @chetan200891! 48431.1.diff Works as expected and I think that this way there won't be any extra side effects from this as it's targeted only to specific edit/ID now :-).

@garrett-eclipse take a look as well if you like, I'm ok for a commit tag here.

#7 @garrett-eclipse
5 years ago

  • Keywords commit added

Thanks for catching that @xkon and the quick refresh @chetan200891 this looks to be a more bullet-proof approach.

My testing looks good here as it no longer appears on the draft list and still appears on both block editor and classic editor when on the Privacy Policy page.

Marking for commit.

#8 @garrett-eclipse
5 years ago

#46255 was marked as a duplicate.

#9 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 47284:

Privacy: Only show the Privacy Policy page notice when editing the page, not on drafts list.

Props chetan200891, xkon, garrett-eclipse.
Fixes #48431.

#10 @benjibee
4 years ago

I'm still seeing this issue with 5.4.1 – I have a page marked as "Privacy Policy Page" in the pages overview, and it is marked as published, but this notice is still shown when editing. The post-ID of the page is 3 so it was not the first page created as far as I can tell.

#11 follow-up: @garrett-eclipse
4 years ago

Hello @benjibee from your comment it sounds like you're seeing the notice when editing the page itself and not on the listing of pages or drafts? If so then that's intended behaviour, the notice should be present when editing the actual page itself. This issue specifically was flagged because the notice was shown outside the editor on the listing of draft pages.

If I've misunderstood please elaborate and potentially provide screenshots.
Thank you

#12 in reply to: ↑ 11 @benjibee
4 years ago

@garrett-eclipse You're right, I commented too hastily, excuse me. I didn't imagine this was expected behavior and assumed it was in error. As others may feel the same, could you point me to the nearest filter to disable this warning, please? Thank you :)

#13 @garrett-eclipse
4 years ago

No worries @benjibee, there's a related ticket (#44981) to make the notice dismissible by the user and pertain that. In the meantime you can remove the admin_notices action tied to the WP_Privacy_Policy_content::notice() as follows;

<?php
remove_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'notice' ) );

*May need to be wrapped in an admin_init action due to load order.

Note: See TracTickets for help on using tickets.