Anonymous user
Module:Protection banner: Difference between revisions
use actual Lua errors, and a small fix to parameter handling
Enwikipedia>Jackmcbarn (only show banners for actions other than edit if they're more restricted than edit) |
Enwikipedia>Jackmcbarn (use actual Lua errors, and a small fix to parameter handling) |
||
Line 52:
dateType,
tostring(dateString)
),
end
Line 122:
'invalid action ("%s")',
tostring(args.action)
),
end
Line 152:
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")',
end
end
Line 543:
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
Line 583:
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
Line 598:
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
Line 624:
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
Line 703:
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
Line 800:
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
Line 865:
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
Line 917 ⟶ 897:
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
Line 929 ⟶ 909:
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
|