Harej has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/350794 )
Change subject: Change how addSelf function works ...................................................................... Change how addSelf function works Before, I had it do an API lookup to get a URL. This added a lot of complication to the process and it turns out I can synthesize the URL myself using the page ID. So I got rid of all that and made the process a lot more efficient. Bug: T163410 Change-Id: I146caa1f9574ea1e2f04d1e8315fed4c331565fc --- M modules/ext.CollaborationKit.list.members.js 1 file changed, 8 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit refs/changes/94/350794/1 diff --git a/modules/ext.CollaborationKit.list.members.js b/modules/ext.CollaborationKit.list.members.js index 67cc895..444cc24 100644 --- a/modules/ext.CollaborationKit.list.members.js +++ b/modules/ext.CollaborationKit.list.members.js @@ -53,9 +53,8 @@ * One-click project-joining button * * @param {number} destinationPage Page ID of member list, if different from current page - * @param {string} destinationUrl Full URL of member list, if different from current page */ - addSelf = function ( destinationPage, destinationUrl ) { + addSelf = function ( destinationPage ) { if ( destinationPage === undefined ) { destinationPage = mw.config.get( 'wgArticleId' ); } @@ -84,11 +83,7 @@ res.content.columns[ 0 ].items[ index ] = itemToAdd; res.summary = mw.msg( 'collaborationkit-list-add-self-summary', itemToAdd.title ); LE.saveJson( res, function () { - if ( destinationUrl === undefined ) { - location.reload(); - } else { - window.location = destinationUrl; - } + window.location.href = 'index.php?curid=' + destinationPage; } ); } ); @@ -102,21 +97,14 @@ if ( mw.config.get( 'wgCollaborationKitAssociatedMemberList' ) && !mw.user.isAnon() ) { memberListPage = mw.config.get( 'wgCollaborationKitAssociatedMemberList' ); curUserIsInList( memberListPage ); // removes Join button if user already is member - new mw.Api().get( { - action: 'query', - prop: 'info', - inprop: 'url', - pageids: memberListPage - } ).done( function ( data ) { - var memberListUrl = data.query.pages[ memberListPage ].fullurl; - $( '.mw-ck-members-join a' ) - .attr( 'href', memberListUrl ); - $( '.mw-ck-members-join' ).on( 'click', function () { - addSelf( memberListPage, memberListUrl ); - } ); + $( '.mw-ck-members-join a' ) + .attr( 'href', '#' ); + + $( '.mw-ck-members-join' ).on( 'click', function () { + addSelf( memberListPage ); } ); - } + }; if ( mw.config.get( 'wgCollaborationKitIsMemberList' ) && !curUserIsInList() && !mw.user.isAnon() // Workflow assumes existence of username -- To view, visit https://gerrit.wikimedia.org/r/350794 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I146caa1f9574ea1e2f04d1e8315fed4c331565fc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CollaborationKit Gerrit-Branch: master Gerrit-Owner: Harej <jamesmh...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits