Module:Protection banner: Difference between revisions

rm some locals that only get used once
(make the Protection class be in charge of the title, and some other tweaks)
(rm some locals that only get used once)
Line 278:
--]]
local cats = cfg.protectionCategories
local cat
for i = 1, 2^noActive do
local key = {}
Line 297 ⟶ 296:
local attempt = cats[key]
if attempt then
cat =return makeCategoryLink(attempt)
break
end
end
 
return makeCategoryLink(cat)
end
 
function Protection:makeExpiryCategory()
local reasonsWithoutExpiryCheckcfg = self._cfg.reasonsWithoutExpiryCheck
local expiryCheckActions = self._cfg.expiryCheckActions
local cat
if not self.expiry
and cfg.expiryCheckActions[self.action]
and self.reason -- the old {{pp-protected}} didn't check for expiry
and not cfg.reasonsWithoutExpiryCheck[self.reason]
then
cat =return makeCategoryLink(self._cfg.msg['tracking-category-expiry'])
end
return makeCategoryLink(cat)
end
 
function Protection:makeErrorCategory()
local cfgexpiry = self._cfgexpiry
local cat
if not self:isProtected()
or type(self.expiry) == 'number' and self.expiry < os.time()
then
catreturn = cfgmakeCategoryLink(self._cfg.msg['tracking-category-incorrect'])
end
return makeCategoryLink(cat)
end
 
function Protection:makeTemplateCategory()
local cfgaction, namespace = self._cfgaction, self.title.namespace
local title = self.title
local cat
if self.level == 'templateeditor'
and (
(self.action ~= 'edit' and self.action ~= 'move')
or (title.namespace ~= 10 and title.namespace ~= 828)
)
then
catreturn = cfgmakeCategoryLink(self._cfg.msg['tracking-category-template'])
end
return makeCategoryLink(cat)
end
 
Line 363 ⟶ 349:
 
function Blurb.makeFullUrl(page, query, display)
return string.format('[%s %s]', url, display)
local url = mw.uri.fullUrl(page, query)
'[%s %s]',
url = tostring(url)
local url = tostring(mw.uri.fullUrl(page, query)),
return string.format('[%s %s]', url, display)
display
)
end
 
Line 384 ⟶ 372:
-- Private methods --
 
function Blurb:_getExpandedMessage(msgmsgKey)
local msg =return self:_substituteParameters(self._cfg.msg[msgmsgKey])
return self:_substituteParameters(msg)
end
 
Anonymous user