mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-27 16:20:12 +00:00
build: Updating npm dependencies
* eslint-config-wikimedia: 0.27.0 → 0.28.0 * grunt-stylelint: 0.19.0 → 0.20.0 * stylelint-config-wikimedia: 0.16.1 → 0.17.1 Change-Id: I0f57a77c738f26a0cda10af9f3891d4beee447d9
This commit is contained in:
parent
3e2df70e2e
commit
830bfffa5c
|
@ -4,7 +4,7 @@
|
|||
const attrName = 'data-revision-id';
|
||||
|
||||
function reloadThankedState() {
|
||||
$( 'a.mw-thanks-thank-link' ).each( function ( idx, el ) {
|
||||
$( 'a.mw-thanks-thank-link' ).each( ( idx, el ) => {
|
||||
const $thankLink = $( el );
|
||||
if ( mw.thanks.thanked.contains( $thankLink.attr( attrName ) ) ) {
|
||||
$thankLink.before(
|
||||
|
@ -54,13 +54,13 @@
|
|||
( new mw.Api() ).postWithToken( 'csrf', apiParams )
|
||||
.then(
|
||||
// Success
|
||||
function () {
|
||||
() => {
|
||||
$thankElement.before( mw.message( 'thanks-thanked', mw.user, $thankLink.data( 'recipient-gender' ) ).escaped() );
|
||||
$thankElement.remove();
|
||||
mw.thanks.thanked.push( $thankLink.attr( attrName ) );
|
||||
},
|
||||
// Fail
|
||||
function ( errorCode ) {
|
||||
( errorCode ) => {
|
||||
// If error occurred, enable attempting to thank again
|
||||
$thankLink.data( 'clickDisabled', false );
|
||||
let msg;
|
||||
|
@ -123,11 +123,11 @@
|
|||
$( reloadThankedState );
|
||||
}
|
||||
|
||||
$( function () {
|
||||
$( () => {
|
||||
addActionToLinks( $( 'body' ) );
|
||||
} );
|
||||
|
||||
mw.hook( 'wikipage.diff' ).add( function ( $content ) {
|
||||
mw.hook( 'wikipage.diff' ).add( ( $content ) => {
|
||||
addActionToLinks( $content );
|
||||
} );
|
||||
}() );
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
}
|
||||
|
||||
function reloadThankedState() {
|
||||
$( 'a.mw-thanks-flow-thank-link' ).each( function ( idx, el ) {
|
||||
$( 'a.mw-thanks-flow-thank-link' ).each( ( idx, el ) => {
|
||||
const $thankLink = $( el );
|
||||
if ( mw.thanks.thanked.contains( $thankLink.closest( '.flow-post' ).attr( attrName ), cookieName ) ) {
|
||||
const author = findPostAuthorFromThankLink( $thankLink );
|
||||
mw.thanks.getUserGender( author )
|
||||
.done( function ( recipientGender ) {
|
||||
.done( ( recipientGender ) => {
|
||||
$thankLink.before(
|
||||
$thankedLabel
|
||||
.clone()
|
||||
|
@ -37,13 +37,13 @@
|
|||
} )
|
||||
.then(
|
||||
// Success
|
||||
function () {
|
||||
() => {
|
||||
const author = findPostAuthorFromThankLink( $thankLink );
|
||||
// Get the user who was thanked (for gender purposes)
|
||||
return mw.thanks.getUserGender( author );
|
||||
},
|
||||
// Failure
|
||||
function ( errorCode ) {
|
||||
( errorCode ) => {
|
||||
switch ( errorCode ) {
|
||||
case 'ratelimited':
|
||||
OO.ui.alert( mw.msg( 'thanks-error-ratelimited', mw.user ) );
|
||||
|
@ -53,7 +53,7 @@
|
|||
}
|
||||
}
|
||||
)
|
||||
.then( function ( recipientGender ) {
|
||||
.then( ( recipientGender ) => {
|
||||
const $thankUserLabel = $thankedLabel.clone();
|
||||
$thankUserLabel.append(
|
||||
mw.msg( 'thanks-button-thanked', mw.user, recipientGender )
|
||||
|
|
|
@ -60,15 +60,11 @@
|
|||
usprop: 'gender'
|
||||
} )
|
||||
.then(
|
||||
function ( result ) {
|
||||
return (
|
||||
result.query.users[ 0 ] &&
|
||||
( result ) => (
|
||||
result.query.users[ 0 ] &&
|
||||
result.query.users[ 0 ].gender
|
||||
) || 'unknown';
|
||||
},
|
||||
function () {
|
||||
return 'unknown';
|
||||
}
|
||||
) || 'unknown',
|
||||
() => 'unknown'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
$elements = $(),
|
||||
self = this;
|
||||
|
||||
selectors.forEach( function ( sel ) {
|
||||
selectors.forEach( ( sel ) => {
|
||||
$elements = $elements.add( jQueryFindWithParent( self, sel ) );
|
||||
} );
|
||||
|
||||
|
|
3374
package-lock.json
generated
3374
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -6,13 +6,13 @@
|
|||
"test": "grunt test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-config-wikimedia": "0.27.0",
|
||||
"eslint-config-wikimedia": "0.28.0",
|
||||
"grunt": "1.6.1",
|
||||
"grunt-banana-checker": "0.13.0",
|
||||
"grunt-contrib-watch": "1.1.0",
|
||||
"grunt-eslint": "24.3.0",
|
||||
"grunt-stylelint": "0.19.0",
|
||||
"stylelint-config-wikimedia": "0.16.1",
|
||||
"grunt-stylelint": "0.20.0",
|
||||
"stylelint-config-wikimedia": "0.17.1",
|
||||
"svgo": "3.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ QUnit.module( 'Thanks thank', QUnit.newMwEnvironment( {
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'thanked cookie', function ( assert ) {
|
||||
QUnit.test( 'thanked cookie', ( assert ) => {
|
||||
const thankId = '8';
|
||||
const thankIdNonExisting = '13';
|
||||
|
||||
|
@ -26,17 +26,17 @@ QUnit.test( 'thanked cookie', function ( assert ) {
|
|||
} );
|
||||
|
||||
QUnit.test( 'gets user gender', function ( assert ) {
|
||||
this.server.respond( /user1/, function ( request ) {
|
||||
this.server.respond( /user1/, ( request ) => {
|
||||
request.respond( 200, { 'Content-Type': 'application/json' },
|
||||
'{"batchcomplete":"","query":{"users":[{"userid":1,"name":"user1","gender":"male"}]}}'
|
||||
);
|
||||
} );
|
||||
this.server.respond( /user2/, function ( request ) {
|
||||
this.server.respond( /user2/, ( request ) => {
|
||||
request.respond( 200, { 'Content-Type': 'application/json' },
|
||||
'{"batchcomplete":"","query":{"users":[{"userid":2,"name":"user2","gender":"unknown"}]}}'
|
||||
);
|
||||
} );
|
||||
this.server.respond( /user3/, function ( request ) {
|
||||
this.server.respond( /user3/, ( request ) => {
|
||||
request.respond( 200, { 'Content-Type': 'application/json' },
|
||||
'{"batchcomplete":"","query":{"users":[{"name":"user3","missing":""}]}}'
|
||||
);
|
||||
|
@ -47,15 +47,15 @@ QUnit.test( 'gets user gender', function ( assert ) {
|
|||
const nonExistingUser = mw.thanks.getUserGender( 'user3' );
|
||||
const done = assert.async( 3 );
|
||||
|
||||
maleUser.then( function ( recipientGender ) {
|
||||
maleUser.then( ( recipientGender ) => {
|
||||
assert.strictEqual( recipientGender, 'male', 'gender for male user' );
|
||||
done();
|
||||
} );
|
||||
unknownGenderUser.then( function ( recipientGender ) {
|
||||
unknownGenderUser.then( ( recipientGender ) => {
|
||||
assert.strictEqual( recipientGender, 'unknown', 'gender for unknown-gender user' );
|
||||
done();
|
||||
} );
|
||||
nonExistingUser.then( function ( recipientGender ) {
|
||||
nonExistingUser.then( ( recipientGender ) => {
|
||||
assert.strictEqual( recipientGender, 'unknown', 'gender for non-existing user' );
|
||||
done();
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue