Module:Protection banner: Difference between revisions

move section, username and deletion discussion methods out of the ProtectionStatus class, as they don't really have anything to do with protection status
Enwikipedia>Jackmcbarn
(get rid of unnecessary wrapper functions)
Enwikipedia>Mr. Stradivarius
(move section, username and deletion discussion methods out of the ProtectionStatus class, as they don't really have anything to do with protection status)
Line 46:
self._reason = args.reason
self._expiry = args.expiry or 'indef'
self._section = args.section
self._protectionDate = args.date
self._username = args.user
self._deletionDiscussionPage = args.xfd
end
 
Line 66 ⟶ 63:
function ProtectionStatus:getExpiry()
return self._expiry
end
 
function ProtectionStatus:getSection()
return self._section
end
 
function ProtectionStatus:getProtectionDate()
return self._protectionDate
end
 
function ProtectionStatus:getUsername()
return self._username
end
 
function ProtectionStatus:getDeletionDiscussionPage()
return self._deletionDiscussionPage
end
 
Line 138 ⟶ 123:
url = tostring(url)
return string.format('[%s %s]', url, display)
end
 
function Blurb:setDeletionDiscussionPage(page)
self._deletionDiscussionPage = args.xfdpage
end
 
function Blurb:setUsername(username)
self._username = args.userusername
end
 
function Blurb:setSection(section)
self._section = args.section
end
 
Line 210 ⟶ 207:
-- parameter $3
-- "disputes", with or without a section link
local section = self._protectionStatusObj:getSection()_section
local disputes = self.configObj:getMessage('dispute-section-link-display')
if section then
Line 252 ⟶ 249:
-- parameter $6
local mVandalM = require('Module:Vandal-m')
local username = self._protectionStatusObj:getUsername()_username
username = username or self._titleObj.baseText
return mVandalM.luaMain{username}
Line 336 ⟶ 333:
function Blurb:_makeTalkLinkParameter()
-- parameter $11
local section = self._protectionStatusObj:getSection()_section
local display = self._configObj:getMessage('talk-page-link-display')
return string.format(
Line 395 ⟶ 392:
function Blurb:_makeDeletionBlurbParameter()
-- parameter $15
local deletionDiscussionPage = getDeletionDiscussionPage()self._deletionDiscussionPage
local key
if deletionDiscussionPage then
Line 408 ⟶ 405:
function Blurb:_makeDeletionDiscussionLinkParameter()
-- parameter $16
local deletionDiscussionPage = getDeletionDiscussionPage()self._deletionDiscussionPage
if deletionDiscussionPage then
local display = self._configObj:getMessage('deletion-discussion-link-display')
Line 766 ⟶ 763:
 
-- Render the banner
local theBanner
if yesno(args.small) then
theBanner = Padlock.new(theConfig, theProtectionStatus, title)
else
theBanner = Banner.new(theConfig, theProtectionStatus, title)
end
theBanner = Padlock.new(theConfig, theProtectionStatus, title)
theBanner:setDeletionDiscussionPage(args.xfd)
theBanner:setUsername(args.user)
theBanner:setSection(args.section)
ret[#ret + 1] = theBanner:export()
-- Render the categories