FIX: Make sure max_oneboxes_per_post is enforced (#16215)

PostAnalyzer and CookedPostProcessor both replace URLs with oneboxes.
PostAnalyzer did not use the max_oneboxes_per_post site and setting and
CookedPostProcessor replaced at most max_oneboxes_per_post URLs ignoring
the oneboxes that were replaced already by PostAnalyzer.
This commit is contained in:
Bianca Nenciu
2022-03-23 17:36:08 +02:00
committed by GitHub
parent 147ffadcf3
commit cbaf7c949b
4 changed files with 40 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
module CookedProcessorMixin
def post_process_oneboxes
limit = SiteSetting.max_oneboxes_per_post
limit = SiteSetting.max_oneboxes_per_post - @doc.css("aside.onebox, a.inline-onebox").size
oneboxes = {}
inlineOneboxes = {}