Jump to content

Module:Protection banner: Difference between revisions

start changing the protection category function after a restructure of the config
(allow the first positional parameter to be used for the reason)
(start changing the protection category function after a restructure of the config)
Line 757: Line 757:
--]]
--]]
local properties = {
local properties = {
expiry = {order = 1, keypos = 5, val = protectionStatusObj:getExpiry()},
expiry   = {order = 1, val = protectionStatusObj:getExpiry()},
namespace = {order = 2, keypos = 3, val = nskey},
namespace = {order = 2, val = nskey},
reason = {order = 3, keypos = 4, val = protectionStatusObj:getReason()},
reason   = {order = 3, val = protectionStatusObj:getReason()},
level = {order = 4, keypos = 2, val = protectionStatusObj:getLevel()},
level     = {order = 4, val = protectionStatusObj:getLevel()},
action = {order = 5, keypos = 1, val = protectionStatusObj:getAction()}
action   = {order = 5, val = protectionStatusObj:getAction()}
}
}
   
   
Line 856: Line 856:
for j, t in ipairs(attemptOrder) do
for j, t in ipairs(attemptOrder) do
if j > noActive then
if j > noActive then
key[t.keypos] = 'all'
key[t.order] = 'all'
else
else
local quotient = i / 2 ^ (j - 1)
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
if quotient % 2 == 1 then
key[t.keypos] = t.val
key[t.order] = t.val
else
else
key[t.keypos] = 'all'
key[t.order] = 'all'
end
end
end
end
Line 910: Line 910:
local level = protectionStatusObj:getLevel()
local level = protectionStatusObj:getLevel()


if type(expiry) == 'number' and expiry < os.time()
if level == '*'
or level == '*'
or action == 'move' and level == 'autoconfirmed'
or action == 'move' and level == 'autoconfirmed'
or type(expiry) == 'number' and expiry < os.time()
then
then
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
Cookies help us deliver our services. By using our services, you agree to our use of cookies.