Zum Inhalt springen

Modul:Protection banner: Unterschied zwischen den Versionen

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.
(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.)
Zeile 51: Zeile 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


Zeile 185: Zeile 191:
}
}


-- To generate the correct category for some reason values, we need to
--[[
-- prioritise the position of the namespace key fragment over that of the
-- The old protection templates used an ad-hoc protection category system,
-- reason key fragment. For these reasn values, swap the namespace subtable
-- with some templates prioritising namespaces in their categories, and
-- and the reason subtable around.
-- 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
   
   
Anonymer Benutzer