Jump to content

Module:Protection banner: Difference between revisions

fix logic for reasonBehavior == 'all' and fix the office protection category key
(see if this is possible with just two options)
(fix logic for reasonBehavior == 'all' and fix the office protection category key)
Line 42: Line 42:
['pc-autoconfirmed-all-all-all'] = 'Wikipedia pending changes protected pages (level 1)',
['pc-autoconfirmed-all-all-all'] = 'Wikipedia pending changes protected pages (level 1)',
['pc-reviewer-all-all-all'] = 'Wikipedia pending changes protected pages (level 2)',
['pc-reviewer-all-all-all'] = 'Wikipedia pending changes protected pages (level 2)',
['all-all-all-office-all'] = 'Wikipedia Office-protected pages',
['all-all-all-all-all'] = 'Wikipedia protected pages',
['all-all-all-all-all'] = 'Wikipedia protected pages',
['office'] = 'Wikipedia Office-protected pages',
}
}


Line 150: Line 150:
local reasonBehavior = reasonBehaviors[reason]
local reasonBehavior = reasonBehaviors[reason]
local attemptOrder  
local attemptOrder  
if reasonBehavior == 'reasonFirst' then
if reasonBehavior == 'namespaceFirst' then
attemptOrder = {
attemptOrder = {
-- type, level, ns, reason, expiry
-- type, level, ns, reason, expiry
{true, true, true, true, true},    -- 1
{true, true, true, true, true},    -- 1
{true, true, true, true, false},    -- 2
{true, true, true, true, false},    -- 2
{true, true, false, true, true},    -- 3
{true, true, true, false, true},    -- 3
{true, true, false, true, false},  -- 4
{true, true, true, false, false},  -- 4
{true, false, true, true, true},    -- 5
{true, false, true, true, true},    -- 5
{true, false, true, true, false},  -- 6
{true, false, true, true, false},  -- 6
{true, false, false, true, true},  -- 7
{true, false, true, false, true},  -- 7
{true, false, false, true, false},  -- 8
{true, false, true, false, false},  -- 8
{false, false, false, true, false}, -- 9
{false, false, true, false, false}, -- 9
{true, true, true, false, true},    -- 10
{true, true, false, true, true},    -- 10
{true, true, true, false, false},  -- 11
{true, true, false, true, false},  -- 11
{true, true, false, false, true},  -- 12
{true, true, false, false, true},  -- 12
{true, false, true, false, true},  -- 13
{true, false, false, true, true},  -- 13
{true, false, true, false, false},  -- 14
{true, false, false, true, false},  -- 14
{true, false, false, false, true},  -- 15
{true, false, false, false, true},  -- 15
{true, false, false, false, false}, -- 16
{true, false, false, false, false}, -- 16
{false, false, false, false, false} -- 17
{false, false, false, false, false} -- 17
}
}
elseif reasonBehavior == 'namespaceFirst' then
elseif reasonBehavior == 'reasonFirst' or reason == 'all' then
attemptOrder = {
attemptOrder = {
-- type, level, ns, reason, expiry
-- type, level, ns, reason, expiry
{true, true, true, true, true},    -- 1
{true, true, true, true, true},    -- 1
{true, true, true, true, false},    -- 2
{true, true, true, true, false},    -- 2
{true, true, true, false, true},    -- 3
{true, true, false, true, true},    -- 3
{true, true, true, false, false},  -- 4
{true, true, false, true, false},  -- 4
{true, false, true, true, true},    -- 5
{true, false, true, true, true},    -- 5
{true, false, true, true, false},  -- 6
{true, false, true, true, false},  -- 6
{true, false, true, false, true},  -- 7
{true, false, false, true, true},  -- 7
{true, false, true, false, false},  -- 8
{true, false, false, true, false},  -- 8
{false, false, true, false, false}, -- 9
{false, false, false, true, false}, -- 9
{true, true, false, true, true},    -- 10
{true, true, true, false, true},    -- 10
{true, true, false, true, false},  -- 11
{true, true, true, false, false},  -- 11
{true, true, false, false, true},  -- 12
{true, true, false, false, true},  -- 12
{true, false, false, true, true},  -- 13
{true, false, true, false, true},  -- 13
{true, false, false, true, false},  -- 14
{true, false, true, false, false},  -- 14
{true, false, false, false, true},  -- 15
{true, false, false, false, true},  -- 15
{true, false, false, false, false}, -- 16
{true, false, false, false, false}, -- 16
{false, false, false, false, false} -- 17
{false, false, false, false, false} -- 17
}
}
elseif reason ~= 'all' then
else
error(reason .. ' is not a valid reason')
error(reason .. ' is not a valid reason')
end
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.