Module:Protection banner: Difference between revisions

add support for the "demolevel" parameter; code by myself and User:Jackmcbarn
(use actual Lua errors, and a small fix to parameter handling)
(add support for the "demolevel" parameter; code by myself and User:Jackmcbarn)
Line 126: Line 126:


-- Set level
-- Set level
obj.level = effectiveProtectionLevel(obj.action, obj.title)
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if obj.level == 'accountcreator' then
if obj.level == 'accountcreator' then
-- Lump titleblacklisted pages in with template-protected pages,
-- Lump titleblacklisted pages in with template-protected pages,
Line 871: Line 871:
-- If a page's edit protection is equally or more restrictive than its protection from some other action,
-- If a page's edit protection is equally or more restrictive than its protection from some other action,
-- then don't bother displaying anything for the other action (except categories).
-- then don't bother displaying anything for the other action (except categories).
if protectionObj.action == 'edit' 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
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
local blurbObj = Blurb.new(protectionObj, args, cfg)