Module:Protection banner: Difference between revisions

add expiry category code
Enwikipedia>Mr. Stradivarius
(add missing parameter methods, add a Blurb:_getExpandedMessage method, and (hopefully) finish updating the various functions to work with the new config structure)
Enwikipedia>Mr. Stradivarius
(add expiry category code)
Line 901:
local configObj = self._configObj
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
 
Line 917 ⟶ 933:
local level = protectionStatusObj:getLevel()
 
if level == '*' or type(expiry) == 'number' and expiry < os.time() then
or action == 'move' and level == 'autoconfirmed'
or type(expiry) == 'number' and expiry < os.time()
then
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))
return Category.export(self)