More actions
Content deleted Content added
remove parameter methods specific to individual reasons - the logic has been moved to Moudle:Protection banner/config |
Fix Protection:makeProtectionCategory for office-protected pages. For these, the reason needs to be the no. 1 priority, not just higher priority than the namespace. |
||
Line 51: | Line 51: | ||
display |
display |
||
) |
) |
||
end |
|||
local function toTableEnd(t, pos) |
|||
-- Sends the value at position pos to the end of array t, and shifts the |
|||
-- other items down accordingly. |
|||
return table.insert(t, table.remove(t, pos)) |
|||
end |
end |
||
Line 185: | Line 191: | ||
} |
} |
||
--[[ |
|||
-- To generate the correct category for some reason values, we need to |
|||
-- The old protection templates used an ad-hoc protection category system, |
|||
-- prioritise the position of the namespace key fragment over that of the |
|||
-- with some templates prioritising namespaces in their categories, and |
|||
-- reason key fragment. For these reasn values, swap the namespace subtable |
|||
-- |
-- others prioritising the protection reason. To emulate this in this module |
||
-- we use the config table cfg.reasonsWithNamespacePriority to set the |
|||
-- reasons for which namespaces have priority over protection reason. |
|||
-- If we are dealing with one of those reasons, move the namespace table to |
|||
-- the end of the order table, i.e. give it highest priority. If not, the |
|||
-- reason should have highest priority, so move that to the end of the table |
|||
-- instead. |
|||
--]] |
|||
if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then |
if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then |
||
table.insert(order, 3, table.remove(order, 2)) |
-- table.insert(order, 3, table.remove(order, 2)) |
||
toTableEnd(order, 2) |
|||
else |
|||
toTableEnd(order, 3) |
|||
end |
end |
||