Changes

Jump to navigation Jump to search

Module:Protection banner

397 bytes added, 05:43, 10 July 2014
use cfg.explanationBlurbs to fetch the explanation blurbs rather than hard-coding the message keys here
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
 
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local namespace = self._protectionObj.title.namespace local isTalk talkKey = self._protectionObj.title.isTalkPageand 'talk' or 'subject'
-- @TODO: add pending changesFind the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local keymsg if namespace == 8 explanations[action][level] and explanations[action][level][talkKey] then -- MediaWiki namespace key msg = 'explanation-blurb-full-nounprotect'explanations[action][level][talkKey] elseif explanations[action == 'edit' ][level] and explanations[action][level == 'sysop' and not isTalk ].default then key msg = 'explanation-blurb-full-subject'explanations[action][level].default elseif explanations[action == 'edit' ].default and level == 'autoconfirmed' explanations[action].default[talkKey] then if isTalk then key msg = 'explanation-blurb-semi-talk' else key = 'explanation-blurb-semi-subject' endexplanations[action].default[talkKey] elseif explanations[action].default and explanations[action == 'move' ].default.default then if isTalk then key msg = 'explanation-blurb-move-talk' else key = 'explanation-blurb-move-subject' endexplanations[action].default.default
else
key = error(string.format( 'could not find explanation-blurb-defaultfor action "%s", level "%s" and talk key "%s"', action, level, talkKey ))
end
return self:_getExpandedMessage_substituteParameters(keymsg)
end
Anonymous user

Navigation menu