Module:Protection banner: Difference between revisions

add support for upload protection, and make some formatting tweaks
m (1 revision imported)
(add support for upload protection, and make some formatting tweaks)
Line 6:
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
 
Line 73 ⟶ 74:
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then break end
toWalk[k] = nil
Line 96 ⟶ 97:
edit = true,
move = true,
autoreview = true,
upload = true
}
 
Line 134 ⟶ 136:
 
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if args.expiry then
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
ifelseif args.expiry then
if cfg.indefStrings[args.expiry] then
obj.expiry = 'indef'
Line 868 ⟶ 875:
local ret = {}
 
-- If a page's edit protection is equally or more restrictive than its protection from some other action,
-- protection from some other action, then don't bother displaying anything for the other action (except categories).
-- for the other action (except categories).
if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then
if protectionObj.action == 'edit' or
args.demolevel or
not walkHierarchy(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
Anonymous user