mirror of
https://github.com/discourse/discourse.git
synced 2026-03-05 15:27:34 +08:00
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>
14 lines
310 B
Ruby
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
|