discourse-category-experts/lib/category_experts
Régis HANOL 6cae3c1cc6
FIX: Use save_custom_fields instead of save! when only custom fields changed (#230)
During user merges, `PostOwnerChanger` reassigns all post types including
small action posts which have `raw: nil` by design. The core `set_owner`
method handles this correctly via `skip_validations: true`, but the plugin's
`post_owner_changed` handler and `PostHandler` methods were calling `save!`
after only modifying custom fields. This triggered full AR validations on
the post body, raising `ActiveRecord::RecordInvalid` for posts with content
that doesn't pass current validation rules.

Replace all `save!` calls with `save_custom_fields` in places where only
custom fields are being modified — 8 occurrences across `plugin.rb` and
`PostHandler` (`mark_post_for_approval`, `mark_post_as_approved`,
`mark_topic_as_question`, `correct_topic_custom_fields_after_removal`,
`correct_topic_custom_fields_after_addition`, `handle_topic_category_change`).

https://meta.discourse.org/t/399785
2026-04-02 18:25:34 +02:00
..
endorsement_rate_limiter.rb DEV: Introduce syntax_tree for ruby formatting (#88) 2022-12-29 13:30:55 +01:00
outgoing_web_hook_extension.rb DEV: Approved Post Webhook Event Payload Update (#159) 2024-09-04 13:58:34 +09:00
post_handler.rb FIX: Use save_custom_fields instead of save! when only custom fields changed (#230) 2026-04-02 18:25:34 +02:00
user_extension.rb DEV: Update rubocop-discourse to latest version 2024-05-16 10:45:37 +02:00