Zum Inhalt springen

Modul:Protection banner: Unterschied zwischen den Versionen

move section, username and deletion discussion methods out of the ProtectionStatus class, as they don't really have anything to do with protection status
(get rid of unnecessary wrapper functions)
(move section, username and deletion discussion methods out of the ProtectionStatus class, as they don't really have anything to do with protection status)
Zeile 46: Zeile 46:
self._reason = args.reason
self._reason = args.reason
self._expiry = args.expiry or 'indef'
self._expiry = args.expiry or 'indef'
self._section = args.section
self._protectionDate = args.date
self._protectionDate = args.date
self._username = args.user
self._deletionDiscussionPage = args.xfd
end
end


Zeile 66: Zeile 63:
function ProtectionStatus:getExpiry()
function ProtectionStatus:getExpiry()
return self._expiry
return self._expiry
end
function ProtectionStatus:getSection()
return self._section
end
end


function ProtectionStatus:getProtectionDate()
function ProtectionStatus:getProtectionDate()
return self._protectionDate
return self._protectionDate
end
function ProtectionStatus:getUsername()
return self._username
end
function ProtectionStatus:getDeletionDiscussionPage()
return self._deletionDiscussionPage
end
end


Zeile 138: Zeile 123:
url = tostring(url)
url = tostring(url)
return string.format('[%s %s]', url, display)
return string.format('[%s %s]', url, display)
end
function Blurb:setDeletionDiscussionPage(page)
self._deletionDiscussionPage = page
end
function Blurb:setUsername(username)
self._username = username
end
function Blurb:setSection(section)
self._section = section
end
end


Zeile 210: Zeile 207:
-- parameter $3
-- parameter $3
-- "disputes", with or without a section link
-- "disputes", with or without a section link
local section = self._protectionStatusObj:getSection()
local section = self._section
local disputes = self.configObj:getMessage('dispute-section-link-display')
local disputes = self.configObj:getMessage('dispute-section-link-display')
if section then
if section then
Zeile 252: Zeile 249:
-- parameter $6
-- parameter $6
local mVandalM = require('Module:Vandal-m')
local mVandalM = require('Module:Vandal-m')
local username = self._protectionStatusObj:getUsername()
local username = self._username
username = username or self._titleObj.baseText
username = username or self._titleObj.baseText
return mVandalM.luaMain{username}
return mVandalM.luaMain{username}
Zeile 336: Zeile 333:
function Blurb:_makeTalkLinkParameter()
function Blurb:_makeTalkLinkParameter()
-- parameter $11
-- parameter $11
local section = self._protectionStatusObj:getSection()
local section = self._section
local display = self._configObj:getMessage('talk-page-link-display')
local display = self._configObj:getMessage('talk-page-link-display')
return string.format(
return string.format(
Zeile 395: Zeile 392:
function Blurb:_makeDeletionBlurbParameter()
function Blurb:_makeDeletionBlurbParameter()
-- parameter $15
-- parameter $15
local deletionDiscussionPage = getDeletionDiscussionPage()
local deletionDiscussionPage = self._deletionDiscussionPage
local key
local key
if deletionDiscussionPage then
if deletionDiscussionPage then
Zeile 408: Zeile 405:
function Blurb:_makeDeletionDiscussionLinkParameter()
function Blurb:_makeDeletionDiscussionLinkParameter()
-- parameter $16
-- parameter $16
local deletionDiscussionPage = getDeletionDiscussionPage()
local deletionDiscussionPage = self._deletionDiscussionPage
if deletionDiscussionPage then
if deletionDiscussionPage then
local display = self._configObj:getMessage('deletion-discussion-link-display')
local display = self._configObj:getMessage('deletion-discussion-link-display')
Zeile 766: Zeile 763:


-- Render the banner
-- 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
-- Render the categories
Anonymer Benutzer