Content deleted Content added
Jackmcbarn (talk | contribs) rm unnecessary setters |
sync to live module |
||
(33 intermediate revisions by 16 users not shown) | |||
Line 3:
-- Initialise necessary modules.
require('
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
Line 113:
else
error(string.format(
'invalid action:
tostring(args.action)
), 3)
Line 132:
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end▼
end
Line 177 ⟶ 169:
end
return setmetatable(obj, Protection)
end▼
-- Whether the page is a user JavaScript or CSS page.
title.contentModel == 'javascript' or title.contentModel == 'css'
)▼
end
Line 182:
return self.level ~= '*'
end
function Protection:shouldShowLock()
-- Whether we should output a banner/padlock
return self:isProtected() and not self:isUserScript()
-- Whether this page needs a protection category.
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock
function Protection:isTemporary()
Line 188 ⟶ 196:
function Protection:makeProtectionCategory()
return ''▼
end▼
local cfg = self._cfg
local title = self.title
▲ if not self:isProtected() then
▲ return ''
▲ end
-- Get the expiry key fragment.
Line 205 ⟶ 212:
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
namespaceFragment =
▲ if not namespaceFragment and title.namespace % 2 == 1 then
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 316 ⟶ 320:
end
return ''
▲end
▲function Protection:needsExpiry()
▲ local cfg = self._cfg
▲ return not self.expiry and (
▲ )
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:
or type(expiry) == 'number' and expiry < os.time()
end
Line 347 ⟶ 339:
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = {
▲ end
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
Line 481 ⟶ 467:
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
Line 664 ⟶ 652:
function Blurb:_makeVandalTemplateParameter()
return mw.getCurrentFrame():expandTemplate{
title="vandal-m",
args={self._args.user or self._protectionObj.title.baseText} }
end
Line 806 ⟶ 795:
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj
obj
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
Line 819 ⟶ 808:
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
Line 856 ⟶ 843:
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if not yesno(args.catonly) and (protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)])
then
-- Initialise the blurb object
Line 867 ⟶ 854:
-- Render the banner
if protectionObj:
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
Line 878 ⟶ 865:
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
-- For arbitration enforcement, flagging [[WP:PIA]] pages to enable [[Special:AbuseFilter/1339]] to flag edits to them
if protectionObj.level == "extendedconfirmed" then
if require("Module:TableTools").inArray(protectionObj.title.talkPageTitle.categories, "Wikipedia pages subject to the extended confirmed restriction related to the Arab-Israeli conflict") then
ret[#ret + 1] = "<p class='PIA-flag' style='display:none; visibility:hidden;' title='This page is subject to the extended confirmed restriction related to the Arab-Israeli conflict.'></p>"
▲ end
end
|