模块:Protection banner:修订间差异
update from enwiki
Cquote>風中的刀劍 (https://en.wikipedia.org/w/index.php?title=Module:Protection_banner&oldid=653706415) |
Cquote>StevenK234 (update from enwiki) |
||
| 第6行: | 第6行: | ||
local makeFileLink = require('Module:File link')._main | local makeFileLink = require('Module:File link')._main | ||
local effectiveProtectionLevel = require('Module:Effective protection level')._main | local effectiveProtectionLevel = require('Module:Effective protection level')._main | ||
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main | |||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
| 第73行: | 第74行: | ||
while true do | while true do | ||
-- Can't use pairs() since we're adding and removing things as we're iterating | -- Can't use pairs() since we're adding and removing things as we're iterating | ||
local k = next(toWalk) | local k = next(toWalk) -- This always gets the "first" key | ||
if k == nil then break end | if k == nil then break end | ||
toWalk[k] = nil | toWalk[k] = nil | ||
| 第96行: | 第97行: | ||
edit = true, | edit = true, | ||
move = true, | move = true, | ||
autoreview = true | autoreview = true, | ||
upload = true | |||
} | } | ||
| 第134行: | 第136行: | ||
-- Set expiry | -- Set expiry | ||
if args.expiry then | local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) | ||
if effectiveExpiry == 'infinity' then | |||
obj.expiry = 'indef' | |||
elseif effectiveExpiry ~= 'unknown' then | |||
obj.expiry = validateDate(effectiveExpiry, 'expiry date') | |||
elseif args.expiry then | |||
if cfg.indefStrings[args.expiry] then | if cfg.indefStrings[args.expiry] then | ||
obj.expiry = 'indef' | obj.expiry = 'indef' | ||
| 第868行: | 第875行: | ||
local ret = {} | local ret = {} | ||
-- 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 | |||
if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then | -- 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 | |||
-- Initialise the blurb object | -- Initialise the blurb object | ||
local blurbObj = Blurb.new(protectionObj, args, cfg) | local blurbObj = Blurb.new(protectionObj, args, cfg) | ||