2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-05 15:27:34 +08:00
discourse/db/migrate/20251008050307_delete_post_localizations_with_links.rb
Rafael dos Santos Silva d4e939d053
FEATURE: Add oneboxes and lightboxes to localized posts (#34900)
This change ensures that oneboxes, lightboxes are correctly generated
for localized posts.

The `PostLocalizer` was using `PrettyText.cook` directly, which does not
perform all the necessary post-processing steps, such as onebox
generation.

This commit introduces a new `LocalizedCookedPostProcessor` class that
is responsible for post-processing the cooked HTML of translated posts.
This new class reuses the `CookedProcessorMixin` to gain access to the
`post_process_oneboxes` method. The `PostLocalizer` is updated to use
this new processor, ensuring that oneboxes are correctly generated in
the translated content.

---------

Co-authored-by: Nat <natalie.tay@discourse.org>
2025-10-08 15:14:56 +08:00

14 lines
310 B
Ruby

# frozen_string_literal: true
class DeletePostLocalizationsWithLinks < ActiveRecord::Migration[8.0]
def up
execute <<~SQL
DELETE FROM post_localizations
WHERE raw ~ 'https?://'
OR cooked ~ 'https?://'
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end