Module:Submit an edit request: Difference between revisions

Content deleted Content added
handle case where makeRequestUrl is called on a title that cannot have a talk page (special pages are an example); see edit request
bypass redirect
 
(8 intermediate revisions by 4 users not shown)
Line 17:
template = 'template',
full = 'full',
interface = 'interface',
manual = 'manual'
}
 
Line 28 ⟶ 29:
return mw.message.newRawMessage(msg):params(params):plain()
end
end
 
local function isTranscludedOnMainPage(titleObj)
local mainPage = message('main-page')
for i, source in ipairs(titleObj.cascadingProtection.sources) do
if source == mainPage then
return true
end
end
return false
end
 
Line 59 ⟶ 50:
function p.makeRequestUrl(level, titleObj)
titleObj = titleObj or mw.title.getCurrentTitle()
local basePage = titleObj.basePageTitle.fullText
if isTranscludedOnMainPage(titleObj) then
if cfg['main-page-content'][basePage] then
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
end
 
local talkPageName = titleObj.talkPageTitle
if talkPageName == nil then
Line 71 ⟶ 64:
end
level = validateLevel(level)
if sourcelevel == mainPage'manual' then
return tostring(mw.uri.fullUrl(talkPageName, {
action = 'edit',
section = 'new'
}))
end
local sectionname = message(
'preload-title-text',
Line 117 ⟶ 116:
 
function p._button(args)
return require('Module:Clickable button 2').luaMainmain{
[1] = args.display or message('default-display-value'),
url = p.makeRequestUrl(args.type),