Module:Protection banner: Difference between revisions
m
Changed protection level for "Module:Protection banner": High use templates ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [Delete=Allow only bureaucrats] (indefinite) [Protect=Allow only administrators] (indefinite))
(add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.) |
Sakura emad (talk | contribs) m (Changed protection level for "Module:Protection banner": High use templates ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [Delete=Allow only bureaucrats] (indefinite) [Protect=Allow only administrators] (indefinite))) |
||
Line 169:
end
return setmetatable(obj, Protection)
end▼
)▼
end
Line 182 ⟶ 174:
return self.level ~= '*'
end
function Protection:isTemporary()
Line 196 ⟶ 180:
function Protection:makeProtectionCategory()
if not self:shouldHaveProtectionCategory() then▼
return ''▼
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
▲ return ''
▲ end
-- Get the expiry key fragment.
Line 216 ⟶ 201:
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
Line 324 ⟶ 309:
function Protection:isIncorrect()
local expiry = self.expiry
return not self:
or type(expiry) == 'number' and expiry < os.time()
end
Line 339 ⟶ 324:
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
Line 652 ⟶ 637:
function Blurb:_makeVandalTemplateParameter()
return
▲ args={self._args.user or self._protectionObj.title.baseText}
}
end
Line 843 ⟶ 827:
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
Line 854 ⟶ 838:
-- Render the banner
if protectionObj:
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
|