Module:Contentious topics/talk notice: Difference between revisions

Content deleted Content added
more extensible
redundant-stuff-be-gone
Line 88:
for _, prot in ipairs(protectionLevels) do
if restrictionsDefinition[prot] then
addRestrictionalwaysAddRestriction(prot)
end
end
--[[
--clear Clear duplicate restrictions (e.g. 0RR and 1RR; 1RR and 1RR-nocat, etc; consensus-required is stronger than BRD)
--]]
-- helper function which clears all revert rules, except for the given one
local function clearOtherRevertRules(rr)
restrictionFlags["0RR"] = nil
restrictionFlags["0RR-nocat"] = nil
restrictionFlags["1RR"] = nil
restrictionFlags["1RR-nocat"] = nil
restrictionFlags[rr] = true
end
--make sure you handle the case with all revert rules active correctly!
if (restrictionFlags["1RR"] or restrictionFlags["1RR-nocat"]) and (restrictionFlags["0RR"] or restrictionFlags["0RR-nocat"]) then
clearOtherRevertRules("0RR")
for _, restriction in ipairs(restrictions) do
elseif restrictionFlags["0RR-nocat"] then
 
clearOtherRevertRules("0RR-nocat")
end
elseif restrictionFlags["1RR"] then
clearOtherRevertRules("1RR")
end
-- if we make it to this point, 1RR-nocat is the only one potentially enabled
-- so we don't make a seperate check for it
-- clear BRD if consensus-required is enabled
if restrictionFlags["consensus-required"] then restrictionFlags["BRD"] = nil end
restrictions = setToList(restrictionFlags)
--[[
 
Restrictions are now all set. Here, we add additional helper functions and variables necessary for generating the banner
--]]
-- Check whether any of the added restrictions are enabled
local underRestrictions = #restrictions > 0
-- Determines whether we should use the string "article" or "page"
local articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"
 
-- Makes a bullet point for a given contentious topic
local function makeTopicBulletPoint(code)
topicBlurb = frame:expandTemplate{ title = "Contentious topics/list", args = { scope=code } }
Line 115 ⟶ 139:
end
end
 
-- Makes a restriction bullet point
local function makeRestrictionBulletPoint(code)
local def = restrictionsDefinition[code]
Line 121 ⟶ 146:
end
--[[
messageBody = "<p>'''The [[Wikipedia:Contentious topics|contentious topics]] procedure applies to this "
Begin building the messageBody
.. articleOrPage .. ".'''"
--]]
messageBody = "'<p>'''<b>The [[Wikipedia:Contentious topics|contentious topics]] procedure applies to this "'
.. articleOrPage .. "'.</b>'''"
.. (yesno(args.section) and (' Parts of this ' .. articleOrPage .. ' relate ') or (' This ' .. articleOrPage .. ' relates '))