Editing Module:Protection banner

From MINR.ORG WIKI

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 132: Line 132:
 
elseif effectiveExpiry ~= 'unknown' then
 
elseif effectiveExpiry ~= 'unknown' then
 
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
 
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
 
end
  
Line 305: Line 313:
 
end
 
end
 
return ''
 
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
 
end
  
Line 325: Line 345:
 
local msg = self._cfg.msg
 
local msg = self._cfg.msg
 
local ret = { self:makeProtectionCategory() }
 
local ret = { self:makeProtectionCategory() }
 +
if self:needsExpiry() then
 +
ret[#ret + 1] = makeCategoryLink(
 +
msg['tracking-category-expiry'],
 +
self.title.text
 +
)
 +
end
 
if self:isIncorrect() then
 
if self:isIncorrect() then
 
ret[#ret + 1] = makeCategoryLink(
 
ret[#ret + 1] = makeCategoryLink(

Please note that all contributions to MINR.ORG WIKI may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see MINR.ORG WIKI:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)