Module:Contentious topics/talk notice: Difference between revisions

Content deleted Content added
m Protected "Module:Contentious topics talk banner": Highly visible template ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
sync with sandbox, which works with a |protection parameter
Line 69:
local function alwaysAddRestriction(restriction)
restrictionFlags[restriction] = true
end
-- helperHelper to add a category
local function addCategory(cat)
if cat then
categories = categories .. '[[Category:' .. cat .. '|' .. currentTitleObject.text .. ']]'
end
end
Line 94 ⟶ 101:
-- Add the protection level
if yesno(args.protection, true) then
protectionLevel = subjectTitleObject.protectionLevels["edit"][1]
if protectionLevel then= subjectTitleObject.protectionLevels["edit"][1]
if protectionLevel then
-- we have page protection
-- so we checkhave ifa ECR is|protection=foo activeparameter, and ifthe sopage onlyis care about full protectionprotected
if restrictionFlags["ECR"] then
-- handle ECR with protection correctly
if protectionLevel == "full" then alwaysAddRestriction("full") end
else
alwaysAddRestriction(protectionLevel)
-- no ECR, so just add the protection as normal
alwaysAddRestriction(protectionLevel)
end
manualRestrictions = true
else
-- we have a |protection=foo parameter, but the page is *not* protected
addCategory(categoryDatabase['protection-error'])
end
end
Line 132 ⟶ 146:
-- Determines whether we should use the string "article" or "page"
local articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"
-- helper to add a category
local function addCategory(cat)
if cat then
categories = categories .. '[[Category:' .. cat .. '|' .. currentTitleObject.text .. ']]'
end
end
 
-- Makes a bullet point for a given contentious topic