When using Realtime Preview and Live preview, the templates listed at "Template used in this preview" at the bottom of the page lose the edit link and protection status on the right
See screenshot:
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Invalid | None | T41272 Bugs in "Live preview" feature (tracking) | |||
Resolved | Samwilson | T321032 When using preview, the edit link and protection status is lost in "Template used in this preview" | |||
Resolved | BUG REPORT | TheresNoTime | T334518 Hidden Categories below the templates in edit isn't greyed out while loading | ||
Resolved | BUG REPORT | Ammarpad | T333808 Live preview incorrectly shows transclusions that are blue links in red | ||
Resolved | BUG REPORT | Samwilson | T335624 Live preview can send hundreds of requests at once to get protection level messages |
Event Timeline
One issue with this is that the existing edit link says 'edit' or 'show source' as appropriate given the current user's rights. To do this in live preview I think will require a separate API call to find out if the templates are editable. That's not too bad is it?
Change 844318 had a related patch set uploaded (by Samwilson; author: Samwilson):
[mediawiki/core@master] Dynamically update template list for live preview
Test wiki created on Patch demo by Shizhao using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/7a50bbe023/w
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/844318/comments/b1a0b3ec_9bbe2069
template list always appears
Change 844318 merged by jenkins-bot:
[mediawiki/core@master] Dynamically update template list for live preview
@Samwilson I got a (⧼restriction-level-templateeditor⧽) when I went to RTP. It was (template editor protected) before as seen in the screenshots below.
Test link: https://en.wikipedia.beta.wmflabs.org/w/index.php?title=T327354:Real-time_preview_(and_live_preview)_don%E2%80%99t_highlight_redirects_in_italic;_Bug_Report&action=edit
OS: macOS 13.0
Browser: Chrome 109
RTP
No RTP
Good catch, thanks! This is because the restriction-level-templateeditor message is not available on the front end, so needs to be loaded separately.
Dom pointed out another issue here (from T327354#8620988):
We can fix the 414 error by POSTing the prop=info call, but we'll also need to handle multiple calls when the number of templates is over 50/500.
Change 890226 had a related patch set uploaded (by Samwilson; author: Samwilson):
[mediawiki/core@master] Template list in previews: Look up missing restriction level messages
In zhwiki, “MediaWiki:Template-protected” message displayed as wikitext when previewing, not parsed as HTML. Seems to be the same problem?
In zhwiki, “MediaWiki:Template-protected” message displayed as wikitext when previewing, not parsed as HTML. Seems to be the same problem?
Good catch, I've updated the above patch to also fix that.
Change 890226 merged by jenkins-bot:
[mediawiki/core@master] Template list in previews: Look up missing restriction level messages
@Samwilson I have found a few articles on production with over 500 templates (List_of_protected_areas_of_South_Africa, Shanghai, Foreign_relations_of_Taiwan). Should we limit and paginate the request to handle this? Otherwise RTP/Live preview won't show newly added templates in the list.
@dom_walden Thanks, those are useful examples. I think you're right, it should be paginated. For most cases, there will only be one page required, so it won't be any worse performance.
Change 901329 had a related patch set uploaded (by Samwilson; author: Samwilson):
[mediawiki/core@master] Live preview: batch requests for template list with max 500 titles
Change 901329 merged by jenkins-bot:
[mediawiki/core@master] page.preview: batch requests for template list with max 50 titles
@Samwilson Please see the following below.
Test link: https://zh.wikipedia.org/w/index.php?title=%E6%A2%85%E5%84%92%E7%91%9E&action=edit
The links above do not get those errors anymore but if the speed to load is fine for https://en.wikipedia.beta.wmflabs.org/wiki/TemplateUsageArticle678 with you, then I can move this to Done.
Thanks!
The links above do not get those errors anymore but if the speed to load is fine for https://en.wikipedia.beta.wmflabs.org/wiki/TemplateUsageArticle678 with you, then I can move this to Done.
I think a large number of templates like on that page will likely always be slow. We can revisit if need be, but for now I'd say it's okay.
@Samwilson Since this ticket is regarding "Template used in this preview", I created T334518: Hidden Categories below the templates in edit isn't greyed out while loading since the "This page is a member of a hidden category:" dropdown is not greyed during loading. I will move this ticket to "Done" though. Thanks for everyone's help!
Test link: https://en.wikipedia.beta.wmflabs.org/wiki/TemplateUsageArticle678