[go: up one dir, main page]

Page MenuHomePhabricator

"Preview page with this template" should only accept/suggest pages that transclude the template
Open, Needs TriagePublic

Description

I've hit "Show preview" many times and wondered why my changes weren't applied only to realize I was editing /sandbox and the page was using the live version, or something to that effect.

Previewing a page that does not transclude the template you're editing should give you a warning instead of showing you the completely unaltered version of the page.

Likewise, the autocomplete function of the "Page title" textbox should only suggest pages that transclude the template you're editing.

2021-03-31_234053_751x149_screenshot.png (149×751 px, 19 KB)
(image borrowed from T279021)

Event Timeline

(Your use of my image has summoned me...woooo....👻)

If this doesn't get picked up and you're desperate, a JS script can do this fairly easily with the embeddedin list on the API

@Inductiveload Can you elaborate? embeddedin doesn't seem to accept prefixes. So it has to either get all pages transcluding the template first (which wouldn't work well for editing a template with >5000 transclusions) or query templates prop in generator=prefixsearch (which is inefficient as it returns all pages with the prefix and then checks for those that use the template). Or is there a neater way?

I don't really have a better idea than what you said, it was just a thought that might scratch an itch until this gets done properly.

I see, thanks for the suggestion anyway.

(Nardog subsequently wrote a script for this, it's TemplatePreviewGuard. This really should still just be in core.)

@Izno It's not quite what this task is asking for, though, as it just checks when you click the button. It wouldn't be difficult to implement it since it's just a script, but I also believe the PHP side should just give you an error instead of the unaltered version of the page.