nat
(Natalie T)
12 مارس 2026، 6:43ص
7
لقد دمجنا إصلاحًا ينظف أسماء العلامات المحلية بعد إرجاعها من نموذج اللغة الكبير (LLM)، بالإضافة إلى ترحيل لاحق ينظف أسماء العلامات المحلية “غير النظيفة” الموجودة.
main ← clean-loc-tag-name
merged 04:54AM - 12 Mar 26 UTC
Localized tag names were never run through `DiscourseTagging.clean_tag`, unlike … regular tag names. A localized name like `mijn-naam" (123)` would be stored and rendered as-is, breaking body classes (`tag-mijn-naam" (123)`) and tag display under topic titles.
This PR adds a `before_validation` callback on `TagLocalization` that cleans names with `DiscourseTagging.clean_tag`. This covers all three entry points `TagLocalizationCreator`, `TagLocalizationUpdater`, and `TagSettingsUpdater` at the model.
Includes a post-migration that cleans existing dirty localization names. The migration only fetches rows that actually violate, names with special characters from `TAGS_FILTER_REGEXP`, uppercase when `force_lowercase_tags` is on, or names exceeding `max_tag_length`. The actual cleaning still uses `DiscourseTagging.clean_tag` so it respects site settings. We try to minimize calling application code in migrations, but this is quite controlled.
Related: https://meta.discourse.org/t/localized-tags-are-not-slugified/398105
لاحظ أيضًا أن طلب السحب (PR) يشير إلى أن الترحيل اللاحق يحتوي على بعض منطق التطبيق لتنظيف العلامات، ولكن يجب أن نكون بأمان هنا بوجود شروط واختبارات معينة.
سأبقي هذا الموضوع مفتوحًا لمعرفة كيف ستسير الأمور بالنسبة لك.
إعجاب واحد (1)