کاربر ناشناس
پودمان:Effective protection level: تفاوت میان نسخهها
جز
Yamaha5 صفحهٔ پودمان:Effective protection level/تمرین را بدون برجایگذاشتن تغییرمسیر به پودمان:Effective protection level منتقل کرد
Hasaninasab (بحث | مشارکتها) (صفحهای تازه حاوی «local p = {} -- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the...» ایجاد کرد) |
جز (Yamaha5 صفحهٔ پودمان:Effective protection level/تمرین را بدون برجایگذاشتن تغییرمسیر به پودمان:Effective protection level منتقل کرد) |
||
خط ۱۴: | خط ۱۴: | ||
pagename = title.prefixedText | pagename = title.prefixedText | ||
if action == 'autoreview' then | if action == 'autoreview' then | ||
local level = mw. | local level = mw.ext.FlaggedRevs.getStabilitySettings(title) | ||
level = level and level.autoreview | |||
if level == 'review' then | if level == 'review' then | ||
return 'reviewer' | return 'reviewer' | ||
خط ۳۱: | خط ۳۲: | ||
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' then | if level == 'sysop' or level == 'editprotected' 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 'templateeditor' | ||
elseif title.namespace == 6 then | elseif title.namespace == 6 then | ||
return 'filemover' | return 'filemover' | ||
elseif level == 'extendedconfirmed' then | |||
return 'extendedconfirmed' | |||
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 | ||
if not blacklistentry.params.autoconfirmed then | |||
return 'templateeditor' | |||
elseif level == 'extendedconfirmed' then | |||
return 'extendedconfirmed' | |||
else | |||
return 'autoconfirmed' | |||
end | |||
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' |