Re: [Wikitech-l] Post to a talk page without knowing whether it'sold-style or Flow

2015-06-04 Thread Matthew Flaschen

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=helpmodules=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 mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Post to a talk page without knowing whether it'sold-style or Flow

2015-06-03 Thread This, that and the other

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.9090...@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.factory
, and you can see an example of how it's used at
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/977f7ad8ade23a7ce5326a993bdf48c8beb42db0/resources%2Fsrc%2Fmediawiki%2Fmediawiki.feedback.js
.

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 




___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l