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