Skip to content

Fix: connector approval notice placement in request logs#598

Open
Malayt04 wants to merge 2 commits into
WordPress:developfrom
Malayt04:fix/connector-approval-notice-placement-in-request-logs
Open

Fix: connector approval notice placement in request logs#598
Malayt04 wants to merge 2 commits into
WordPress:developfrom
Malayt04:fix/connector-approval-notice-placement-in-request-logs

Conversation

@Malayt04
Copy link
Copy Markdown
Contributor

@Malayt04 Malayt04 commented May 21, 2026

What?

Closes: #596

Fixes the connector approval notice appearing inside the page header on the AI Request Logs screen

Why?

WordPress Core's common.js moves .notice elements to after the first h1 in .wrap. The @wordpress/admin-ui Page component renders its h1 inside a flex header, so the notice ends up as an inline flex child in the header row instead of in the content area.

How?

Instead of displaying the notice via PHP (which triggers Core's relocation script), the PHP notice is suppressed on this screen and the pending approval data is passed to the React app. The notice is then rendered directly in the page content area, in the right place.

Changes:

  • Admin_Notice.php — suppress PHP notice on the Request Logs screen
  • AI_Request_Log_Page.php — pass connectorApprovalNotice data to JS; add get_connector_approval_notice_data()
  • types.ts — add ConnectorApprovalNotice interface and field to LocalizedSettings
  • index.tsx — render the notice in the content canvas

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Used for: Root cause analysis and implementation. Tested by me.

Testing Instructions

Screenshots or screencast

Before

Screenshot 2026-05-21 at 12 06 54 PM

After

Screenshot 2026-05-21 at 12 07 14 PM

Changelog Entry

Fixed - Connector approval notice now correctly appears below the page subtitle on the AI Request Logs screen instead of overlapping the page header.

Open WordPress Playground Preview

Malayt04 added 2 commits May 21, 2026 11:40
The PHP admin notice rendered by Admin_Notice::render() was being
relocated by WordPress Core's common.js to sit after the first h1 it
found inside .wrap. Because the React Page component renders its h1
inside a flex header container, the notice ended up as a flex child
inline with the title and period-selector actions.

Fix by suppressing the PHP notice on the tools_page_ai-request-logs
screen and instead passing the pending approval data to the React app
via the localized script. The notice is now rendered as a
@wordpress/components Notice inside .ai-request-logs__app, which sits
below the Page header and subtitle — the correct intended placement.

Changes:
- Admin_Notice.php: suppress on tools_page_ai-request-logs screen
- AI_Request_Log_Page.php: pass connectorApprovalNotice data to JS;
  add get_connector_approval_notice_data() private method
- types.ts: add ConnectorApprovalNotice interface and field to
  LocalizedSettings
- index.tsx: import _n/sprintf; render Notice in content canvas
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Malayt04 <malaytiwari@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 3.84615% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.97%. Comparing base (246680c) to head (687daef).

Files with missing lines Patch % Lines
includes/Logging/AI_Request_Log_Page.php 0.00% 25 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #598      +/-   ##
=============================================
- Coverage      73.18%   72.97%   -0.21%     
- Complexity      1731     1735       +4     
=============================================
  Files             85       85              
  Lines           7473     7494      +21     
=============================================
  Hits            5469     5469              
- Misses          2004     2025      +21     
Flag Coverage Δ
unit 72.97% <3.84%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul jeffpaul requested a review from dkotter May 21, 2026 16:27
@jeffpaul jeffpaul added this to the 1.1.0 milestone May 21, 2026
Copy link
Copy Markdown
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

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

I haven't tested but I'm assuming this approach works but it's a lot of changes just to support a better notice placement on one specific page.

If this is the root problem:

WordPress Core's common.js moves .notice elements to after the first h1 in .wrap. The @wordpress/admin-ui Page component renders its h1 inside a flex header, so the notice ends up as an inline flex child in the header row instead of in the content area.

Is there a better/cleaner way to solve this by changing the markup of this Request Log page so this placement never happens?

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.

Connector Approvals request misplaced on Request Logs screen

3 participants