User:Qwerfjkl/scripts/massXFD.js: Difference between revisions

Content deleted Content added
m Fix duplicate notcies bug (hopefully) (via CAE)
(semi-)fix bug where nominating redirects in (any) talk namespace caused the script to use Undefined instead of the redirect title [Factotum]
Line 6:
 
// 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 703 ⟶ 706:
.then(response => {
response.forEach(user => {
if (window.debuggingMode) console.log(user);
if (user
&& (!user.blockexpiry || user.blockexpiry !== "infinite" || 'blockpartial' in user)
Line 1,329 ⟶ 1,332:
 
var [redirectTargets, nonredirects] = await createRedirectTargetsList(allTitles);
if (window.debuggingMode) console.log(`Redirect targets: ${JSON.stringify(redirectTargets)}`);
// console.log(Object.values(redirectTargets).map(title => {
// let page = new mw.Title(title)
// return page.getTalkPage().getPrefixedText()
// }))
// console.log([... new Set(Object.values(redirectTargets).map(title => {
// let page = new mw.Title(title)
// return page.getTalkPage().getPrefixedText()
// }))])
// window.batches=batches
batches[0].titles = Object.keys(batches[0].titles)
Line 1,452 ⟶ 1,464:
 
if (data.id === 'rfd-notify-target') {
data.textToModify// = data.textToModify.replace('${redirectTitle}', getKeyByValue(redirectTargets,is a placeholder for the redirect newbeing mw.Title(title).getSubjectPage().getPrefixedText()));nominated
// this code needs a more intelligent way of checking which redirect was tagged.
data.textToModify = data.textToModify.replace('${redirectTitle}', getKeyByValue(redirectTargets, new mw.Title(title).getPrefixedText()) ?? getKeyByValue(redirectTargets, new mw.Title(title).getSubjectPage().getPrefixedText()) ?? "");
}
 
Line 1,574 ⟶ 1,588:
batchesToProcess.push({
id: 'rfd-notify-target',
titles: [... new Set(Object.values(redirectTargets).map(title => {
let page = new mw.Title(title)
return page.getTalkPage().getPrefixedText()