Page MenuHomePhabricator

Support single set of index.php parameters for pre-filling new topics for both old-style talk pages and Flow
Open, NormalPublic

Description

This is not for api.php actions. It's for when a script (see e.g. T59989#1499862) wants to prefill a topic title and body without actually saving it.

Both Flow (example) and [old-style talk pages (example)](https://en.wikipedia.org/wiki/User_talk:Mattflaschen-WMF?preloadtitle=Preloaded title&preload=User:Mattflaschen-WMF/Preloaded body example&action=edit&section=new) support this in basically the same way, but with different URL parameters (topiclist_preloadtitle and topiclist_preload vs. preloadtitle, preload, action=edit, section=new). However, that means they need to detect which it is, which is a pain.

I see two main options:

  1. Add a new method to mw.messagePoster.MessagePoster. e.g.

function prefill( subject, bodyTemplate)

That would navigate the user to the appropriate URL (or potentially just return that URL).

  1. Have Flow polyfill (could just be a redirect) index.php?action=edit&section=new&preloadtitle=&preload.

I think #1 is more consistent with what we did for the post use case, but this is somewhat a different issue.

Event Timeline

Mattflaschen-WMF updated the task description. (Show Details)
Mattflaschen-WMF raised the priority of this task from to Needs Triage.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Catrope triaged this task as Normal priority.Aug 5 2015, 11:52 PM
Catrope added a subscriber: Catrope.

I like #2 because people often build these links using parser functions / templates.

Have Flow polyfill (could just be a redirect) index.php?action=edit&section=new&preloadtitle=&preload

This actually looks very easy to do. Flow already handles action=edit (includes/Actions/EditAction.php), in order to redirect to regular non-edit URL.

Change 250959 had a related patch set uploaded (by Bartosz Dziewoński):
Recognize ?action=edit&section=new URLs and redirect to the new topic form

https://gerrit.wikimedia.org/r/250959

Change 250959 abandoned by Bartosz Dziewoński:
Recognize ?action=edit&section=new URLs and redirect to the new topic form

Reason:
I would appreciate if somebody could pick this up, debug and get it merged.

https://gerrit.wikimedia.org/r/250959

I believe the first option was implemented, with the information documented at https://www.mediawiki.org/wiki/Flow/Architecture/API#Posting_a_new_topic_from_on-wiki_JavaScript (?). If that's the only resolution, then further documentation improvements would help, e.g. giving example diffs in a gadget's code.

I believe the first option was implemented, with the information documented at https://www.mediawiki.org/wiki/Flow/Architecture/API#Posting_a_new_topic_from_on-wiki_JavaScript (?). If that's the only resolution, then further documentation improvements would help, e.g. giving example diffs in a gadget's code.

No, MessagePoster finishes the actual post. The user does not have the opportunity to review.

A pre-fill link like https://www.mediawiki.org/wiki/User_talk:Mattflaschen-WMF?topiclist_preloadtitle=Preloaded%20title&topiclist_preload=User:Mattflaschen-WMF/Preloaded%20body%20example lets the user change whatever they want before saving.

Both Flow and core support this, but with different URLs.

matmarex renamed this task from Support single API for pre-filling new topics for both old-style talk pages and Flow to Support single set of index.php parameters for pre-filling new topics for both old-style talk pages and Flow.Mar 8 2016, 12:10 AM