Content deleted Content added
Fix major bug where it used undefined for RFD nominations due to inocrrect format of titles object [Factotum] |
Two minor bug fixes -- author list breaking with false author, and cl doubling Category: [Factotum] |
||
Line 5:
// Function to wipe the text content of the page inside #bodyContent
// update normalise function for CfD - use mw.Title() -- this will solve bugs like title input as ":foo"
function capitalise(s) {
return s[0].toUpperCase() + s.slice(1);
Line 687:
// Function to create a list of page authors and filter duplicates
async function createAuthorList(titles) {
var authorList = [];
var promises = titles.map(function (title) {
Line 695 ⟶ 694:
const authors = await Promise.all(promises);
let queryBatchSize = 50;
let authorTitles = authors.filter(Boolean).map(author => author.replace(/ /g, '_')); // Replace spaces with underscores, remove false values
let filteredAuthorList = [];
for (let i = 0; i < authorTitles.length; i += queryBatchSize) {
Line 763 ⟶ 762:
function editPage(options) {
const localOptions = deepCopy(options);
localOptions.text = localOptions.textToModify;
const api = new mw.Api();
Line 802 ⟶ 800:
requestData.text = localOptions.text;
}
return new Promise((resolve, reject) => {
Line 1,343 ⟶ 1,339:
if (!Object.keys(redirectTargets).length) {
var errorMessageElement = createErrorMessage('None of the titles are redirects, aborting.');
Line 1,349 ⟶ 1,344:
return;
}
if (nonredirects.length) {
let nonredirectsWarningMessage = createWarningMessage();
Line 1,367 ⟶ 1,361:
bodyContent.append(fetchedRedirectsElement.$element);
}
Line 1,394 ⟶ 1,387:
}
if (!Array.isArray(options.titles)) {
Line 1,465 ⟶ 1,456:
data.title = title;
const promise = editPage(data);
Line 1,538 ⟶ 1,528:
}
}
nominationText += `:* '''Propose ${action}''' {{${categoryTemplateDropdown.getValue()}|${categoryTemplateDropdown.getValue() === 'cl' ? page.replace(/^ *Category:/i, '') : page }}}${targetText}\n`;
} else {
nominationText += config.displayTemplate.replaceAll('${pageName}', page).replaceAll('${redirectTarget}', redirectTargets[page]) + '\n';
|