در حال ویرایش پودمان:Effective protection level
این ویرایش را میتوان خنثی کرد. لطفاً تفاوت زیر را بررسی کنید تا تأیید کنید که این چیزی است که میخواهید انجام دهید، سپس تغییرات زیر را ذخیره کنید تا خنثیسازی ویرایش را به پایان ببرید.
نسخهٔ فعلی | متن شما | ||
خط ۱۴: | خط ۱۴: | ||
pagename = title.prefixedText | pagename = title.prefixedText | ||
if action == 'autoreview' then | if action == 'autoreview' then | ||
local level = mw. | local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) | ||
if level == 'review' then | if level == 'review' then | ||
return 'reviewer' | return 'reviewer' | ||
خط ۲۳: | خط ۲۲: | ||
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review | return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review | ||
end | end | ||
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload | elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then | ||
error( ' | error( 'نخستین پارامتر باید یکی از edit، move، create، upload، autoreview باشد.', 2 ) | ||
end | end | ||
if title.namespace == 8 then -- MediaWiki namespace | if title.namespace == 8 then -- MediaWiki namespace | ||
return 'sysop' | |||
elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page | |||
elseif title.namespace == 2 and title.isSubpage | |||
return 'sysop' | return 'sysop' | ||
end | end | ||
local level = title.protectionLevels[action] and title.protectionLevels[action][1] | local level = title.protectionLevels[action] and title.protectionLevels[action][1] | ||
if level == 'sysop | if level == 'sysop' then | ||
return 'sysop' | return 'sysop' | ||
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page | elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page | ||
خط ۵۲: | خط ۴۰: | ||
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. | local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. | ||
if blacklistentry and not blacklistentry.params.autoconfirmed then | if blacklistentry and not blacklistentry.params.autoconfirmed then | ||
return ' | return 'accountcreator' | ||
elseif title.namespace == 6 then | elseif title.namespace == 6 then | ||
return 'filemover' | return 'filemover' | ||
else | else | ||
return 'autoconfirmed' | return 'autoconfirmed' | ||
خط ۶۳: | خط ۴۹: | ||
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) | local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) | ||
if blacklistentry then | if blacklistentry then | ||
return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' | |||
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason | elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason | ||
return 'autoconfirmed' | return 'autoconfirmed' |