Idea Hub post annotation only shown on drafts
See original GitHub issueBug Description
When you trash a draft post, the idea isn’t shown in the trash.
Steps to reproduce
- Create a draft from an idea, notice the idea name is in the status.
- Trash the post, idea name is not shown.
- Restore the trashed post, and see the idea is shown again.
Recording
https://user-images.githubusercontent.com/373931/130031511-4fe045a8-c7f4-4f7a-a4dc-d3ac43fadcb7.mp4
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The Idea Hub annotation added to Idea Hub created posts in the post list table should be shown for posts of all statuses, not only drafts (e.g. trashed, future, pending, private, etc) – how it is added depends on the post status, post state, and post title
- For
draft
posts with no title only, the state should be replaced byIdea Hub Draft “{idea-name}”
- For all other post statuses OR drafts that have titles, the annotation should be simplified to
inspired by Idea Hub
- For all post statuses (except drafts with no title)
- If there is already content for the post state (e.g.
scheduled
), combine the original content of the post state by appending the annotation like so:{post-state}, {idea-hub-annotation}
- If no content exists for the post state, the annotation becomes the post state, rather than appending to it
- If there is already content for the post state (e.g.
- See https://github.com/google/site-kit-wp/pull/4061#discussion_r712384583 for reference
Implementation Brief
-
In
includes/Modules/Idea_Hub.php
->register_persistent()
->display_post_states()
: -
- Remove the check for post status: https://github.com/google/site-kit-wp/blob/38ae6cb09c82acea56a5bde768028d93b3cc6580/includes/Modules/Idea_Hub.php#L165-L167
-
- Instead of adding our message to the
draft
post state, add it for the current post’s post state https://github.com/google/site-kit-wp/blob/38ae6cb09c82acea56a5bde768028d93b3cc6580/includes/Modules/Idea_Hub.php#L173
- Instead of adding our message to the
$post_states[$post->post_status ] = ...
-
- If the
post_title
is empty"" === $post->post_title
, use the current messagesprintf( __( 'Idea Hub Draft “%s”', 'google-site-kit' ), $idea['text'] );
, otherwise if a title is set, set the message toinspired by Idea Hub
: https://github.com/google/site-kit-wp/blob/38ae6cb09c82acea56a5bde768028d93b3cc6580/includes/Modules/Idea_Hub.php#L173
- If the
Test Coverage
- Update test name and test in
tests/phpunit/integration/Modules/Idea_HubTest.php::test_draft_labels()
Visual Regression Changes
- N/A
QA Brief
- Create an idea hub draft, ensure that the posts list table shows its status message as
Idea Hub Draft ...
. - Set a title and update the draft, ensure that the status says
inspired by Idea Hub
. - Trash the post and ensure it still has the correct status message.

Changelog entry
- Update the post state for Idea Hub posts and enable it for posts of all statuses.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Show Idea Hub context for posts based on Idea Hub ... - GitHub
The WordPress posts list table should indicate which posts are drafts created on an Idea Hub idea. Do not alter or remove anything...
Read more >How do I view annotation feedback comments from my...
The View Feedback link displays an indicator if annotated comments have been ... If your assignment looks different than what is displayed in...
Read more >INCEpTION User Guide
INCEpTION supports span layers in order to annotate a span from one character (“letter”) in the text to another, relation layers in order...
Read more >Introducing Modern Comments in Microsoft Word
After you draft a new comment or reply, click the Post button or use the keyboard shortcut Ctrl+Enter (Windows) or Cmd + Enter...
Read more >C# Chart Line Annotation disappears when anchor point is off ...
The annotations didn't show when I tried it first, so I added 0.005 to the AnchorX to see if it had to be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
SGTM for using “inspired by Idea Hub” for all posts with a title updated by the user (including posts in draft state with an updated title).
@eugene-manuilov I’m not sure how familiar users will be in the beginning with the Idea Hub icon, and if they would understand why it’s there / what it means. I’d suggest adding the short text for now and revisit to add the icon at a later stage, a few months after we’ve rolled the feature out to 100% of eligible sites.