<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ASubmit_an_edit_request</id>
	<title>Module:Submit an edit request - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ASubmit_an_edit_request"/>
	<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Submit_an_edit_request&amp;action=history"/>
	<updated>2026-04-04T17:49:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://the-democratika.com/wiki/index.php?title=Module:Submit_an_edit_request&amp;diff=9536&amp;oldid=prev</id>
		<title>&gt;HouseBlaster: bypass redirect</title>
		<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Submit_an_edit_request&amp;diff=9536&amp;oldid=prev"/>
		<updated>2024-12-16T15:29:26Z</updated>

		<summary type="html">&lt;p&gt;bypass redirect&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{Submit an edit request}}.&lt;br /&gt;
&lt;br /&gt;
local CONFIG_MODULE = &amp;#039;Module:Submit an edit request/config&amp;#039;&lt;br /&gt;
&lt;br /&gt;
-- Load necessary modules&lt;br /&gt;
local mRedirect = require(&amp;#039;Module:Redirect&amp;#039;)&lt;br /&gt;
local cfg = mw.loadData(CONFIG_MODULE)&lt;br /&gt;
local effectiveProtectionLevel = require(&amp;#039;Module:Effective protection level&amp;#039;)._main&lt;br /&gt;
local escape = require(&amp;quot;Module:String&amp;quot;)._escapePattern&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local validLevels = {&lt;br /&gt;
	semi = &amp;#039;semi&amp;#039;,&lt;br /&gt;
	extended = &amp;#039;extended&amp;#039;,&lt;br /&gt;
	template = &amp;#039;template&amp;#039;,&lt;br /&gt;
	full = &amp;#039;full&amp;#039;,&lt;br /&gt;
	interface = &amp;#039;interface&amp;#039;,&lt;br /&gt;
	manual = &amp;#039;manual&amp;#039;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function message(key, ...)&lt;br /&gt;
	local params = {...}&lt;br /&gt;
	local msg = cfg[key]&lt;br /&gt;
	if #params &amp;lt; 1 then&lt;br /&gt;
		return msg&lt;br /&gt;
	else&lt;br /&gt;
		return mw.message.newRawMessage(msg):params(params):plain()&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function validateLevel(level)&lt;br /&gt;
	return level and validLevels[level] or &amp;#039;full&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getLevelInfo(level, field)&lt;br /&gt;
	return cfg.protectionLevels[level][field]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function resolveRedirect(page)&lt;br /&gt;
	return mRedirect.luaMain(page)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isProtected(page)&lt;br /&gt;
	local action = mw.title.new(page).exists and &amp;#039;edit&amp;#039; or &amp;#039;create&amp;#039;&lt;br /&gt;
	return effectiveProtectionLevel(action, page) ~= &amp;#039;*&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.makeRequestUrl(level, titleObj)&lt;br /&gt;
	titleObj = titleObj or mw.title.getCurrentTitle()&lt;br /&gt;
	local basePage = titleObj.basePageTitle.fullText&lt;br /&gt;
	if cfg[&amp;#039;main-page-content&amp;#039;][basePage] then&lt;br /&gt;
		return tostring(mw.uri.fullUrl(message(&amp;#039;main-page-request-page&amp;#039;)))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local talkPageName = titleObj.talkPageTitle&lt;br /&gt;
	if talkPageName == nil then&lt;br /&gt;
		return tostring(mw.uri.fullUrl(message(&amp;#039;protected-talk-page-request-page&amp;#039;)))&lt;br /&gt;
	end&lt;br /&gt;
	talkPageName = resolveRedirect(talkPageName.prefixedText)&lt;br /&gt;
	if isProtected(talkPageName) then&lt;br /&gt;
		return tostring(mw.uri.fullUrl(message(&amp;#039;protected-talk-page-request-page&amp;#039;)))&lt;br /&gt;
	end&lt;br /&gt;
	level = validateLevel(level)&lt;br /&gt;
	if level == &amp;#039;manual&amp;#039; then&lt;br /&gt;
		return tostring(mw.uri.fullUrl(talkPageName, {&lt;br /&gt;
			action = &amp;#039;edit&amp;#039;,&lt;br /&gt;
			section = &amp;#039;new&amp;#039;&lt;br /&gt;
		}))&lt;br /&gt;
	end&lt;br /&gt;
	local sectionname = message(&lt;br /&gt;
			&amp;#039;preload-title-text&amp;#039;,&lt;br /&gt;
			getLevelInfo(level, &amp;#039;levelText&amp;#039;),&lt;br /&gt;
			lang:formatDate(message(&amp;#039;preload-title-date-format&amp;#039;))&lt;br /&gt;
	)&lt;br /&gt;
	local content = mw.title.new(talkPageName):getContent()&lt;br /&gt;
	if content and content:find(&amp;quot;== *&amp;quot; .. escape(sectionname) .. &amp;quot; *==&amp;quot;) then&lt;br /&gt;
		local dedup = 2&lt;br /&gt;
		while true do&lt;br /&gt;
			local newname = message(&amp;quot;preload-title-dedup-suffix&amp;quot;, sectionname, dedup)&lt;br /&gt;
			if not content:find(&amp;quot;== *&amp;quot; .. escape(newname) .. &amp;quot; *==&amp;quot;) then&lt;br /&gt;
				sectionname = newname&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
			dedup = dedup + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local url = mw.uri.fullUrl(talkPageName, {&lt;br /&gt;
		action = &amp;#039;edit&amp;#039;,&lt;br /&gt;
		editintro = getLevelInfo(level, &amp;#039;editintro&amp;#039;),&lt;br /&gt;
		preload = message(&amp;#039;preload-template&amp;#039;),&lt;br /&gt;
		preloadtitle = sectionname,&lt;br /&gt;
		section = &amp;#039;new&amp;#039;&lt;br /&gt;
	})&lt;br /&gt;
	url = tostring(url)&lt;br /&gt;
&lt;br /&gt;
	-- Add the preload parameters. @TODO: merge this into the mw.uri.fullUrl&lt;br /&gt;
	-- query table once [[phab:T93059]] is fixed.&lt;br /&gt;
	local function encodeParam(key, val)&lt;br /&gt;
		return string.format(&amp;#039;&amp;amp;%s=%s&amp;#039;, mw.uri.encode(key), mw.uri.encode(val))&lt;br /&gt;
	end&lt;br /&gt;
	url = url .. encodeParam(&amp;#039;preloadparams[]&amp;#039;, getLevelInfo(level, &amp;#039;requestTemplate&amp;#039;))&lt;br /&gt;
	url = url .. encodeParam(&amp;#039;preloadparams[]&amp;#039;, titleObj.prefixedText)&lt;br /&gt;
&lt;br /&gt;
	return url&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._link(args)&lt;br /&gt;
	return string.format(&lt;br /&gt;
		&amp;#039;&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[%s %s]&amp;lt;/span&amp;gt;&amp;#039;,&lt;br /&gt;
		p.makeRequestUrl(args.type),&lt;br /&gt;
		args.display or message(&amp;#039;default-display-value&amp;#039;)&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._button(args)&lt;br /&gt;
	return require(&amp;#039;Module:Clickable button&amp;#039;).main{&lt;br /&gt;
		[1] = args.display or message(&amp;#039;default-display-value&amp;#039;),&lt;br /&gt;
		url = p.makeRequestUrl(args.type),&lt;br /&gt;
		class = &amp;#039;mw-ui-progressive&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeInvokeFunc(func, wrapper)&lt;br /&gt;
	return function (frame)&lt;br /&gt;
		local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
			wrappers = {wrapper}&lt;br /&gt;
		})&lt;br /&gt;
		return func(args)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.link = makeInvokeFunc(p._link, message(&amp;#039;link-wrapper-template&amp;#039;))&lt;br /&gt;
p.button = makeInvokeFunc(p._button, message(&amp;#039;button-wrapper-template&amp;#039;))&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>&gt;HouseBlaster</name></author>
	</entry>
</feed>