Module:Contentious topics/talk notice: Difference between revisions

Content deleted Content added
protection level
protection
Line 44:
local currentTitleObject = mw.title.getCurrentTitle()
local subjectTitleObject = currentTitleObject.subjectPageTitle
local underRestrictions -- a boolean for whether there are any active restrictions
local protectionLevel
local articleOrPage -- the string "article" (if a mainspace page) or "page" (if not)
local protectionLevel -- the edit protection level
local messageBody
Line 54 ⟶ 56:
-- Helpers to add a restriction if it's active and hasn't been added yet
local function addRestriction(restriction, topicWidebypassLookup)
if yesno(args[restriction]) or topicWidebypassLookup then
restrictionFlags[restriction] = true
end
Line 81 ⟶ 83:
maybeAddRestriction(restriction)
end
end
end
 
-- Page protection restriction (if it's defined)
-- todo: Figure this one
for _, prot in ipairs(protectionLevels) do
if restrictionsDefinition[prot] then
alwaysAddRestriction(prot)
end
end
-- Add the protection level
maybeAddRestriction(protectionLevel = subjectTitleObject.protectionLevels["edit"][1])
localif protectionLevel then
alwaysAddRestriction(protprotectionLevel)
end
--[[
Line 125 ⟶ 122:
restrictions = setToList(restrictionFlags)
end
--[[
Restrictions are now all set. Here, we add additional helper functions and variables necessary for generating the banner
Line 130 ⟶ 128:
-- Check whether any of the added restrictions are enabled
local underRestrictions = #restrictions > 0
-- Determines whether we should use the string "article" or "page"