mirror of
https://ghfast.top/https://github.com/discourse/discourse-category-experts.git
synced 2026-07-15 11:36:31 +08:00
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 |
||
|---|---|---|
| .. | ||
| endorsement_rate_limiter.rb | ||
| outgoing_web_hook_extension.rb | ||
| post_handler.rb | ||
| user_extension.rb | ||