Module:Protection banner: Difference between revisions
add expiry category code
(add missing parameter methods, add a Blurb:_getExpandedMessage method, and (hopefully) finish updating the various functions to work with the new config structure) |
(add expiry category code) |
||
Line 901: | Line 901: | ||
local configObj = self._configObj | local configObj = self._configObj | ||
local protectionStatusObj = self._protectionStatusObj | local protectionStatusObj = self._protectionStatusObj | ||
local reasonsWithoutExpiryCheck = configObj:getConfigTable('reasonsWithoutExpiryCheck') | |||
local expiryCheckActions = configObj:getConfigTable('expiryCheckActions') | |||
local expiry = protectionStatusObj:getExpiry() | |||
local action = protectionStatusObj:getAction() | |||
local reason = protectionStatusObj:getReason() | |||
if not expiry | |||
and expiryCheckActions[action] | |||
and reason -- the old {{pp-protected}} didn't check for expiry | |||
and not reasonsWithoutExpiryCheck[reason] | |||
then | |||
local cat = configObj:getMessage('tracking-category-expiry') | |||
Category.setName(self, cat) | |||
return Category.export(self) | |||
end | |||
end | end | ||
Line 917: | Line 933: | ||
local level = protectionStatusObj:getLevel() | local level = protectionStatusObj:getLevel() | ||
if level == '*' | if level == '*' or type(expiry) == 'number' and expiry < os.time() then | ||
Category.setName(self, configObj:getMessage('tracking-category-incorrect')) | Category.setName(self, configObj:getMessage('tracking-category-incorrect')) | ||
return Category.export(self) | return Category.export(self) |