模組討論:Submit an edit request
外观
Xiplus在话题“編輯請求 2019-10-17”中的最新留言:5年前
編輯請求 2019-10-17
请求已拒绝--Xiplus#Talk 2019年11月3日 (日) 00:47 (UTC)
建議將
function p.makeRequestUrl(level, titleObj)
titleObj = titleObj or mw.title.getCurrentTitle()
if isTranscludedOnMainPage(titleObj) then
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
end
local talkPageName = resolveRedirect(titleObj.talkPageTitle.prefixedText)
if isProtected(talkPageName) then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
end
level = validateLevel(level)
local url = mw.uri.fullUrl(talkPageName, {
action = 'edit',
editintro = getLevelInfo(level, 'editintro'),
preload = message('preload-template'),
preloadtitle = '',
section = 'new'
})
url = tostring(url)
-- Add the preload parameters. @TODO: merge this into the mw.uri.fullUrl
-- query table once [[phab:T93059]] is fixed.
local function encodeParam(key, val)
return string.format('&%s=%s', mw.uri.encode(key), mw.uri.encode(val))
end
url = url .. encodeParam('preloadparams[]', message(
'preload-title-text',
lang:formatDate(message('preload-title-date-format'))
))
return url
end
改成
function p.makeRequestUrl(level, titleObj)
titleObj = titleObj or mw.title.getCurrentTitle()
if isTranscludedOnMainPage(titleObj) then
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
end
local talkPageName = resolveRedirect(titleObj.talkPageTitle.prefixedText)
if isProtected(talkPageName) then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
end
level = validateLevel(level)
local url = mw.uri.fullUrl(talkPageName, {
action = 'edit',
editintro = getLevelInfo(level, 'editintro'),
preload = message('preload-template'),
preloadtitle = message('preload-title-text',lang:formatDate(message('preload-title-date-format'))),
section = 'new'
})
return tostring(url) .. 'preloadparams%5B%5D='
end
預防有人錯填標題-- Sunny00217 2019年10月17日 (四) 13:19 (UTC)
- 經測試結果有錯,而且根本不需要preloadtitle。--Xiplus#Talk 2019年11月3日 (日) 00:47 (UTC)