Many user scripts and gadgets, such as Twinkle, UserMessages, etc., need to post on various talk pages.
With the development of Flow, there are now two possible types of talk pages to deal with (not counting LQT, which this solution does not handle), old-style and Flow. User talk pages are already starting to use Flow on a very limited opt-in basis (I think the number is still less than I have fingers).
Now, you can use MessagePoster to post to a page without knowing this information ahead of time. The documentation is at https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.messagePoster.f... , and you can see an example of how it's used at https://git.wikimedia.org/blob/mediawiki%2Fcore.git/977f7ad8ade23a7ce5326a99... .
Feel free to reply, or ask on #wikimedia-collaboration, if you have any questions.
Matt Flaschen
Thanks for thinking of tools like Twinkle!
I wonder why this couldn't be implemented directly as an API action, though. That would probably be helpful to bots and non-JS-based tools, as well as to Twinkle itself (since we use our own XML-based MediaWiki API wrapper for consistent error handling and user experience).
TTO
"Matthew Flaschen" wrote in message news:556E561F.9090007@wikimedia.org...
Many user scripts and gadgets, such as Twinkle, UserMessages, etc., need to post on various talk pages.
With the development of Flow, there are now two possible types of talk pages to deal with (not counting LQT, which this solution does not handle), old-style and Flow. User talk pages are already starting to use Flow on a very limited opt-in basis (I think the number is still less than I have fingers).
Now, you can use MessagePoster to post to a page without knowing this information ahead of time. The documentation is at https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.messagePoster.f... , and you can see an example of how it's used at https://git.wikimedia.org/blob/mediawiki%2Fcore.git/977f7ad8ade23a7ce5326a99... .
Feel free to reply, or ask on #wikimedia-collaboration, if you have any questions.
Matt Flaschen
_______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 06/03/2015 08:07 AM, This, that and the other wrote:
Thanks for thinking of tools like Twinkle!
I wonder why this couldn't be implemented directly as an API action, though.
We considered this (https://phabricator.wikimedia.org/T59989) and decided against it.
Since the internals are different (Flow posts are fully versioned, but they are not 'pages' at the MW core level), we were concerned that the shim would be leaky (responses would be kinda sorta right, but not when you did something deeper, and error responses would probably be even wronger).
So there is of course a public documented API (https://www.mediawiki.org/w/api.php?action=help&modules=flow%20new-topic) for creating new Flow topics, but it is not the same API as for posting sections (nor is there a shim).
That would probably be helpful to bots and non-JS-based tools, as well as to Twinkle itself (since we use our own XML-based MediaWiki API wrapper for consistent error handling and user experience).
For bots, Alexander Jones is working on https://phabricator.wikimedia.org/T67119 to add Flow support to Pywikibot (John Vandenberg and I are mentoring).
Not all bots use Pywikibot, but that should lead the way and other library and bot developers can learn from the solutions implemented there.
No one has an obligation to use MessagePoster. There are other ways to solve the problem (basically, check the content model of the target page then do what you want).
For many developers, I think MessagePoster will be pretty simple. For Twinkle, you'll have to decide whether it can fit into your architecture.
Best,
Matt Flaschen
wikitech-l@lists.wikimedia.org