Changes

Jump to navigation Jump to search

Module:Protection banner

126 bytes added, 11:06, 29 June 2014
make the protection object responsible for accessing the title object and the config inside the Blurb class
self._cfg = cfg
self._protectionObj = protectionObj
self._bannerConfig = protectionObj.bannerConfig
self._title = protectionObj.title
self._deletionDiscussionPage = args.xfd
self._username = args.user
-- protection.
local action = self._protectionObj.action
local pagename = self._title_protectionObj.title.prefixedText
if action == 'move' then
-- We need the move log link.
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._title_protectionObj.title.namespace].talk.name, self._title_protectionObj.title.text,
section,
disputes
local action = self._protectionObj.action
local level = self._protectionObj.level
local namespace = self._title_protectionObj.title.namespace local isTalk = self._title_protectionObj.title.isTalkPage
-- @TODO: add semi-protection and pending changes blurbs
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
local namespace = self._title_protectionObj.title.namespace
return pagetypes[namespace] or pagetypes.default or error('no default pagetype defined')
end
function Blurb:_makeProtectionLogParameter()
local action = self._protectionObj.action
local pagename = self._title_protectionObj.title.prefixedText
if action == 'autoreview' then
-- We need the pending changes log.
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._title_protectionObj.title.namespace].talk.name, self._title_protectionObj.title.text,
section or 'top',
display
local mVandalM = require('Module:Vandal-m')
local username = self._username
username = username or self._title_protectionObj.title.baseText
return mVandalM._main{username}
end
function Blurb:makeReasonText()
local msg = self._bannerConfig_protectionObj.bannerConfig.text
if msg then
return self:_substituteParameters(msg)
function Blurb:makeExplanationText()
local msg = self._bannerConfig_protectionObj.bannerConfig.explanation
return self:_substituteParameters(msg)
end
function Blurb:makeTooltipText()
local msg = self._bannerConfig_protectionObj.bannerConfig.tooltip
return self:_substituteParameters(msg)
end
function Blurb:makeAltText()
local msg = self._bannerConfig_protectionObj.bannerConfig.alt
return self:_substituteParameters(msg)
end
function Blurb:makeLinkText()
local msg = self._bannerConfig_protectionObj.bannerConfig.link
return self:_substituteParameters(msg)
end
Anonymous user

Navigation menu