Editing Module:Effective protection level
From Wings of Fire: The New World Wiki
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 13: | Line 13: | ||
end | end | ||
pagename = title.prefixedText | pagename = title.prefixedText | ||
if action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then | if action == 'autoreview' then | ||
local level = mw.ext.FlaggedRevs.getStabilitySettings(title) | |||
level = level and level.autoreview | |||
if level == 'review' then | |||
return 'reviewer' | |||
elseif level ~= '' then | |||
return level | |||
else | |||
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 | |||
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then | |||
error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) | error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) | ||
end | end | ||
Line 40: | Line 50: | ||
return 'templateeditor' | return 'templateeditor' | ||
elseif action == 'move' then | elseif action == 'move' then | ||
if title.namespace == 6 then | 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 | |||
return 'templateeditor' | |||
elseif title.namespace == 6 then | |||
return 'filemover' | return 'filemover' | ||
elseif level == 'extendedconfirmed' then | elseif level == 'extendedconfirmed' then | ||
Line 48: | Line 61: | ||
end | end | ||
end | end | ||
if level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason | local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) | ||
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 | |||
return 'autoconfirmed' | return 'autoconfirmed' | ||
elseif level then | elseif level then | ||
Line 54: | Line 76: | ||
elseif action == 'upload' then | elseif action == 'upload' then | ||
return 'autoconfirmed' | return 'autoconfirmed' | ||
elseif action == 'create' then | elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts | ||
return ' | if title.namespace == 0 then | ||
return 'autoconfirmed' -- Per [[WP:ACPERM]], you need to be autoconfirmed to create pages in mainspace | |||
end | |||
return 'user' | |||
else | else | ||
return '*' | return '*' |