Module:Protection banner: Difference between revisions

remove expiry param (now also automatically retrieved for autoreview) and needsexpiry check
Enwikipedia>Jackmcbarn
(bring changes from sandbox live)
(remove expiry param (now also automatically retrieved for autoreview) and needsexpiry check)
Line 132:
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
elseif args.expiry then
if cfg.indefStrings[args.expiry] then
obj.expiry = 'indef'
elseif type(args.expiry) == 'number' then
obj.expiry = args.expiry
else
obj.expiry = validateDate(args.expiry, 'expiry date')
end
end
 
Line 313 ⟶ 305:
end
return ''
end
 
function Protection:needsExpiry()
local cfg = self._cfg
local actionNeedsCheck = cfg.expiryCheckActions[self.action]
return not self.expiry and (
actionNeedsCheck or (
actionNeedsCheck == nil
and self.reason -- the old {{pp-protected}} didn't check for expiry
and not cfg.reasonsWithoutExpiryCheck[self.reason]
)
)
end
 
Line 345 ⟶ 325:
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:needsExpiry() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-expiry'],
self.title.text
)
end
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
Anonymous user