Anonymous user
Module:Protection banner: Difference between revisions
add template protection tracking category
Enwikipedia>Mr. Stradivarius (output the categories, and don't display the banner if the page is not protected) |
Enwikipedia>Mr. Stradivarius (add template protection tracking category) |
||
Line 164:
function ProtectionStatus:getLevel()
return self._level
end
function ProtectionStatus:isProtected()
return self._level ~= '*'
end
Line 741 ⟶ 745:
-- Get the level and exit if the page is not protected.
if level == '*' then▼
return ''
end
Line 768 ⟶ 771:
local reason = protectionStatusObj:getReason()
local action = protectionStatusObj:getAction()
local level = protectionStatusObj:getLevel()
--[[
Line 886 ⟶ 890:
end
if cat then
return Category.render(self)▼
)▼
end
end
Line 917 ⟶ 916:
and not reasonsWithoutExpiryCheck[reason]
then
Category.setName(self, cat)▼
return Category.render(self)▼
end
end
Line 937 ⟶ 935:
local level = protectionStatusObj:getLevel()
if not protectionStatusObj:isProtected()
Category.setName(self, configObj:getMessage('tracking-category-incorrect'))▼
then
return Category.render(self)▼
end
end
--------------------------------------------------------------------------------
-- TemplateCategory class
--------------------------------------------------------------------------------
local TemplateCategory = Category:subclass('TemplateCategory')
function TemplateCategory:initialize(configObj, protectionStatusObj, titleObj)
Category.initialize(self, configObj, protectionStatusObj)
self._titleObj = titleObj
end
function TemplateCategory:render()
local configObj = self._configObj
local protectionStatusObj = self._protectionStatusObj
local titleObj = self._titleObj
local action = protectionStatusObj:getAction()
local level = protectionStatusObj:getLevel()
local namespace = titleObj.namespace
and (
action == 'create'
or not (namespace == 10 or namespace == 828)
▲ )
then
self:setName(configObj:getMessage('tracking-category-template'))
end
end
Line 1,014 ⟶ 1,045:
ProtectionCategory:new(configObj, protectionObj, titleObj),
ExpiryCategory:new(configObj, protectionObj),
ErrorCategory:new(configObj, protectionObj),
TemplateCategory:new(configObj, protectionObj, titleObj)
}
for _, obj in ipairs(objects) do
|