-
Notifications
You must be signed in to change notification settings - Fork 55
Description
When making changes to existing content (e.g. not appending or prepending text), it is important that bots don't accidentally overwrite edits by other users.
The way bots should do this to, when fetching the existing content, pass the revision timestamp to the edit module. This way, if another edit has been made since then, the edit will be rejected. At this point the bot can either try again, or skip the item for the time being.
mwbot provides a getArticle method, but it doesn't expose any meta data besides the page content.
Please provide an easy way for developers to use mwbot to make edits in a way that doesn't cause human edits to be overwritten by default. It should perhaps be an option to ignore conflicts, but by default it probably should not ignore conflicts.
Ideas:
// getPage(string name) -> API query revisions, rvprop=content|timestamp
client.getPage(name, function (err, data) {
// data.title
// data.content
// data.timestamp
var newContent = change(data.content);
// Method 1: edit( pageName, content, summary, params, callback )
client.edit(data.title, newContent, '', { basetimestamp: data.timestamp, fn(err,data) });
// Method 2: edit( string|Object pageData, content, summary, calllback )
client.edit(data, newContent, '', function (err, data) { });
});
The second method is probably easiest and encourages developers to use it without hardcoding details of parameters.