From 3a60f435207b6070cc40e757467b11c923f94060 Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Fri, 23 Aug 2024 04:58:48 -0700 Subject: [PATCH] remove 3 unused parameters from AFCH.addTalkPageBanners --- src/modules/core.js | 10 +-- src/modules/submissions.js | 5 +- tests/test-core.js | 128 ++++--------------------------------- 3 files changed, 16 insertions(+), 127 deletions(-) diff --git a/src/modules/core.js b/src/modules/core.js index f2e96bb4..ade01348 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -1648,17 +1648,11 @@ * @param {Array} newWikiProjects Value of the "Add WikiPrjects" part of the form. The is a chips interface called jquery.chosen. Note that if there are existing WikiProject banners on the page, the form will auto-add those to the "Add WikiProjects" part of the form when it first loads. * @param {string} lifeStatus Value of "Is the subject alive?" dropdown list ("unknown", "living", "dead") * @param {string} subjectName Value of the "Subject name (last, first)" text input, or "" if blank - * @param {Array} existingWikiProjects An array of associative arrays. The associative arrays contain the keys: - * 1) {string} displayName (example: Somalia), - * 2) {string} templateName (example: WikiProject Somalia), - * 3) {boolean} alreadyOnPage - * @param {boolean} alreadyHasWPBio - * @param {null} existingWPBioTemplateName * @return {Object} * 1) {string} talkText * 2) {number} wikiProjectBannerCount */ - addTalkPageBanners: function ( talkText, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName, existingWikiProjects, alreadyHasWPBio, existingWPBioTemplateName ) { + addTalkPageBanners: function ( talkText, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName ) { // build an array of all banners already on page var bannerTemplates = 'wikiproject (?!banner)|football|oka'; var bannerTemplateRegEx = new RegExp( '{{(?:' + bannerTemplates + ')[^}]+}}', 'gi' ); @@ -1674,7 +1668,7 @@ var bannerShellRegEx = new RegExp( '{{(?:' + bannerShellTemplates + ')[^}]*}}', 'is' ); talkText = talkText.replace( bannerShellRegEx, '' ); - // trim + // trim. makes unit tests more stable talkText = talkText.trim(); // add AFC banner to array diff --git a/src/modules/submissions.js b/src/modules/submissions.js index e7089fc5..5aa81875 100644 --- a/src/modules/submissions.js +++ b/src/modules/submissions.js @@ -2395,10 +2395,7 @@ data.isBiography, data.newWikiProjects, data.lifeStatus, - data.subjectName, - data.existingWikiProjects, - data.alreadyHasWPBio, - data.existingWPBioTemplateName + data.subjectName ); talkText = results.talkText; diff --git a/tests/test-core.js b/tests/test-core.js index cdf941f8..e480a9c8 100644 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -130,10 +130,7 @@ describe( 'AFCH.addTalkPageBanners', function () { var newWikiProjects = []; var lifeStatus = 'unknown'; var subjectName = ''; - var existingWikiProjects = []; - var alreadyHasWPBio = false; - var existingWPBioTemplateName = null; - var output = AFCH.addTalkPageBanners( talkText, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName, existingWikiProjects, alreadyHasWPBio, existingWPBioTemplateName ); + var output = AFCH.addTalkPageBanners( talkText, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName ); expect( output.talkText ).toBe( `{{WikiProject banner shell| {{subst:WPAFC/article|oldid=592485}} @@ -152,10 +149,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|