Module:Protection banner: Difference between revisions

use cfg.explanationBlurbs to fetch the explanation blurbs rather than hard-coding the message keys here
(add explanation blurb for semi-protection)
(use cfg.explanationBlurbs to fetch the explanation blurbs rather than hard-coding the message keys here)
Line 469:
 
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
key =return self:_getExpandedMessage('explanation-blurb-full-nounprotect')
end
 
key -- =Get 'explanation- blurb-default' table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local namespacetalkKey = self._protectionObj.title.namespaceisTalkPage and 'talk' or 'subject'
local isTalk = self._protectionObj.title.isTalkPage
 
-- Find the message in the explanation blurb table and substitute any
-- @TODO: add pending changes
-- parameters.
local key
local explanations = self._cfg.explanationBlurbs
if namespace == 8 then
local keymsg
-- MediaWiki namespace
if explanations[action][level] and explanations[action][level][talkKey] then
key = 'explanation-blurb-full-nounprotect'
msg = explanations[action][level][talkKey]
elseif action == 'edit' and level == 'sysop' and not isTalk then
elseif explanations[action][level] and explanations[action][level].default then
key = 'explanation-blurb-full-subject'
msg = explanations[action][level].default
elseif action == 'edit' and level == 'autoconfirmed' then
elseif explanations[action].default and explanations[action].default[talkKey] then
if isTalk then
msg = explanations[action].default[talkKey]
key = 'explanation-blurb-semi-talk'
elseif explanations[action].default and explanations[action].default.default then
else
msg = explanations[action].default.default
key = 'explanation-blurb-semi-subject'
end
elseif action == 'move' then
if isTalk then
key = 'explanation-blurb-move-talk'
else
key = 'explanation-blurb-move-subject'
end
else
error(string.format(
key = 'explanation-blurb-default'
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
))
end
return self:_getExpandedMessage_substituteParameters(keymsg)
end