Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
new mw.Api().get( {
action: 'query',
list: 'recentchanges',
rcuser: mw.user.getName(),
rcprop: 'comment',
rctype: 'edit',
rclimit: 50
} ).then( function ( response ) {
var comments, usedComments = {},
changes = ve.getProp( response, 'query', 'recentchanges' ) || [];
comments = changes.map( function ( change ) {
// Remove section /* headings */
return change.comment.replace( /\/\*.+?\*\//g, '' ).trim();
} );
// Filter out duplicates and empty comments
comments = comments.filter( function ( comment ) {
var exists;
exists = usedComments.hasOwnProperty( comment );
usedComments[ comment ] = true;
return !exists && comment;
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment