Skip to content

Instantly share code, notes, and snippets.

@edg2s
Created March 20, 2016 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edg2s/f7db01d240ad3c83d183 to your computer and use it in GitHub Desktop.
Save edg2s/f7db01d240ad3c83d183 to your computer and use it in GitHub Desktop.
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