Changes
put Protection in charge of generating its own category links
end
function Protection:makeExpiryCategoryneedsExpiry()
local cfg = self._cfg
and cfg.expiryCheckActions[self.action]
and self.reason -- the old {{pp-protected}} didn't check for expiry
and not cfg.reasonsWithoutExpiryCheck[self.reason]
end
function Protection:makeErrorCategoryisIncorrect()
local expiry = self.expiry
or type(expiry) == 'number' and expiry < os.time()
end
function Protection:makeTemplateCategoryisTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink(msg['tracking-category-expiry']) end if self:isIncorrect() then return ret[#ret + 1] = makeCategoryLink(msg['tracking-category-incorrect']) end if self._cfg.:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink(msg['tracking-category-template'])
end
return table.concat(ret)
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeProtectionCategory() ret[#ret + 1] = protectionObj:makeExpiryCategory() ret[#ret + 1] = protectionObj:makeErrorCategory() ret[#ret + 1] = protectionObj:makeTemplateCategorymakeCategoryLinks()
end