#57709 closed defect (bug) (fixed)
Links to the editor don't work for template and template parts revisions in the revisions screen
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | blocker | Version: | |
Component: | Revisions | Keywords: | has-patch dev-reviewed commit |
Focuses: | ui | Cc: |
Description
In https://github.com/WordPress/gutenberg/pull/45215 the template and template part editors gained a button that links to the revisions screen for the edited template and template part.
The problem is that in the revisions screen there are two links that should link back to the editor which don't work (one with the template name and another one with the text "go to editor").
In the post editor (block editor) going to the revisions screen will set these links to a shape of:
/wp-admin/post.php?post=3594&action=edit
In the template editor going to the revisions screen will set these links to a shape of:
/wp-admin/revision.php?revision=4068&gutenberg=true
, which is the URI of the revisions screen itself.
I've put this for 6.2 since it is a blocker for #57704
Change History (27)
#2
@
2 years ago
- Milestone changed from 6.2 to 6.3
Hi @audrasjb
I’ve looked into this and:
- the links are wrong because template and template part CPTs do not have the internal
_edit_link
set when they get registered - the shape of an
_edit_link
is completely different from that of posts or pages - for examplesite-editor.php?postId=twentytwentythree//header&action=edit&canvas=edit&path=/template-parts/single&postType=wp_template_part
get_edit_post_link
needs some multiple lines to accommodate this
This is hardly justified to rush and has the potential to break WP admin :)
This ticket was mentioned in PR #4212 on WordPress/wordpress-develop by @andraganescu.
2 years ago
#3
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/57709
@andraganescu commented on PR #4212:
2 years ago
#5
Ooops I missed that part! Thank you @ocean90
This ticket was mentioned in PR #4229 on WordPress/wordpress-develop by @andraganescu.
2 years ago
#6
Trac ticket: https://core.trac.wordpress.org/ticket/57709
Trac ticket:
@andraganescu commented on PR #4229:
2 years ago
#7
Thanks for the review @spacedmonkey I've committed all your suggestions, will check to see how it works now.
@andraganescu commented on PR #4229:
2 years ago
#8
Applied @anton-vlasenko 's feedback as well. @azaozz had some concerns over how we're using slugs initially. In light of #49164 I don't know if this fix should land or some new way of solving the problem with posts existing on disk 1st should be thought of? cc @youknowriad
@youknowriad commented on PR #4229:
2 years ago
#9
Personally, I think a fix like this PR or similar is the way to go. Reverting to using auto-drafts and all for template and template parts is way too impactful and it's not clear how it would solve the initial issues we had with that approach.
@andraganescu commented on PR #4229:
2 years ago
#10
I fixed the failing tests, let me know if there is anything else needed for this patch to land 🙏🏻
#12
@
2 years ago
Test Report
This report validates that the indicated patch addresses the issue.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/4229
Environment
- WordPress: 6.3-alpha-55505-src
- PHP: 8.0.27
- Server: Apache/2.4.55 (Unix) PHP/8.0.27
- Database: mysqli (Server: 5.7.38 / Client: mysqlnd 8.0.27)
- Browser: Safari 16.4 (macOS)
- Theme: Twenty Twenty-Two - WordPress.com 1.2
- MU-Plugins: None activated
- Plugins:
- Gutenberg 15.5.1
Steps to Reproduce
- Enable Gutenberg.
- Go to the Editor, create your own template part.
- Modify your template by adding a paragraph block, then add another paragraph block, and save it multiple times.
- Open the "Template" tab, click on the "X Revisions" link as shown in the screenshot below:
- In the header, click on the links in the header (as shown below):
Expected Results
- ✅ The links should take you back to the "Edit template" page.
Actual Results
- ❌ The links don't work. Nothing happens when I click on them.
After applying the patch
- ✅ The links take you back to the Edit template page.
Additional Notes
- I have only tested the template parts functionality.
@ramonopoly commented on PR #4229:
2 years ago
#13
Thanks for working on this bug. I started without seeing this one.
We could probably add some tests as well.
I have some here: https://github.com/WordPress/wordpress-develop/pull/4326 if you want to pull them across.
#14
@
2 years ago
Might be worth adding tests for get_edit_post_link()
I couldn't find any. I added some to cover the expected functionality over in
https://github.com/WordPress/wordpress-develop/pull/4326 if you want to pull them across.
#15
@
2 years ago
Tested:
- WordPress 6.3-alpha-55505-src
- Gutenberg Version 15.6.0-rc.1
Can confirm the edit links work for template and template parts
Post and page edit links work as before.
@andraganescu commented on PR #4229:
2 years ago
#16
@ramonjd I included the tests you added 👏🏻 , the edit link for the global styles post type and the comment update. I didn;t understand what you asked about context and encoding ampersand.
@anton-vlasenko not sure if these additions require new testing if the tests pass 🙏🏻
@andraganescu commented on PR #4229:
2 years ago
#17
The tests don't pass :)) will check them out.
@andraganescu commented on PR #4229:
2 years ago
#18
Hmm. Still not fixed the new tests. Will loop back on this.
#19
@
2 years ago
- Keywords commit added
@antonvlasenko said:
Thanks for working on this, @draganescu.
The code looks good to me.
Not sure why Trac didn't pick it up :P
#20
@
2 years ago
Adding additional test results as a confidence check re: comment:16 👍🏻
Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/4229
Environment
- Hardware: MacBook Pro Apple M1 Pro
- OS: macOS 13.3.1
- Browser: Safari 16.4
- Server: nginx/1.23.4
- PHP: 7.4.33
- WordPress: 6.3-alpha-55505-src
- Theme: twentytwentythree v1.1
- Active Plugins:
- gutenberg v15.6.0-rc.2
Actual Results
- ✅ The "Go to editor" and template links on revisions page navigate back to the editor screen.
- ✅ PHPunit tests pass (see comment:18).
Supplemental Artifacts
Before Patch | After Patch |
---|---|
![]() | ![]() |
23 months ago
#21
Where are we at here? It's holding up my ability to test this more broadly in the FSE Outreach Program and, with all of the work on revisions, I want to ensure we get some solid feedback!
@andraganescu commented on PR #4229:
23 months ago
#22
I think it just needs someone to commit it.
@davidbaumwald commented on PR #4229:
23 months ago
#26
Merged into core in https://core.trac.wordpress.org/changeset/55743.
@andraganescu commented on PR #4229:
23 months ago
#27
Thank you @dream-encode !
Hello @andraganescu, if we want to fix this issue in 6.2, we'll have to get a patch ready in the next few hours, because #57704 is an enhancement and should even be in the milestone anymore (we're one week pas beta 1).