Module:Submit an edit request: Difference between revisions

Content deleted Content added
Tag: Reverted
bypass redirect
 
(5 intermediate revisions by 4 users not shown)
Line 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 60 ⟶ 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
local basePage = titleObj.basePageTitle.fullText
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
if cfg['main-page-content'][basePage] then
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
end
end
 
local talkPageName = titleObj.talkPageTitle
local useTalkPage = true
if talkPageName == nil then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page'), {))
useTalkPage = false
end
else
talkPageName = resolveRedirect(talkPageName.prefixedText)
if isProtected(talkPageName) then
pageToEdit =return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
useTalkPage = false
end
end
level = validateLevel(level)
if sourcelevel == mainPage'manual' then
local pageToEdit
if not useTalkPage then
if level == 'manual' then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page'), {
action = 'edit',
section = 'new'
}))
else
pageToEdit = message('protected-talk-page-request-page')
sectionname = titleObj.prefixedText
end
elseif level == 'manual' then
return tostring(mw.uri.fullUrl(talkPageName, {
action = 'edit',
section = 'new'
}))
end
else
local mainPagesectionname = message('main-page')
pageToEdit = talkPageName
sectionname = message(
'preload-title-text',
getLevelInfo(level, 'levelText'),
lang:formatDate(message('preload-title-date-format'))
)
local content = mw.title.new(pageToEdittalkPageName):getContent()
end
local content = mw.title.new(pageToEdit):getContent()
if content and content:find("== *" .. escape(sectionname) .. " *==") then
local dedup = 2
Line 113 ⟶ 87:
end
end
local url = mw.uri.fullUrl(pageToEdittalkPageName, {
action = 'edit',
editintro = getLevelInfo(level, 'editintro'),
Line 142 ⟶ 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),