Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
Line 1:
// Wikipedia User Block & Activity Checker for common.js
// Checks if users are blocked and if they've been active in the last 12 months
// Features: maxlag support, HTTP error handling, exponential backoff retry (1min, 3min, 5min), deduplication
async function checkUserBlocks() {
Line 76:
async function processUsers(input, dialog) {
const
const users = deduplicateUsers(allUsers);
if (users.length === 0) {
Line 86 ⟶ 87:
$('#status-area').show();
const statusDiv = $('#status-text');
statusDiv.html(`<div>Checking ${users.length} users for blocks and activity (last 12 months)...</div>`);▼
// Show deduplication info if there were duplicates
const duplicateCount = allUsers.length - users.length;
if (duplicateCount > 0) {
statusDiv.html(`<div>Found ${allUsers.length} usernames, removed ${duplicateCount} duplicates.</div><div>Checking ${users.length} unique users for blocks and activity (last 12 months)...</div>`);
console.log(`Found ${allUsers.length} usernames, removed ${duplicateCount} duplicates.`);
} else {
▲ statusDiv.html(`<div>Checking ${users.length} users for blocks and activity (last 12 months)...</div>`);
}
scrollStatusToBottom();
Line 197 ⟶ 206:
return users;
}
function deduplicateUsers(users) {
const seen = new Set();
const uniqueUsers = [];
for (const user of users) {
// Use lowercase username for comparison to handle case variations
const normalizedUsername = user.username.toLowerCase();
if (!seen.has(normalizedUsername)) {
seen.add(normalizedUsername);
uniqueUsers.push(user);
}
}
return uniqueUsers;
}
|