app/forms/thredded/post_form.rb in thredded-0.12.1 vs app/forms/thredded/post_form.rb in thredded-0.12.2
- old
+ new
@@ -1,6 +1,7 @@
# frozen_string_literal: true
+
module Thredded
class PostForm
attr_reader :post, :topic
delegate :id,
:persisted?,
@@ -14,9 +15,10 @@
# @param post_params [Hash]
def initialize(user:, topic:, post: nil, post_params: {})
@messageboard = topic.messageboard
@topic = topic
@post = post ? post : topic.posts.build
+ user ||= Thredded::NullUser.new
if post_params.include?(:quote_post)
post_params[:content] =
Thredded::ContentFormatter.quote_content(post_params.delete(:quote_post).content)
end