Module:Rfx and Module:Rfx/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
replace checks for categories with a call to mw.title’s `categories` |
move out here |
||
Line 90: | Line 90: | ||
end |
end |
||
end |
end |
||
return false |
|||
end |
|||
local function hasCategory(category, catList) |
|||
for _, c in ipairs(catList) do |
|||
if c == category then |
|||
return true |
|||
end |
|||
end |
|||
return false |
return false |
||
end |
end |
||
Line 157: | Line 147: | ||
-- Switch to reconfirmation request for adminship if in that category |
-- Switch to reconfirmation request for adminship if in that category |
||
if umatch( |
|||
local categories = title.categories |
|||
pageText, |
|||
if hasCategory('Reconfirmation requests for adminship', categories) then |
|||
'%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*[rR]econfirmation requests for adminship(.-)[%s_]*%]%]' |
|||
) then |
|||
data.type = 'rrfa' |
data.type = 'rrfa' |
||
end |
end |
||
Line 281: | Line 273: | ||
local rfxType = data.type |
local rfxType = data.type |
||
if rfxType == 'rfa' or rfxType == 'rrfa' then |
if rfxType == 'rfa' or rfxType == 'rrfa' then |
||
if umatch( |
|||
if hasCategory('Successful requests for adminship', categories) then |
|||
pageText, |
|||
'%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*[sS]uccessful requests for adminship(.-)[%s_]*%]%]' |
|||
) then |
|||
return 'successful' |
return 'successful' |
||
elseif umatch( |
|||
elseif hasCategory('Unsuccessful requests for adminship', categories) then |
|||
pageText, |
|||
'%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*[uU]nsuccessful requests for adminship(.-)[%s_]*%]%]' |
|||
) then |
|||
return 'unsuccessful' |
return 'unsuccessful' |
||
end |
end |
||
elseif rfxType == 'rfb' then |
elseif rfxType == 'rfb' then |
||
if umatch( |
|||
if hasCategory('Successful requests for bureaucratship', categories) then |
|||
pageText, |
|||
'%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*[sS]uccessful requests for bureaucratship(.-)[%s_]*%]%]' |
|||
) then |
|||
return 'successful' |
return 'successful' |
||
elseif umatch( |
|||
elseif hasCategory('Unsuccessful requests for bureaucratship', categories) then |
|||
pageText, |
|||
'%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*[uU]nsuccessful requests for bureaucratship(.-)[%s_]*%]%]' |
|||
) then |
|||
return 'unsuccessful' |
return 'unsuccessful' |
||
end |
end |