-
Notifications
You must be signed in to change notification settings - Fork 295
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
Show Idea Hub context for posts based on Idea Hub idea in WordPress posts list table #3271
Comments
Thanks, @ivankruchkoff. The IB mostly looks good. Could you please explicitly mention that we need to update |
Updated, although for non draft posts it wouldn't matter as their non-draft status means that they wouldn't get the draft label anyway. |
Thanks, @ivankruchkoff! IB ✔️ |
@felixarntz this might still need QA:Eng due to steps 2 and 4 of qa brief. |
@ivankruchkoff when I run Steps. Connected to SSH on terminal, pointed to the folder cd apps etc. Can you think of any reason why this might not work now? |
Can you start with a fresh install, enable a few modules and then try it again? |
@cole10up would you be able to look at this one? I have followed the instructions in the QAB. I can connect Idea Hub,, but when I try and add the settings in terminal, nothing happens. When I run the get command, the settings are not updated. Have spent quite a lot of time on this ticket, so think it needs another pair of eyes. |
QA ✅@wpdarren - I was able to create the post manually using "tempid=$(wp post create --post_title='A' --porcelain); echo $tempid ; wp db query "update wp_posts set post_title='' where ID=$tempid;" Ran the following commands: From here I confirmed in edit.php that a draft post was created called "(no title) — Idea Hub Draft “Using Site Kit to analyze your success” Sending to testing approved. |
The WordPress posts list table should indicate which posts are drafts created on an Idea Hub idea.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
In
/includes/Modules/Idea_Hub.php
, update the functionpublic function register()
Add a check for
if ( $this->is_connected() ) {
Add a filter
display_post_states( $states, $post )
https://developer.wordpress.org/reference/hooks/display_post_states/In the filter function, first check that the post is a draft, if it isn't then return the states object as is. Next, add a check for
get_post_idea( $post->ID )
(see #3157 ),if it's not null, we update the draft state, which will change the label:
Make sure to use smart / directional quotation marks “” rather than unidirectional "", or directional single quotes ‘’ see https://en.wikipedia.org/wiki/Quotation_mark#Summary_table English, US
Test Coverage
Update
tests/phpunit/integration/Modules/Idea_HubTest.php
to create a new test which tests the following:Idea Hub Module registered, draft post with idea, when running the filter
display_post_states
the text is changed.Idea Hub Module registered, draft post not via idea hub, when running the filter
display_post_states
the text saysDraft
.Idea Hub Module NOT registered, draft post with idea, when running the filter
display_post_states
the text saysDraft
.Visual Regression Changes
QA Brief
wp option patch insert googlesitekit_active_modules 3 idea-hub
wp option add googlesitekit_idea-hub_settings --format=json '{"ideaLocale":"en-US"}
If #3269 is merged, you can do this:
Otherise you need to create it manually:
With the post id from the previous step, add your idea post meta:
After you've created the draft post, open the all posts list
/wp-admin/edit.php
, you should see your draft post there:(no title) — Idea Hub Draft “Using Site Kit to analyze your success”
Changelog entry
The text was updated successfully, but these errors were encountered: