Content deleted Content added
HouseBlaster (talk | contribs) bypass redirect |
|||
(17 intermediate revisions by 9 users not shown) | |||
Line 1:
-- This module implements {{Submit an edit request}}.
local CONFIG_MODULE = 'Module:Submit an edit request/config
-- Load necessary modules
Line 7:
local cfg = mw.loadData(CONFIG_MODULE)
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local escape = require("Module:String")._escapePattern
local lang = mw.language.getContentLanguage()
Line 13 ⟶ 14:
local validLevels = {
semi = 'semi',
extended = 'extended',
template = 'template',
full = 'full',
interface = 'interface',
manual = 'manual'
}
Line 25 ⟶ 29:
return mw.message.newRawMessage(msg):params(params):plain()
end
end▼
local mainPage = message('main-page')▼
if source == mainPage then▼
return true▼
end▼
end▼
end
Line 56 ⟶ 50:
function p.makeRequestUrl(level, titleObj)
titleObj = titleObj or mw.title.getCurrentTitle()
local basePage = titleObj.basePageTitle.fullText
if cfg['main-page-content'][basePage] then
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
end
local talkPageName = resolveRedirect(titleObj.talkPageTitle.prefixedText)▼
local talkPageName = titleObj.talkPageTitle
if talkPageName == nil then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
▲ end
if isProtected(talkPageName) then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
end
level = validateLevel(level)
return tostring(mw.uri.fullUrl(talkPageName, {
action = 'edit',
section = 'new'
▲ end
'preload-title-text',▼
getLevelInfo(level, 'levelText'),▼
lang:formatDate(message('preload-title-date-format'))▼
)
local content = mw.title.new(talkPageName):getContent()
if content and content:find("== *" .. escape(sectionname) .. " *==") then
local dedup = 2
local newname = message("preload-title-dedup-suffix", sectionname, dedup)
if not content:find("== *" .. escape(newname) .. " *==") then
sectionname = newname
break
end
dedup = dedup + 1
▲ end
end
local url = mw.uri.fullUrl(talkPageName, {
action = 'edit',
editintro = getLevelInfo(level, 'editintro'),
preload = message('preload-template'),
preloadtitle =
▲ 'preload-title-text',
▲ getLevelInfo(level, 'levelText'),
▲ lang:formatDate(message('preload-title-date-format'))
▲ ),
section = 'new'
})
Line 97 ⟶ 116:
function p._button(args)
return require('Module:Clickable button
[1] = args.display or message('default-display-value'),
url = p.makeRequestUrl(args.type),
|