Jump to content

Module:SPI archive notice

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dreamy Jazz (talk | contribs) at 18:02, 13 February 2022 (Protected "Module:SPI archive notice": Highly visible template: Same as Template:SPI archive notice ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local mRedirect = require('Module:Redirect')
local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.checkIfSPIMayNeedRename(frame)
	local args = getArgs(frame)
	return p._checkIfSPIMayNeedRename(args)
end

function p._checkIfSPIMayNeedRename(args)
	if (mw.title.new('User talk:' .. args[1]):getContent() == nil and mw.title.new('User:' .. args[1]):getContent() == nil) then
		return 'yes_no_user_content'
	else
		local redirectTarget = mRedirect.getTarget('User talk:' .. args[1])
		if (redirectTarget ~= nil) then
			if (mw.ustring.find(redirectTarget, '^User:' .. args[1]) or mw.ustring.find(redirectTarget, '^User talk:' .. args[1])) then
				return 'no'
			else
				return 'yes_redirected_elsewhere'
			end
		else
			return 'no'	
		end
	end
end

return p