mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-15 02:54:23 +00:00
Send thank for the right link
Due to confusion between $thankLinks (plural) and $thankLink (singular), clicking any thank link was sending thank for the first thankable revision on the page. Introduced in I9097bd976f8da1632577a3f4438b9f1186baca88 Bug: T187757 Change-Id: I7993531206c46657908a66d73369928ccf5dc677
This commit is contained in:
parent
29aa780fed
commit
3f139b3dd2
|
@ -58,24 +58,33 @@
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add interactive handlers to all 'thank' links in $content
|
||||
*
|
||||
* @param {jQuery} $content
|
||||
*/
|
||||
function addActionToLinks( $content ) {
|
||||
var $thankLink = $content.find( 'a.mw-thanks-thank-link' );
|
||||
var $thankLinks = $content.find( 'a.mw-thanks-thank-link' );
|
||||
if ( mw.config.get( 'thanks-confirmation-required' ) ) {
|
||||
$thankLink.confirmable( {
|
||||
i18n: {
|
||||
confirm: mw.msg( 'thanks-confirmation2', mw.user ),
|
||||
no: mw.msg( 'cancel' ),
|
||||
noTitle: mw.msg( 'thanks-thank-tooltip-no', mw.user ),
|
||||
yes: mw.msg( 'thanks-button-thank', mw.user, $thankLink.data( 'recipient-gender' ) ),
|
||||
yesTitle: mw.msg( 'thanks-thank-tooltip-yes', mw.user )
|
||||
},
|
||||
handler: function ( e ) {
|
||||
e.preventDefault();
|
||||
sendThanks( $thankLink, $thankLink.closest( '.jquery-confirmable-wrapper' ) );
|
||||
}
|
||||
$thankLinks.each( function () {
|
||||
var $thankLink = $( this );
|
||||
$thankLink.confirmable( {
|
||||
i18n: {
|
||||
confirm: mw.msg( 'thanks-confirmation2', mw.user ),
|
||||
no: mw.msg( 'cancel' ),
|
||||
noTitle: mw.msg( 'thanks-thank-tooltip-no', mw.user ),
|
||||
yes: mw.msg( 'thanks-button-thank', mw.user, $thankLink.data( 'recipient-gender' ) ),
|
||||
yesTitle: mw.msg( 'thanks-thank-tooltip-yes', mw.user )
|
||||
},
|
||||
handler: function ( e ) {
|
||||
e.preventDefault();
|
||||
sendThanks( $thankLink, $thankLink.closest( '.jquery-confirmable-wrapper' ) );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} else {
|
||||
$thankLink.click( function ( e ) {
|
||||
$thankLinks.click( function ( e ) {
|
||||
var $thankLink = $( this );
|
||||
e.preventDefault();
|
||||
sendThanks( $thankLink, $thankLink );
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue