mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 17:04:59 +08:00
FIX: allow both meta_data and custom_fields when creating a topic
For some reasons, we have two ways of associating "custom fields" to a new topic: using 'meta_data' and 'custom_fields'. However, if we were to provide both arguments, the 'meta_data' would be overwritten by any 'custom_fields' provided. This commit ensures we can use both and merges the 'custom_fields' with the 'meta_data'.
This commit is contained in:
@ -35,8 +35,9 @@ class TopicCreator
|
||||
def create
|
||||
topic = Topic.new(setup_topic_params)
|
||||
setup_tags(topic)
|
||||
|
||||
if fields = @opts[:custom_fields]
|
||||
topic.custom_fields = fields
|
||||
topic.custom_fields.merge!(fields)
|
||||
end
|
||||
|
||||
DiscourseEvent.trigger(:before_create_topic, topic, self)
|
||||
|
Reference in New Issue
Block a user